Fix race in short FGS timeout
Bug: 257270313 Test: atest CtsShortFgsTestCases Test: atest CtsShortFgsTestCases:android.app.cts.shortfgstest.ActivityManagerShortFgsTest#testTimeout --rerun-until-failure 20 Change-Id: I7dfa3e5c4854eaa578e6a7899078b0d09feb40c3
This commit is contained in:
@@ -2981,6 +2981,9 @@ public final class ActiveServices {
|
||||
void onShortFgsTimeout(ServiceRecord sr) {
|
||||
synchronized (mAm) {
|
||||
if (!sr.shouldTriggerShortFgsTimeout()) {
|
||||
if (DEBUG_SHORT_SERVICE) {
|
||||
Slog.d(TAG_SERVICE, "[STALE] Short FGS timed out: " + sr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Slog.e(TAG_SERVICE, "Short FGS timed out: " + sr);
|
||||
@@ -3021,6 +3024,9 @@ public final class ActiveServices {
|
||||
tr.mLatencyTracker.waitingOnAMSLockEnded();
|
||||
|
||||
if (!sr.shouldTriggerShortFgsAnr()) {
|
||||
if (DEBUG_SHORT_SERVICE) {
|
||||
Slog.d(TAG_SERVICE, "[STALE] Short FGS ANR'ed: " + sr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1416,7 +1416,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
|
||||
|| !mShortFgsInfo.isCurrent()) {
|
||||
return false;
|
||||
}
|
||||
return mShortFgsInfo.getTimeoutTime() < SystemClock.uptimeMillis();
|
||||
return mShortFgsInfo.getTimeoutTime() <= SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1431,7 +1431,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN
|
||||
|| !mShortFgsInfo.isCurrent()) {
|
||||
return false;
|
||||
}
|
||||
return mShortFgsInfo.getAnrTime() < SystemClock.uptimeMillis();
|
||||
return mShortFgsInfo.getAnrTime() <= SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
private boolean isAppAlive() {
|
||||
|
||||
Reference in New Issue
Block a user