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

[BUG] Crashes on boot if recents provider is enabled by QuickSwitch #4661

Closed
jingyu9575 opened this issue Aug 17, 2024 · 2 comments
Closed
Labels

Comments

@jingyu9575
Copy link

Describe the bug

The app crashes on boot, until several seconds later, if the recents provider is enabled by QuickSwitch.

Steps to reproduce

Steps to reproduce the behavior:

  1. Enable the recents provider in QuickSwitch.
  2. Reboot
  3. See crash dialog

Expected behavior

It should not crash.

Screenshots

dcf4b26d5df5e197970540f5e279927

Device information

  • Device: Xiaomi 12
  • OS: LineageOS 21 Android version 14
  • App version: 14.Dev.(# 1225)

Additional context

Maybe this is the problem:

08-17 17:34:35.940 4100 4100 E AndroidRuntime: FATAL EXCEPTION: main
08-17 17:34:35.940 4100 4100 E AndroidRuntime: Process: app.lawnchair.debug, PID: 4100
08-17 17:34:35.940 4100 4100 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user (id 0) is unlocked
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4925)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2407)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.os.Looper.loop(Looper.java:317)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8592)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: Caused by: java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user (id 0) is unlocked
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:605)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:588)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:223)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.LauncherPrefs.getEncryptedPrefs(LauncherPrefs.kt:51)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.LauncherPrefs.chooseSharedPreferences(LauncherPrefs.kt:65)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.LauncherPrefs.getInner(LauncherPrefs.kt:81)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.LauncherPrefs.get(LauncherPrefs.kt:72)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.DisplayController$Info.(DisplayController.java:404)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.DisplayController.(DisplayController.java:136)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.DisplayController$$ExternalSyntheticLambda2.get(D8$$SyntheticClass:0)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.MainThreadInitializedObject.lambda$get$0(MainThreadInitializedObject.java:60)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.MainThreadInitializedObject.$r8$lambda$jeoH4EKO3m1c-S7-sJSjrbw_Ei4(Unknown Source:0)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.MainThreadInitializedObject$$ExternalSyntheticLambda1.get(D8$$SyntheticClass:0)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.TraceHelper.allowIpcs(TraceHelper.java:100)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.launcher3.util.MainThreadInitializedObject.get(MainThreadInitializedObject.java:59)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.quickstep.RecentsAnimationDeviceState.(RecentsAnimationDeviceState.java:134)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at com.android.quickstep.TouchInteractionService.onCreate(TouchInteractionService.java:497)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4912)
08-17 17:34:35.940 4100 4100 E AndroidRuntime: ... 9 more

@jingyu9575 jingyu9575 added the bug label Aug 17, 2024
nulldrf pushed a commit to nulldrf/lawnchair that referenced this issue Aug 24, 2024
@jingyu9575
Copy link
Author

Hi, I still get this error on new versions. I think it is not in the resetHomeBounceSeenOnQuickstepEnabledFirstTime function but TouchInteractionService.onCreate, right?

@CrazyManLabs
Copy link

CrazyManLabs commented Oct 2, 2024

@MrSluffy
Hello.
Sorry to bother, but I'm tagging you, as you've implemented fix for this issue initially.

I can confirm, that issue @jingyu9575 mentioned in initial report still persists even in latest nightly, so issue is clearly not fixed and it is preventing users from using Lawnchair as default launcher and task switcher app (because after each reboot user is forced to somehow restart Lawnchair to make it work again, which is annoing at least and sometimes not even possible without access to PC).

Steps to reproduce:

  • install Lawnchair 14 (even latest version will do)
  • install QuickSwitch Magisk module
  • open QuickSwitch and set Lawnchair as recents provider
  • reboot device, observe Lawnchair crashing on startup (we do not even need to set it as default launcher app)
Observed error/stack trace
java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user (id 0) is unlocked
stacktrace: java.lang.RuntimeException: Unable to create service com.android.quickstep.TouchInteractionService: java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user (id 0) is unlocked
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4925)
	at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2407)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8592)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:583)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Caused by: java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user (id 0) is unlocked
	at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:605)
	at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:588)
	at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:223)
	at com.android.launcher3.LauncherPrefs.getEncryptedPrefs(LauncherPrefs.kt:51)
	at com.android.launcher3.LauncherPrefs.chooseSharedPreferences(LauncherPrefs.kt:65)
	at com.android.launcher3.LauncherPrefs.getInner(LauncherPrefs.kt:81)
	at com.android.launcher3.LauncherPrefs.get(LauncherPrefs.kt:72)
	at com.android.launcher3.util.DisplayController$Info.<init>(DisplayController.java:404)
	at com.android.launcher3.util.DisplayController.<init>(DisplayController.java:136)
	at com.android.launcher3.util.DisplayController$$ExternalSyntheticLambda2.get(D8$$SyntheticClass:0)
	at com.android.launcher3.util.MainThreadInitializedObject.lambda$get$0(MainThreadInitializedObject.java:60)
	at com.android.launcher3.util.MainThreadInitializedObject.$r8$lambda$jeoH4EKO3m1c-S7-sJSjrbw_Ei4(Unknown Source:0)
	at com.android.launcher3.util.MainThreadInitializedObject$$ExternalSyntheticLambda1.get(D8$$SyntheticClass:0)
	at com.android.launcher3.util.TraceHelper.allowIpcs(TraceHelper.java:100)
	at com.android.launcher3.util.MainThreadInitializedObject.get(MainThreadInitializedObject.java:59)
	at com.android.quickstep.RecentsAnimationDeviceState.<init>(RecentsAnimationDeviceState.java:134)
	at com.android.quickstep.TouchInteractionService.onCreate(TouchInteractionService.java:497)
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4912)
	... 9 more

Details:

  • Device: OnePlus 8T
  • OS: Android 14, Evolution X 9.4 (Lineage OS 21-based)
  • Lawnchair: 14 Beta 3
  • QuickSwitch: 4.0.3
  • Magisk: Canary 27008

P.S.: I would like to help and provide a patch or MR with fix, but issue seems to be complex enough without looking too deep into the code and knowing Android direct boot mode specifics (and I'm not an Android developer :( ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants