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

Commit 4af0a8a5 authored by Adam Bookatz's avatar Adam Bookatz Committed by Android (Google) Code Review
Browse files

Merge "Stop inactive bg user if memory pressure" into main

parents ea8a5151 075f9fe4
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -168,17 +168,16 @@ public abstract class ActivityManagerInternal {
     *
     * The automatic stopping is not guaranteed, and there are cases in which it won't be.
     * Similarly, there is no guarantee that the user will not be stopped prior to the given
     * duration.
     *
     * In the current implementation, this value simply replaces any default inactive stopping time
     * (from config_backgroundUserScheduledStopTimeSecs), but that is subject to change.
     * duration (such as if too many users are running, or the user has been in the background for
     * long enough that it is considered dispensable).
     *
     * Automatically stopping background users is not currently enabled for devices supporting
     * {@link android.os.UserManager#isVisibleBackgroundUsersEnabled() visible background users};
     * on such devices, the user will still be started but not stopped.
     *
     * @param userId ID of the user to start
     * @param durSecs in how many seconds we should attempt to stop the user
     * @param durSecs in how many seconds we should attempt to stop the user, typically something on
     *                the order of a few minutes
     * @return true if the user has been successfully started
     */
    public abstract boolean startUserInBackgroundTemporarily(@UserIdInt int userId, int durSecs);
+5 −3
Original line number Diff line number Diff line
@@ -3185,9 +3185,11 @@
    <!-- Maximum number of users we allow to be running at a time. -->
    <integer name="config_multiuserMaxRunningUsers">3</integer>

    <!-- Number of seconds of uptime after a full user enters the background before we attempt to
         stop it due to inactivity. Set to -1 to disable scheduling stopping background users. -->
    <integer name="config_backgroundUserScheduledStopTimeSecs">1800</integer> <!-- 30 minutes -->
    <!-- Number of seconds of uptime after a full user enters the background before we consider
         it as no longer important, and therefore can consider automatically stopping it.
         Set to -1 to disable this feature (i.e. don't auto-stop background users after some elapsed
         time). -->
    <integer name="config_backgroundUserConsideredDispensableTimeSecs">93600</integer> <!-- 26 hours -->

    <!-- Whether to delay user data locking for background user.
         If false, user switched-out from user switching will still be in running state until
+1 −1
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@
  <java-symbol type="integer" name="config_lockSoundVolumeDb" />
  <java-symbol type="integer" name="config_multiuserMaximumUsers" />
  <java-symbol type="integer" name="config_multiuserMaxRunningUsers" />
  <java-symbol type="integer" name="config_backgroundUserScheduledStopTimeSecs" />
  <java-symbol type="integer" name="config_backgroundUserConsideredDispensableTimeSecs" />
  <java-symbol type="bool" name="config_multiuserDelayUserDataLocking" />
  <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsers" />
  <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsersOnDefaultDisplay" />
+4 −3
Original line number Diff line number Diff line
@@ -8949,10 +8949,11 @@ public class ActivityManagerService extends IActivityManager.Stub
                    com.android.internal.R.integer.config_multiuserMaxRunningUsers);
            final boolean delayUserDataLocking = res.getBoolean(
                    com.android.internal.R.bool.config_multiuserDelayUserDataLocking);
            final int backgroundUserScheduledStopTimeSecs = res.getInteger(
                    com.android.internal.R.integer.config_backgroundUserScheduledStopTimeSecs);
            final int backgroundUserConsideredDispensableTimeSecs = res.getInteger(
                    com.android.internal.R.integer
                            .config_backgroundUserConsideredDispensableTimeSecs);
            mUserController.setInitialConfig(userSwitchUiEnabled, maxRunningUsers,
                    delayUserDataLocking, backgroundUserScheduledStopTimeSecs);
                    delayUserDataLocking, backgroundUserConsideredDispensableTimeSecs);
        }
        mAppErrors.loadAppsNotReportingCrashesFromConfig(res.getString(
                com.android.internal.R.string.config_appsNotReportingCrashes));
+284 −64

File changed.

Preview size limit exceeded, changes collapsed.

Loading