Obey rule instance limit.

Do not show a rule type in the 'Add rule' dialog if the number of
current instances of that rule equals the max number of instances 
allowed by that rule type.

Bug: 25563007
Change-Id: I18f2598c6d92aec93c27755bb6b04c460ee294d0
This commit is contained in:
Julia Reynolds
2016-01-15 10:11:16 -05:00
parent 8e7c979bad
commit 0cca0f5c02
4 changed files with 32 additions and 9 deletions

View File

@@ -60,14 +60,12 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase {
addPreferencesFromResource(R.xml.zen_mode_automation_settings);
mPm = mContext.getPackageManager();
mServiceListing = new ServiceListing(mContext, CONFIG);
mServiceListing.reload();
mServiceListing.setListening(true);
mServiceListing.reloadApprovedServices();
}
@Override
public void onDestroy() {
super.onDestroy();
mServiceListing.setListening(false);
}
@Override
@@ -228,7 +226,8 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase {
ri.packageName = si.packageName;
ri.configurationActivity = getSettingsActivity(si);
ri.packageLabel = si.applicationInfo.loadLabel(pm);
ri.ruleInstanceLimit =
si.metaData.getInt(ConditionProviderService.META_DATA_RULE_INSTANCE_LIMIT, -1);
return ri;
}
return null;