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

Commit 1f8634ec authored by Chloris Kuo's avatar Chloris Kuo
Browse files

New DeviceConfig flags for NAS

Add ENABLE_NAS_RANKING, ENABLE_NAS_PRIORITIZER, ENABLE_NAS_FEEDBACK

Test: atest NotificationManagerServiceTest; manual test on device
Bug: 175363481
Change-Id: I63ee375c14435e50ecaf755da6b7068af9afe57f
parent 25c8f639
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(