Add condition provider access to settings.
Pull NotificationAccessSettings out into a reusable base class and reuse all of it for a new condition providers settings page. As with notification listeners, the entire section is hidden if no apps provide conditions. Change-Id: Ib5273f3362e392d99647347c23a514e4590f7ac9
This commit is contained in:
@@ -225,21 +225,13 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
// === Notification listeners ===
|
||||
|
||||
private int getNumEnabledNotificationListeners() {
|
||||
final String flat = Settings.Secure.getString(getContentResolver(),
|
||||
Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
|
||||
if (flat == null || "".equals(flat)) return 0;
|
||||
final String[] components = flat.split(":");
|
||||
return components.length;
|
||||
}
|
||||
|
||||
private void refreshNotificationListeners() {
|
||||
if (mNotificationAccess != null) {
|
||||
final int total = NotificationAccessSettings.getListenersCount(mPM);
|
||||
if (total == 0) {
|
||||
getPreferenceScreen().removePreference(mNotificationAccess);
|
||||
} else {
|
||||
final int n = getNumEnabledNotificationListeners();
|
||||
final int n = NotificationAccessSettings.getEnabledListenersCount(mContext);
|
||||
if (n == 0) {
|
||||
mNotificationAccess.setSummary(getResources().getString(
|
||||
R.string.manage_notification_access_summary_zero));
|
||||
|
Reference in New Issue
Block a user