Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33de1a2d authored by Collin Fijalkovich's avatar Collin Fijalkovich
Browse files

Revert "Defer FGS notifications from legacy apps by default"

This reverts commit 871b04e2.

Reason for revert: b/175764941

Change-Id: I947413b0047edbc69a4426986a45deb56120bad7
parent 871b04e2
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -1672,13 +1672,12 @@ public final class ActiveServices {
    // TODO: remove as part of fixing b/173627642
    @SuppressWarnings("AndroidFrameworkCompatChange")
    private void postFgsNotificationLocked(ServiceRecord r) {
        final boolean isLegacyApp = (r.appInfo.targetSdkVersion < Build.VERSION_CODES.S);
        boolean showNow = !mAm.mConstants.mFlagFgsNotificationDeferralEnabled;
        if (!showNow) {
            // Legacy apps' FGS notifications are not deferred unless the relevant
            // DeviceConfig element has been set
            showNow = mAm.mConstants.mFlagFgsNotificationDeferralApiGated
                    && isLegacyApp;
                    && r.appInfo.targetSdkVersion < Build.VERSION_CODES.S;
        }
        if (!showNow) {
            // is the notification such that it should show right away?
@@ -1733,11 +1732,6 @@ public final class ActiveServices {
            Slog.d(TAG_SERVICE, "FGS " + r
                    + " notification in " + (when - now) + " ms");
        }
        if (isLegacyApp) {
            Slog.i(TAG_SERVICE, "Deferring FGS notification in legacy app "
                    + r.appInfo.packageName + "/" + UserHandle.formatUid(r.appInfo.uid)
                    + " : " + r.foregroundNoti);
        }
        mAm.mHandler.postAtTime(mPostDeferredFGSNotifications, when);
    }

+4 −4
Original line number Diff line number Diff line
@@ -370,9 +370,9 @@ final class ActivityManagerConstants extends ContentObserver {
    volatile boolean mFlagFgsNotificationDeferralEnabled = true;

    // Restrict FGS notification deferral policy to only those apps that target
    // API version S or higher.  Disabled by default; set to "true" to force
    // legacy app FGS notifications to display immediately in all cases.
    volatile boolean mFlagFgsNotificationDeferralApiGated = false;
    // API version S or higher.  Enabled by default; set to "false" to defer FGS
    // notifications from legacy apps as well.
    volatile boolean mFlagFgsNotificationDeferralApiGated = true;

    // Time in milliseconds to defer FGS notifications after their transition to
    // the foreground state.
@@ -806,7 +806,7 @@ final class ActivityManagerConstants extends ContentObserver {
        mFlagFgsNotificationDeferralApiGated = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                KEY_DEFERRED_FGS_NOTIFICATIONS_API_GATED,
                /*default value*/ false);
                /*default value*/ true);
    }

    private void updateFgsNotificationDeferralInterval() {