MuntashirAkon / AppManager

A full-featured package manager and viewer for Android
https://muntashirakon.github.io/AppManager/
Other
4.97k stars 280 forks source link

Crash on Work profile apps #1107

Closed shuvashish76 closed 1 year ago

shuvashish76 commented 1 year ago

Please check before submitting an issue

Describe the bug

Crash when opening App Info page for any work profile apps through AM. Latest AM Debug v3.2.0-alpha01 Run#2426

To Reproduce

  1. Open AM main page & scroll down to any app which is also installed on work profile
  2. Click on that app & choose > Selected user "Island"
  3. See error

Expected behavior

No response

Screenshots

No response

Logs

java.lang.RuntimeException: java.lang.SecurityException: getPackageUid: UID 10919 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS to access user 10.
    at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel.lambda$loadAppInfo$3(AppInfoViewModel.java:330)
    at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel$$ExternalSyntheticLambda1.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:978)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loopOnce(Looper.java:238)
    at android.os.Looper.loop(Looper.java:357)
    at android.app.ActivityThread.main(ActivityThread.java:8090)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)
 Caused by: java.lang.SecurityException: getPackageUid: UID 10919 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS to access user 10.
   at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)
   at android.os.Parcel.createException(Parcel.java:2410)
   at android.os.Parcel.readException(Parcel.java:2393)
   at android.os.Parcel.readException(Parcel.java:2335)
   at android.content.pm.IPackageManager$Stub$Proxy.getPackageUid(IPackageManager.java:5086)
   at android.os.storage.StorageManager.getVolumeList(StorageManager.java:1432)
   at io.github.muntashirakon.AppManager.compat.StorageManagerCompat.getVolumeList(StorageManagerCompat.java:71)
   at io.github.muntashirakon.AppManager.misc.OsEnvironment$UserEnvironment.getExternalDirs(OsEnvironment.java:97)
   at io.github.muntashirakon.AppManager.misc.OsEnvironment$UserEnvironment.buildExternalStorageAppDataDirs(OsEnvironment.java:158)
   at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel.loadAppInfo(AppInfoViewModel.java:282)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment.loadPackageInfo(AppInfoFragment.java:1692)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment.$r8$lambda$oxlKbqiAsxIkEG69gntC-jrgnXk(Unknown Source:0)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment$$ExternalSyntheticLambda82.run(Unknown Source:2)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
   at java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
   at java.lang.Thread.run(Thread.java:1012)
 Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.pm.PackageManagerService$ComputerEngine.enforceCrossUserPermission(PackageManagerService.java:4800)
    at com.android.server.pm.PackageManagerService$ComputerEngine.enforceCrossUserPermission(PackageManagerService.java:4765)
    at com.android.server.pm.PackageManagerService$ComputerTracker.enforceCrossUserPermission(PackageManagerService.java:6037)
    at com.android.server.pm.PackageManagerService.enforceCrossUserPermission(PackageManagerService.java:12754)
    at com.android.server.pm.PackageManagerService.getPackageUid(PackageManagerService.java:9306)

Device info

App version: 3.2.0-alpha01-DEBUG App version code: 433 Android build version: 8049b-fa5cf Android release version: 12 Android SDK version: 31 Android build ID: S2RUBS32.51-15-9-7 Device brand: motorola Device manufacturer: motorola Device name: corfur Device model: moto g71 5G Device product name: corfur_g Device hardware name: qcom ABIs: [arm64-v8a, armeabi-v7a, armeabi] ABIs (32bit): [armeabi-v7a, armeabi] ABIs (64bit): [arm64-v8a] System language: en-IN In-App Language: auto Mode: auto Inferred Mode: ADB

Additional context

No response

MuntashirAkon commented 1 year ago

Thanks for the issue. It appears I've forgotten to fetch the list of storages using remote service.

MuntashirAkon commented 1 year ago

Should be fixed in 8333dde9a5c7635e4249cc14463ef829ed37524f