Loading core/java/com/android/internal/app/procstats/IProcessStats.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,15 @@ interface IProcessStats { */ long getCommittedStats(long highWaterMarkMs, int section, boolean doAggregate, out List<ParcelFileDescriptor> committedStats); /** * Get stats committed after highWaterMarkMs * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicate which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @param List of Files of individual commits in protobuf binary or one that is merged from them. * @param ProcessStats object that will be used to return the full set of merged stats. */ long getCommittedStatsMerged(long highWaterMarkMs, int section, boolean doAggregate, out List<ParcelFileDescriptor> committedStats, out ProcessStats mergedStats); } core/java/com/android/internal/app/procstats/ProcessStats.java +9 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,15 @@ public final class ProcessStats implements Parcelable { readFromParcel(in); } /** * No-arg constructor is for use in AIDL-derived stubs. * * <p>This defaults to the non-running state, so is equivalent to ProcessStats(false). */ public ProcessStats() { this(false); } public void add(ProcessStats other) { ArrayMap<String, SparseArray<LongSparseArray<PackageState>>> pkgMap = other.mPackages.getMap(); Loading services/core/java/com/android/server/am/ProcessStatsService.java +16 −2 Original line number Diff line number Diff line Loading @@ -539,15 +539,29 @@ public final class ProcessStatsService extends IProcessStats.Stub { * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicage which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @return List of proto binary of individual commit files or one that is merged from them. * @return List of proto binary of individual commit files or one that is merged from them */ @Override public long getCommittedStats(long highWaterMarkMs, int section, boolean doAggregate, List<ParcelFileDescriptor> committedStats) { return getCommittedStatsMerged(highWaterMarkMs, section, doAggregate, committedStats, new ProcessStats(false)); } /** * Get stats committed after highWaterMarkMs * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicage which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @return List of proto binary of individual commit files or one that is merged from them; * the merged, final ProcessStats object. */ @Override public long getCommittedStatsMerged(long highWaterMarkMs, int section, boolean doAggregate, List<ParcelFileDescriptor> committedStats, ProcessStats mergedStats) { mAm.mContext.enforceCallingOrSelfPermission( android.Manifest.permission.PACKAGE_USAGE_STATS, null); ProcessStats mergedStats = new ProcessStats(false); long newHighWaterMark = highWaterMarkMs; mWriteLock.lock(); try { Loading Loading
core/java/com/android/internal/app/procstats/IProcessStats.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,15 @@ interface IProcessStats { */ long getCommittedStats(long highWaterMarkMs, int section, boolean doAggregate, out List<ParcelFileDescriptor> committedStats); /** * Get stats committed after highWaterMarkMs * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicate which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @param List of Files of individual commits in protobuf binary or one that is merged from them. * @param ProcessStats object that will be used to return the full set of merged stats. */ long getCommittedStatsMerged(long highWaterMarkMs, int section, boolean doAggregate, out List<ParcelFileDescriptor> committedStats, out ProcessStats mergedStats); }
core/java/com/android/internal/app/procstats/ProcessStats.java +9 −0 Original line number Diff line number Diff line Loading @@ -266,6 +266,15 @@ public final class ProcessStats implements Parcelable { readFromParcel(in); } /** * No-arg constructor is for use in AIDL-derived stubs. * * <p>This defaults to the non-running state, so is equivalent to ProcessStats(false). */ public ProcessStats() { this(false); } public void add(ProcessStats other) { ArrayMap<String, SparseArray<LongSparseArray<PackageState>>> pkgMap = other.mPackages.getMap(); Loading
services/core/java/com/android/server/am/ProcessStatsService.java +16 −2 Original line number Diff line number Diff line Loading @@ -539,15 +539,29 @@ public final class ProcessStatsService extends IProcessStats.Stub { * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicage which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @return List of proto binary of individual commit files or one that is merged from them. * @return List of proto binary of individual commit files or one that is merged from them */ @Override public long getCommittedStats(long highWaterMarkMs, int section, boolean doAggregate, List<ParcelFileDescriptor> committedStats) { return getCommittedStatsMerged(highWaterMarkMs, section, doAggregate, committedStats, new ProcessStats(false)); } /** * Get stats committed after highWaterMarkMs * @param highWaterMarkMs Report stats committed after this time. * @param section Integer mask to indicage which sections to include in the stats. * @param doAggregate Whether to aggregate the stats or keep them separated. * @return List of proto binary of individual commit files or one that is merged from them; * the merged, final ProcessStats object. */ @Override public long getCommittedStatsMerged(long highWaterMarkMs, int section, boolean doAggregate, List<ParcelFileDescriptor> committedStats, ProcessStats mergedStats) { mAm.mContext.enforceCallingOrSelfPermission( android.Manifest.permission.PACKAGE_USAGE_STATS, null); ProcessStats mergedStats = new ProcessStats(false); long newHighWaterMark = highWaterMarkMs; mWriteLock.lock(); try { Loading