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

Commit 415376b9 authored by Gus Prevas's avatar Gus Prevas
Browse files

Replaces binary flag for new interruption model with secure setting.

Bug: 116622974
Test: n/a
Change-Id: I8445e5db49ba3f87046332624c0a705cc082ab59
parent c6c85691
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -8197,6 +8197,12 @@ public final class Settings {
        public static final String PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE =
                "packages_to_clear_data_before_full_restore";
        /**
         * Setting to determine whether to use the new notification priority handling features.
         * @hide
         */
        public static final String NOTIFICATION_NEW_INTERRUPTION_MODEL = "new_interruption_model";
        /**
         * This are the settings to be backed up.
         *
@@ -8311,6 +8317,7 @@ public final class Settings {
            CHARGING_VIBRATION_ENABLED,
            ACCESSIBILITY_MINIMUM_UI_TIMEOUT_ENABLED,
            ACCESSIBILITY_MINIMUM_UI_TIMEOUT_MS,
            NOTIFICATION_NEW_INTERRUPTION_MODEL,
        };
        /**
@@ -8470,6 +8477,7 @@ public final class Settings {
            VALIDATORS.put(ACCESSIBILITY_MINIMUM_UI_TIMEOUT_MS, NON_NEGATIVE_INTEGER_VALIDATOR);
            VALIDATORS.put(USER_SETUP_COMPLETE, BOOLEAN_VALIDATOR);
            VALIDATORS.put(ASSIST_GESTURE_SETUP_COMPLETE, BOOLEAN_VALIDATOR);
            VALIDATORS.put(NOTIFICATION_NEW_INTERRUPTION_MODEL, BOOLEAN_VALIDATOR);
        }
        /**
+0 −3
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
package com.android.systemui.statusbar;

import android.content.pm.UserInfo;
import android.os.SystemProperties;
import android.service.notification.StatusBarNotification;
import android.util.SparseArray;

@@ -26,8 +25,6 @@ public interface NotificationLockscreenUserManager {
    String NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION
            = "com.android.systemui.statusbar.work_challenge_unlocked_notification_action";

    boolean AUTO_DEMOTE_NOTIFICATIONS = SystemProperties.getBoolean("debug.demote_notifs", false);

    boolean shouldAllowLockscreenRemoteInput();

    /**
+2 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.notification.NotificationData;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardMonitor;

@@ -293,7 +294,7 @@ public class NotificationLockscreenUserManagerImpl implements
            return false;
        }
        boolean exceedsPriorityThreshold;
        if (AUTO_DEMOTE_NOTIFICATIONS) {
        if (NotificationUtils.useNewInterruptionModel(mContext)) {
            exceedsPriorityThreshold =
                    getEntryManager().getNotificationData().getImportance(sbn.getKey())
                            >= IMPORTANCE_DEFAULT;
+9 −0
Original line number Diff line number Diff line
@@ -16,8 +16,11 @@

package com.android.systemui.statusbar.notification;

import static android.provider.Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL;

import android.content.Context;
import android.graphics.Color;
import android.provider.Settings;
import android.view.View;
import android.widget.ImageView;

@@ -68,4 +71,10 @@ public class NotificationUtils {
                context.getResources().getDisplayMetrics().density);
        return (int) (dimensionPixelSize * factor);
    }

    /** Returns the value of the new interruption model setting. */
    public static boolean useNewInterruptionModel(Context context) {
        return Settings.System.getInt(context.getContentResolver(),
                NOTIFICATION_NEW_INTERRUPTION_MODEL, 0) != 0;
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.ViewClippingUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.notification.NotificationData;
@@ -50,7 +49,7 @@ public class NotificationIconAreaController implements DarkReceiver {
        public void onTuningChanged(String key, String newValue) {
            if (key.equals(LOW_PRIORITY)) {
                mShowLowPriority = "1".equals(newValue)
                        || !NotificationLockscreenUserManager.AUTO_DEMOTE_NOTIFICATIONS;
                        || !NotificationUtils.useNewInterruptionModel(mContext);
                if (mNotificationScrollLayout != null) {
                    updateStatusBarIcons();
                }