Introduce quiet mode state to managed profile users

Quiet mode means the user will be free from visual and audio interruptions
from apps inside the managed profile, including notifications, widgets and
others. This CL adds the underlying state bit to users and exposes various
APIs to control and query the quiet mode state.

Bug: 22541941
Change-Id: If5f8e5a897843050e83b6ec26cb39561098f12b9
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b65d825..bc7620c 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2991,6 +2991,28 @@
             "android.intent.action.MANAGED_PROFILE_REMOVED";
 
     /**
+     * Broadcast sent to the primary user when an associated managed profile's availability has
+     * changed. This includes when the user toggles the profile's quiet mode, or when the profile
+     * owner suspends the profile. Carries an extra {@link #EXTRA_USER} that specifies the
+     * UserHandle of the profile. When quiet mode is changed, this broadcast will carry a boolean
+     * extra {@link #EXTRA_QUIET_MODE} indicating the new state of quiet mode. This is only sent to
+     * registered receivers, not manifest receivers.
+     */
+    public static final String ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED =
+            "android.intent.action.MANAGED_PROFILE_AVAILABILITY_CHANGED";
+
+    /**
+     * Broadcast sent to the managed profile when its availability has changed. This includes when
+     * the user toggles the profile's quiet mode, or when the profile owner suspends the profile.
+     * When quiet mode is changed, this broadcast will carry a boolean extra
+     * {@link #EXTRA_QUIET_MODE} indicating the new state of quiet mode. This is only sent to
+     * registered receivers, not manifest receivers. See also
+     * {@link #ACTION_MANAGED_PROFILE_AVAILABILITY_CHANGED}
+     */
+    public static final String ACTION_AVAILABILITY_CHANGED =
+            "android.intent.action.AVAILABILITY_CHANGED";
+
+    /**
      * Sent when the user taps on the clock widget in the system's "quick settings" area.
      */
     public static final String ACTION_QUICK_CLOCK =
@@ -4028,6 +4050,10 @@
     /** {@hide} */
     public static final String EXTRA_INDEX = "android.intent.extra.INDEX";
 
+    /**
+     * Optional boolean extra indicating whether quiet mode has been switched on or off.
+     */
+    public static final String EXTRA_QUIET_MODE = "android.intent.extra.QUIET_MODE";
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     // Intent flags (see mFlags variable).