Loading cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +14 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.commands.bmgr; import android.annotation.IntDef; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.backup.BackupManager; import android.app.backup.BackupManagerMonitor; import android.app.backup.BackupProgress; Loading Loading @@ -73,6 +74,8 @@ public class Bmgr { "Error: Could not access the backup transport. Is the system running?"; private static final String PM_NOT_RUNNING_ERR = "Error: Could not access the Package Manager. Is the system running?"; private static final String INVALID_USER_ID_ERR_TEMPLATE = "Error: Invalid user id (%d).\n"; private String[] mArgs; private int mNextArg; Loading Loading @@ -104,6 +107,11 @@ public class Bmgr { mArgs = args; mNextArg = 0; int userId = parseUserId(); if (userId < 0) { System.err.printf(INVALID_USER_ID_ERR_TEMPLATE, userId); return; } String op = nextArg(); Slog.v(TAG, "Running " + op + " for user:" + userId); Loading Loading @@ -955,12 +963,15 @@ public class Bmgr { private int parseUserId() { String arg = nextArg(); if ("--user".equals(arg)) { return UserHandle.parseUserArg(nextArg()); } else { if (!"--user".equals(arg)) { mNextArg--; return UserHandle.USER_SYSTEM; } int userId = UserHandle.parseUserArg(nextArg()); if (userId == UserHandle.USER_CURRENT) { userId = ActivityManager.getCurrentUser(); } return userId; } private static void showUsage() { Loading Loading
cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +14 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.commands.bmgr; import android.annotation.IntDef; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.backup.BackupManager; import android.app.backup.BackupManagerMonitor; import android.app.backup.BackupProgress; Loading Loading @@ -73,6 +74,8 @@ public class Bmgr { "Error: Could not access the backup transport. Is the system running?"; private static final String PM_NOT_RUNNING_ERR = "Error: Could not access the Package Manager. Is the system running?"; private static final String INVALID_USER_ID_ERR_TEMPLATE = "Error: Invalid user id (%d).\n"; private String[] mArgs; private int mNextArg; Loading Loading @@ -104,6 +107,11 @@ public class Bmgr { mArgs = args; mNextArg = 0; int userId = parseUserId(); if (userId < 0) { System.err.printf(INVALID_USER_ID_ERR_TEMPLATE, userId); return; } String op = nextArg(); Slog.v(TAG, "Running " + op + " for user:" + userId); Loading Loading @@ -955,12 +963,15 @@ public class Bmgr { private int parseUserId() { String arg = nextArg(); if ("--user".equals(arg)) { return UserHandle.parseUserArg(nextArg()); } else { if (!"--user".equals(arg)) { mNextArg--; return UserHandle.USER_SYSTEM; } int userId = UserHandle.parseUserArg(nextArg()); if (userId == UserHandle.USER_CURRENT) { userId = ActivityManager.getCurrentUser(); } return userId; } private static void showUsage() { Loading