Rename ServiceRecord.isolatedProc to isolationHostProc.

This member is used to keep track of a process that we have started for
hosting a service. For normal services, we don't need to keep track,
because we can identify the process that should host the service by
matching its uid with the uid off the service. This however is not true
for isolated processes (which have their own uid), and now it's also not
true for supplemental processes (which also run in their own UID range).
To make clear that this will no longer just be used for isolated processes,
rename to isolationHostProc.

Bug: 215012578
Test: N/A
Change-Id: Ida90829ae196bf1161892e3da822444c913885ba
This commit is contained in:
Martijn Coenen
2022-01-17 19:08:09 +01:00
committed by Nikita Ioffe
parent 9c9045241a
commit 174211109c
3 changed files with 15 additions and 14 deletions

View File

@@ -4138,7 +4138,7 @@ public final class ActiveServices {
// for a previous process to come up. To deal with this, we store
// in the service any current isolated process it is running in or
// waiting to have come up.
app = r.isolatedProc;
app = r.isolationHostProc;
if (WebViewZygote.isMultiprocessEnabled()
&& r.serviceInfo.packageName.equals(WebViewZygote.getPackageName())) {
hostingRecord = HostingRecord.byWebviewZygote(r.instanceName);
@@ -4165,7 +4165,7 @@ public final class ActiveServices {
return msg;
}
if (isolated) {
r.isolatedProc = app;
r.isolationHostProc = app;
}
}
@@ -4976,7 +4976,7 @@ public final class ActiveServices {
try {
for (int i=0; i<mPendingServices.size(); i++) {
sr = mPendingServices.get(i);
if (proc != sr.isolatedProc && (proc.uid != sr.appInfo.uid
if (proc != sr.isolationHostProc && (proc.uid != sr.appInfo.uid
|| !processName.equals(sr.processName))) {
continue;
}
@@ -5016,7 +5016,7 @@ public final class ActiveServices {
boolean didImmediateRestart = false;
for (int i=0; i<mRestartingServices.size(); i++) {
sr = mRestartingServices.get(i);
if (proc != sr.isolatedProc && (proc.uid != sr.appInfo.uid
if (proc != sr.isolationHostProc && (proc.uid != sr.appInfo.uid
|| !processName.equals(sr.processName))) {
continue;
}
@@ -5048,9 +5048,9 @@ public final class ActiveServices {
ServiceRecord sr = mPendingServices.get(i);
if ((proc.uid == sr.appInfo.uid
&& proc.processName.equals(sr.processName))
|| sr.isolatedProc == proc) {
|| sr.isolationHostProc == proc) {
Slog.w(TAG, "Forcing bringing down service: " + sr);
sr.isolatedProc = null;
sr.isolationHostProc = null;
mPendingServices.remove(i);
size = mPendingServices.size();
i--;
@@ -5083,7 +5083,7 @@ public final class ActiveServices {
stopServiceAndUpdateAllowlistManagerLocked(service);
}
service.setProcess(null, null, 0, null);
service.isolatedProc = null;
service.isolationHostProc = null;
if (mTmpCollectionResults == null) {
mTmpCollectionResults = new ArrayList<>();
}
@@ -5321,7 +5321,7 @@ public final class ActiveServices {
sr.app.mServices.updateBoundClientUids();
}
sr.setProcess(null, null, 0, null);
sr.isolatedProc = null;
sr.isolationHostProc = null;
sr.executeNesting = 0;
synchronized (mAm.mProcessStats.mLock) {
sr.forceClearTracker();

View File

@@ -598,7 +598,7 @@ public class OomAdjuster {
for (int i = psr.numberOfConnections() - 1; i >= 0; i--) {
ConnectionRecord cr = psr.getConnectionAt(i);
ProcessRecord service = (cr.flags & ServiceInfo.FLAG_ISOLATED_PROCESS) != 0
? cr.binding.service.isolatedProc : cr.binding.service.app;
? cr.binding.service.isolationHostProc : cr.binding.service.app;
if (service == null || service == pr) {
continue;
}

View File

@@ -102,7 +102,8 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
// IBinder -> ConnectionRecord of all bound clients
ProcessRecord app; // where this service is running or null.
ProcessRecord isolatedProc; // keep track of isolated process, if requested
ProcessRecord isolationHostProc; // process which we've started for this service (used for
// isolated and supplemental processes)
ServiceState tracker; // tracking service execution, may be null
ServiceState restartTracker; // tracking service restart
boolean allowlistManager; // any bindings to this service have BIND_ALLOW_WHITELIST_MANAGEMENT?
@@ -352,8 +353,8 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
if (app != null) {
app.dumpDebug(proto, ServiceRecordProto.APP);
}
if (isolatedProc != null) {
isolatedProc.dumpDebug(proto, ServiceRecordProto.ISOLATED_PROC);
if (isolationHostProc != null) {
isolationHostProc.dumpDebug(proto, ServiceRecordProto.ISOLATED_PROC);
}
proto.write(ServiceRecordProto.WHITELIST_MANAGER, allowlistManager);
proto.write(ServiceRecordProto.DELAYED, delayed);
@@ -455,8 +456,8 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
pw.print(prefix); pw.print("dataDir="); pw.println(appInfo.dataDir);
}
pw.print(prefix); pw.print("app="); pw.println(app);
if (isolatedProc != null) {
pw.print(prefix); pw.print("isolatedProc="); pw.println(isolatedProc);
if (isolationHostProc != null) {
pw.print(prefix); pw.print("isolationHostProc="); pw.println(isolationHostProc);
}
if (allowlistManager) {
pw.print(prefix); pw.print("allowlistManager="); pw.println(allowlistManager);