updateAppUidRecLocked() needs to run for all ProcessRecord of a
UidRecord.
for example,
adb shell dumpsys activity -a | grep *APP* | grep quicksearchbox
*APP* UID 10148 ProcessRecord{a86bfc8 19343:com.google.android.googlequicksearchbox:search/u0a148}
*APP* UID 10148 ProcessRecord{8932590 20318:com.google.android.googlequicksearchbox:assistant/u0a148}
*APP* UID 10148 ProcessRecord{7458b77 19013:com.google.android.googlequicksearchbox:interactor/u0a148}
UID 10148 has three ProcessRecord.
After uidRec.reset(), for uidRec that has multiple processes(ProcessRecord),
We need apply all ProcessRecord into UidRecord, otherwise, the
UidRecord's proc state and capability are wrong.
Bug: 157269041, 152709842
Test: Use the reproduce step in b/152709842, squeeze phone and talk to
Assistant.
Change-Id: Id46dbd4f428968fb2029255fbcf61bba328b582c
This commit is contained in:
@@ -4914,8 +4914,13 @@ public final class ActiveServices {
|
||||
|
||||
// TODO: remove this toast after feature development is done
|
||||
void showWhileInUseDebugToastLocked(int uid, int op, int mode) {
|
||||
for (int i = mAm.mProcessList.mLruProcesses.size() - 1; i >= 0; i--) {
|
||||
ProcessRecord pr = mAm.mProcessList.mLruProcesses.get(i);
|
||||
final UidRecord uidRec = mAm.mProcessList.getUidRecordLocked(uid);
|
||||
if (uidRec == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = uidRec.procRecords.size() - 1; i >= 0; i--) {
|
||||
ProcessRecord pr = uidRec.procRecords.valueAt(i);
|
||||
if (pr.uid != uid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -324,8 +324,21 @@ public final class OomAdjuster {
|
||||
boolean success = applyOomAdjLocked(app, doingAll, now, SystemClock.elapsedRealtime());
|
||||
|
||||
if (uidRec != null) {
|
||||
updateAppUidRecLocked(app);
|
||||
// If this proc state is changed, need to update its uid record here
|
||||
// After uidRec.reset() above, for UidRecord that has multiple processes (ProcessRecord)
|
||||
// , We need to apply all ProcessRecord into UidRecord.
|
||||
final ArraySet<ProcessRecord> procRecords = app.uidRecord.procRecords;
|
||||
for (int i = procRecords.size() - 1; i >= 0; i--) {
|
||||
final ProcessRecord pr = procRecords.valueAt(i);
|
||||
if (!pr.killedByAm && pr.thread != null) {
|
||||
if (pr.isolated && pr.numberOfRunningServices() <= 0
|
||||
&& pr.isolatedEntryPoint == null) {
|
||||
// No op.
|
||||
} else {
|
||||
// Keeping this process, update its uid.
|
||||
updateAppUidRecLocked(pr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (uidRec.getCurProcState() != PROCESS_STATE_NONEXISTENT
|
||||
&& (uidRec.setProcState != uidRec.getCurProcState()
|
||||
|| uidRec.setCapability != uidRec.curCapability
|
||||
|
||||
@@ -2808,6 +2808,7 @@ public final class ProcessList {
|
||||
uidRec.curCapability);
|
||||
}
|
||||
proc.uidRecord = uidRec;
|
||||
uidRec.procRecords.add(proc);
|
||||
|
||||
// Reset render thread tid if it was already set, so new process can set it again.
|
||||
proc.renderThreadTid = 0;
|
||||
@@ -2901,6 +2902,7 @@ public final class ProcessList {
|
||||
}
|
||||
if (old != null && old.uidRecord != null) {
|
||||
old.uidRecord.numProcs--;
|
||||
old.uidRecord.procRecords.remove(old);
|
||||
if (old.uidRecord.numProcs == 0) {
|
||||
// No more processes using this uid, tell clients it is gone.
|
||||
if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS,
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.app.ActivityManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.util.ArraySet;
|
||||
import android.util.TimeUtils;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
import android.util.proto.ProtoUtils;
|
||||
@@ -44,6 +45,7 @@ public final class UidRecord {
|
||||
boolean idle;
|
||||
boolean setIdle;
|
||||
int numProcs;
|
||||
ArraySet<ProcessRecord> procRecords = new ArraySet<>();
|
||||
|
||||
/**
|
||||
* Sequence number associated with the {@link #mCurProcState}. This is incremented using
|
||||
|
||||
Reference in New Issue
Block a user