am dc9cfca8: Merge "Prevent system uid component from running in an app process" into klp-dev

* commit 'dc9cfca80139714ca37122148d041beedbf0ceb2':
  Prevent system uid component from running in an app process
This commit is contained in:
Wale Ogunwale
2015-07-01 16:18:17 +00:00
committed by Android Git Automerger

View File

@ -2526,9 +2526,14 @@ public final class ActivityManagerService extends ActivityManagerNative
// should never happen).
SparseArray<ProcessRecord> procs = mProcessNames.getMap().get(processName);
if (procs == null) return null;
final int N = procs.size();
for (int i = 0; i < N; i++) {
if (UserHandle.isSameUser(procs.keyAt(i), uid)) return procs.valueAt(i);
final int procCount = procs.size();
for (int i = 0; i < procCount; i++) {
final int procUid = procs.keyAt(i);
if (UserHandle.isApp(procUid) || !UserHandle.isSameUser(procUid, uid)) {
// Don't use an app process or different user process for system component.
continue;
}
return procs.valueAt(i);
}
}
ProcessRecord proc = mProcessNames.get(processName, uid);