Merge "Showing battery saver notifications in secondary profiles." into qt-dev

am: e666a46e36

Change-Id: Id6514d69c8b0050942bd6787ee650f017efb9a82
This commit is contained in:
Kweku Adams
2019-05-24 17:10:36 -07:00
committed by android-build-merger

View File

@@ -791,11 +791,12 @@ public class BatterySaverStateMachine {
ensureNotificationChannelExists(manager, DYNAMIC_MODE_NOTIF_CHANNEL_ID,
R.string.dynamic_mode_notification_channel_name);
manager.notify(DYNAMIC_MODE_NOTIFICATION_ID,
manager.notifyAsUser(TAG, DYNAMIC_MODE_NOTIFICATION_ID,
buildNotification(DYNAMIC_MODE_NOTIF_CHANNEL_ID,
mContext.getResources().getString(R.string.dynamic_mode_notification_title),
R.string.dynamic_mode_notification_summary,
Intent.ACTION_POWER_USAGE_SUMMARY));
Intent.ACTION_POWER_USAGE_SUMMARY),
UserHandle.ALL);
}
@VisibleForTesting
@@ -806,12 +807,13 @@ public class BatterySaverStateMachine {
final String percentage = NumberFormat.getPercentInstance()
.format((double) mBatteryLevel / 100.0);
manager.notify(STICKY_AUTO_DISABLED_NOTIFICATION_ID,
manager.notifyAsUser(TAG, STICKY_AUTO_DISABLED_NOTIFICATION_ID,
buildNotification(BATTERY_SAVER_NOTIF_CHANNEL_ID,
mContext.getResources().getString(
R.string.battery_saver_charged_notification_title, percentage),
R.string.battery_saver_off_notification_summary,
Settings.ACTION_BATTERY_SAVER_SETTINGS));
Settings.ACTION_BATTERY_SAVER_SETTINGS),
UserHandle.ALL);
}
private void ensureNotificationChannelExists(NotificationManager manager,
@@ -819,6 +821,7 @@ public class BatterySaverStateMachine {
NotificationChannel channel = new NotificationChannel(
channelId, mContext.getText(nameId), NotificationManager.IMPORTANCE_DEFAULT);
channel.setSound(null, null);
channel.setBlockableSystem(true);
manager.createNotificationChannel(channel);
}