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

Commit 337a29bf authored by Mohammed Rashidy's avatar Mohammed Rashidy
Browse files

Starting sandbox activity should not start a new sandbox process

The sandbox activity is designed to be hosted in a running sandbox
process with a runtime loaded SDK ready to to populate views into it.

If for some reason, the sandbox process is killed while the activity is
being created, default behaviour of the system is to create a new
sandbox process, that would create a process lacking some important
information which cause exceptions, which might cause system crash.

This change avoids creating new sandbox process if the required
information is missing, and it aborts launching the sandbox activity if
there was no sandbox process to host it.

Test: manually by killing the sandbox process while launcing the sandbox
activity
Bug: 278086359

Change-Id: Ibab83a00cdc744e1ff7286de0868f57612e5c5c0
parent f636d7c5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3091,6 +3091,10 @@ public final class ProcessList {
        if (isSdkSandbox) {
            uid = sdkSandboxUid;
        }
        if (Process.isSdkSandboxUid(uid) && (!isSdkSandbox || sdkSandboxClientAppPackage == null)) {
            Slog.e(TAG, "Abort creating new sandbox process as required parameters are missing.");
            return null;
        }
        if (isolated) {
            if (isolatedUid == 0) {
                IsolatedUidRange uidRange = getOrCreateIsolatedUidRangeLocked(info, hostingRecord);
+6 −0
Original line number Diff line number Diff line
@@ -1074,6 +1074,12 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            // Remove the process record so it won't be considered as alive.
            mService.mProcessNames.remove(wpc.mName, wpc.mUid);
            mService.mProcessMap.remove(wpc.getPid());
        } else if (r.intent.isSandboxActivity(mService.mContext)) {
            Slog.e(TAG, "Abort sandbox activity launching as no sandbox process to host it.");
            r.finishIfPossible("No sandbox process for the activity", false /* oomAdj */);
            r.launchFailed = true;
            r.detachFromProcess();
            return;
        }

        r.notifyUnknownVisibilityLaunchedForKeyguardTransition();