diff options
| author | 2023-05-09 16:28:27 +0000 | |
|---|---|---|
| committer | 2023-05-09 16:35:31 +0000 | |
| commit | 06d917ece11cd9fde698a083f5f50acbbb6faf1d (patch) | |
| tree | 2321aa299eeeb88b827ac34d6e2f15ab9bee0da6 | |
| parent | 07c181c7832880c0fbeb19ba54dfeaa20089d3c7 (diff) | |
Revert "Log the process hosting component types in ProcessMemory..."
This revert was created by Android Culprit Assistant. The culprit was identified in the following culprit search session (http://go/aca-get/5f01059b-51af-4073-b5d2-667ab4e4d6a3).
Bug: 10093767
Change-Id: I30e39f2eaaca0cd04d28cc030891cefb079f0404
8 files changed, 98 insertions, 142 deletions
diff --git a/core/java/android/app/ProcessMemoryState.java b/core/java/android/app/ProcessMemoryState.java index c4caa4512acc..2c58603ecdb9 100644 --- a/core/java/android/app/ProcessMemoryState.java +++ b/core/java/android/app/ProcessMemoryState.java @@ -16,7 +16,6 @@ package android.app; -import android.annotation.IntDef; import android.os.Parcel; import android.os.Parcelable; @@ -25,132 +24,19 @@ import android.os.Parcelable; * {@hide} */ public final class ProcessMemoryState implements Parcelable { - /** - * The type of the component this process is hosting; - * this means not hosting any components (cached). - */ - public static final int HOSTING_COMPONENT_TYPE_EMPTY = - AppProtoEnums.HOSTING_COMPONENT_TYPE_EMPTY; - - /** - * The type of the component this process is hosting; - * this means it's a system process. - */ - public static final int HOSTING_COMPONENT_TYPE_SYSTEM = - AppProtoEnums.HOSTING_COMPONENT_TYPE_SYSTEM; - - /** - * The type of the component this process is hosting; - * this means it's a persistent process. - */ - public static final int HOSTING_COMPONENT_TYPE_PERSISTENT = - AppProtoEnums.HOSTING_COMPONENT_TYPE_PERSISTENT; - - /** - * The type of the component this process is hosting; - * this means it's hosting a backup/restore agent. - */ - public static final int HOSTING_COMPONENT_TYPE_BACKUP = - AppProtoEnums.HOSTING_COMPONENT_TYPE_BACKUP; - - /** - * The type of the component this process is hosting; - * this means it's hosting an instrumentation. - */ - public static final int HOSTING_COMPONENT_TYPE_INSTRUMENTATION = - AppProtoEnums.HOSTING_COMPONENT_TYPE_INSTRUMENTATION; - - /** - * The type of the component this process is hosting; - * this means it's hosting an activity. - */ - public static final int HOSTING_COMPONENT_TYPE_ACTIVITY = - AppProtoEnums.HOSTING_COMPONENT_TYPE_ACTIVITY; - - /** - * The type of the component this process is hosting; - * this means it's hosting a broadcast receiver. - */ - public static final int HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER = - AppProtoEnums.HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER; - - /** - * The type of the component this process is hosting; - * this means it's hosting a content provider. - */ - public static final int HOSTING_COMPONENT_TYPE_PROVIDER = - AppProtoEnums.HOSTING_COMPONENT_TYPE_PROVIDER; - - /** - * The type of the component this process is hosting; - * this means it's hosting a started service. - */ - public static final int HOSTING_COMPONENT_TYPE_STARTED_SERVICE = - AppProtoEnums.HOSTING_COMPONENT_TYPE_STARTED_SERVICE; - - /** - * The type of the component this process is hosting; - * this means it's hosting a foreground service. - */ - public static final int HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE = - AppProtoEnums.HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE; - - /** - * The type of the component this process is hosting; - * this means it's being bound via a service binding. - */ - public static final int HOSTING_COMPONENT_TYPE_BOUND_SERVICE = - AppProtoEnums.HOSTING_COMPONENT_TYPE_BOUND_SERVICE; - - /** - * The type of the component this process is hosting. - * @hide - */ - @IntDef(flag = true, prefix = { "HOSTING_COMPONENT_TYPE_" }, value = { - HOSTING_COMPONENT_TYPE_EMPTY, - HOSTING_COMPONENT_TYPE_SYSTEM, - HOSTING_COMPONENT_TYPE_PERSISTENT, - HOSTING_COMPONENT_TYPE_BACKUP, - HOSTING_COMPONENT_TYPE_INSTRUMENTATION, - HOSTING_COMPONENT_TYPE_ACTIVITY, - HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER, - HOSTING_COMPONENT_TYPE_PROVIDER, - HOSTING_COMPONENT_TYPE_STARTED_SERVICE, - HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE, - HOSTING_COMPONENT_TYPE_BOUND_SERVICE, - }) - public @interface HostingComponentType {} - public final int uid; public final int pid; public final String processName; public final int oomScore; public final boolean hasForegroundServices; - /** - * The types of the components this process is hosting at the moment this snapshot is taken. - * - * Its value is the combination of {@link HostingComponentType}. - */ - public final int mHostingComponentTypes; - - /** - * The historical types of the components this process is or was hosting since it's born. - * - * Its value is the combination of {@link HostingComponentType}. - */ - public final int mHistoricalHostingComponentTypes; - public ProcessMemoryState(int uid, int pid, String processName, int oomScore, - boolean hasForegroundServices, int hostingComponentTypes, - int historicalHostingComponentTypes) { + boolean hasForegroundServices) { this.uid = uid; this.pid = pid; this.processName = processName; this.oomScore = oomScore; this.hasForegroundServices = hasForegroundServices; - this.mHostingComponentTypes = hostingComponentTypes; - this.mHistoricalHostingComponentTypes = historicalHostingComponentTypes; } private ProcessMemoryState(Parcel in) { @@ -159,8 +45,6 @@ public final class ProcessMemoryState implements Parcelable { processName = in.readString(); oomScore = in.readInt(); hasForegroundServices = in.readInt() == 1; - mHostingComponentTypes = in.readInt(); - mHistoricalHostingComponentTypes = in.readInt(); } public static final @android.annotation.NonNull Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() { @@ -187,7 +71,5 @@ public final class ProcessMemoryState implements Parcelable { parcel.writeString(processName); parcel.writeInt(oomScore); parcel.writeInt(hasForegroundServices ? 1 : 0); - parcel.writeInt(mHostingComponentTypes); - parcel.writeInt(mHistoricalHostingComponentTypes); } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 9514572e3b01..a4cd2780bec6 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -53,10 +53,6 @@ import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_SYSTEM_INIT; import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_UI_VISIBILITY; import static android.app.AppOpsManager.MODE_ALLOWED; import static android.app.AppOpsManager.OP_NONE; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BACKUP; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_INSTRUMENTATION; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_PERSISTENT; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_SYSTEM; import static android.content.pm.ApplicationInfo.HIDDEN_API_ENFORCEMENT_DEFAULT; import static android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES; import static android.content.pm.PackageManager.MATCH_ALL; @@ -162,6 +158,10 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.MemoryStatUtil.hasMemcg; import static com.android.server.am.ProcessList.ProcStartHandler; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_BACKUP; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_INSTRUMENTATION; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_PERSISTENT; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_SYSTEM; import static com.android.server.net.NetworkPolicyManagerInternal.updateBlockedReasonsWithProcState; import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import static com.android.server.pm.UserManagerInternal.USER_START_MODE_BACKGROUND; @@ -17696,9 +17696,7 @@ public class ActivityManagerService extends IActivityManager.Stub final ProcessRecord r = mPidsSelfLocked.valueAt(i); processMemoryStates.add(new ProcessMemoryState( r.uid, r.getPid(), r.processName, r.mState.getCurAdj(), - r.mServices.hasForegroundServices(), - r.mProfile.getCurrentHostingComponentTypes(), - r.mProfile.getHistoricalHostingComponentTypes())); + r.mServices.hasForegroundServices())); } } return processMemoryStates; diff --git a/services/core/java/com/android/server/am/ContentProviderHelper.java b/services/core/java/com/android/server/am/ContentProviderHelper.java index e744eee8b485..6015e5f02221 100644 --- a/services/core/java/com/android/server/am/ContentProviderHelper.java +++ b/services/core/java/com/android/server/am/ContentProviderHelper.java @@ -18,7 +18,6 @@ package com.android.server.am; import static android.Manifest.permission.GET_ANY_PROVIDER_TYPE; import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_GET_PROVIDER; import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_REMOVE_PROVIDER; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_PROVIDER; import static android.content.ContentProvider.isAuthorityRedirectedForCloneProfile; import static android.os.Process.PROC_CHAR; import static android.os.Process.PROC_OUT_LONG; @@ -35,6 +34,7 @@ import static com.android.internal.util.FrameworkStatsLog.PROVIDER_ACQUISITION_E import static com.android.internal.util.FrameworkStatsLog.PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU; import static com.android.server.am.ActivityManagerService.TAG_MU; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_PROVIDER; import android.annotation.Nullable; import android.annotation.UserIdInt; diff --git a/services/core/java/com/android/server/am/ProcessProfileRecord.java b/services/core/java/com/android/server/am/ProcessProfileRecord.java index 5ad49a47a012..4c15308a574e 100644 --- a/services/core/java/com/android/server/am/ProcessProfileRecord.java +++ b/services/core/java/com/android/server/am/ProcessProfileRecord.java @@ -17,10 +17,9 @@ package com.android.server.am; import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_EMPTY; +import android.annotation.IntDef; import android.app.IApplicationThread; -import android.app.ProcessMemoryState.HostingComponentType; import android.content.pm.ApplicationInfo; import android.os.Debug; import android.os.SystemClock; @@ -43,6 +42,88 @@ import java.util.concurrent.atomic.AtomicLong; * Profiling info of the process, such as PSS, cpu, etc. */ final class ProcessProfileRecord { + // Keep below types in sync with the HostingComponentType in the atoms.proto. + /** + * The type of the component this process is hosting; + * this means not hosting any components (cached). + */ + static final int HOSTING_COMPONENT_TYPE_EMPTY = 0x0; + + /** + * The type of the component this process is hosting; + * this means it's a system process. + */ + static final int HOSTING_COMPONENT_TYPE_SYSTEM = 0x00000001; + + /** + * The type of the component this process is hosting; + * this means it's a persistent process. + */ + static final int HOSTING_COMPONENT_TYPE_PERSISTENT = 0x00000002; + + /** + * The type of the component this process is hosting; + * this means it's hosting a backup/restore agent. + */ + static final int HOSTING_COMPONENT_TYPE_BACKUP = 0x00000004; + + /** + * The type of the component this process is hosting; + * this means it's hosting an instrumentation. + */ + static final int HOSTING_COMPONENT_TYPE_INSTRUMENTATION = 0x00000008; + + /** + * The type of the component this process is hosting; + * this means it's hosting an activity. + */ + static final int HOSTING_COMPONENT_TYPE_ACTIVITY = 0x00000010; + + /** + * The type of the component this process is hosting; + * this means it's hosting a broadcast receiver. + */ + static final int HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER = 0x00000020; + + /** + * The type of the component this process is hosting; + * this means it's hosting a content provider. + */ + static final int HOSTING_COMPONENT_TYPE_PROVIDER = 0x00000040; + + /** + * The type of the component this process is hosting; + * this means it's hosting a started service. + */ + static final int HOSTING_COMPONENT_TYPE_STARTED_SERVICE = 0x00000080; + + /** + * The type of the component this process is hosting; + * this means it's hosting a foreground service. + */ + static final int HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE = 0x00000100; + + /** + * The type of the component this process is hosting; + * this means it's being bound via a service binding. + */ + static final int HOSTING_COMPONENT_TYPE_BOUND_SERVICE = 0x00000200; + + @IntDef(flag = true, prefix = { "HOSTING_COMPONENT_TYPE_" }, value = { + HOSTING_COMPONENT_TYPE_EMPTY, + HOSTING_COMPONENT_TYPE_SYSTEM, + HOSTING_COMPONENT_TYPE_PERSISTENT, + HOSTING_COMPONENT_TYPE_BACKUP, + HOSTING_COMPONENT_TYPE_INSTRUMENTATION, + HOSTING_COMPONENT_TYPE_ACTIVITY, + HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER, + HOSTING_COMPONENT_TYPE_PROVIDER, + HOSTING_COMPONENT_TYPE_STARTED_SERVICE, + HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE, + HOSTING_COMPONENT_TYPE_BOUND_SERVICE, + }) + @interface HostingComponentType {} + final ProcessRecord mApp; private final ActivityManagerService mService; diff --git a/services/core/java/com/android/server/am/ProcessServiceRecord.java b/services/core/java/com/android/server/am/ProcessServiceRecord.java index 81d0b6ac700b..53fa4f1b2ac2 100644 --- a/services/core/java/com/android/server/am/ProcessServiceRecord.java +++ b/services/core/java/com/android/server/am/ProcessServiceRecord.java @@ -16,8 +16,8 @@ package com.android.server.am; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BOUND_SERVICE; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_BOUND_SERVICE; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE; import android.app.ActivityManager; import android.content.Context; diff --git a/services/core/java/com/android/server/am/ProcessStateRecord.java b/services/core/java/com/android/server/am/ProcessStateRecord.java index db341d253818..ab71acd5f21d 100644 --- a/services/core/java/com/android/server/am/ProcessStateRecord.java +++ b/services/core/java/com/android/server/am/ProcessStateRecord.java @@ -19,11 +19,11 @@ package com.android.server.am; import static android.app.ActivityManager.PROCESS_CAPABILITY_NONE; import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT; import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_UI_VISIBILITY; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_ACTIVITY; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_STARTED_SERVICE; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_ACTIVITY; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_STARTED_SERVICE; import static com.android.server.am.ProcessRecord.TAG; import android.annotation.ElapsedRealtimeLong; diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java index b22ece30c386..6551db9ad783 100644 --- a/services/core/java/com/android/server/am/ServiceRecord.java +++ b/services/core/java/com/android/server/am/ServiceRecord.java @@ -18,7 +18,6 @@ package com.android.server.am; import static android.app.PendingIntent.FLAG_IMMUTABLE; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; -import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BOUND_SERVICE; import static android.os.PowerExemptionManager.REASON_DENIED; import static android.os.Process.INVALID_UID; @@ -26,6 +25,7 @@ import static com.android.internal.util.Preconditions.checkArgument; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOREGROUND_SERVICE; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; +import static com.android.server.am.ProcessProfileRecord.HOSTING_COMPONENT_TYPE_BOUND_SERVICE; import android.annotation.NonNull; import android.annotation.Nullable; diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index e82521584731..6eded1a14dbf 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -18,7 +18,6 @@ package com.android.server.stats.pull; import static android.app.AppOpsManager.OP_FLAG_SELF; import static android.app.AppOpsManager.OP_FLAG_TRUSTED_PROXIED; -import static android.app.AppProtoEnums.HOSTING_COMPONENT_TYPE_EMPTY; import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED; import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS; import static android.hardware.display.HdrConversionMode.HDR_CONVERSION_PASSTHROUGH; @@ -2351,8 +2350,7 @@ public class StatsPullAtomService extends SystemService { snapshot.rssInKilobytes, snapshot.anonRssInKilobytes, snapshot.swapInKilobytes, snapshot.anonRssInKilobytes + snapshot.swapInKilobytes, gpuMemPerPid.get(managedProcess.pid), managedProcess.hasForegroundServices, - snapshot.rssShmemKilobytes, managedProcess.mHostingComponentTypes, - managedProcess.mHistoricalHostingComponentTypes)); + snapshot.rssShmemKilobytes)); } // Complement the data with native system processes. Given these measurements can be taken // in response to LMKs happening, we want to first collect the managed app stats (to @@ -2372,10 +2370,7 @@ public class StatsPullAtomService extends SystemService { snapshot.rssInKilobytes, snapshot.anonRssInKilobytes, snapshot.swapInKilobytes, snapshot.anonRssInKilobytes + snapshot.swapInKilobytes, gpuMemPerPid.get(pid), false /* has_foreground_services */, - snapshot.rssShmemKilobytes, - // Native processes don't really have a hosting component type. - HOSTING_COMPONENT_TYPE_EMPTY, - HOSTING_COMPONENT_TYPE_EMPTY)); + snapshot.rssShmemKilobytes)); } return StatsManager.PULL_SUCCESS; } |