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

Commit 8047aec1 authored by Chloris Kuo's avatar Chloris Kuo Committed by Android (Google) Code Review
Browse files

Merge "New DeviceConfig flags for NAS"

parents cb236b70 1f8634ec
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -47,6 +47,21 @@ public final class SystemUiDeviceConfigFlags {
     */
    public static final String NAS_MAX_SUGGESTIONS = "nas_max_suggestions";

    /**
     * Whether the Notification Assistant can change ranking.
     */
    public static final String ENABLE_NAS_RANKING = "enable_nas_ranking";

    /**
     * Whether the Notification Assistant can prioritize notification.
     */
    public static final String ENABLE_NAS_PRIORITIZER = "enable_nas_prioritizer";

    /**
     * Whether to enable feedback UI for Notification Assistant
     */
    public static final String ENABLE_NAS_FEEDBACK = "enable_nas_feedback";

    // Flags related to screenshot intelligence

    /**
+18 −4
Original line number Diff line number Diff line
@@ -2274,10 +2274,24 @@ public class NotificationManagerService extends SystemService {
            if (!DeviceConfig.NAMESPACE_SYSTEMUI.equals(properties.getNamespace())) {
                return;
            }
            if (properties.getKeyset()
                    .contains(SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE)) {
                mAssistants.allowAdjustmentType(Adjustment.KEY_IMPORTANCE);
            for (String name : properties.getKeyset()) {
                if (SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE.equals(name)) {
                    mAssistants.resetDefaultAssistantsIfNecessary();
                } else if (SystemUiDeviceConfigFlags.ENABLE_NAS_PRIORITIZER.equals(name)) {
                    String value = properties.getString(name, null);
                    if ("true".equals(value)) {
                        mAssistants.allowAdjustmentType(Adjustment.KEY_IMPORTANCE);
                    } else if ("false".equals(value)) {
                        mAssistants.disallowAdjustmentType(Adjustment.KEY_IMPORTANCE);
                    }
                } else if (SystemUiDeviceConfigFlags.ENABLE_NAS_RANKING.equals(name)) {
                    String value = properties.getString(name, null);
                    if ("true".equals(value)) {
                        mAssistants.allowAdjustmentType(Adjustment.KEY_RANKING_SCORE);
                    } else if ("false".equals(value)) {
                        mAssistants.disallowAdjustmentType(Adjustment.KEY_RANKING_SCORE);
                    }
                }
            }
        };
        DeviceConfig.addOnPropertiesChangedListener(