Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06d917ec authored by Android Culprit Assistant's avatar Android Culprit Assistant Committed by Taylor Nelms
Browse files

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
parent 07c181c7
Loading
Loading
Loading
Loading
+1 −119
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package android.app;
package android.app;


import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;


@@ -25,132 +24,19 @@ import android.os.Parcelable;
 * {@hide}
 * {@hide}
 */
 */
public final class ProcessMemoryState implements Parcelable {
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 uid;
    public final int pid;
    public final int pid;
    public final String processName;
    public final String processName;
    public final int oomScore;
    public final int oomScore;
    public final boolean hasForegroundServices;
    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,
    public ProcessMemoryState(int uid, int pid, String processName, int oomScore,
            boolean hasForegroundServices, int hostingComponentTypes,
            boolean hasForegroundServices) {
            int historicalHostingComponentTypes) {
        this.uid = uid;
        this.uid = uid;
        this.pid = pid;
        this.pid = pid;
        this.processName = processName;
        this.processName = processName;
        this.oomScore = oomScore;
        this.oomScore = oomScore;
        this.hasForegroundServices = hasForegroundServices;
        this.hasForegroundServices = hasForegroundServices;
        this.mHostingComponentTypes = hostingComponentTypes;
        this.mHistoricalHostingComponentTypes = historicalHostingComponentTypes;
    }
    }


    private ProcessMemoryState(Parcel in) {
    private ProcessMemoryState(Parcel in) {
@@ -159,8 +45,6 @@ public final class ProcessMemoryState implements Parcelable {
        processName = in.readString();
        processName = in.readString();
        oomScore = in.readInt();
        oomScore = in.readInt();
        hasForegroundServices = in.readInt() == 1;
        hasForegroundServices = in.readInt() == 1;
        mHostingComponentTypes = in.readInt();
        mHistoricalHostingComponentTypes = in.readInt();
    }
    }


    public static final @android.annotation.NonNull Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
    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.writeString(processName);
        parcel.writeInt(oomScore);
        parcel.writeInt(oomScore);
        parcel.writeInt(hasForegroundServices ? 1 : 0);
        parcel.writeInt(hasForegroundServices ? 1 : 0);
        parcel.writeInt(mHostingComponentTypes);
        parcel.writeInt(mHistoricalHostingComponentTypes);
    }
    }
}
}
+5 −7
Original line number Original line Diff line number Diff line
@@ -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.ActivityManagerInternal.OOM_ADJ_REASON_UI_VISIBILITY;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_NONE;
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.ApplicationInfo.HIDDEN_API_ENFORCEMENT_DEFAULT;
import static android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES;
import static android.content.pm.PackageManager.GET_SHARED_LIBRARY_FILES;
import static android.content.pm.PackageManager.MATCH_ALL;
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.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.MemoryStatUtil.hasMemcg;
import static com.android.server.am.MemoryStatUtil.hasMemcg;
import static com.android.server.am.ProcessList.ProcStartHandler;
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.net.NetworkPolicyManagerInternal.updateBlockedReasonsWithProcState;
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import static com.android.server.pm.UserManagerInternal.USER_START_MODE_BACKGROUND;
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);
                    final ProcessRecord r = mPidsSelfLocked.valueAt(i);
                    processMemoryStates.add(new ProcessMemoryState(
                    processMemoryStates.add(new ProcessMemoryState(
                            r.uid, r.getPid(), r.processName, r.mState.getCurAdj(),
                            r.uid, r.getPid(), r.processName, r.mState.getCurAdj(),
                            r.mServices.hasForegroundServices(),
                            r.mServices.hasForegroundServices()));
                            r.mProfile.getCurrentHostingComponentTypes(),
                            r.mProfile.getHistoricalHostingComponentTypes()));
                }
                }
            }
            }
            return processMemoryStates;
            return processMemoryStates;
+1 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.server.am;
import static android.Manifest.permission.GET_ANY_PROVIDER_TYPE;
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_GET_PROVIDER;
import static android.app.ActivityManagerInternal.OOM_ADJ_REASON_REMOVE_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.content.ContentProvider.isAuthorityRedirectedForCloneProfile;
import static android.os.Process.PROC_CHAR;
import static android.os.Process.PROC_CHAR;
import static android.os.Process.PROC_OUT_LONG;
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.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.ActivityManagerDebugConfig.DEBUG_MU;
import static com.android.server.am.ActivityManagerService.TAG_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.Nullable;
import android.annotation.UserIdInt;
import android.annotation.UserIdInt;
+83 −2
Original line number Original line Diff line number Diff line
@@ -17,10 +17,9 @@
package com.android.server.am;
package com.android.server.am;


import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
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.IApplicationThread;
import android.app.ProcessMemoryState.HostingComponentType;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.os.Debug;
import android.os.Debug;
import android.os.SystemClock;
import android.os.SystemClock;
@@ -43,6 +42,88 @@ import java.util.concurrent.atomic.AtomicLong;
 * Profiling info of the process, such as PSS, cpu, etc.
 * Profiling info of the process, such as PSS, cpu, etc.
 */
 */
final class ProcessProfileRecord {
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;
    final ProcessRecord mApp;


    private final ActivityManagerService mService;
    private final ActivityManagerService mService;
+2 −2
Original line number Original line Diff line number Diff line
@@ -16,8 +16,8 @@


package com.android.server.am;
package com.android.server.am;


import static android.app.ProcessMemoryState.HOSTING_COMPONENT_TYPE_BOUND_SERVICE;
import static com.android.server.am.ProcessProfileRecord.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_FOREGROUND_SERVICE;


import android.app.ActivityManager;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Context;
Loading