Merge "[Bugfix] Don't delete mPendingUids if PendingTopPid is added later than updateOomAdj started" am: 8f321a616b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2036403 Change-Id: Ie24ddda890ce027bfaf5984263802756bb838eef
This commit is contained in:
@@ -586,8 +586,9 @@ public abstract class ActivityManagerInternal {
|
||||
/**
|
||||
* Delete uid from the ActivityManagerService PendingStartActivityUids list.
|
||||
* @param uid uid
|
||||
* @param nowElapsed starting time of updateOomAdj
|
||||
*/
|
||||
public abstract void deletePendingTopUid(int uid);
|
||||
public abstract void deletePendingTopUid(int uid, long nowElapsed);
|
||||
|
||||
/**
|
||||
* Is the uid in ActivityManagerService PendingStartActivityUids list?
|
||||
|
||||
@@ -16306,8 +16306,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePendingTopUid(int uid) {
|
||||
mPendingStartActivityUids.delete(uid);
|
||||
public void deletePendingTopUid(int uid, long nowElapsed) {
|
||||
mPendingStartActivityUids.delete(uid, nowElapsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1378,7 +1378,7 @@ public class OomAdjuster {
|
||||
mService.mServices.foregroundServiceProcStateChangedLocked(uidRec);
|
||||
}
|
||||
}
|
||||
mService.mInternal.deletePendingTopUid(uidRec.getUid());
|
||||
mService.mInternal.deletePendingTopUid(uidRec.getUid(), nowElapsed);
|
||||
}
|
||||
if (mLocalPowerManager != null) {
|
||||
mLocalPowerManager.finishUidChanges();
|
||||
|
||||
@@ -50,9 +50,15 @@ final class PendingStartActivityUids {
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void delete(int uid) {
|
||||
synchronized void delete(int uid, long nowElapsed) {
|
||||
final Pair<Integer, Long> pendingPid = mPendingUids.get(uid);
|
||||
if (pendingPid != null) {
|
||||
if (nowElapsed < pendingPid.second) {
|
||||
Slog.i(TAG,
|
||||
"updateOomAdj start time is before than pendingPid added,"
|
||||
+ " don't delete it");
|
||||
return;
|
||||
}
|
||||
final long delay = SystemClock.elapsedRealtime() - pendingPid.second;
|
||||
if (delay >= 1000 /*ms*/) {
|
||||
Slog.i(TAG,
|
||||
@@ -75,4 +81,4 @@ final class PendingStartActivityUids {
|
||||
synchronized boolean isPendingTopUid(int uid) {
|
||||
return mPendingUids.get(uid) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ public class ActivityTaskSupervisorTests extends WindowTestsBase {
|
||||
.setCreateActivity(true).build().getTopMostActivity();
|
||||
activity2.getTask().setResumedActivity(activity2, "test");
|
||||
|
||||
mAtm.mAmInternal.deletePendingTopUid(activity1.getUid());
|
||||
mAtm.mAmInternal.deletePendingTopUid(activity1.getUid(), Long.MAX_VALUE);
|
||||
clearInvocations(mAtm);
|
||||
activity1.moveFocusableActivityToTop("test");
|
||||
assertTrue(mAtm.mAmInternal.isPendingTopUid(activity1.getUid()));
|
||||
|
||||
Reference in New Issue
Block a user