Merge "Do not crash webview if its group creation fails due to a dead process"

This commit is contained in:
Suren Baghdasaryan
2023-04-17 20:43:22 +00:00
committed by Gerrit Code Review

View File

@@ -105,6 +105,7 @@ import android.os.Trace;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.StorageManagerInternal; import android.os.storage.StorageManagerInternal;
import android.system.Os; import android.system.Os;
import android.system.OsConstants;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.ArraySet; import android.util.ArraySet;
@@ -2328,9 +2329,15 @@ public final class ProcessList {
if (!regularZygote) { if (!regularZygote) {
// webview and app zygote don't have the permission to create the nodes // webview and app zygote don't have the permission to create the nodes
if (Process.createProcessGroup(uid, startResult.pid) < 0) { final int res = Process.createProcessGroup(uid, startResult.pid);
throw new AssertionError("Unable to create process group for " + app.processName if (res < 0) {
+ " (" + startResult.pid + ")"); if (res == -OsConstants.ESRCH) {
Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
throw new AssertionError("Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} }
} }