Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "App list" permission on Samsung devices with Android 14 #1354

Closed
GreenDreenAct opened this issue Aug 5, 2024 · 12 comments · Fixed by #1355
Closed

Missing "App list" permission on Samsung devices with Android 14 #1354

GreenDreenAct opened this issue Aug 5, 2024 · 12 comments · Fixed by #1355
Labels
api: 34 A14 (Upside Down Cake) c: PKGS Package related operations. Device specific A device specific issue or behavior.

Comments

@GreenDreenAct
Copy link

Describe the bug
Software crashes

To Reproduce
Steps to reproduce the behavior:
1.Click on 'Cleanup Keys'

Expected behavior
Start cleaning

Smartphone (please complete the following information):

  • Device: [s23ultra]
  • OS: [e.g. Android 14]
  • Root status [e.g. Rooted - 26.4-kitsune (26400)]
  • SD Maid 2/SE version [e.g. v1.2.2-rc0]

Debug log
[https://drive.google.com/file/d/101JmJHkGVU_hfkZqXTpDglJkURhHrlHl/view?usp=drivesdk]

Screenshots/Video
https://github.com/user-attachments/assets/a87159ae-2589-4c72-8bc9-4b12733d7938

@GreenDreenAct GreenDreenAct added bug Something isn't working as expected triage This ticket needs to be sorted and labeled. labels Aug 5, 2024
@d4rken d4rken changed the title Crash Installed apps can't be retrieved Aug 5, 2024
@d4rken d4rken added c: PKGS Package related operations. and removed triage This ticket needs to be sorted and labeled. labels Aug 5, 2024
@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

The crash is caused by this error:

2024-08-05T04:17:42.829Z  E/SDMSE:App: UNCAUGHT EXCEPTION: eu.darken.sdmse.common.pkgs.pkgops.IllegalPkgDataException: No installed packages
	at eu.darken.sdmse.common.pkgs.sources.NormalPkgsSource.access$coreList(Unknown Source:420)
	at eu.darken.sdmse.common.pkgs.sources.NormalPkgsSource$coreList$1.invokeSuspend(Unknown Source:11)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:112)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:95)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@316cea8, Dispatchers.Default]

This is a "safety" crash. SD Maid asks the system for a list of installed apps. The system says "0 apps" which can't be true (there are always at least system apps). To not make any mistakes based on false data (e.g. delete corpses), SD Maid crashes.

Now the question is why the system is saying "0 apps installed" 🤔

Have you rebooted the phone?

@d4rken d4rken added the needs info/repro 🤔 Needs more information (from OP?) to be acted upon label Aug 5, 2024
@GreenDreenAct
Copy link
Author

Sorry, I found that the crash was caused by not granting SD Maid the "read app list" permission. However, I noticed that SD Maid did not request the "read app list" permission from me before crashing, but instead crashed first and then asked for the permission.

@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

QUERY_ALL_PACKAGES is not a permission that the user needs to manually grant (usually). At least not on any of the devices i tested with.

Are you using a specific root app to do additional permission management?

@d4rken d4rken added api: 34 A14 (Upside Down Cake) Device specific A device specific issue or behavior. and removed bug Something isn't working as expected needs info/repro 🤔 Needs more information (from OP?) to be acted upon labels Aug 5, 2024
@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

According to the log, the permission is granted though 🤔

D/SDMSE:Setup:Inventory:Module: android.permission.QUERY_ALL_PACKAGES isGranted=true

@d4rken d4rken changed the title Installed apps can't be retrieved Crash if "read app list" permission is not granted Aug 5, 2024
@GreenDreenAct
Copy link
Author

I am not using any permission management tools. I re-downloaded the app several times, and the app did not automatically receive the QUERY_ALL_PACKAGES permission. SD Maid was not granted this permission.

@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

A Samsung Android 14 specific behavior? 🤔

the app did not automatically receive the QUERY_ALL_PACKAGES permission. SD Maid was not granted this permission.

This is concerning because the code check says that SD Maid did get the permission. This would mean that Samsung fakes the permission and just returns an empty list of installed apps? 😠

Can you show me a few screenshots (or a video), with english UI, of the extra permission granting process that is required?

@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

Hm this was already an issue in February (#1015), also an S24 with Android 14 🤔

I closed that by adding a check and setup prompt if QUERY_ALL_PACKAGES is not granted, maybe in that case the permission was already granted too and the issue was that it still returns an empty list... 🤔

@GreenDreenAct
Copy link
Author

vedio[https://s-share.samsungcloudcn.com/a7ZqXu82nJNy]

@d4rken d4rken changed the title Crash if "read app list" permission is not granted Missing "App list" permission on Samsung devices with Android 14 Aug 5, 2024
@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

Thanks, good video 👍

I probably have to handle this different and show an error and explain to the user how to solve it. Maybe add an FAQ entry too (can I include your video as example?).

I'm still confused why I don't get more reports about this. Google Play console does not show any crashes and with the many thousands of users SD Maid has, only two reports about this behavior. My guess would be that usually the permission is automatically granted, but sometimes it is not.

Could you help me investigate this a bit more?

According to the log, you have the FOSS build installed. Did you manually sideload (e.g. ADB) or did you install it through an app store (e.g. F-DROID)?

Can you access Google Play and install it from there to check if the permission was automatically granted then?

@GreenDreenAct
Copy link
Author

Of course, you can use my video, that's not a problem.

I downloaded the APK from GitHub and installed it directly.

I also installed it from Google Play, but the permissions were still not granted automatically.

@d4rken
Copy link
Member

d4rken commented Aug 5, 2024

I also installed it from Google Play, but the permissions were still not granted automatically.

Thanks for the details. I will work on a new info card that shows instead of a crash.

I checked Google Play and there are over 6000 Samsung Galaxy S23 Ultra (samsung dm3q) being used with SD Maid. If everyone one of them would crash, I would have a lot of reports 🤔

If you can think of any reason why it is working for others and not for your device, please let me know 🙏 .

@GreenDreenAct
Copy link
Author

Thanks! 😊 If I find out why it's happening on my device, I'll let you know. 🔍

d4rken added a commit that referenced this issue Aug 6, 2024
`QUERY_ALL_PACKAGES` is a permission that is automatically granted, at least according to documentation.
Except, of course, on some Samsung devices running Android 14, because why not do things differently...

This PR prevents SD Maid from crashing in these cases. A specific error is shown.
The state is now detected and treated as a permission error and will show as incomplete-setup.

Fixes #1354
d4rken added a commit that referenced this issue Aug 9, 2024
`QUERY_ALL_PACKAGES` is a permission that is automatically granted, at least according to documentation.
Except, of course, on some Samsung devices running Android 14, because why not do things differently...

This PR prevents SD Maid from crashing in these cases. A specific error is shown.
The state is now detected and treated as a permission error and will show as incomplete-setup.

Fixes #1354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: 34 A14 (Upside Down Cake) c: PKGS Package related operations. Device specific A device specific issue or behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants