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

Commit 6ba17c18 authored by Xin Guan's avatar Xin Guan Committed by Android (Google) Code Review
Browse files

Merge "Remove flag avoid_idle_check" into main

parents e140d552 755c43aa
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
package: "com.android.server.usage"
container: "system"

flag {
    name: "avoid_idle_check"
    namespace: "backstage_power"
    description: "Postpone app idle check after boot completed"
    is_fixed_read_only: true
    bug: "337864590"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "screen_time_bypass"
    namespace: "backstage_power"
+3 −7
Original line number Diff line number Diff line
@@ -848,13 +848,9 @@ public class AppIdleHistory {
                        }
                        appUsageHistory.nextEstimatedLaunchTime = getLongValue(parser,
                                ATTR_NEXT_ESTIMATED_APP_LAUNCH_TIME, 0);
                        if (Flags.avoidIdleCheck()) {
                        // Set lastInformedBucket to the same value with the currentBucket
                        // it should have already been informed.
                        appUsageHistory.lastInformedBucket = appUsageHistory.currentBucket;
                        } else {
                            appUsageHistory.lastInformedBucket = -1;
                        }
                        userHistory.put(packageName, appUsageHistory);

                        if (version >= XML_VERSION_ADD_BUCKET_EXPIRY_TIMES) {
+3 −19
Original line number Diff line number Diff line
@@ -713,10 +713,6 @@ public class AppStandbyController
                initializeDefaultsForSystemApps(UserHandle.USER_SYSTEM);
            }

            if (!Flags.avoidIdleCheck() && mPendingOneTimeCheckIdleStates) {
                postOneTimeCheckIdleStates();
            }

            // Populate list of system packages and their app-ids.
            final List<ApplicationInfo> systemApps = mPackageManager.getInstalledApplications(
                    SYSTEM_PACKAGE_FLAGS);
@@ -2003,7 +1999,7 @@ public class AppStandbyController
                mAdminProtectedPackages.put(userId, packageNames);
            }
        }
        if (!Flags.avoidIdleCheck() || mInjector.getBootPhase() >= PHASE_BOOT_COMPLETED) {
        if (mInjector.getBootPhase() >= PHASE_BOOT_COMPLETED) {
            postCheckIdleStates(userId);
        }
    }
@@ -2418,19 +2414,9 @@ public class AppStandbyController
            if (pkgInfo == null) {
                continue;
            }
            final String pkg = pkgInfo.packageName;
            final boolean isHeadLess = !systemLauncherActivities.contains(pkg);

            if (updateHeadlessSystemAppCache(pkg, isHeadLess)) {
                if (!Flags.avoidIdleCheck()) {
                    // Checking idle state for the each individual headless system app
                    // during the boot up is not necessary, a full idle check for all
                    // usres will be scheduled after boot completed.
                    mHandler.obtainMessage(MSG_CHECK_PACKAGE_IDLE_STATE,
                                    UserHandle.USER_SYSTEM, -1, pkg)
                            .sendToTarget();
                }
            }
            updateHeadlessSystemAppCache(pkgInfo.packageName,
                    !systemLauncherActivities.contains(pkgInfo.packageName));
        }
        final long end = SystemClock.uptimeMillis();
        Slog.d(TAG, "Loaded headless system app cache in " + (end - start) + " ms:"
@@ -2474,8 +2460,6 @@ public class AppStandbyController
    @Override
    public void dumpState(String[] args, PrintWriter pw) {
        pw.println("Flags: ");
        pw.println("    " + Flags.FLAG_AVOID_IDLE_CHECK
                + ": " + Flags.avoidIdleCheck());
        pw.println("    " + Flags.FLAG_ADJUST_DEFAULT_BUCKET_ELEVATION_PARAMS
                + ": " + Flags.adjustDefaultBucketElevationParams());
        pw.println("    " + Flags.FLAG_PERSIST_RESTORE_TO_RARE_APPS_LIST
+0 −3
Original line number Diff line number Diff line
@@ -144,9 +144,6 @@ public class AppIdleHistoryTests extends AndroidTestCase {
        assertEquals(aih.getAppStandbyReason(PACKAGE_4, USER_ID, 3000),
                REASON_MAIN_FORCED_BY_USER);

        if (!Flags.avoidIdleCheck()) {
            assertTrue(aih.shouldInformListeners(PACKAGE_1, USER_ID, 5000, STANDBY_BUCKET_RARE));
        }
        assertFalse(aih.shouldInformListeners(PACKAGE_1, USER_ID, 5000, STANDBY_BUCKET_RARE));
        assertTrue(aih.shouldInformListeners(PACKAGE_1, USER_ID, 5000, STANDBY_BUCKET_FREQUENT));
    }