Trust: Request removal of the notification when disabling the preference
* Right now, nothing requests the removal of the notification
* This means, that disabling the preference still leaves us with the
notification
* By notifying the service of the user action, the notification gets
cancelled properly
Change-Id: I26d23f3dde582dbc923faaa558d5f0bf00d49035
diff --git a/src/org/lineageos/lineageparts/trust/TrustPreferences.java b/src/org/lineageos/lineageparts/trust/TrustPreferences.java
index 8a7f6cb..670fcad 100644
--- a/src/org/lineageos/lineageparts/trust/TrustPreferences.java
+++ b/src/org/lineageos/lineageparts/trust/TrustPreferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 The LineageOS Project
+ * Copyright (C) 2018-2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -229,8 +229,12 @@
int original = LineageSettings.Secure.getInt(getContext().getContentResolver(),
LineageSettings.Secure.TRUST_WARNINGS, TrustInterface.TRUST_WARN_MAX_VALUE);
int newValue = value ? (original | feature) : (original & ~feature);
- return LineageSettings.Secure.putInt(getContext().getContentResolver(),
+ boolean success = LineageSettings.Secure.putInt(getContext().getContentResolver(),
LineageSettings.Secure.TRUST_WARNINGS, newValue);
+ if (success && !value) {
+ mInterface.removeNotificationForFeature(feature);
+ }
+ return success;
}