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

Commit 8b14288c authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Remove rename automatic zen rule."

parents fb78ae50 4fe98d6d
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -5080,7 +5080,7 @@ package android.app {
  }
  public class NotificationManager {
    method public boolean addOrUpdateAutomaticZenRule(android.app.AutomaticZenRule);
    method public android.app.AutomaticZenRule addAutomaticZenRule(android.app.AutomaticZenRule);
    method public void cancel(int);
    method public void cancel(java.lang.String, int);
    method public void cancelAll();
@@ -5093,9 +5093,9 @@ package android.app {
    method public void notify(int, android.app.Notification);
    method public void notify(java.lang.String, int, android.app.Notification);
    method public boolean removeAutomaticZenRule(java.lang.String);
    method public boolean renameAutomaticZenRule(java.lang.String, java.lang.String);
    method public final void setInterruptionFilter(int);
    method public void setNotificationPolicy(android.app.NotificationManager.Policy);
    method public boolean updateAutomaticZenRule(android.app.AutomaticZenRule);
    field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
    field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
    field public static final java.lang.String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED";
@@ -28851,10 +28851,8 @@ package android.service.notification {
    method public abstract void onRequestConditions(int);
    method public abstract void onSubscribe(android.net.Uri);
    method public abstract void onUnsubscribe(android.net.Uri);
    field public static final java.lang.String EXTRA_CONDITION_ID = "android.content.automatic.conditionId";
    field public static final java.lang.String EXTRA_RULE_NAME = "android.content.automatic.ruleName";
    field public static final java.lang.String EXTRA_RULE_ID = "android.content.automatic.ruleId";
    field public static final java.lang.String META_DATA_CONFIGURATION_ACTIVITY = "android.service.zen.automatic.configurationActivity";
    field public static final java.lang.String META_DATA_DEFAULT_CONDITION_ID = "android.service.zen.automatic.defaultConditionId";
    field public static final java.lang.String META_DATA_RULE_TYPE = "android.service.zen.automatic.ruleType";
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
  }
+3 −5
Original line number Diff line number Diff line
@@ -5197,7 +5197,7 @@ package android.app {
  }
  public class NotificationManager {
    method public boolean addOrUpdateAutomaticZenRule(android.app.AutomaticZenRule);
    method public android.app.AutomaticZenRule addAutomaticZenRule(android.app.AutomaticZenRule);
    method public void cancel(int);
    method public void cancel(java.lang.String, int);
    method public void cancelAll();
@@ -5210,9 +5210,9 @@ package android.app {
    method public void notify(int, android.app.Notification);
    method public void notify(java.lang.String, int, android.app.Notification);
    method public boolean removeAutomaticZenRule(java.lang.String);
    method public boolean renameAutomaticZenRule(java.lang.String, java.lang.String);
    method public final void setInterruptionFilter(int);
    method public void setNotificationPolicy(android.app.NotificationManager.Policy);
    method public boolean updateAutomaticZenRule(android.app.AutomaticZenRule);
    field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
    field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
    field public static final java.lang.String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED";
@@ -30940,10 +30940,8 @@ package android.service.notification {
    method public abstract void onRequestConditions(int);
    method public abstract void onSubscribe(android.net.Uri);
    method public abstract void onUnsubscribe(android.net.Uri);
    field public static final java.lang.String EXTRA_CONDITION_ID = "android.content.automatic.conditionId";
    field public static final java.lang.String EXTRA_RULE_NAME = "android.content.automatic.ruleName";
    field public static final java.lang.String EXTRA_RULE_ID = "android.content.automatic.ruleId";
    field public static final java.lang.String META_DATA_CONFIGURATION_ACTIVITY = "android.service.zen.automatic.configurationActivity";
    field public static final java.lang.String META_DATA_DEFAULT_CONDITION_ID = "android.service.zen.automatic.defaultConditionId";
    field public static final java.lang.String META_DATA_RULE_TYPE = "android.service.zen.automatic.ruleType";
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
  }
+4 −4
Original line number Diff line number Diff line
@@ -93,11 +93,11 @@ interface INotificationManager
    String[] getPackagesRequestingNotificationPolicyAccess();
    boolean isNotificationPolicyAccessGrantedForPackage(String pkg);
    void setNotificationPolicyAccessGranted(String pkg, boolean granted);
    AutomaticZenRule getAutomaticZenRule(String name);
    AutomaticZenRule getAutomaticZenRule(String id);
    List<AutomaticZenRule> getAutomaticZenRules();
    boolean addOrUpdateAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean renameAutomaticZenRule(String oldName, String newName);
    boolean removeAutomaticZenRule(String name);
    AutomaticZenRule addAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean updateAutomaticZenRule(in AutomaticZenRule automaticZenRule);
    boolean removeAutomaticZenRule(String id);

    byte[] getBackupPayload(int user);
    void applyRestore(in byte[] payload, int user);
+19 −21
Original line number Diff line number Diff line
@@ -436,48 +436,47 @@ public class NotificationManager
    }

    /**
     * Returns the AutomaticZenRule with the given name, if it exists and the caller has access.
     * Returns the AutomaticZenRule with the given id, if it exists and the caller has access.
     *
     * <p>
     * Only available if policy access is granted to this package.
     * See {@link #isNotificationPolicyAccessGranted}.
     *
     * <p>
     * Returns null if there are no zen rules that match the given name, or if the calling package
     * Returns null if there are no zen rules that match the given id, or if the calling package
     * doesn't own the matching rule. See {@link AutomaticZenRule#getOwner}.
     */
    public AutomaticZenRule getAutomaticZenRule(String name) {
    public AutomaticZenRule getAutomaticZenRule(String id) {
        INotificationManager service = getService();
        try {
            return service.getAutomaticZenRule(name);
            return service.getAutomaticZenRule(id);
        } catch (RemoteException e) {
        }
        return null;
    }

    /**
     * Creates or updates the given zen rule.
     * Creates the given zen rule.
     *
     * <p>
     * Only available if policy access is granted to this package.
     * See {@link #isNotificationPolicyAccessGranted}.
     *
     * <p>
     * Callers can only update rules that they own. See {@link AutomaticZenRule#getOwner}.
     * @param automaticZenRule the rule to create or update.
     * @return Whether the rule was successfully created or updated.
     * @param automaticZenRule the rule to create.
     * @return A fully populated {@link AutomaticZenRule} if the rule was persisted successfully,
     * null otherwise.
     */
    public boolean addOrUpdateAutomaticZenRule(AutomaticZenRule automaticZenRule) {
    public AutomaticZenRule addAutomaticZenRule(AutomaticZenRule automaticZenRule) {
        INotificationManager service = getService();
        try {
            return service.addOrUpdateAutomaticZenRule(automaticZenRule);
            return service.addAutomaticZenRule(automaticZenRule);
        } catch (RemoteException e) {
        }
        return false;
        return null;
    }

    /**
     * Renames a zen rule.
     * Updates the given zen rule.
     *
     * <p>
     * Only available if policy access is granted to this package.
@@ -485,21 +484,20 @@ public class NotificationManager
     *
     * <p>
     * Callers can only update rules that they own. See {@link AutomaticZenRule#getOwner}.
     * @param oldName The name of the rule to update.
     * @param newName The new name for the rule.
     * @param automaticZenRule the rule to update. 
     * @return Whether the rule was successfully updated.
     */
    public boolean renameAutomaticZenRule(String oldName, String newName) {
    public boolean updateAutomaticZenRule(AutomaticZenRule automaticZenRule) {
        INotificationManager service = getService();
        try {
            return service.renameAutomaticZenRule(oldName, newName);
            return service.updateAutomaticZenRule(automaticZenRule);
        } catch (RemoteException e) {
        }
        return false;
    }

    /**
     * Deletes the automatic zen rule with the given name.
     * Deletes the automatic zen rule with the given id.
     *
     * <p>
     * Only available if policy access is granted to this package.
@@ -507,13 +505,13 @@ public class NotificationManager
     *
     * <p>
     * Callers can only delete rules that they own. See {@link AutomaticZenRule#getOwner}.
     * @param name the name of the rule to delete.
     * @param id the id of the rule to delete.
     * @return Whether the rule was successfully deleted.
     */
    public boolean removeAutomaticZenRule(String name) {
    public boolean removeAutomaticZenRule(String id) {
        INotificationManager service = getService();
        try {
            return service.removeAutomaticZenRule(name);
            return service.removeAutomaticZenRule(id);
        } catch (RemoteException e) {
        }
        return false;
+3 −23
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@ import android.util.Log;
 * the {@link android.Manifest.permission#BIND_CONDITION_PROVIDER_SERVICE} permission
 * and include an intent filter with the {@link #SERVICE_INTERFACE} action. If you want users to be
 * able to create and update conditions for this service to monitor, include the
 * {@link #META_DATA_RULE_TYPE}, {@link #META_DATA_DEFAULT_CONDITION_ID}, and
 * {@link #META_DATA_CONFIGURATION_ACTIVITY} tags. For example:</p>
 * {@link #META_DATA_RULE_TYPE} and {@link #META_DATA_CONFIGURATION_ACTIVITY} tags. For example:</p>
 * <pre>
 * &lt;service android:name=".MyConditionProvider"
 *          android:label="&#64;string/service_name"
@@ -49,10 +48,6 @@ import android.util.Log;
 *               android:value="@string/my_condition_rule">
 *           &lt;/meta-data>
 *           &lt;meta-data
 *               android:name="android.service.zen.automatic.defaultConditionId"
 *               android:value="condition://com.my.package/mycondition">
 *           &lt;/meta-data>
 *           &lt;meta-data
 *               android:name="android.service.zen.automatic.configurationActivity"
 *               android:value="com.my.package/.MyConditionConfigurationActivity">
 *           &lt;/meta-data>
@@ -81,13 +76,6 @@ public abstract class ConditionProviderService extends Service {
     */
    public static final String META_DATA_RULE_TYPE = "android.service.zen.automatic.ruleType";

    /**
     * The name of the {@code meta-data} tag containing a default Condition {@link Uri} that can
     * be parsed by this service.
     */
    public static final String META_DATA_DEFAULT_CONDITION_ID =
            "android.service.zen.automatic.defaultConditionId";

    /**
     * The name of the {@code meta-data} tag containing the {@link ComponentName} of an activity
     * that allows users to configure the conditions provided by this service.
@@ -96,17 +84,9 @@ public abstract class ConditionProviderService extends Service {
            "android.service.zen.automatic.configurationActivity";

    /**
     * A condition {@link Uri} extra passed to {@link #META_DATA_CONFIGURATION_ACTIVITY}. If the
     * condition Uri is modified by that activity, it must be included in the result Intent extras
     * in order to be persisted.
     */
    public static final String EXTRA_CONDITION_ID = "android.content.automatic.conditionId";

    /**
     * A String rule name extra passed to {@link #META_DATA_CONFIGURATION_ACTIVITY}. This extra is
     * informative only, and will be ignored if included in the result Intent extras.
     * A String rule id extra passed to {@link #META_DATA_CONFIGURATION_ACTIVITY}.
     */
    public static final String EXTRA_RULE_NAME = "android.content.automatic.ruleName";
    public static final String EXTRA_RULE_ID = "android.content.automatic.ruleId";

    /**
     * Called when this service is connected.
Loading