Loading res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -9101,9 +9101,9 @@ Data usage charges may apply.</string> <!-- App Info > Notifications: Title for section controlling whether this app may show notifications in a promoted format [CHAR LIMIT=80] --> <string name="live_notifications">Live notifications</string> <!-- App Info > Notifications: Text on the switch to enable or disable an app from showing notifications in a live/promoted format [CHAR LIMIT=50] --> <string name="live_notifications_switch">Show live info</string> <string name="live_notifications_switch">Live updates</string> <!-- App Info > Notifications: Text accompanying the "Show live info" switch explaining the purpose of the setting --> <string name="live_notifications_desc">Pinned notifications display live info from apps, and always appear on the status bar and lock screen</string> <string name="live_notifications_desc">Display ongoing, time-sensitive notifications on the status bar and lock screen</string> <!-- Configure Notifications: Title for the notification bubbles option. [CHAR LIMIT=60] --> <string name="notification_bubbles_title">Bubbles</string> src/com/android/settings/notification/app/PromotedNotificationsPreferenceController.java +30 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,12 @@ */ package com.android.settings.notification.app; import android.Manifest; import android.app.Flags; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; import androidx.annotation.NonNull; import androidx.preference.Preference; Loading @@ -24,9 +28,11 @@ import androidx.preference.Preference; import com.android.settings.notification.NotificationBackend; import com.android.settingslib.RestrictedSwitchPreference; public class PromotedNotificationsPreferenceController extends NotificationPreferenceController implements Preference.OnPreferenceChangeListener { protected static final String KEY_PROMOTED_SWITCH = "promoted_switch"; private static final String TAG = "PromotedNotiPrefCon"; public PromotedNotificationsPreferenceController(@NonNull Context context, @NonNull NotificationBackend backend) { Loading @@ -44,9 +50,32 @@ public class PromotedNotificationsPreferenceController extends if (!Flags.uiRichOngoing()) { return false; } return super.isAvailable(); return isPermissionRequested() && super.isAvailable(); } private boolean isPermissionRequested() { if (!Flags.apiRichOngoingPermission()) { return true; } try { PackageInfo packageInfo = mPm.getPackageInfo( mAppRow.pkg, PackageManager.GET_PERMISSIONS); for (String requestedPermission : packageInfo.requestedPermissions) { if (Manifest.permission.POST_PROMOTED_NOTIFICATIONS.equals(requestedPermission)) { return true; } } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "isPermissionRequested failed", e); } return false; } @Override boolean isIncludedInFilter() { // not a channel-specific preference; only at the app level Loading Loading
res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -9101,9 +9101,9 @@ Data usage charges may apply.</string> <!-- App Info > Notifications: Title for section controlling whether this app may show notifications in a promoted format [CHAR LIMIT=80] --> <string name="live_notifications">Live notifications</string> <!-- App Info > Notifications: Text on the switch to enable or disable an app from showing notifications in a live/promoted format [CHAR LIMIT=50] --> <string name="live_notifications_switch">Show live info</string> <string name="live_notifications_switch">Live updates</string> <!-- App Info > Notifications: Text accompanying the "Show live info" switch explaining the purpose of the setting --> <string name="live_notifications_desc">Pinned notifications display live info from apps, and always appear on the status bar and lock screen</string> <string name="live_notifications_desc">Display ongoing, time-sensitive notifications on the status bar and lock screen</string> <!-- Configure Notifications: Title for the notification bubbles option. [CHAR LIMIT=60] --> <string name="notification_bubbles_title">Bubbles</string>
src/com/android/settings/notification/app/PromotedNotificationsPreferenceController.java +30 −1 Original line number Diff line number Diff line Loading @@ -15,8 +15,12 @@ */ package com.android.settings.notification.app; import android.Manifest; import android.app.Flags; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; import androidx.annotation.NonNull; import androidx.preference.Preference; Loading @@ -24,9 +28,11 @@ import androidx.preference.Preference; import com.android.settings.notification.NotificationBackend; import com.android.settingslib.RestrictedSwitchPreference; public class PromotedNotificationsPreferenceController extends NotificationPreferenceController implements Preference.OnPreferenceChangeListener { protected static final String KEY_PROMOTED_SWITCH = "promoted_switch"; private static final String TAG = "PromotedNotiPrefCon"; public PromotedNotificationsPreferenceController(@NonNull Context context, @NonNull NotificationBackend backend) { Loading @@ -44,9 +50,32 @@ public class PromotedNotificationsPreferenceController extends if (!Flags.uiRichOngoing()) { return false; } return super.isAvailable(); return isPermissionRequested() && super.isAvailable(); } private boolean isPermissionRequested() { if (!Flags.apiRichOngoingPermission()) { return true; } try { PackageInfo packageInfo = mPm.getPackageInfo( mAppRow.pkg, PackageManager.GET_PERMISSIONS); for (String requestedPermission : packageInfo.requestedPermissions) { if (Manifest.permission.POST_PROMOTED_NOTIFICATIONS.equals(requestedPermission)) { return true; } } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "isPermissionRequested failed", e); } return false; } @Override boolean isIncludedInFilter() { // not a channel-specific preference; only at the app level Loading