Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 033b13bc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Home: fix set the default home app issue"

parents ab62e68d 3e4e3243
Loading
Loading
Loading
Loading
+25 −8
Original line number Diff line number Diff line
@@ -1232,6 +1232,17 @@ public final class ActivityManagerService extends ActivityManagerNative
    int mThumbnailWidth;
    int mThumbnailHeight;
    /**
     *  This is flag used for the first time boot of fresh new phone.
     *
     *  1. startHomeActivityLocked will be called three times at first time boot, we also
     *  need to set three time in order to successfully set the default home.
     *
     *  2. there are won't set anymore after the first time boot, because a property will
     *  ignore the default home set.
     */
    int mStartHomeSetDefaultLauncherCount = 3;
    final ServiceThread mHandlerThread;
    final MainHandler mHandler;
@@ -3311,6 +3322,20 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    boolean startHomeActivityLocked(int userId) {
        // Only set at first time boot up for a fresh new phone
        if (mStartHomeSetDefaultLauncherCount > 0) {
            mStartHomeSetDefaultLauncherCount--;
            boolean firstLaunch = SystemProperties.getBoolean("persist.sys.sw.firstLaunch", true);
            if(firstLaunch){
                setDefaultLauncher();
                if (mStartHomeSetDefaultLauncherCount == 0) {
                    SystemProperties.set("persist.sys.sw.firstLaunch", "false");
                }
            }
        }
        if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL
                && mTopAction == null) {
            // We are running in factory test mode, but unable to find
@@ -11390,14 +11415,6 @@ public final class ActivityManagerService extends ActivityManagerNative
                }
            }
            // Only set at first time boot up for a fresh new phone
            boolean firstLaunch = SystemProperties.getBoolean("persist.sys.sw.firstLaunch", true);
            if(firstLaunch){
                SystemProperties.set("persist.sys.sw.firstLaunch", "false");
                setDefaultLauncher();
            }
            // Start up initial activity.
            mBooting = true;
            startHomeActivityLocked(mCurrentUserId);