Re: Android framework reboots due to force finishing activity call stucks in an infinite loop. (100% reproducible)

1,647 views
Skip to first unread message

Dave Cameron

unread,
Jul 8, 2013, 3:10:51 PM7/8/13
to android-...@googlegroups.com
We believe we are seeing a similar problem when we try to upgrade our APK. The APK contains a custom launcher implementation. We see a loop of ActivityManager trying to start our launcher activity, followed by the "force closing activity message" followed again by starting the launcher activity. Looking at the filesystem suggests that the upgrade was never completed successfully.

Did anything further develop with this issue?

07-01 11:29:02.965: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b5923938 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.965: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.975: INFO/ActivityManager(2728): Start proc com.ourdomain for activity com.ourdomain/com.oldpackagename.OurLauncherActivity: pid=3250 uid=10044 gids={3003, 1015, 1028}
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b5921a18 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b597f4a0 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b5980b18 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b5941620 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b591ac50 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b591c308 com.ourdomain/com.oldpackagename.OurLauncherActivity}
07-01 11:29:02.985: INFO/ActivityManager(2728): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.ourdomain/com.oldpackagename.OurLauncherActivity u=0} from pid 0
07-01 11:29:02.985: INFO/ActivityManager(2728): Force finishing activity ActivityRecord{b594beb8 com.ourdomain/com.oldpackagename.OurLauncherActivity}




On Wednesday, May 15, 2013 5:00:04 AM UTC-4, Lalit Kansara wrote:
Description: We are observing framework reboot issue when there is only Launcher activity from Launcher2 package in the activity stack and a new activity WallpaperChooser activity form same package is started through adb shell. The Launcher activity is finished forcefully in this case and started back but it traps in an infinite loop being finished and started continuously. Watchdog kills system process resulting in framework reboot. This can happen with other packages too.

Steps to reproduce the issue:
1. After rebooting the phone let the home screen come or lock screen or launcher screen
2. Run the following command
    $ adb shell am start -S com.android.launcher/com.android.launcher2.WallpaperChooser

Android OS: Jelly Bean
Android OS: JB-MR1-DEV

A possible fix for this issue is given in Green text as-

    private final boolean forceStopPackageLocked(String name, int uid,
            boolean callerWillRestart, boolean purgeCache, boolean doit,
            boolean evenPersistent, int userId) {

        int i;
        int N;

        int lastHistorySize;
        ...

        ...

        ...

        for (i=0; i<mMainStack.mHistory.size(); i++) {
            ActivityRecord r = (ActivityRecord)mMainStack.mHistory.get(i);
            final boolean samePackage = r.packageName.equals(name);
            if (r.userId == userId
                    && (samePackage || r.task == lastTask)
                    && (r.app == null || evenPersistent || !r.app.persistent)) {
                ...

                ...                     
                lastTask = r.task;
                lastHistorySize = mMainStack.mHistory.size();
                if (r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED,
                        null, "force-stop", true)) {
                    int historySize = mMainStack.mHistory.size();
                    // If lastHistorySize before finishing the activity is equal to
                    // current history Size and also it was the last record in the
                    // stack then we should skip decrement of index to avoid an
                    // infinite loop.

                    if (lastHistorySize == historySize && i == historySize - 1) {
                        continue;
                    }

                    i--;
                }
            }
        }

        ...

        ...

        ...      
        return didSomething;
    }

Can someone from Google provide fix?

Thanks,
Lalit Kansara.

Lalit Kansara

unread,
May 15, 2013, 5:00:04 AM5/15/13
to android-...@googlegroups.com

Rupert Rawnsley

unread,
Jan 9, 2015, 6:22:02 AM1/9/15
to android-...@googlegroups.com
We are seeing the same thing on all versions of Android and all devices. Our app is a custom home launcher and while it is being upgraded, the OS can't find anything to show to the user and goes into this death loop. This can also cause the upgrade to fail as it leaves two versions of the APK file in the /data/app folder. When the OS comes back up it picks the original and ignores the new one.
...
Reply all
Reply to author
Forward
0 new messages