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

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

Merge "Add null checking for Log.wtf CrashInfo"

parents 7f0d5c6d b7c28f94
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -7745,11 +7745,15 @@ public class ActivityManagerService extends IActivityManager.Stub
     * @return true if the process should exit immediately (WTF is fatal)
     * @return true if the process should exit immediately (WTF is fatal)
     */
     */
    @Override
    @Override
    public boolean handleApplicationWtf(final IBinder app, final String tag, boolean system,
    public boolean handleApplicationWtf(@Nullable final IBinder app, @Nullable final String tag,
            final ApplicationErrorReport.ParcelableCrashInfo crashInfo, int immediateCallerPid) {
            boolean system, @NonNull final ApplicationErrorReport.ParcelableCrashInfo crashInfo,
            int immediateCallerPid) {
        final int callingUid = Binder.getCallingUid();
        final int callingUid = Binder.getCallingUid();
        final int callingPid = Binder.getCallingPid();
        final int callingPid = Binder.getCallingPid();
        // Internal callers in RuntimeInit should always generate a crashInfo.
        Preconditions.checkNotNull(crashInfo);
        // If this is coming from the system, we could very well have low-level
        // If this is coming from the system, we could very well have low-level
        // system locks held, so we want to do this all asynchronously.  And we
        // system locks held, so we want to do this all asynchronously.  And we
        // never want this to become fatal, so there is that too.
        // never want this to become fatal, so there is that too.
@@ -7782,14 +7786,15 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        }
    }
    }
    ProcessRecord handleApplicationWtfInner(int callingUid, int callingPid, IBinder app, String tag,
    ProcessRecord handleApplicationWtfInner(int callingUid, int callingPid, @Nullable IBinder app,
            final ApplicationErrorReport.CrashInfo crashInfo) {
            @Nullable String tag, @Nullable final ApplicationErrorReport.CrashInfo crashInfo) {
        final ProcessRecord r = findAppProcess(app, "WTF");
        final ProcessRecord r = findAppProcess(app, "WTF");
        final String processName = app == null ? "system_server"
        final String processName = app == null ? "system_server"
                : (r == null ? "unknown" : r.processName);
                : (r == null ? "unknown" : r.processName);
        EventLogTags.writeAmWtf(UserHandle.getUserId(callingUid), callingPid,
        EventLogTags.writeAmWtf(UserHandle.getUserId(callingUid), callingPid,
                processName, r == null ? -1 : r.info.flags, tag, crashInfo.exceptionMessage);
                processName, r == null ? -1 : r.info.flags, tag,
                crashInfo == null ? "unknown" : crashInfo.exceptionMessage);
        FrameworkStatsLog.write(FrameworkStatsLog.WTF_OCCURRED, callingUid, tag, processName,
        FrameworkStatsLog.write(FrameworkStatsLog.WTF_OCCURRED, callingUid, tag, processName,
                callingPid, (r != null) ? r.getProcessClassEnum() : 0);
                callingPid, (r != null) ? r.getProcessClassEnum() : 0);