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

Commit 97910cb7 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add API for modes user management

The user modes management feature will not be tied to an API bump,
so add an API for apps to know when it's in place.

Test: cts NotificationManagerZenTest
Fixes: 310204784
Change-Id: I6feaa97bece339698417064ab7e513272177db3c
parent e4771d67
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6904,6 +6904,7 @@ package android.app {
  public class NotificationManager {
    method public String addAutomaticZenRule(android.app.AutomaticZenRule);
    method @FlaggedApi("android.app.modes_api") public boolean areAutomaticZenRulesUserManaged();
    method @Deprecated public boolean areBubblesAllowed();
    method public boolean areBubblesEnabled();
    method public boolean areNotificationsEnabled();
+16 −0
Original line number Diff line number Diff line
@@ -1246,6 +1246,22 @@ public class NotificationManager {
        }
    }

    /**
     * Returns true if users can independently and fully manage {@link AutomaticZenRule} rules. This
     * includes the ability to independently activate/deactivate rules and overwrite/freeze the
     * behavior (policy) of the rule when activated.
     * <p>
     * If this method returns true, calls to
     * {@link #updateAutomaticZenRule(String, AutomaticZenRule)} may fail and apps should defer
     * rule management to system settings/uis.
     */
    @FlaggedApi(Flags.FLAG_MODES_API)
    public boolean areAutomaticZenRulesUserManaged() {
        // modes ui is dependent on modes api
        return Flags.modesApi() && Flags.modesUi();
    }


    /**
     * Returns AutomaticZenRules owned by the caller.
     *
+7 −0
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@ flag {
  bug: "300477976"
}

flag {
  name: "modes_ui"
  namespace: "systemui"
  description: "This flag controls new and updated DND UIs; dependent on flag modes_api"
  bug: "270703654"
}

flag {
  name: "api_tvextender"
  namespace: "systemui"