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

Commit cd616a65 authored by Li Li's avatar Li Li Committed by Android (Google) Code Review
Browse files

Merge "Fix process group of webview zygote" into sc-dev

parents 026edc0d da9ad351
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -2377,6 +2377,7 @@ public final class ProcessList {
            }
            }


            final Process.ProcessStartResult startResult;
            final Process.ProcessStartResult startResult;
            boolean regularZygote = false;
            if (hostingRecord.usesWebviewZygote()) {
            if (hostingRecord.usesWebviewZygote()) {
                startResult = startWebView(entryPoint,
                startResult = startWebView(entryPoint,
                        app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                        app.processName, uid, uid, gids, runtimeFlags, mountExternal,
@@ -2396,12 +2397,8 @@ public final class ProcessList {
                        app.getDisabledCompatChanges(), pkgDataInfoMap, allowlistedAppDataInfoMap,
                        app.getDisabledCompatChanges(), pkgDataInfoMap, allowlistedAppDataInfoMap,
                        false, false,
                        false, false,
                        new String[]{PROC_START_SEQ_IDENT + app.getStartSeq()});
                        new String[]{PROC_START_SEQ_IDENT + app.getStartSeq()});

                if (Process.createProcessGroup(uid, startResult.pid) < 0) {
                    Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
                            + app.processName + " (" + startResult.pid + ")");
                }
            } else {
            } else {
                regularZygote = true;
                startResult = Process.start(entryPoint,
                startResult = Process.start(entryPoint,
                        app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                        app.processName, uid, uid, gids, runtimeFlags, mountExternal,
                        app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
                        app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
@@ -2410,6 +2407,15 @@ public final class ProcessList {
                        allowlistedAppDataInfoMap, bindMountAppsData, bindMountAppStorageDirs,
                        allowlistedAppDataInfoMap, bindMountAppsData, bindMountAppStorageDirs,
                        new String[]{PROC_START_SEQ_IDENT + app.getStartSeq()});
                        new String[]{PROC_START_SEQ_IDENT + app.getStartSeq()});
            }
            }

            if (!regularZygote) {
                // webview and app zygote don't have the permission to create the nodes
                if (Process.createProcessGroup(uid, startResult.pid) < 0) {
                    Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
                            + app.processName + " (" + startResult.pid + ")");
                }
            }

            // This runs after Process.start() as this method may block app process starting time
            // This runs after Process.start() as this method may block app process starting time
            // if dir is not cached. Running this method after Process.start() can make it
            // if dir is not cached. Running this method after Process.start() can make it
            // cache the dir asynchronously, so zygote can use it without waiting for it.
            // cache the dir asynchronously, so zygote can use it without waiting for it.