From a7d76511063114b27421aef20fe59dda12468c92 Mon Sep 17 00:00:00 2001 From: Joey Date: Wed, 13 Jun 2018 11:18:29 +0200 Subject: [PATCH] Trust: add action to disable alerts to notifications Change-Id: I39c60e87e511819aaac82e104d6495f363ccef0d Signed-off-by: Joey --- .../platform/internal/TrustInterfaceService.java | 16 ++++++++++++---- .../drawable/ic_trust_notification_manage.xml | 11 +++++++++++ lineage/res/res/values/strings.xml | 2 +- lineage/res/res/values/symbols.xml | 3 ++- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 lineage/res/res/drawable/ic_trust_notification_manage.xml diff --git a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java index e97730a0..201dc413 100644 --- a/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java +++ b/lineage/lib/main/java/org/lineageos/platform/internal/TrustInterfaceService.java @@ -106,16 +106,24 @@ public class TrustInterfaceService extends LineageSystemService { String title = mContext.getString(strings.first); String message = mContext.getString(strings.second); - Intent intent = new Intent(INTENT_PARTS); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0); + String action = mContext.getString(R.string.trust_notification_action_manage); + + Intent mainIntent = new Intent(INTENT_PARTS); + mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + PendingIntent pMainIntent = PendingIntent.getActivity(mContext, 0, mainIntent, 0); + + Intent actionIntent = new Intent(INTENT_PARTS); + actionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + actionIntent.putExtra(":settings:fragment_args_key", "trust_category_alerts"); + PendingIntent pActionIntent = PendingIntent.getActivity(mContext, 0, actionIntent, 0); Notification.Builder notification = new Notification.Builder(mContext, CHANNEL_NAME) .setContentTitle(title) .setContentText(message) .setStyle(new Notification.BigTextStyle().bigText(message)) .setAutoCancel(true) - .setContentIntent(pIntent) + .setContentIntent(pMainIntent) + .addAction(R.drawable.ic_trust_notification_manage, action, pActionIntent) .setColor(mContext.getColor(R.color.color_error)) .setSmallIcon(R.drawable.ic_warning); diff --git a/lineage/res/res/drawable/ic_trust_notification_manage.xml b/lineage/res/res/drawable/ic_trust_notification_manage.xml new file mode 100644 index 00000000..7b74acf7 --- /dev/null +++ b/lineage/res/res/drawable/ic_trust_notification_manage.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/lineage/res/res/values/strings.xml b/lineage/res/res/values/strings.xml index f44ed0ca..49ee5acd 100644 --- a/lineage/res/res/values/strings.xml +++ b/lineage/res/res/values/strings.xml @@ -191,5 +191,5 @@ An app is using the root privileges right now Discover Trust Get to know how to assure your device is safe - Not now + Manage alerts diff --git a/lineage/res/res/values/symbols.xml b/lineage/res/res/values/symbols.xml index cc646c69..4da0d3de 100644 --- a/lineage/res/res/values/symbols.xml +++ b/lineage/res/res/values/symbols.xml @@ -169,6 +169,7 @@ + @@ -178,7 +179,7 @@ - +