gsantner/memetastic

Revoking permission at MemeCreateActivity causes app crashed

Opened this issue · 2 comments

Hi, there, I've found a crash in MemeTastic v1.6.7(68), which is downloaded from F-Droid.

I seems that it is related to the dangerous permission android.permission.WRITE_EXTERNAL_STORAGE and is triggered during the following call chain:

net.gsantner.memetastic.activity.MemeCreateActivity.onCreate(android.os.Bundle)void
  net.gsantner.memetastic.activity.MemeCreateActivity.initMemeSettings(android.os.Bundle)boolean
    net.gsantner.memetastic.activity.MemeCreateActivity.extractBitmapFromIntent(android.content.Intent)android.graphics.Bitmap
      net.gsantner.opoc.util.ShareUtil.extractFileFromIntent(android.content.Intent)java.io.File
        android.os.Environment.getExternalStorageDirectory()java.io.File

This call chain does not involves either permission checking (via checkSelfPermission) nor permission request (via requestPermissions) to the corresponding permission, which may produce unexpected consequence.

Reproduce crash

In fact, I found this lack of permission management causes a crash on my Samsung device, following the steps:

  1. enter the app from the home screen and allow the permission request
  2. choose one meme item and enter the ``create meme activity''
  3. go to system setting and revoke the storage permission
  4. go back to the app and it crashes

@gsantner
Could you help me review this issue? If you need more information, I may make a video showing the crash. Very thanks!

You manually, forcefully remove the permission from the app. And MemeTastic saves to external storage / Pictures folder.

What did you expect to happen? Hm.

You manually, forcefully remove the permission from the app. And MemeTastic saves to external storage / Pictures folder.

What did you expect to happen? Hm.

Yes, it's unusual, but it happens. I noticed that the main activity will show a message "need permission to storage ..." if the user denied the permission request.
So I believe it would be better if a notice is presented to the users, when the permission is missing, rather than simply leave it crashes.