ChargingControl: Add cancel toggle for limit done notification
Change-Id: I4f969ae87e1f9aa264113f044ee850def33ad20f
diff --git a/src/org/omnirom/omnilib/internal/health/ChargingControlController.java b/src/org/omnirom/omnilib/internal/health/ChargingControlController.java
index b8939ca..da65199 100644
--- a/src/org/omnirom/omnilib/internal/health/ChargingControlController.java
+++ b/src/org/omnirom/omnilib/internal/health/ChargingControlController.java
@@ -829,6 +829,15 @@
.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());
}