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

Commit c12189b2 authored by Alex Chau's avatar Alex Chau
Browse files

Add adb command to get max running users

Bug: 72033601
Test: New command is working
Change-Id: I38746a2c03a6da35e7d8a149e1fb0b3604234dbc
parent 588a06f5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -334,4 +334,9 @@ public abstract class ActivityManagerInternal {
     * Sets the user switcher message for switching to {@link android.os.UserHandle#SYSTEM}.
     */
    public abstract void setSwitchingToSystemUserMessage(String switchingToSystemUserMessage);

    /**
     * Returns maximum number of users that can run simultaneously.
     */
    public abstract int getMaxRunningUsers();
}
+5 −0
Original line number Diff line number Diff line
@@ -25142,6 +25142,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        public void setSwitchingToSystemUserMessage(String switchingToSystemUserMessage) {
            mUserController.setSwitchingToSystemUserMessage(switchingToSystemUserMessage);
        }
        @Override
        public int getMaxRunningUsers() {
            return mUserController.mMaxRunningUsers;
        }
    }
    /**
+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.pm;

import android.accounts.IAccountManager;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.content.ComponentName;
import android.content.Context;
import android.content.IIntentReceiver;
@@ -72,6 +73,7 @@ import android.util.PrintWriterPrinter;
import com.android.internal.content.PackageHelper;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.SizedInputStream;
import com.android.server.LocalServices;
import com.android.server.SystemConfig;

import dalvik.system.DexFile;
@@ -222,6 +224,8 @@ class PackageManagerShellCommand extends ShellCommand {
                    return runSetUserRestriction();
                case "get-max-users":
                    return runGetMaxUsers();
                case "get-max-running-users":
                    return runGetMaxRunningUsers();
                case "set-home-activity":
                    return runSetHomeActivity();
                case "set-installer":
@@ -1883,6 +1887,14 @@ class PackageManagerShellCommand extends ShellCommand {
        return 0;
    }

    public int runGetMaxRunningUsers() {
        ActivityManagerInternal activityManagerInternal =
                LocalServices.getService(ActivityManagerInternal.class);
        getOutPrintWriter().println("Maximum supported running users: "
                + activityManagerInternal.getMaxRunningUsers());
        return 0;
    }

    private static class InstallParams {
        SessionParams sessionParams;
        String installerPackageName;
@@ -2607,6 +2619,8 @@ class PackageManagerShellCommand extends ShellCommand {
        pw.println("");
        pw.println("  get-max-users");
        pw.println("");
        pw.println("  get-max-running-users");
        pw.println("");
        pw.println("  compile [-m MODE | -r REASON] [-f] [-c] [--split SPLIT_NAME]");
        pw.println("          [--reset] [--check-prof (true | false)] (-a | TARGET-PACKAGE)");
        pw.println("    Trigger compilation of TARGET-PACKAGE or all packages if \"-a\".  Options are:");