Loading src/com/android/settings/notification/BubbleNotificationPreferenceController.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.content.ContentResolver; Loading Loading @@ -88,14 +88,14 @@ public class BubbleNotificationPreferenceController extends TogglePreferenceCont @Override public boolean isChecked() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } @Override public boolean setChecked(boolean isChecked) { return Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, isChecked ? ON : OFF); return Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, isChecked ? ON : OFF); } @Override Loading @@ -106,7 +106,7 @@ public class BubbleNotificationPreferenceController extends TogglePreferenceCont class SettingObserver extends ContentObserver { private final Uri NOTIFICATION_BUBBLES_URI = Settings.Global.getUriFor(NOTIFICATION_BUBBLES); Settings.Secure.getUriFor(NOTIFICATION_BUBBLES); private final Preference mPreference; Loading src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.content.Context; Loading Loading @@ -54,7 +54,7 @@ public class BubbleSummaryNotificationPreferenceController extends BasePreferenc } private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } } src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification.app; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.content.Context; import android.content.Intent; Loading Loading @@ -67,7 +67,7 @@ public class BubbleCategoryPreferenceController extends NotificationPreferenceCo private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } } src/com/android/settings/notification/app/BubbleLinkPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification.app; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.content.Context; import android.content.Intent; Loading Loading @@ -67,7 +67,7 @@ public class BubbleLinkPreferenceController extends NotificationPreferenceContro private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } } src/com/android/settings/notification/app/BubblePreferenceController.java +16 −14 Original line number Diff line number Diff line Loading @@ -17,10 +17,10 @@ package com.android.settings.notification.app; import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.NotificationChannel; import android.content.Context; import android.provider.Settings; Loading Loading @@ -72,7 +72,7 @@ public class BubblePreferenceController extends NotificationPreferenceController if (!super.isAvailable()) { return false; } if (!mIsAppPage && !isGloballyEnabled()) { if (!mIsAppPage && !isEnabled()) { return false; } if (mChannel != null) { Loading Loading @@ -101,7 +101,7 @@ public class BubblePreferenceController extends NotificationPreferenceController BubblePreference pref = (BubblePreference) preference; pref.setDisabledByAdmin(mAdmin); pref.setSelectedVisibility(!mHasSentInvalidMsg || mNumConversations > 0); if (!isGloballyEnabled()) { if (!isEnabled()) { pref.setSelectedPreference(BUBBLE_PREFERENCE_NONE); } else { pref.setSelectedPreference(backEndPref); Loading @@ -110,7 +110,7 @@ public class BubblePreferenceController extends NotificationPreferenceController // We're on the channel specific notification page which displays a toggle. RestrictedSwitchPreference switchpref = (RestrictedSwitchPreference) preference; switchpref.setDisabledByAdmin(mAdmin); switchpref.setChecked(mChannel.canBubble() && isGloballyEnabled()); switchpref.setChecked(mChannel.canBubble() && isEnabled()); } } Loading @@ -125,7 +125,7 @@ public class BubblePreferenceController extends NotificationPreferenceController BubblePreference pref = (BubblePreference) preference; if (mAppRow != null && mFragmentManager != null) { final int value = (int) newValue; if (!isGloballyEnabled() if (!isEnabled() && pref.getSelectedPreference() == BUBBLE_PREFERENCE_NONE) { // if the global setting is off, toggling app level permission requires extra // confirmation Loading @@ -145,9 +145,9 @@ public class BubblePreferenceController extends NotificationPreferenceController return true; } private boolean isGloballyEnabled() { private boolean isEnabled() { ActivityManager am = mContext.getSystemService(ActivityManager.class); return !am.isLowRamDevice() && Settings.Global.getInt(mContext.getContentResolver(), return !am.isLowRamDevice() && Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON; } Loading @@ -155,25 +155,27 @@ public class BubblePreferenceController extends NotificationPreferenceController * Used in app level prompt that confirms the user is ok with turning on bubbles * globally. If they aren't, undo that. */ public static void revertBubblesApproval(Context mContext, String pkg, int uid) { public static void revertBubblesApproval(Context context, String pkg, int uid) { NotificationBackend backend = new NotificationBackend(); backend.setAllowBubbles(pkg, uid, BUBBLE_PREFERENCE_NONE); // changing the global settings will cause the observer on the host page to reload // correct preference state Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF); Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF); } /** * Apply global bubbles approval */ public static void applyBubblesApproval(Context mContext, String pkg, int uid, int pref) { public static void applyBubblesApproval(Context context, String pkg, int uid, int pref) { NotificationBackend backend = new NotificationBackend(); backend.setAllowBubbles(pkg, uid, pref); // changing the global settings will cause the observer on the host page to reload // correct preference state Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON); Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON); } } Loading
src/com/android/settings/notification/BubbleNotificationPreferenceController.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.content.ContentResolver; Loading Loading @@ -88,14 +88,14 @@ public class BubbleNotificationPreferenceController extends TogglePreferenceCont @Override public boolean isChecked() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } @Override public boolean setChecked(boolean isChecked) { return Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, isChecked ? ON : OFF); return Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, isChecked ? ON : OFF); } @Override Loading @@ -106,7 +106,7 @@ public class BubbleNotificationPreferenceController extends TogglePreferenceCont class SettingObserver extends ContentObserver { private final Uri NOTIFICATION_BUBBLES_URI = Settings.Global.getUriFor(NOTIFICATION_BUBBLES); Settings.Secure.getUriFor(NOTIFICATION_BUBBLES); private final Preference mPreference; Loading
src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.content.Context; Loading Loading @@ -54,7 +54,7 @@ public class BubbleSummaryNotificationPreferenceController extends BasePreferenc } private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } }
src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification.app; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.content.Context; import android.content.Intent; Loading Loading @@ -67,7 +67,7 @@ public class BubbleCategoryPreferenceController extends NotificationPreferenceCo private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } }
src/com/android/settings/notification/app/BubbleLinkPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.settings.notification.app; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.content.Context; import android.content.Intent; Loading Loading @@ -67,7 +67,7 @@ public class BubbleLinkPreferenceController extends NotificationPreferenceContro private boolean areBubblesEnabled() { return Settings.Global.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON) == ON; } }
src/com/android/settings/notification/app/BubblePreferenceController.java +16 −14 Original line number Diff line number Diff line Loading @@ -17,10 +17,10 @@ package com.android.settings.notification.app; import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE; import static android.provider.Settings.Global.NOTIFICATION_BUBBLES; import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import android.app.ActivityManager; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.NotificationChannel; import android.content.Context; import android.provider.Settings; Loading Loading @@ -72,7 +72,7 @@ public class BubblePreferenceController extends NotificationPreferenceController if (!super.isAvailable()) { return false; } if (!mIsAppPage && !isGloballyEnabled()) { if (!mIsAppPage && !isEnabled()) { return false; } if (mChannel != null) { Loading Loading @@ -101,7 +101,7 @@ public class BubblePreferenceController extends NotificationPreferenceController BubblePreference pref = (BubblePreference) preference; pref.setDisabledByAdmin(mAdmin); pref.setSelectedVisibility(!mHasSentInvalidMsg || mNumConversations > 0); if (!isGloballyEnabled()) { if (!isEnabled()) { pref.setSelectedPreference(BUBBLE_PREFERENCE_NONE); } else { pref.setSelectedPreference(backEndPref); Loading @@ -110,7 +110,7 @@ public class BubblePreferenceController extends NotificationPreferenceController // We're on the channel specific notification page which displays a toggle. RestrictedSwitchPreference switchpref = (RestrictedSwitchPreference) preference; switchpref.setDisabledByAdmin(mAdmin); switchpref.setChecked(mChannel.canBubble() && isGloballyEnabled()); switchpref.setChecked(mChannel.canBubble() && isEnabled()); } } Loading @@ -125,7 +125,7 @@ public class BubblePreferenceController extends NotificationPreferenceController BubblePreference pref = (BubblePreference) preference; if (mAppRow != null && mFragmentManager != null) { final int value = (int) newValue; if (!isGloballyEnabled() if (!isEnabled() && pref.getSelectedPreference() == BUBBLE_PREFERENCE_NONE) { // if the global setting is off, toggling app level permission requires extra // confirmation Loading @@ -145,9 +145,9 @@ public class BubblePreferenceController extends NotificationPreferenceController return true; } private boolean isGloballyEnabled() { private boolean isEnabled() { ActivityManager am = mContext.getSystemService(ActivityManager.class); return !am.isLowRamDevice() && Settings.Global.getInt(mContext.getContentResolver(), return !am.isLowRamDevice() && Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON; } Loading @@ -155,25 +155,27 @@ public class BubblePreferenceController extends NotificationPreferenceController * Used in app level prompt that confirms the user is ok with turning on bubbles * globally. If they aren't, undo that. */ public static void revertBubblesApproval(Context mContext, String pkg, int uid) { public static void revertBubblesApproval(Context context, String pkg, int uid) { NotificationBackend backend = new NotificationBackend(); backend.setAllowBubbles(pkg, uid, BUBBLE_PREFERENCE_NONE); // changing the global settings will cause the observer on the host page to reload // correct preference state Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF); Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF); } /** * Apply global bubbles approval */ public static void applyBubblesApproval(Context mContext, String pkg, int uid, int pref) { public static void applyBubblesApproval(Context context, String pkg, int uid, int pref) { NotificationBackend backend = new NotificationBackend(); backend.setAllowBubbles(pkg, uid, pref); // changing the global settings will cause the observer on the host page to reload // correct preference state Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON); Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON); } }