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

Commit 3f4a9687 authored by Felipe Leme's avatar Felipe Leme Committed by Automerger Merge Worker
Browse files

Merge "New TestAPIs on ActivityManager to not stop bg users on switch." into...

Merge "New TestAPIs on ActivityManager to not stop bg users on switch." into sc-v2-dev am: 7c1c6a69

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16105957

Change-Id: Iae229bfacaec6690fd114789c9336fdfdbc33418
parents 28dd1b47 7c1c6a69
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ package android.app {
    method @RequiresPermission(android.Manifest.permission.RESET_APP_ERRORS) public void resetAppErrors();
    method public static void resumeAppSwitches() throws android.os.RemoteException;
    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public void setStopBackgroundUsersOnSwitch(int);
    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public boolean stopUser(int, boolean);
    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.DUMP) public void waitForBroadcastIdle();
@@ -127,6 +128,9 @@ package android.app {
    field public static final int PROCESS_CAPABILITY_NONE = 0; // 0x0
    field public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; // 0x4
    field public static final int PROCESS_STATE_TOP = 2; // 0x2
    field public static final int STOP_BG_USERS_ON_SWITCH_DEFAULT = -1; // 0xffffffff
    field public static final int STOP_BG_USERS_ON_SWITCH_FALSE = 0; // 0x0
    field public static final int STOP_BG_USERS_ON_SWITCH_TRUE = 1; // 0x1
  }

  public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
+50 −0
Original line number Diff line number Diff line
@@ -4075,6 +4075,56 @@ public class ActivityManager {
        return switchUser(user.getIdentifier());
    }

    /**
     * Uses the value defined by the platform.
     *
     * @hide
     */
    @TestApi
    public static final int STOP_BG_USERS_ON_SWITCH_DEFAULT = -1;

    /**
     * Overrides value defined by the platform and stop background users on switch.
     *
     * @hide
     */
    @TestApi
    public static final int STOP_BG_USERS_ON_SWITCH_TRUE = 1;

    /**
     * Overrides value defined by the platform and don't stop background users on switch.
     *
     * @hide
     */
    @TestApi
    public static final int STOP_BG_USERS_ON_SWITCH_FALSE = 0;

    /** @hide */
    @IntDef(prefix = { "STOP_BG_USERS_ON_SWITCH_" }, value = {
            STOP_BG_USERS_ON_SWITCH_DEFAULT,
            STOP_BG_USERS_ON_SWITCH_TRUE,
            STOP_BG_USERS_ON_SWITCH_FALSE
    })
    public @interface StopBgUsersOnSwitch {}

    /**
     * Sets whether background users should be stopped when the current user is switched.
     *
     * <p>Should only be used on tests.
     *
     * @hide
     */
    @TestApi
    @RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS,
            android.Manifest.permission.INTERACT_ACROSS_USERS_FULL})
    public void setStopBackgroundUsersOnSwitch(@StopBgUsersOnSwitch int value) {
        try {
            getService().setStopBackgroundUsersOnSwitch(value);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Starts a profile.
     * To be used with non-managed profiles, managed profiles should use
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.app;

import static android.app.ActivityManager.StopBgUsersOnSwitch;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
@@ -660,6 +662,11 @@ public abstract class ActivityManagerInternal {
    public abstract void setVoiceInteractionManagerProvider(
            @Nullable VoiceInteractionManagerProvider provider);

    /**
     * Sets whether background users should be stopped when the current user is switched.
     */
    public abstract void setStopBackgroundUsersOnSwitch(@StopBgUsersOnSwitch int value);

    /**
     * Provides the interface to communicate between voice interaction manager service and
     * ActivityManagerService.
+1 −0
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ interface IActivityManager {
    @UnsupportedAppUsage
    boolean switchUser(int userid);
    @UnsupportedAppUsage
    void setStopBackgroundUsersOnSwitch(int value);
    boolean removeTask(int taskId);
    @UnsupportedAppUsage
    void registerProcessObserver(in IProcessObserver observer);
+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static android.app.ActivityManager.INTENT_SENDER_ACTIVITY;
import static android.app.ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
import static android.app.ActivityManager.PROCESS_STATE_TOP;
import static android.app.ActivityManager.StopBgUsersOnSwitch;
import static android.app.ActivityManagerInternal.ALLOW_FULL_ONLY;
import static android.app.ActivityManagerInternal.ALLOW_NON_FULL;
import static android.app.AppOpsManager.OP_NONE;
@@ -15104,6 +15105,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mUserController.switchUser(targetUserId);
    }
    @Override
    public void setStopBackgroundUsersOnSwitch(@StopBgUsersOnSwitch int value) {
        mUserController.setStopBackgroundUsersOnSwitch(value);
    }
    @Override
    public int stopUser(final int userId, boolean force, final IStopUserCallback callback) {
        return mUserController.stopUser(userId, force, /* allowDelayedLocking= */ false,
@@ -16401,6 +16407,11 @@ public class ActivityManagerService extends IActivityManager.Stub
                @Nullable ActivityManagerInternal.VoiceInteractionManagerProvider provider) {
            ActivityManagerService.this.setVoiceInteractionManagerProvider(provider);
        }
        @Override
        public void setStopBackgroundUsersOnSwitch(int value) {
            ActivityManagerService.this.setStopBackgroundUsersOnSwitch(value);
        }
    }
    long inputDispatchingTimedOut(int pid, final boolean aboveSystem, String reason) {
Loading