lawnchair icon indicating copy to clipboard operation
lawnchair copied to clipboard

[BUG] "Lawnchair Recent Apps" Crashes on Older Android Versions

Open berkekbgz opened this issue 3 months ago • 0 comments

Describe the bug

Sometimes "Lawnchair Recent Apps" crashes when I try to access to recent apps using gesture controls.

Here's what I found:

In Line 255 of TopTaskTracker.java, Lawnchair tries to access isVisible method which introduced in Android 12. So I am thinking this is the reason why it is crashing on older Android.

https://github.com/LawnchairLauncher/lawnchair/blob/fb6fcb7a872c703bdd3fc8ca5430fca7ba000947/quickstep/src/com/android/quickstep/TopTaskTracker.java#L248-L260

I am not entirely sure on this since I don't have much experience in that side of Android development but I hope I could help.

Steps to reproduce

I didn't know it is happening because of an activity that is excluded from recents until I read the code and I don't know how to spawn that type of activity so I cannot reproduce it now. It is just happens randomly(?).

  1. Find a way to summon an activity that is excluded from recents.
  2. Using gesture controls swipe up to access recent apps
  3. Go to 1 until it gives you a crash log

Expected behavior

It should not crash I think.

Screenshots

No response

Device information

  • Android 11
  • Lawnchair 14 Beta 2
  • QuickSwitch 3.1.8

Additional context

error: Uncaught exception

java.lang.NoSuchFieldError: No instance field isVisible of type Z in class Landroid/app/ActivityManager$RunningTaskInfo; or its superclasses (declaration of 'android.app.ActivityManager$RunningTaskInfo' appears in /system/framework/framework.jar)
	at com.android.quickstep.TopTaskTracker$CachedTaskInfo.lambda$otherVisibleTaskThisIsExcludedOver$0(Unknown Source:0)
	at com.android.quickstep.TopTaskTracker$CachedTaskInfo.a(Unknown Source:0)
	at com.android.quickstep.l8.test(Unknown Source:2)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:184)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1390)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:475)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:517)
	at com.android.quickstep.TopTaskTracker$CachedTaskInfo.otherVisibleTaskThisIsExcludedOver(Unknown Source:36)
	at com.android.quickstep.TouchInteractionService.newBaseConsumer(Unknown Source:83)
	at com.android.quickstep.TouchInteractionService.newConsumer(Unknown Source:165)
	at com.android.quickstep.TouchInteractionService.onInputEvent(Unknown Source:167)
	at com.android.quickstep.TouchInteractionService.c(Unknown Source:0)
	at com.android.quickstep.q8.onInputEvent(Unknown Source:2)
	at com.android.systemui.shared.system.InputChannelCompat$InputEventReceiver$1.onInputEvent(Unknown Source:2)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:335)
	at android.os.Looper.loop(Looper.java:183)
	at android.app.ActivityThread.main(ActivityThread.java:7731)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

berkekbgz avatar Apr 17 '24 14:04 berkekbgz