Merge "Multiuser perfetto metric: adb tracepoints"

This commit is contained in:
Adam Bookatz
2021-11-11 17:10:39 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 11 deletions

View File

@@ -87,6 +87,7 @@ import android.os.ShellCommand;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
@@ -1889,16 +1890,21 @@ final class ActivityManagerShellCommand extends ShellCommand {
int userId = Integer.parseInt(getNextArgRequired());
boolean switched;
if (wait) {
switched = switchUserAndWaitForComplete(userId);
} else {
switched = mInterface.switchUser(userId);
}
if (switched) {
return 0;
} else {
pw.printf("Error: Failed to switch to user %d\n", userId);
return 1;
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "shell_runSwitchUser");
try {
if (wait) {
switched = switchUserAndWaitForComplete(userId);
} else {
switched = mInterface.switchUser(userId);
}
if (switched) {
return 0;
} else {
pw.printf("Error: Failed to switch to user %d\n", userId);
return 1;
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
}
}

View File

@@ -1406,7 +1406,7 @@ class UserController implements Handler.Callback {
@Nullable IProgressListener unlockListener) {
TimingsTraceAndSlog t = new TimingsTraceAndSlog();
t.traceBegin("startUser-" + userId + "-" + (foreground ? "fg" : "bg"));
t.traceBegin("UserController.startUser-" + userId + "-" + (foreground ? "fg" : "bg"));
try {
return startUserInternal(userId, foreground, unlockListener, t);
} finally {

View File

@@ -81,6 +81,7 @@ import android.os.ServiceSpecificException;
import android.os.ShellCommand;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.incremental.V4Signature;
@@ -2629,6 +2630,7 @@ class PackageManagerShellCommand extends ShellCommand {
if (userType == null) {
userType = UserInfo.getDefaultUserType(flags);
}
Trace.traceBegin(Trace.TRACE_TAG_PACKAGE_MANAGER, "shell_runCreateUser");
try {
if (UserManager.isUserTypeRestricted(userType)) {
// In non-split user mode, userId can only be SYSTEM
@@ -2645,6 +2647,8 @@ class PackageManagerShellCommand extends ShellCommand {
}
} catch (ServiceSpecificException e) {
getErrPrintWriter().println("Error: " + e);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_PACKAGE_MANAGER);
}
if (info != null) {