Skip to content

Commit

Permalink
ChargingControl: Add cancel toggle for limit done notification
Browse files Browse the repository at this point in the history
Change-Id: I4f969ae87e1f9aa264113f044ee850def33ad20f
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
  • Loading branch information
hellobbn authored and bheatleyyy committed Sep 28, 2023
1 parent 0a45669 commit 2856713
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -828,6 +828,15 @@ private void postChargingDoneNotification(Long targetTime) {
.setSmallIcon(R.drawable.ic_charging_control)
.setOngoing(false);

if (targetTime == null) {
Intent cancelOnceIntent = new Intent(ACTION_CHARGING_CONTROL_CANCEL_ONCE);
PendingIntent cancelPendingIntent = PendingIntent.getBroadcast(mContext, 0,
cancelOnceIntent, PendingIntent.FLAG_IMMUTABLE);
notification.addAction(R.drawable.ic_charging_control,
mContext.getString(R.string.charging_control_notification_cancel_once),
cancelPendingIntent);
}

createNotificationChannelIfNeeded();
mNotificationManager.notify(CHARGING_CONTROL_NOTIFICATION_ID, notification.build());
}
Expand Down

0 comments on commit 2856713

Please sign in to comment.