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

Commit ad216bac authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Settings override for use_app_info_not_launched flag" into main

parents 5db09741 2073b73d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -17818,6 +17818,12 @@ public final class Settings {
        public static final String FORCE_NON_DEBUGGABLE_FINAL_BUILD_FOR_COMPAT =
                "force_non_debuggable_final_build_for_compat";
        /**
         * Flag to enable the use of ApplicationInfo for getting not-launched status.
         *
         * @hide
         */
        public static final String ENABLE_USE_APP_INFO_NOT_LAUNCHED = "use_app_info_not_launched";
        /**
         * Current version of signed configuration applied.
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ public class SettingsBackupTest {
                    Settings.Global.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE,
                    Settings.Global.ENABLE_DISKSTATS_LOGGING,
                    Settings.Global.ENABLE_EPHEMERAL_FEATURE,
                    Settings.Global.ENABLE_USE_APP_INFO_NOT_LAUNCHED,
                    Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED,
                    Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
                    Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
+19 −0
Original line number Diff line number Diff line
@@ -685,6 +685,11 @@ final class ActivityManagerConstants extends ContentObserver {
    // default. Controlled by Settings.Global.FORCE_ENABLE_PSS_PROFILING
    volatile boolean mForceEnablePssProfiling = false;

    // Indicates whether to use ApplicationInfo to determine launched state instead of PM user state
    // This is a temporary workaround until the trunk-stable flag is pushed to nextfood.
    // TODO: b/365979852 - remove this workaround when redundant
    volatile boolean mFlagUseAppInfoNotLaunched = false;

    /**
     * Indicates whether the foreground service background start restriction is enabled for
     * caller app that is targeting S+.
@@ -1017,6 +1022,9 @@ final class ActivityManagerConstants extends ContentObserver {
    private static final Uri FORCE_ENABLE_PSS_PROFILING_URI =
            Settings.Global.getUriFor(Settings.Global.FORCE_ENABLE_PSS_PROFILING);

    private static final Uri ENABLE_USE_APP_INFO_NOT_LAUNCHED_URI =
            Settings.Global.getUriFor(Settings.Global.ENABLE_USE_APP_INFO_NOT_LAUNCHED);

    /**
     * The threshold to decide if a given association should be dumped into metrics.
     */
@@ -1479,6 +1487,7 @@ final class ActivityManagerConstants extends ContentObserver {
                    false, this);
        }
        mResolver.registerContentObserver(FORCE_ENABLE_PSS_PROFILING_URI, false, this);
        mResolver.registerContentObserver(ENABLE_USE_APP_INFO_NOT_LAUNCHED_URI, false, this);
        updateConstants();
        if (mSystemServerAutomaticHeapDumpEnabled) {
            updateEnableAutomaticSystemServerHeapDumps();
@@ -1495,6 +1504,7 @@ final class ActivityManagerConstants extends ContentObserver {
        updateActivityStartsLoggingEnabled();
        updateForegroundServiceStartsLoggingEnabled();
        updateForceEnablePssProfiling();
        updateEnableUseAppInfoNotLaunched();
        // Read DropboxRateLimiter params from flags.
        mService.initDropboxRateLimiter();
    }
@@ -1540,6 +1550,8 @@ final class ActivityManagerConstants extends ContentObserver {
            updateEnableAutomaticSystemServerHeapDumps();
        } else if (FORCE_ENABLE_PSS_PROFILING_URI.equals(uri)) {
            updateForceEnablePssProfiling();
        } else if (ENABLE_USE_APP_INFO_NOT_LAUNCHED_URI.equals(uri)) {
            updateEnableUseAppInfoNotLaunched();
        }
    }

@@ -1659,6 +1671,11 @@ final class ActivityManagerConstants extends ContentObserver {
                Settings.Global.FORCE_ENABLE_PSS_PROFILING, 0) == 1;
    }

    private void updateEnableUseAppInfoNotLaunched() {
        mFlagUseAppInfoNotLaunched = Settings.Global.getInt(mResolver,
                Settings.Global.ENABLE_USE_APP_INFO_NOT_LAUNCHED, 0) == 1;
    }

    private void updateBackgroundActivityStarts() {
        mFlagBackgroundActivityStartsEnabled = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
@@ -2538,6 +2555,8 @@ final class ActivityManagerConstants extends ContentObserver {
        pw.print("  OOMADJ_UPDATE_QUICK="); pw.println(OOMADJ_UPDATE_QUICK);
        pw.print("  ENABLE_WAIT_FOR_FINISH_ATTACH_APPLICATION=");
        pw.println(mEnableWaitForFinishAttachApplication);
        pw.print("  FLAG_USE_APP_INFO_NOT_LAUNCHED=");
        pw.println(mFlagUseAppInfoNotLaunched);

        pw.print("  "); pw.print(KEY_FOLLOW_UP_OOMADJ_UPDATE_WAIT_DURATION);
        pw.print("="); pw.println(FOLLOW_UP_OOMADJ_UPDATE_WAIT_DURATION);
+4 −2
Original line number Diff line number Diff line
@@ -3398,7 +3398,8 @@ public final class ProcessList {
        // Check if we should mark the processrecord for first launch after force-stopping
        if (wasStopped) {
            boolean wasEverLaunched = false;
            if (android.app.Flags.useAppInfoNotLaunched()) {
            if (android.app.Flags.useAppInfoNotLaunched()
                    || mService.mConstants.mFlagUseAppInfoNotLaunched) {
                wasEverLaunched = !info.isNotLaunched();
            } else {
                try {
@@ -3419,7 +3420,8 @@ public final class ProcessList {
                        : STOPPED_STATE_FIRST_LAUNCH;
                r.getWindowProcessController().setStoppedState(stoppedState);
            } else {
                if (android.app.Flags.useAppInfoNotLaunched()) {
                if (android.app.Flags.useAppInfoNotLaunched()
                        || mService.mConstants.mFlagUseAppInfoNotLaunched) {
                    // If it was launched before, then it must be a force-stop
                    r.setWasForceStopped(wasEverLaunched);
                } else {