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

Commit 4b44e88e authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Shorten bitmap duration for debugging" into main

parents 9807a369 e7a38113
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ public class SystemUiSystemPropertiesFlags {
        /** b/301242692: Visit extra URIs used in notifications to prevent security issues. */
        public static final Flag VISIT_RISKY_URIS = devFlag(
                "persist.sysui.notification.visit_risky_uris");

        /** b/303716154: For debugging only: use short bitmap duration. */
        public static final Flag DEBUG_SHORT_BITMAP_DURATION = devFlag(
                "persist.sysui.notification.debug_short_bitmap_duration");
    }

    //// == End of flags.  Everything below this line is the implementation. == ////
+19 −2
Original line number Diff line number Diff line
@@ -291,6 +291,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.compat.IPlatformCompat;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags;
import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags;
import com.android.internal.logging.InstanceId;
import com.android.internal.logging.InstanceIdSequence;
import com.android.internal.logging.MetricsLogger;
@@ -2909,7 +2910,16 @@ public class NotificationManagerService extends SystemService {
            mPreferencesHelper.updateFixedImportance(mUm.getUsers());
            mPreferencesHelper.migrateNotificationPermissions(mUm.getUsers());
        } else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
            if (expireBitmaps()) {
            if (mFlagResolver.isEnabled(NotificationFlags.DEBUG_SHORT_BITMAP_DURATION)) {
                new Thread(() -> {
                    while (true) {
                        try {
                            Thread.sleep(5000);
                        } catch (InterruptedException e) { }
                        mInternalService.removeBitmaps();
                    }
                }).start();
            } else if (expireBitmaps()) {
                NotificationBitmapJobService.scheduleJob(getContext());
            }
        }
@@ -6765,7 +6775,14 @@ public class NotificationManagerService extends SystemService {
                    final long timePostedMs = r.getSbn().getPostTime();
                    final long timeNowMs = System.currentTimeMillis();
                    if (isBitmapExpired(timePostedMs, timeNowMs, BITMAP_DURATION.toMillis())) {
                    final long bitmapDuration;
                    if (mFlagResolver.isEnabled(NotificationFlags.DEBUG_SHORT_BITMAP_DURATION)) {
                        bitmapDuration = Duration.ofSeconds(5).toMillis();
                    } else {
                        bitmapDuration = BITMAP_DURATION.toMillis();
                    }
                    if (isBitmapExpired(timePostedMs, timeNowMs, bitmapDuration)) {
                        removeBitmapAndRepost(r);
                    }
                }