Trust: add action to disable alerts to notifications
Change-Id: I39c60e87e511819aaac82e104d6495f363ccef0d Signed-off-by: Joey <joey@lineageos.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
11
lineage/res/res/drawable/ic_trust_notification_manage.xml
Normal file
11
lineage/res/res/drawable/ic_trust_notification_manage.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M3,18 L3,18 C3,18.55,3.45,19,4,19 L9,19 L9,17 L4,17 C3.45,17,3,17.45,3,18 Z M3,6 L3,6 C3,6.55,3.45,7,4,7 L13,7 L13,5 L4,5 C3.45,5,3,5.45,3,6 Z M13,20 L13,19 L20,19 C20.55,19,21,18.55,21,18 L21,18 C21,17.45,20.55,17,20,17 L13,17 L13,16 C13,15.45,12.55,15,12,15 L12,15 C11.45,15,11,15.45,11,16 L11,20 C11,20.55,11.45,21,12,21 L12,21 C12.55,21,13,20.55,13,20 Z M7,10 L7,11 L4,11 C3.45,11,3,11.45,3,12 L3,12 C3,12.55,3.45,13,4,13 L7,13 L7,14 C7,14.55,7.45,15,8,15 L8,15 C8.55,15,9,14.55,9,14 L9,10 C9,9.45,8.55,9,8,9 L8,9 C7.45,9,7,9.45,7,10 Z M21,12 L21,12 C21,11.45,20.55,11,20,11 L11,11 L11,13 L20,13 C20.55,13,21,12.55,21,12 Z M16,9 L16,9 C16.55,9,17,8.55,17,8 L17,7 L20,7 C20.55,7,21,6.55,21,6 L21,6 C21,5.45,20.55,5,20,5 L17,5 L17,4 C17,3.45,16.55,3,16,3 L16,3 C15.45,3,15,3.45,15,4 L15,8 C15,8.55,15.45,9,16,9 Z" />
|
||||
</vector>
|
||||
@@ -191,5 +191,5 @@
|
||||
<string name="trust_notification_content_root">An app is using the root privileges right now</string>
|
||||
<string name="trust_notification_title_onboarding">Discover Trust</string>
|
||||
<string name="trust_notification_content_onboarding">Get to know how to assure your device is safe</string>
|
||||
<string name="trust_notification_action_later">Not now</string>
|
||||
<string name="trust_notification_action_manage">Manage alerts</string>
|
||||
</resources>
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
<!-- Trust interface -->
|
||||
<java-symbol type="bool" name="config_trustLegacyEncryption" />
|
||||
<java-symbol type="drawable" name="ic_trust" />
|
||||
<java-symbol type="drawable" name="ic_trust_notification_manage" />
|
||||
<java-symbol type="drawable" name="ic_warning" />
|
||||
<java-symbol type="string" name="trust_feature_name" />
|
||||
<java-symbol type="string" name="trust_notification_channel" />
|
||||
@@ -178,7 +179,7 @@
|
||||
<java-symbol type="string" name="trust_notification_content_root" />
|
||||
<java-symbol type="string" name="trust_notification_title_onboarding" />
|
||||
<java-symbol type="string" name="trust_notification_content_onboarding" />
|
||||
<java-symbol type="string" name="trust_notification_action_later" />
|
||||
<java-symbol type="string" name="trust_notification_action_manage" />
|
||||
|
||||
<!-- Full screen aspect ratio -->
|
||||
<java-symbol type="bool" name="config_haveHigherAspectRatioScreen" />
|
||||
|
||||
Reference in New Issue
Block a user