MuntashirAkon / AppManager

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

Crash on newly installed App Manager 4.0.0 beta 01 bld 2754 #1432

Open 0xlne opened 2 months ago

0xlne commented 2 months ago

Please check before submitting an issue

Describe the bug

App Manager hangs for a long period before being able to select connection mode (ADB wireless). Finally on pairing & a reboot, App Manager launches & after a while, crashes. Even when it runs, doesn't display the list of apps (tried system & user apps).

java.lang.SecurityException: Shell does not have permission to access user 10 com.android.server.am.ActivityManagerService.handleIncomingUser:13114 com.android.server.usage.UsageStatsService$BinderService.isAppInactive:2321 android.app.usage.IUsageStatsManager$Stub.onTransact:482 at android.os.Parcel.createExceptionOrNull(Parcel.java:3011) at android.os.Parcel.createException(Parcel.java:2995) at android.os.Parcel.readException(Parcel.java:2978) at android.os.Parcel.readException(Parcel.java:2920) at android.app.usage.IUsageStatsManager$Stub$Proxy.isAppInactive(IUsageStatsManager.java:1032) at io.github.muntashirakon.AppManager.compat.UsageStatsManagerCompat.isAppInactive(UsageStatsManagerCompat.java:58) at io.github.muntashirakon.AppManager.main.ApplicationItem.generateOtherInfo(ApplicationItem.java:166) at io.github.muntashirakon.AppManager.main.MainViewModel.getNewApplicationItem(MainViewModel.java:753) at io.github.muntashirakon.AppManager.main.MainViewModel.updateInfoForPackages(MainViewModel.java:611) at io.github.muntashirakon.AppManager.main.MainViewModel.access$100(MainViewModel.java:69) at io.github.muntashirakon.AppManager.main.MainViewModel$PackageIntentReceiver.onPackageChanged(MainViewModel.java:794) at io.github.muntashirakon.AppManager.types.PackageChangeReceiver$ReceiverHandler.handleMessage(PackageChangeReceiver.java:142) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.os.HandlerThread.run(HandlerThread.java:67)

To Reproduce

No response

Expected behavior

No response

Screenshots

No response

Logs

No response

Device info

Device Info: App version: 4.0.0-beta01-DEBUG bld 2754 App version code: 436 Android build version: V14.0.14.0.TLRCNXM Android release version: 13 Android SDK version: 33 Android build ID: TKQ1.220829.002 test-keys Device brand: Xiaomi Device manufacturer: Xiaomi Device name: zizhan Device model: 22061218C Device product name: zizhan Device hardware name: qcom ABIs: [arm64-v8a, armeabi-v7a, armeabi] ABIs (32bit): [armeabi-v7a, armeabi] ABIs (64bit): [arm64-v8a] System language: en-US In-App Language: auto Mode: adb_wifi Inferred Mode: ADB

Additional context

No response

MuntashirAkon commented 1 month ago

java.lang.SecurityException: Shell does not have permission to access user 10

Weird issue. It appears ADB does not have enough permissions in your device. If you have access to a personal computer, can you connect ADB and run the following command:

adb shell pm list package --user 10 

and see if the output throws an error.

0xlne commented 1 month ago

java.lang.SecurityException: Shell does not have permission to access user 10

Weird issue. It appears ADB does not have enough permissions in your device. If you have access to a personal computer, can you connect ADB and run the following command:

adb shell pm list package --user 10 

and see if the output throws an error.

Yes indeed - user 10 is the "Work" profile, & I am not rooted, so it's not surprising that adb/shell cannot access that profile. However, that isn't a problem until after build 2754. I uninstalled all AM Debug versions & reinstalled bld 2754 from scratch - it works correctly (although I need to turn back the system clock as it complains that the grace period is over & I need to update AM). All builds after 2754 cause that symptom. I also tried selecting only user 0 from the list of profiles to be accessed/managed by AM, but that didn't help.

Logcat fwiw:


Exception occurred while executing 'list':
java.lang.SecurityException: Shell does not have permission to access user 10
 com.android.server.am.ActivityManagerService.handleIncomingUser:13114 android.app.ActivityManager.handleIncomingUser:4301 com.android.server.pm.PackageManagerShellCommand.translateUserId:3444 
    at com.android.server.am.UserController.handleIncomingUser(UserController.java:2304)
    at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13114)
    at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:4301)
    at com.android.server.pm.PackageManagerShellCommand.translateUserId(PackageManagerShellCommand.java:3444)
    at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:950)
    at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:856)
    at com.android.server.pm.PackageManagerShellCommand.runList(PackageManagerShellCommand.java:715)
    at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:209)
    at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
    at android.os.ShellCommand.exec(ShellCommand.java:38)
    at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6203)
    at android.os.Binder.shellCommand(Binder.java:1054)
    at android.os.Binder.onTransact(Binder.java:882)
    at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
    at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6187)
    at android.os.Binder.execTransactInternal(Binder.java:1290)
    at android.os.Binder.execTransact(Binder.java:1249)
MuntashirAkon commented 1 month ago

Yes indeed - user 10 is the "Work" profile, & I am not rooted, so it's not surprising that adb/shell cannot access that profile.

It's surprising because AOSP allows it. Your ROM probably customised its behaviour to deny it or move the permission from the Shell package.

0xlne commented 1 month ago

FWIW, I am using the stock rom. That device does not even have the bootloader unlocked. I did update the ROM a few times in the couple of years I got it but stayed on Android 13. On another note, I wouldn't have been surprised if AM had never worked, but I have been using it since day 1 on that device, have been updating regularly when new builds were released on telegram, & everything was fine until that version. I can freely uninstall/install bld 2754 & any after that, and that symptom is reproduceible, which leads me (unless I'm missing anything) to believe the common denominator is a change beyond bld 2754.

We can have a screenshare session over Telegram/Jami/Rustdesk if you want; I have a new primary device now & AM works fine there, so I'm not particularly hung up on getting this issue fixed, but I guess this could be the case for anyone else on MIUI14.