Loading cmds/pm/src/com/android/commands/pm/Pm.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -1441,10 +1441,10 @@ public final class Pm { System.err.println("Error: no size specified"); System.err.println("Error: no size specified"); return showUsage(); return showUsage(); } } int len = size.length(); long multiplier = 1; long multiplier = 1; if (len > 1) { int len = size.length(); char c = size.charAt(len - 1); char c = size.charAt(len - 1); if (c < '0' || c > '9') { if (c == 'K' || c == 'k') { if (c == 'K' || c == 'k') { multiplier = 1024L; multiplier = 1024L; } else if (c == 'M' || c == 'm') { } else if (c == 'M' || c == 'm') { Loading core/java/android/app/usage/ExternalStorageStats.java +25 −6 Original line number Original line Diff line number Diff line Loading @@ -37,30 +37,46 @@ public final class ExternalStorageStats implements Parcelable { /** /** * Return the total bytes used by all files in the shared/external storage * Return the total bytes used by all files in the shared/external storage * hosted on this volume. * hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. Any OBB data shared between users is not accounted in * this value. */ */ public @BytesLong long getTotalBytes() { public @BytesLong long getTotalBytes() { return totalBytes; return totalBytes; } } /** /** * Return the total bytes used by audio files in the shared/external storage * Return the total bytes used by all audio files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getAudioBytes() { public @BytesLong long getAudioBytes() { return audioBytes; return audioBytes; } } /** /** * Return the total bytes used by video files in the shared/external storage * Return the total bytes used by all video files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getVideoBytes() { public @BytesLong long getVideoBytes() { return videoBytes; return videoBytes; } } /** /** * Return the total bytes used by image files in the shared/external storage * Return the total bytes used by all image files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getImageBytes() { public @BytesLong long getImageBytes() { return imageBytes; return imageBytes; Loading @@ -72,6 +88,9 @@ public final class ExternalStorageStats implements Parcelable { * <p> * <p> * This data is already accounted against individual apps as returned * This data is already accounted against individual apps as returned * through {@link StorageStats}. * through {@link StorageStats}. * <p> * This value only includes data which is isolated for each user on a * multiuser device. */ */ public @BytesLong long getAppBytes() { public @BytesLong long getAppBytes() { return appBytes; return appBytes; Loading services/core/java/com/android/server/am/ActivityManagerService.java +28 −0 Original line number Original line Diff line number Diff line Loading @@ -23850,6 +23850,34 @@ public class ActivityManagerService extends IActivityManager.Stub } } } } public void waitForBroadcastIdle(PrintWriter pw) { enforceCallingPermission(permission.DUMP, "waitForBroadcastIdle()"); while (true) { boolean idle = true; synchronized (this) { for (BroadcastQueue queue : mBroadcastQueues) { if (!queue.isIdle()) { final String msg = "Waiting for queue " + queue + " to become idle..."; pw.println(msg); pw.flush(); Slog.v(TAG, msg); idle = false; } } } if (idle) { final String msg = "All broadcast queues are idle!"; pw.println(msg); pw.flush(); Slog.v(TAG, msg); return; } else { SystemClock.sleep(1000); } } } /** /** * Return the user id of the last resumed activity. * Return the user id of the last resumed activity. */ */ services/core/java/com/android/server/am/ActivityManagerShellCommand.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -251,6 +251,8 @@ final class ActivityManagerShellCommand extends ShellCommand { return runUpdateApplicationInfo(pw); return runUpdateApplicationInfo(pw); case "no-home-screen": case "no-home-screen": return runNoHomeScreen(pw); return runNoHomeScreen(pw); case "wait-for-broadcast-idle": return runWaitForBroadcastIdle(pw); default: default: return handleDefaultCommands(cmd); return handleDefaultCommands(cmd); } } Loading Loading @@ -2419,6 +2421,11 @@ final class ActivityManagerShellCommand extends ShellCommand { return 0; return 0; } } int runWaitForBroadcastIdle(PrintWriter pw) throws RemoteException { mInternal.waitForBroadcastIdle(pw); return 0; } private Resources getResources(PrintWriter pw) throws RemoteException { private Resources getResources(PrintWriter pw) throws RemoteException { // system resources does not contain all the device configuration, construct it manually. // system resources does not contain all the device configuration, construct it manually. Configuration config = mInterface.getConfiguration(); Configuration config = mInterface.getConfiguration(); Loading services/core/java/com/android/server/am/BroadcastQueue.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -203,6 +203,11 @@ public final class BroadcastQueue { mDelayBehindServices = allowDelayBehindServices; mDelayBehindServices = allowDelayBehindServices; } } @Override public String toString() { return mQueueName; } public boolean isPendingBroadcastProcessLocked(int pid) { public boolean isPendingBroadcastProcessLocked(int pid) { return mPendingBroadcast != null && mPendingBroadcast.curApp.pid == pid; return mPendingBroadcast != null && mPendingBroadcast.curApp.pid == pid; } } Loading Loading @@ -1571,6 +1576,11 @@ public final class BroadcastQueue { record.intent == null ? "" : record.intent.getAction()); record.intent == null ? "" : record.intent.getAction()); } } final boolean isIdle() { return mParallelBroadcasts.isEmpty() && mOrderedBroadcasts.isEmpty() && (mPendingBroadcast == null); } final boolean dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, final boolean dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage, boolean needSep) { int opti, boolean dumpAll, String dumpPackage, boolean needSep) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Loading Loading
cmds/pm/src/com/android/commands/pm/Pm.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -1441,10 +1441,10 @@ public final class Pm { System.err.println("Error: no size specified"); System.err.println("Error: no size specified"); return showUsage(); return showUsage(); } } int len = size.length(); long multiplier = 1; long multiplier = 1; if (len > 1) { int len = size.length(); char c = size.charAt(len - 1); char c = size.charAt(len - 1); if (c < '0' || c > '9') { if (c == 'K' || c == 'k') { if (c == 'K' || c == 'k') { multiplier = 1024L; multiplier = 1024L; } else if (c == 'M' || c == 'm') { } else if (c == 'M' || c == 'm') { Loading
core/java/android/app/usage/ExternalStorageStats.java +25 −6 Original line number Original line Diff line number Diff line Loading @@ -37,30 +37,46 @@ public final class ExternalStorageStats implements Parcelable { /** /** * Return the total bytes used by all files in the shared/external storage * Return the total bytes used by all files in the shared/external storage * hosted on this volume. * hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. Any OBB data shared between users is not accounted in * this value. */ */ public @BytesLong long getTotalBytes() { public @BytesLong long getTotalBytes() { return totalBytes; return totalBytes; } } /** /** * Return the total bytes used by audio files in the shared/external storage * Return the total bytes used by all audio files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getAudioBytes() { public @BytesLong long getAudioBytes() { return audioBytes; return audioBytes; } } /** /** * Return the total bytes used by video files in the shared/external storage * Return the total bytes used by all video files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getVideoBytes() { public @BytesLong long getVideoBytes() { return videoBytes; return videoBytes; } } /** /** * Return the total bytes used by image files in the shared/external storage * Return the total bytes used by all image files in the shared/external * hosted on this volume. * storage hosted on this volume. * <p> * This value only includes data which is isolated for each user on a * multiuser device. This value does not include any app files which are all * accounted under {@link #getAppBytes()}. */ */ public @BytesLong long getImageBytes() { public @BytesLong long getImageBytes() { return imageBytes; return imageBytes; Loading @@ -72,6 +88,9 @@ public final class ExternalStorageStats implements Parcelable { * <p> * <p> * This data is already accounted against individual apps as returned * This data is already accounted against individual apps as returned * through {@link StorageStats}. * through {@link StorageStats}. * <p> * This value only includes data which is isolated for each user on a * multiuser device. */ */ public @BytesLong long getAppBytes() { public @BytesLong long getAppBytes() { return appBytes; return appBytes; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +28 −0 Original line number Original line Diff line number Diff line Loading @@ -23850,6 +23850,34 @@ public class ActivityManagerService extends IActivityManager.Stub } } } } public void waitForBroadcastIdle(PrintWriter pw) { enforceCallingPermission(permission.DUMP, "waitForBroadcastIdle()"); while (true) { boolean idle = true; synchronized (this) { for (BroadcastQueue queue : mBroadcastQueues) { if (!queue.isIdle()) { final String msg = "Waiting for queue " + queue + " to become idle..."; pw.println(msg); pw.flush(); Slog.v(TAG, msg); idle = false; } } } if (idle) { final String msg = "All broadcast queues are idle!"; pw.println(msg); pw.flush(); Slog.v(TAG, msg); return; } else { SystemClock.sleep(1000); } } } /** /** * Return the user id of the last resumed activity. * Return the user id of the last resumed activity. */ */
services/core/java/com/android/server/am/ActivityManagerShellCommand.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -251,6 +251,8 @@ final class ActivityManagerShellCommand extends ShellCommand { return runUpdateApplicationInfo(pw); return runUpdateApplicationInfo(pw); case "no-home-screen": case "no-home-screen": return runNoHomeScreen(pw); return runNoHomeScreen(pw); case "wait-for-broadcast-idle": return runWaitForBroadcastIdle(pw); default: default: return handleDefaultCommands(cmd); return handleDefaultCommands(cmd); } } Loading Loading @@ -2419,6 +2421,11 @@ final class ActivityManagerShellCommand extends ShellCommand { return 0; return 0; } } int runWaitForBroadcastIdle(PrintWriter pw) throws RemoteException { mInternal.waitForBroadcastIdle(pw); return 0; } private Resources getResources(PrintWriter pw) throws RemoteException { private Resources getResources(PrintWriter pw) throws RemoteException { // system resources does not contain all the device configuration, construct it manually. // system resources does not contain all the device configuration, construct it manually. Configuration config = mInterface.getConfiguration(); Configuration config = mInterface.getConfiguration(); Loading
services/core/java/com/android/server/am/BroadcastQueue.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -203,6 +203,11 @@ public final class BroadcastQueue { mDelayBehindServices = allowDelayBehindServices; mDelayBehindServices = allowDelayBehindServices; } } @Override public String toString() { return mQueueName; } public boolean isPendingBroadcastProcessLocked(int pid) { public boolean isPendingBroadcastProcessLocked(int pid) { return mPendingBroadcast != null && mPendingBroadcast.curApp.pid == pid; return mPendingBroadcast != null && mPendingBroadcast.curApp.pid == pid; } } Loading Loading @@ -1571,6 +1576,11 @@ public final class BroadcastQueue { record.intent == null ? "" : record.intent.getAction()); record.intent == null ? "" : record.intent.getAction()); } } final boolean isIdle() { return mParallelBroadcasts.isEmpty() && mOrderedBroadcasts.isEmpty() && (mPendingBroadcast == null); } final boolean dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, final boolean dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage, boolean needSep) { int opti, boolean dumpAll, String dumpPackage, boolean needSep) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Loading