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

Commit c1ac3581 authored by Louis Chang's avatar Louis Chang
Browse files

Ensure the calling identity is restored

To follow the security checker guideline, go/android-security-checker

Bug: 304519474
Test: wm presubmit
Change-Id: Id4aeeec7d9ff4d347c15f6f714ad1917c3513fd6
parent fe0619f8
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -707,7 +707,7 @@ class ActivityStarter {
                }
            }

            int res;
            int res = START_CANCELED;
            synchronized (mService.mGlobalLock) {
                final boolean globalConfigWillChange = mRequest.globalConfig != null
                        && mService.getGlobalConfiguration().diff(mRequest.globalConfig) != 0;
@@ -719,22 +719,20 @@ class ActivityStarter {
                        + "will change = %b", globalConfigWillChange);

                final long origId = Binder.clearCallingIdentity();

                try {
                    res = resolveToHeavyWeightSwitcherIfNeeded();
                    if (res != START_SUCCESS) {
                        return res;
                    }

                try {
                    res = executeRequest(mRequest);
                } finally {
                    Binder.restoreCallingIdentity(origId);
                    mRequest.logMessage.append(" result code=").append(res);
                    Slog.i(TAG, mRequest.logMessage.toString());
                    mRequest.logMessage.setLength(0);
                }

                Binder.restoreCallingIdentity(origId);

                if (globalConfigWillChange) {
                    // If the caller also wants to switch to a new configuration, do so now.
                    // This allows a clean switch, as we are waiting for the current activity