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

Commit fd21b518 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Report crash source(sys app, user app, sys serve) in AppCrashOccurred atom."

parents b8054120 732d638b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1594,6 +1594,8 @@ message AppCrashOccurred {
        FOREGROUND = 2;
    }
    optional ForegroundState foreground_state = 7;

    optional android.server.ErrorSource error_source = 8;
}

/**
@@ -1612,6 +1614,8 @@ message WTFOccurred {

    // The pid if available. -1 means not available.
    optional sint32 pid = 4;

    optional android.server.ErrorSource error_source = 5;
}

/**
@@ -1649,6 +1653,10 @@ message ANROccurred {
        FOREGROUND = 2;
    }
    optional ForegroundState foreground_state = 6;

    optional android.server.ErrorSource error_source = 7;

    optional string package_name = 8;
}

/**
+10 −0
Original line number Diff line number Diff line
@@ -28,3 +28,13 @@ enum DeviceIdleModeEnum {
    // Device idle mode - active in full mode.
    DEVICE_IDLE_MODE_DEEP = 2;
}

enum ErrorSource {
    ERROR_SOURCE_UNKNOWN = 0;
    // Data app
    DATA_APP = 1;
    // System app
    SYSTEM_APP = 2;
    // System server.
    SYSTEM_SERVER = 3;
}
+3 −2
Original line number Diff line number Diff line
@@ -8568,7 +8568,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                r != null ? (r.isInterestingToUserLocked()
                        ? StatsLog.APP_CRASH_OCCURRED__FOREGROUND_STATE__FOREGROUND
                        : StatsLog.APP_CRASH_OCCURRED__FOREGROUND_STATE__BACKGROUND)
                        : StatsLog.APP_CRASH_OCCURRED__FOREGROUND_STATE__UNKNOWN
                        : StatsLog.APP_CRASH_OCCURRED__FOREGROUND_STATE__UNKNOWN,
                (r != null) ? r.getProcessClassEnum() : 0
        );
        final int relaunchReason = r == null ? RELAUNCH_REASON_NONE
@@ -8751,7 +8752,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                processName, r == null ? -1 : r.info.flags, tag, crashInfo.exceptionMessage);
        StatsLog.write(StatsLog.WTF_OCCURRED, callingUid, tag, processName,
                callingPid);
                callingPid, (r != null) ? r.getProcessClassEnum() : 0);
        addErrorToDropBox("wtf", r, processName, null, null, null, tag, null, null, crashInfo);
+15 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.server.ServerProtoEnums;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.DebugUtils;
@@ -1224,6 +1225,17 @@ final class ProcessRecord implements WindowProcessListener {
        return mWindowProcessController.getInputDispatchingTimeout();
    }

    public int getProcessClassEnum() {
        if (pid == MY_PID) {
            return ServerProtoEnums.SYSTEM_SERVER;
        }
        if (info == null) {
            return ServerProtoEnums.ERROR_SOURCE_UNKNOWN;
        }
        return (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? ServerProtoEnums.SYSTEM_APP :
            ServerProtoEnums.DATA_APP;
    }

    void appNotResponding(String activityShortComponentName, ApplicationInfo aInfo,
            String parentShortComponentName, WindowProcessController parentProcess,
            boolean aboveSystem, String annotation) {
@@ -1380,7 +1392,9 @@ final class ProcessRecord implements WindowProcessListener {
                        : StatsLog.ANROCCURRED__IS_INSTANT_APP__UNAVAILABLE,
                isInterestingToUserLocked()
                        ? StatsLog.ANROCCURRED__FOREGROUND_STATE__FOREGROUND
                        : StatsLog.ANROCCURRED__FOREGROUND_STATE__BACKGROUND);
                        : StatsLog.ANROCCURRED__FOREGROUND_STATE__BACKGROUND,
                getProcessClassEnum(),
                (this.info != null) ? this.info.packageName : "");
        final ProcessRecord parentPr = parentProcess != null
                ? (ProcessRecord) parentProcess.mOwner : null;
        mService.addErrorToDropBox("anr", this, processName, activityShortComponentName,