Merge "Correct garbled rebase re FGS notification ratelimit" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-31 16:08:28 +00:00
committed by Android (Google) Code Review

View File

@@ -1996,17 +1996,16 @@ public final class ActiveServices {
final long now = SystemClock.uptimeMillis(); final long now = SystemClock.uptimeMillis();
final boolean isLegacyApp = (r.appInfo.targetSdkVersion < Build.VERSION_CODES.S); final boolean isLegacyApp = (r.appInfo.targetSdkVersion < Build.VERSION_CODES.S);
boolean showNow = withinFgsDeferRateLimit(uid, now); // Is the behavior enabled at all?
boolean showNow = !mAm.mConstants.mFlagFgsNotificationDeferralEnabled;
if (!showNow) { if (!showNow) {
final boolean showLegacyNow = isLegacyApp // Did the app have another FGS notification deferred recently?
&& mAm.mConstants.mFlagFgsNotificationDeferralApiGated; showNow = withinFgsDeferRateLimit(uid, now);
showNow = !mAm.mConstants.mFlagFgsNotificationDeferralEnabled || showLegacyNow;
} }
if (!showNow) { if (!showNow) {
// Legacy apps' FGS notifications are not deferred unless the relevant // Legacy apps' FGS notifications are not deferred unless the relevant
// DeviceConfig element has been set // DeviceConfig element has been set
showNow = mAm.mConstants.mFlagFgsNotificationDeferralApiGated showNow = isLegacyApp && mAm.mConstants.mFlagFgsNotificationDeferralApiGated;
&& isLegacyApp;
} }
if (!showNow) { if (!showNow) {
// has the app forced deferral? // has the app forced deferral?