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

Commit 3951ad97 authored by Martijn Coenen's avatar Martijn Coenen Committed by Android Build Cherrypicker Worker
Browse files

Give WebViewZygote process shared app GID.

So WebViewZygote can access profiles belonging to the app.

Bug: 254422654
Flag: EXEMPT bugfix
Test: inspect /proc/pid/maps to verify profiles are loaded
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4e2db7cea643a55aa7d0b10659334c26bfc9a571)
Merged-In: I33ebb8c2f8115cd3f25099987dfb5dad38ed057c
Change-Id: I33ebb8c2f8115cd3f25099987dfb5dad38ed057c
parent 6caaf2f3
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Build;
import android.os.ChildZygoteProcess;
import android.os.ChildZygoteProcess;
import android.os.Process;
import android.os.Process;
import android.os.UserHandle;
import android.os.ZygoteProcess;
import android.os.ZygoteProcess;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Log;
@@ -141,12 +142,14 @@ public class WebViewZygote {
            String abi = sPackage.applicationInfo.primaryCpuAbi;
            String abi = sPackage.applicationInfo.primaryCpuAbi;
            int runtimeFlags = Zygote.getMemorySafetyRuntimeFlagsForSecondaryZygote(
            int runtimeFlags = Zygote.getMemorySafetyRuntimeFlagsForSecondaryZygote(
                    sPackage.applicationInfo, null);
                    sPackage.applicationInfo, null);
            final int[] sharedAppGid = {
                    UserHandle.getSharedAppGid(UserHandle.getAppId(sPackage.applicationInfo.uid)) };
            sZygote = Process.ZYGOTE_PROCESS.startChildZygote(
            sZygote = Process.ZYGOTE_PROCESS.startChildZygote(
                    "com.android.internal.os.WebViewZygoteInit",
                    "com.android.internal.os.WebViewZygoteInit",
                    "webview_zygote",
                    "webview_zygote",
                    Process.WEBVIEW_ZYGOTE_UID,
                    Process.WEBVIEW_ZYGOTE_UID,
                    Process.WEBVIEW_ZYGOTE_UID,
                    Process.WEBVIEW_ZYGOTE_UID,
                    null,  // gids
                    sharedAppGid,  // Access to shared app GID for ART profiles
                    runtimeFlags,
                    runtimeFlags,
                    "webview_zygote",  // seInfo
                    "webview_zygote",  // seInfo
                    abi,  // abi
                    abi,  // abi