diff options
| author | Julia Reynolds <juliacr@google.com> | 2016-01-14 15:05:34 -0500 |
|---|---|---|
| committer | Julia Reynolds <juliacr@google.com> | 2016-01-15 10:30:17 -0500 |
| commit | 43b70cdc395d3a6cf3bd0a78b686a7f5d3ed86e0 (patch) | |
| tree | d5014f800f66cda0f0288656e5f890e1a8062cf2 /core/java/android | |
| parent | 0ae2b0b47d49784e4ef12c04fb49fef45959933f (diff) | |
Allow condition providers to specify a rule instance limit.
Bug: 25563007
Change-Id: I1149cb5be59668f8869c81cb46c5ead49aec933a
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/INotificationManager.aidl | 1 | ||||
| -rw-r--r-- | core/java/android/app/NotificationManager.java | 12 | ||||
| -rw-r--r-- | core/java/android/service/notification/ConditionProviderService.java | 7 |
3 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl index 633f6995b986..368b8ef17cc9 100644 --- a/core/java/android/app/INotificationManager.aidl +++ b/core/java/android/app/INotificationManager.aidl @@ -103,6 +103,7 @@ interface INotificationManager boolean updateAutomaticZenRule(in AutomaticZenRule automaticZenRule); boolean removeAutomaticZenRule(String id); boolean removeAutomaticZenRules(String packageName); + int getRuleInstanceCount(in ComponentName owner); byte[] getBackupPayload(int user); void applyRestore(in byte[] payload, int user); diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index 9a3c82036399..faf5b11951a6 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -380,6 +380,18 @@ public class NotificationManager } /** + * @hide + */ + public int getRuleInstanceCount(ComponentName owner) { + INotificationManager service = getService(); + try { + return service.getRuleInstanceCount(owner); + } catch (RemoteException e) { + } + return 0; + } + + /** * Returns AutomaticZenRules owned by the caller. * * <p> diff --git a/core/java/android/service/notification/ConditionProviderService.java b/core/java/android/service/notification/ConditionProviderService.java index 88bd283d06a1..eff09d62e56e 100644 --- a/core/java/android/service/notification/ConditionProviderService.java +++ b/core/java/android/service/notification/ConditionProviderService.java @@ -85,6 +85,13 @@ public abstract class ConditionProviderService extends Service { "android.service.zen.automatic.configurationActivity"; /** + * The name of the {@code meta-data} tag containing the maximum number of rule instances that + * can be created for this rule type. Omit or enter a value <= 0 to allow unlimited instances. + */ + public static final String META_DATA_RULE_INSTANCE_LIMIT = + "android.service.zen.automatic.ruleInstanceLimit"; + + /** * A String rule id extra passed to {@link #META_DATA_CONFIGURATION_ACTIVITY}. */ public static final String EXTRA_RULE_ID = "android.content.automatic.ruleId"; |
