Loading packages/SystemUI/res/values/cm_strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -133,4 +133,7 @@ <!-- Notify use that they are in Lock-to-app (for devices without navbar)--> <string name="screen_pinning_toast_no_navbar">To unpin this screen, touch & hold Back button</string> <!-- Channel name for Battery notifications --> <string name="battery_notification_channel_tv">Battery warning</string> </resources> packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +18 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.power; import android.app.KeyguardManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ActivityNotFoundException; Loading @@ -27,6 +28,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.media.AudioAttributes; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -80,6 +82,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private static final String TAG = PowerUI.TAG + ".Notification"; private static final boolean DEBUG = PowerUI.DEBUG; private static final String BATTERY_NOTIF_CHANNEL_ID_TV = "powernotifications.battery.tv"; private static final String TAG_BATTERY = "low_battery"; private static final String TAG_TEMPERATURE = "high_temp"; private static final String TAG_AUTO_SAVER = "auto_saver"; Loading Loading @@ -167,6 +171,13 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { mKeyguard = mContext.getSystemService(KeyguardManager.class); mReceiver.init(); mActivityStarter = activityStarter; if (isTv()) { // TV-specific notification channel mNoMan.createNotificationChannel(new NotificationChannel(BATTERY_NOTIF_CHANNEL_ID_TV, mContext.getString(R.string.battery_notification_channel_tv), NotificationManager.IMPORTANCE_HIGH)); } } @Override Loading Loading @@ -234,6 +245,10 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } } private boolean isTv() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); } private void showInvalidChargerNotification() { final Notification.Builder nb = new Notification.Builder(mContext, NotificationChannels.ALERTS) Loading Loading @@ -277,7 +292,9 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setOnlyAlertOnce(true) .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) .setStyle(new Notification.BigTextStyle().bigText(contentText)) .setVisibility(Notification.VISIBILITY_PUBLIC); .setVisibility(Notification.VISIBILITY_PUBLIC) .extend(new Notification.TvExtender() .setChannelId(BATTERY_NOTIF_CHANNEL_ID_TV)); if (hasBatterySettings()) { nb.setContentIntent(pendingBroadcast(ACTION_SHOW_BATTERY_SETTINGS)); } Loading Loading
packages/SystemUI/res/values/cm_strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -133,4 +133,7 @@ <!-- Notify use that they are in Lock-to-app (for devices without navbar)--> <string name="screen_pinning_toast_no_navbar">To unpin this screen, touch & hold Back button</string> <!-- Channel name for Battery notifications --> <string name="battery_notification_channel_tv">Battery warning</string> </resources>
packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +18 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.power; import android.app.KeyguardManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ActivityNotFoundException; Loading @@ -27,6 +28,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.media.AudioAttributes; import android.net.Uri; import android.os.Bundle; Loading Loading @@ -80,6 +82,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private static final String TAG = PowerUI.TAG + ".Notification"; private static final boolean DEBUG = PowerUI.DEBUG; private static final String BATTERY_NOTIF_CHANNEL_ID_TV = "powernotifications.battery.tv"; private static final String TAG_BATTERY = "low_battery"; private static final String TAG_TEMPERATURE = "high_temp"; private static final String TAG_AUTO_SAVER = "auto_saver"; Loading Loading @@ -167,6 +171,13 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { mKeyguard = mContext.getSystemService(KeyguardManager.class); mReceiver.init(); mActivityStarter = activityStarter; if (isTv()) { // TV-specific notification channel mNoMan.createNotificationChannel(new NotificationChannel(BATTERY_NOTIF_CHANNEL_ID_TV, mContext.getString(R.string.battery_notification_channel_tv), NotificationManager.IMPORTANCE_HIGH)); } } @Override Loading Loading @@ -234,6 +245,10 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { } } private boolean isTv() { return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); } private void showInvalidChargerNotification() { final Notification.Builder nb = new Notification.Builder(mContext, NotificationChannels.ALERTS) Loading Loading @@ -277,7 +292,9 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setOnlyAlertOnce(true) .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) .setStyle(new Notification.BigTextStyle().bigText(contentText)) .setVisibility(Notification.VISIBILITY_PUBLIC); .setVisibility(Notification.VISIBILITY_PUBLIC) .extend(new Notification.TvExtender() .setChannelId(BATTERY_NOTIF_CHANNEL_ID_TV)); if (hasBatterySettings()) { nb.setContentIntent(pendingBroadcast(ACTION_SHOW_BATTERY_SETTINGS)); } Loading