Skip to content

File access permissions when restarting a particular device (Moto G7) #14

@dgis

Description

@dgis

From RM, on a Moto G7 running Android 9 version PPOS29.114-134-10 with security patch level 1 Feb 20, when the device is restarted, the file access permissions which should have been persistent with takePersistableUriPermission(), is not.

It can be reproduce by taping 'CLEAR ACCESS' in the Android settings/App/Emu48/Storage.

When it happens, at the start, Emu48 try to load the last saved document (state.e48 file), and we get that exception:

2020-04-08 18:19:50.896 18771-18771/org.emulator.forty.eight W/System.err: java.lang.SecurityException: Permission Denial: opening provider com.android.externalstorage.ExternalStorageProvider from ProcessRecord{529794b 18771:org.emulator.forty.eight/u0a100} (pid=18771, uid=10100) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
2020-04-08 18:19:50.897 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Parcel.createException(Parcel.java:1942)
2020-04-08 18:19:50.897 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Parcel.readException(Parcel.java:1910)
2020-04-08 18:19:50.897 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Parcel.readException(Parcel.java:1860)
2020-04-08 18:19:50.898 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:4181)
2020-04-08 18:19:50.898 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ActivityThread.acquireProvider(ActivityThread.java:5970)
2020-04-08 18:19:50.898 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2592)
2020-04-08 18:19:50.898 18771-18771/org.emulator.forty.eight W/System.err:     at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1828)
2020-04-08 18:19:50.899 18771-18771/org.emulator.forty.eight W/System.err:     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1297)
2020-04-08 18:19:50.899 18771-18771/org.emulator.forty.eight W/System.err:     at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1148)
2020-04-08 18:19:50.899 18771-18771/org.emulator.forty.eight W/System.err:     at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1102)
2020-04-08 18:19:50.900 18771-18771/org.emulator.forty.eight W/System.err:     at org.emulator.forty.eight.MainActivity.openFileFromContentResolver(MainActivity.java:1274)
2020-04-08 18:19:50.900 18771-18771/org.emulator.forty.eight W/System.err:     at org.emulator.calculator.NativeLib.onFileOpen(Native Method)
2020-04-08 18:19:50.900 18771-18771/org.emulator.forty.eight W/System.err:     at org.emulator.forty.eight.MainActivity.onFileOpen(MainActivity.java:1175)
2020-04-08 18:19:50.900 18771-18771/org.emulator.forty.eight W/System.err:     at org.emulator.forty.eight.MainActivity.onCreate(MainActivity.java:232)
2020-04-08 18:19:50.901 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.Activity.performCreate(Activity.java:7136)
2020-04-08 18:19:50.901 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.Activity.performCreate(Activity.java:7127)
2020-04-08 18:19:50.901 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
2020-04-08 18:19:50.902 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
2020-04-08 18:19:50.902 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
2020-04-08 18:19:50.902 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
2020-04-08 18:19:50.902 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
2020-04-08 18:19:50.903 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
2020-04-08 18:19:50.903 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
2020-04-08 18:19:50.903 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2020-04-08 18:19:50.904 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Looper.loop(Looper.java:193)
2020-04-08 18:19:50.904 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6669)
2020-04-08 18:19:50.904 18771-18771/org.emulator.forty.eight W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2020-04-08 18:19:50.904 18771-18771/org.emulator.forty.eight W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2020-04-08 18:19:50.905 18771-18771/org.emulator.forty.eight W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-04-08 18:19:50.905 18771-18771/org.emulator.forty.eight W/System.err: Caused by: android.os.RemoteException: Remote stack trace:
2020-04-08 18:19:50.905 18771-18771/org.emulator.forty.eight W/System.err:     at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:12188)
2020-04-08 18:19:50.905 18771-18771/org.emulator.forty.eight W/System.err:     at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:12585)
2020-04-08 18:19:50.906 18771-18771/org.emulator.forty.eight W/System.err:     at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:357)
2020-04-08 18:19:50.906 18771-18771/org.emulator.forty.eight W/System.err:     at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3291)
2020-04-08 18:19:50.906 18771-18771/org.emulator.forty.eight W/System.err:     at android.os.Binder.execTransact(Binder.java:731)

I don't know if it is a bug in the vendor ROM or in Emu48.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions