GmsCore icon indicating copy to clipboard operation
GmsCore copied to clipboard

[com.lge.launcher3] phonesky breaks recents screen

Open imyxh opened this issue 11 months ago • 9 comments

Affected app Name: Home Package id: com.lge.launcher3

Describe the bug When I install phonesky (fdroid), the next time I tap the square nav button, the recents screen will open, but each time after that will crash com.lge.launcher3.

To Reproduce Steps to reproduce the behavior:

  1. degoogle device
  2. install gmscore
  3. observe that recents work fine
  4. install phonesky
  5. observe that recents are now broken
  6. uninstall phonesky
  7. observe that recents work fine again

System Android Version: 12 Custom ROM: stock

microG microG Core version: 0.2.27.223616 microG Self-Check results: all ticked, except of course the phonesky one when it's uninstalled

Additional context I tried switching to Lawnchair+QuickSwitch as my recents provider but that didn't work either. See https://github.com/LawnchairLauncher/lawnchair/issues/5047#issuecomment-2560928966 for logs of the launcher3 crash—I only just figured out it was phonesky-related.

imyxh avatar Dec 24 '24 13:12 imyxh

microG Core version: 0.2.27.223616

v0.2.27 is very outdated, test with v0.3.6 instead.

JonnyTech avatar Dec 24 '24 15:12 JonnyTech

v0.2.27 is very outdated, test with v0.3.6 instead.

Huh, just checked again and it reads 0.3.6.244735. Not sure why I wrote 0.2.27 earlier.

Nonetheless the issue persists.

imyxh avatar Dec 24 '24 17:12 imyxh

With "phonesky" do you mean microG Companion or the real Google Play Store?

If it is microG Companion: First update microG Services, then update microG Companion. If you have done it in the opposite order, uninstall and reinstall microG Companion.

Both microG Services and microG Companion must be version 0.3.6 or higher.

ale5000-git avatar Dec 24 '24 20:12 ale5000-git

With "phonesky" do you mean microG Companion or the real Google Play Store?

microG companion

If it is microG Companion: First update microG Services, then update microG Companion. If you have done it in the opposite order, uninstall and reinstall microG Companion.

Both microG Services and microG Companion must be version 0.3.6 or higher.

Mmm, no luck. Installing microG companion at 0.3.6.40226 still causes the issue.

imyxh avatar Dec 24 '24 21:12 imyxh

Try reset data of microG Companion and then if it happens again take a logcat and post it here please.

ale5000-git avatar Dec 24 '24 21:12 ale5000-git

Sure, here's the relevant portion of the logcat:

recents_phonesky.log

More specifically, the crash is

[ 12-24 17:08:01.228  9183: 9183 E/AndroidRuntime ]
FATAL EXCEPTION: main
Process: com.lge.launcher3, PID: 9183
java.lang.IndexOutOfBoundsException: Index: 0
	at java.util.Collections$EmptyList.get(Collections.java:4511)
	at com.android.quickstep.views.RecommandAppLayout.addItem(RecommandAppLayout.java:235)
	at com.android.quickstep.views.RecommandAppLayout.updateItems(RecommandAppLayout.java:167)
	at com.android.quickstep.views.RecentsView.reloadIfNeeded(RecentsView.java:1353)
	at com.android.quickstep.views.RecentsView.reloadIfNeeded(RecentsView.java:2909)
	at com.android.quickstep.views.RecentsView.updateTaskStackListenerState(RecentsView.java:1029)
	at com.android.quickstep.views.RecentsView.onAttachedToWindow(RecentsView.java:620)
	at android.view.View.dispatchAttachedToWindow(View.java:20795)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3581)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3588)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3588)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3588)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3588)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3588)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2677)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2185)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8988)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1120)
	at android.view.Choreographer.doCallbacks(Choreographer.java:926)
	at android.view.Choreographer.doFrame(Choreographer.java:859)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1105)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:8005)
	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:1039)

When microG companion is uninstalled, there are no such E/AndroidRuntime crashes.

My LGHome.apk is here: https://drive.google.com/file/d/1D1p2m34XldnLD0SFl4g4pe_STc-wHwx4/view?usp=drive_link

I also decompiled and lightly annotated the addItem method:

public void addItem(String itemToAdd) {
    Launcher thisLauncher = this.mLauncher;
    List launcherActivityList = null;
    Context thisContext = null;
    int var2;
    int var3;
    int var4;
    ShortcutInfo var8;
    LauncherActivityInfo var9;
    LinearLayout.LayoutParams var10;
    BubbleTextView var12;
    if (thisLauncher != null) {
        LauncherAppState.getInstance(thisLauncher).getIconCache();
        launcherActivityList = LauncherAppsCompat.getInstance(this.mLauncher).getActivityList(itemToAdd, Process.myUserHandle());
        if (itemToAdd.equals("com.android.contacts")) {
            Iterator var11 = launcherActivityList.iterator();

            while(true) {
                var8 = thisContext;
                if (!var11.hasNext()) {
                    break;
                }

                var9 = (LauncherActivityInfo)var11.next();
                if (var9.getComponentName().flattenToShortString().contains("DialtactsActivity")) {
                    var8 = ShortcutInfo.fromActivityInfo(var9, this.mLauncher);
                    break;
                }
            }
        } else {
            // FIXME: launcherActivityList is an empty list here
            var8 = ShortcutInfo.fromActivityInfo((LauncherActivityInfo)launcherActivityList.get(0), this.mLauncher);
        }

        if (var8 != null) {
            var12 = (BubbleTextView)this.mLauncher.createShortcut(this, var8, 2131492918);
            var8.usingLowResIcon = true;
            var12.setTag(var8);
            var12.verifyHighRes();
            var12.setTextVisibility(false);
            var4 = this.getResources().getDimensionPixelSize(2131166196);
            this.mIconSize = var12.getIconSize();
            var3 = this.mIconSize;
            var2 = var4 * 2;
            var10 = new LinearLayout.LayoutParams(var3 + var2, var3 + var2);
            var12.setPadding(var4, var4, var4, var4);
            var12.setLayoutParams(var10);
            this.addView(var12);
        }
    } else {
        thisContext = this.mContext;
        if (thisContext != null) {
            LauncherAppState.getInstance(thisContext).getIconCache();
            List launcherActivityList2 = LauncherAppsCompat.getInstance(this.mContext).getActivityList(itemToAdd, Process.myUserHandle());
            if (itemToAdd.equals("com.android.contacts")) {
                Iterator var14 = launcherActivityList2.iterator();

                while(true) {
                    var8 = launcherActivityList;
                    if (!var14.hasNext()) {
                        break;
                    }

                    var9 = (LauncherActivityInfo)var14.next();
                    if (var9.getComponentName().flattenToShortString().contains("DialtactsActivity")) {
                        var8 = ShortcutInfo.fromActivityInfo(var9, this.mContext);
                        break;
                    }
                }
            } else {
                var8 = ShortcutInfo.fromActivityInfo((LauncherActivityInfo)launcherActivityList2.get(0), this.mContext);
            }

            if (var8 != null) {
                var12 = (BubbleTextView)this.createShortcut(this.mContext, this, var8);
                var8.usingLowResIcon = true;
                var12.setTag(var8);
                var12.verifyHighRes();
                var12.setTextVisibility(false);
                var4 = this.getResources().getDimensionPixelSize(2131166196);
                var2 = var12.getIconSize();
                var3 = var4 * 2;
                var10 = new LinearLayout.LayoutParams(var2 + var3, var12.getIconSize() + var3);
                var12.setPadding(var4, var4, var4, var4);
                var12.setLayoutParams(var10);
                this.addView(var12);
            }
        }
    }

}

so it's clear that the crash is happening when LGHome tries to .get(0) on the result of .getActivityList(itemToAdd, ...) which is apparently empty for some itemToAdd. Is it possible that .getActivityList("com.android.vending", ...) is being called, but returning an empty list?

imyxh avatar Dec 24 '24 22:12 imyxh

Can you try if installing the -hw variant of com.android.vending solves this issue? https://github.com/microg/GmsCore/releases/download/v0.3.6.244735/com.android.vending-84022612-hw.apk

mar-v-in avatar Dec 24 '24 23:12 mar-v-in

Can you try if installing the -hw variant of com.android.vending solves this issue? https://github.com/microg/GmsCore/releases/download/v0.3.6.244735/com.android.vending-84022612-hw.apk

Seems to work! Any idea why?

imyxh avatar Dec 25 '24 06:12 imyxh

Huawei doesn't allow to distribute apps through their store that don't have a launcher activity, so the -hw variant has a dummy launcher activity.

So this confirms that your launcher requires that the com.android.vending package has a luncher activity (and probably others too). We can probably add a dummy activity to the regular build as well that is automatically disabled so it won't actually show up on the launcher.

mar-v-in avatar Dec 26 '24 07:12 mar-v-in

@mar-v-in Any update about the dummy launcher activity?

ale5000-git avatar Jul 12 '25 00:07 ale5000-git