Loading core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -6152,7 +6152,7 @@ public final class ActivityThread extends ClientTransactionHandler { try { synchronized (getGetProviderLock(auth, userId)) { holder = ActivityManager.getService().getContentProvider( getApplicationThread(), auth, userId, stable); getApplicationThread(), c.getOpPackageName(), auth, userId, stable); } } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); Loading core/java/android/app/IActivityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ interface IActivityManager { int ignoreWindowingMode); void moveTaskToFront(int task, int flags, in Bundle options); int getTaskForActivity(in IBinder token, in boolean onlyRoot); ContentProviderHolder getContentProvider(in IApplicationThread caller, ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage, in String name, int userId, boolean stable); void publishContentProviders(in IApplicationThread caller, in List<ContentProviderHolder> providers); Loading core/java/com/android/internal/app/procstats/AssociationState.java +34 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.app.procstats; import android.annotation.Nullable; import android.os.Parcel; import android.os.SystemClock; import android.os.UserHandle; Loading Loading @@ -192,9 +193,16 @@ public final class AssociationState { */ String mProcess; SourceKey(int uid, String process) { /** * Optional package name, or null; consider this final. Not final just to avoid a * temporary object during lookup. */ @Nullable String mPackage; SourceKey(int uid, String process, String pkg) { mUid = uid; mProcess = process; mPackage = pkg; } public boolean equals(Object o) { Loading @@ -202,12 +210,14 @@ public final class AssociationState { return false; } SourceKey s = (SourceKey) o; return s.mUid == mUid && Objects.equals(s.mProcess, mProcess); return s.mUid == mUid && Objects.equals(s.mProcess, mProcess) && Objects.equals(s.mPackage, mPackage); } @Override public int hashCode() { return Integer.hashCode(mUid) ^ (mProcess == null ? 0 : mProcess.hashCode()); return Integer.hashCode(mUid) ^ (mProcess == null ? 0 : mProcess.hashCode()) ^ (mPackage == null ? 0 : (mPackage.hashCode() * 33)); } @Override Loading @@ -217,6 +227,8 @@ public final class AssociationState { UserHandle.formatUid(sb, mUid); sb.append(' '); sb.append(mProcess); sb.append(' '); sb.append(mPackage); sb.append('}'); return sb.toString(); } Loading @@ -227,7 +239,7 @@ public final class AssociationState { */ private final ArrayMap<SourceKey, SourceState> mSources = new ArrayMap<>(); private final SourceKey mTmpSourceKey = new SourceKey(0, null); private final SourceKey mTmpSourceKey = new SourceKey(0, null, null); private ProcessState mProc; Loading Loading @@ -266,12 +278,13 @@ public final class AssociationState { mProc = proc; } public SourceState startSource(int uid, String processName) { public SourceState startSource(int uid, String processName, String packageName) { mTmpSourceKey.mUid = uid; mTmpSourceKey.mProcess = processName; mTmpSourceKey.mPackage = packageName; SourceState src = mSources.get(mTmpSourceKey); if (src == null) { SourceKey key = new SourceKey(uid, processName); SourceKey key = new SourceKey(uid, processName, packageName); src = new SourceState(key); mSources.put(key, src); } Loading Loading @@ -379,6 +392,7 @@ public final class AssociationState { final SourceState src = mSources.valueAt(isrc); out.writeInt(key.mUid); stats.writeCommonString(out, key.mProcess); stats.writeCommonString(out, key.mPackage); out.writeInt(src.mCount); out.writeLong(src.mDuration); out.writeInt(src.mActiveCount); Loading @@ -405,7 +419,8 @@ public final class AssociationState { for (int isrc = 0; isrc < NSRC; isrc++) { final int uid = in.readInt(); final String procName = stats.readCommonString(in, parcelVersion); final SourceKey key = new SourceKey(uid, procName); final String pkgName = stats.readCommonString(in, parcelVersion); final SourceKey key = new SourceKey(uid, procName, pkgName); final SourceState src = new SourceState(key); src.mCount = in.readInt(); src.mDuration = in.readLong(); Loading Loading @@ -445,10 +460,11 @@ public final class AssociationState { } } public boolean hasProcess(String procName) { public boolean hasProcessOrPackage(String procName) { final int NSRC = mSources.size(); for (int isrc = 0; isrc < NSRC; isrc++) { if (mSources.keyAt(isrc).mProcess.equals(procName)) { final SourceKey key = mSources.keyAt(isrc); if (procName.equals(key.mProcess) || procName.equals(key.mPackage)) { return true; } } Loading @@ -466,7 +482,8 @@ public final class AssociationState { for (int isrc = 0; isrc < NSRC; isrc++) { final SourceKey key = mSources.keyAt(isrc); final SourceState src = mSources.valueAt(isrc); if (reqPackage != null && !reqPackage.equals(key.mProcess)) { if (reqPackage != null && !reqPackage.equals(key.mProcess) && !reqPackage.equals(key.mPackage)) { continue; } pw.print(prefixInner); Loading @@ -474,6 +491,11 @@ public final class AssociationState { pw.print(key.mProcess); pw.print("/"); UserHandle.formatUid(pw, key.mUid); if (key.mPackage != null) { pw.print(" ("); pw.print(key.mPackage); pw.print(")"); } pw.println(":"); pw.print(prefixInner); pw.print(" Total count "); Loading Loading @@ -683,6 +705,7 @@ public final class AssociationState { final SourceState src = mSources.valueAt(isrc); final long sourceToken = proto.start(PackageAssociationProcessStatsProto.SOURCES); proto.write(PackageAssociationSourceProcessStatsProto.PROCESS_NAME, key.mProcess); proto.write(PackageAssociationSourceProcessStatsProto.PACKAGE_NAME, key.mPackage); proto.write(PackageAssociationSourceProcessStatsProto.PROCESS_UID, key.mUid); proto.write(PackageAssociationSourceProcessStatsProto.TOTAL_COUNT, src.mCount); long duration = src.mDuration; Loading core/java/com/android/internal/app/procstats/ProcessStats.java +3 −3 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public final class ProcessStats implements Parcelable { {"proc", "pkg-proc", "pkg-svc", "pkg-asc", "pkg-all", "all"}; // Current version of the parcel format. private static final int PARCEL_VERSION = 34; private static final int PARCEL_VERSION = 35; // In-memory Parcel magic number, used to detect attempts to unmarshall bad data private static final int MAGIC = 0x50535454; Loading Loading @@ -1490,7 +1490,7 @@ public final class ProcessStats implements Parcelable { // package, so that if so we print those. for (int iasc = 0; iasc < NASCS; iasc++) { AssociationState asc = pkgState.mAssociations.valueAt(iasc); if (asc.hasProcess(reqPackage)) { if (asc.hasProcessOrPackage(reqPackage)) { onlyAssociations = true; break; } Loading Loading @@ -1591,7 +1591,7 @@ public final class ProcessStats implements Parcelable { for (int iasc = 0; iasc < NASCS; iasc++) { AssociationState asc = pkgState.mAssociations.valueAt(iasc); if (!pkgMatch && !reqPackage.equals(asc.getProcessName())) { if (!onlyAssociations || !asc.hasProcess(reqPackage)) { if (!onlyAssociations || !asc.hasProcessOrPackage(reqPackage)) { continue; } } Loading core/proto/android/service/procstats.proto +3 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ message PackageServiceStatsProto { repeated PackageServiceOperationStatsProto operation_stats = 2; } // Next Tag: 7 // Next Tag: 8 message PackageAssociationSourceProcessStatsProto { option (android.msg_privacy).dest = DEST_AUTOMATIC; Loading @@ -194,6 +194,8 @@ message PackageAssociationSourceProcessStatsProto { optional int32 process_uid = 1; // Process name. optional string process_name = 2; // Package name. optional string package_name = 7; // Total count of the times this association appeared. optional int32 total_count = 3; Loading Loading
core/java/android/app/ActivityThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -6152,7 +6152,7 @@ public final class ActivityThread extends ClientTransactionHandler { try { synchronized (getGetProviderLock(auth, userId)) { holder = ActivityManager.getService().getContentProvider( getApplicationThread(), auth, userId, stable); getApplicationThread(), c.getOpPackageName(), auth, userId, stable); } } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); Loading
core/java/android/app/IActivityManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ interface IActivityManager { int ignoreWindowingMode); void moveTaskToFront(int task, int flags, in Bundle options); int getTaskForActivity(in IBinder token, in boolean onlyRoot); ContentProviderHolder getContentProvider(in IApplicationThread caller, ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage, in String name, int userId, boolean stable); void publishContentProviders(in IApplicationThread caller, in List<ContentProviderHolder> providers); Loading
core/java/com/android/internal/app/procstats/AssociationState.java +34 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.app.procstats; import android.annotation.Nullable; import android.os.Parcel; import android.os.SystemClock; import android.os.UserHandle; Loading Loading @@ -192,9 +193,16 @@ public final class AssociationState { */ String mProcess; SourceKey(int uid, String process) { /** * Optional package name, or null; consider this final. Not final just to avoid a * temporary object during lookup. */ @Nullable String mPackage; SourceKey(int uid, String process, String pkg) { mUid = uid; mProcess = process; mPackage = pkg; } public boolean equals(Object o) { Loading @@ -202,12 +210,14 @@ public final class AssociationState { return false; } SourceKey s = (SourceKey) o; return s.mUid == mUid && Objects.equals(s.mProcess, mProcess); return s.mUid == mUid && Objects.equals(s.mProcess, mProcess) && Objects.equals(s.mPackage, mPackage); } @Override public int hashCode() { return Integer.hashCode(mUid) ^ (mProcess == null ? 0 : mProcess.hashCode()); return Integer.hashCode(mUid) ^ (mProcess == null ? 0 : mProcess.hashCode()) ^ (mPackage == null ? 0 : (mPackage.hashCode() * 33)); } @Override Loading @@ -217,6 +227,8 @@ public final class AssociationState { UserHandle.formatUid(sb, mUid); sb.append(' '); sb.append(mProcess); sb.append(' '); sb.append(mPackage); sb.append('}'); return sb.toString(); } Loading @@ -227,7 +239,7 @@ public final class AssociationState { */ private final ArrayMap<SourceKey, SourceState> mSources = new ArrayMap<>(); private final SourceKey mTmpSourceKey = new SourceKey(0, null); private final SourceKey mTmpSourceKey = new SourceKey(0, null, null); private ProcessState mProc; Loading Loading @@ -266,12 +278,13 @@ public final class AssociationState { mProc = proc; } public SourceState startSource(int uid, String processName) { public SourceState startSource(int uid, String processName, String packageName) { mTmpSourceKey.mUid = uid; mTmpSourceKey.mProcess = processName; mTmpSourceKey.mPackage = packageName; SourceState src = mSources.get(mTmpSourceKey); if (src == null) { SourceKey key = new SourceKey(uid, processName); SourceKey key = new SourceKey(uid, processName, packageName); src = new SourceState(key); mSources.put(key, src); } Loading Loading @@ -379,6 +392,7 @@ public final class AssociationState { final SourceState src = mSources.valueAt(isrc); out.writeInt(key.mUid); stats.writeCommonString(out, key.mProcess); stats.writeCommonString(out, key.mPackage); out.writeInt(src.mCount); out.writeLong(src.mDuration); out.writeInt(src.mActiveCount); Loading @@ -405,7 +419,8 @@ public final class AssociationState { for (int isrc = 0; isrc < NSRC; isrc++) { final int uid = in.readInt(); final String procName = stats.readCommonString(in, parcelVersion); final SourceKey key = new SourceKey(uid, procName); final String pkgName = stats.readCommonString(in, parcelVersion); final SourceKey key = new SourceKey(uid, procName, pkgName); final SourceState src = new SourceState(key); src.mCount = in.readInt(); src.mDuration = in.readLong(); Loading Loading @@ -445,10 +460,11 @@ public final class AssociationState { } } public boolean hasProcess(String procName) { public boolean hasProcessOrPackage(String procName) { final int NSRC = mSources.size(); for (int isrc = 0; isrc < NSRC; isrc++) { if (mSources.keyAt(isrc).mProcess.equals(procName)) { final SourceKey key = mSources.keyAt(isrc); if (procName.equals(key.mProcess) || procName.equals(key.mPackage)) { return true; } } Loading @@ -466,7 +482,8 @@ public final class AssociationState { for (int isrc = 0; isrc < NSRC; isrc++) { final SourceKey key = mSources.keyAt(isrc); final SourceState src = mSources.valueAt(isrc); if (reqPackage != null && !reqPackage.equals(key.mProcess)) { if (reqPackage != null && !reqPackage.equals(key.mProcess) && !reqPackage.equals(key.mPackage)) { continue; } pw.print(prefixInner); Loading @@ -474,6 +491,11 @@ public final class AssociationState { pw.print(key.mProcess); pw.print("/"); UserHandle.formatUid(pw, key.mUid); if (key.mPackage != null) { pw.print(" ("); pw.print(key.mPackage); pw.print(")"); } pw.println(":"); pw.print(prefixInner); pw.print(" Total count "); Loading Loading @@ -683,6 +705,7 @@ public final class AssociationState { final SourceState src = mSources.valueAt(isrc); final long sourceToken = proto.start(PackageAssociationProcessStatsProto.SOURCES); proto.write(PackageAssociationSourceProcessStatsProto.PROCESS_NAME, key.mProcess); proto.write(PackageAssociationSourceProcessStatsProto.PACKAGE_NAME, key.mPackage); proto.write(PackageAssociationSourceProcessStatsProto.PROCESS_UID, key.mUid); proto.write(PackageAssociationSourceProcessStatsProto.TOTAL_COUNT, src.mCount); long duration = src.mDuration; Loading
core/java/com/android/internal/app/procstats/ProcessStats.java +3 −3 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public final class ProcessStats implements Parcelable { {"proc", "pkg-proc", "pkg-svc", "pkg-asc", "pkg-all", "all"}; // Current version of the parcel format. private static final int PARCEL_VERSION = 34; private static final int PARCEL_VERSION = 35; // In-memory Parcel magic number, used to detect attempts to unmarshall bad data private static final int MAGIC = 0x50535454; Loading Loading @@ -1490,7 +1490,7 @@ public final class ProcessStats implements Parcelable { // package, so that if so we print those. for (int iasc = 0; iasc < NASCS; iasc++) { AssociationState asc = pkgState.mAssociations.valueAt(iasc); if (asc.hasProcess(reqPackage)) { if (asc.hasProcessOrPackage(reqPackage)) { onlyAssociations = true; break; } Loading Loading @@ -1591,7 +1591,7 @@ public final class ProcessStats implements Parcelable { for (int iasc = 0; iasc < NASCS; iasc++) { AssociationState asc = pkgState.mAssociations.valueAt(iasc); if (!pkgMatch && !reqPackage.equals(asc.getProcessName())) { if (!onlyAssociations || !asc.hasProcess(reqPackage)) { if (!onlyAssociations || !asc.hasProcessOrPackage(reqPackage)) { continue; } } Loading
core/proto/android/service/procstats.proto +3 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ message PackageServiceStatsProto { repeated PackageServiceOperationStatsProto operation_stats = 2; } // Next Tag: 7 // Next Tag: 8 message PackageAssociationSourceProcessStatsProto { option (android.msg_privacy).dest = DEST_AUTOMATIC; Loading @@ -194,6 +194,8 @@ message PackageAssociationSourceProcessStatsProto { optional int32 process_uid = 1; // Process name. optional string process_name = 2; // Package name. optional string package_name = 7; // Total count of the times this association appeared. optional int32 total_count = 3; Loading