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

Commit 4c522bde authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Deliver exceptions to sources of PALs."

parents f157b366 13997f50
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -374,13 +374,26 @@ public final class ActivityStackSupervisor implements DisplayListener {
        final ActivityRecord sourceRecord;
        final int startFlags;
        final ActivityStack stack;
        final ProcessRecord callerApp;

        PendingActivityLaunch(ActivityRecord _r, ActivityRecord _sourceRecord,
                int _startFlags, ActivityStack _stack) {
                int _startFlags, ActivityStack _stack, ProcessRecord _callerApp) {
            r = _r;
            sourceRecord = _sourceRecord;
            startFlags = _startFlags;
            stack = _stack;
            callerApp = _callerApp;
        }

        void sendErrorResult(String message) {
            try {
                if (callerApp.thread != null) {
                    callerApp.thread.scheduleCrash(message);
                }
            } catch (RemoteException e) {
                Slog.e(TAG, "Exception scheduling crash of failed "
                        + "activity launcher sourceRecord=" + sourceRecord, e);
            }
        }
    }

@@ -1678,8 +1691,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
                || stack.mResumedActivity.info.applicationInfo.uid != callingUid)) {
            if (!mService.checkAppSwitchAllowedLocked(callingPid, callingUid,
                    realCallingPid, realCallingUid, "Activity start")) {
                PendingActivityLaunch pal =
                        new PendingActivityLaunch(r, sourceRecord, startFlags, stack);
                PendingActivityLaunch pal =  new PendingActivityLaunch(r, 
                        sourceRecord, startFlags, stack, callerApp);
                mPendingActivityLaunches.add(pal);
                ActivityOptions.abort(options);
                return ActivityManager.START_SWITCHES_CANCELED;
@@ -2547,7 +2560,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
                startActivityUncheckedLocked(pal.r, pal.sourceRecord, null, null, pal.startFlags,
                        doResume && mPendingActivityLaunches.isEmpty(), null, null);
            } catch (Exception e) {
                Slog.w(TAG, "Exception during pending activity launch pal=" + pal, e);
                Slog.e(TAG, "Exception during pending activity launch pal=" + pal, e);
                pal.sendErrorResult(e.getMessage());
            }
        }
    }