Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e5db13f authored by LuK1337's avatar LuK1337
Browse files

LineageParts: Discard all invalid bits when setting TRUST_WARNINGS value

Test: adb shell settings --lineage put secure trust_warnings 3
      then try to change the preference in settings.
Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/2435
Change-Id: Ieda259513fb51380ffb3216f33353f51c23f8ddc
parent 6d9b7c4f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -230,7 +230,8 @@ public class TrustPreferences extends SettingsPreferenceFragment {
                LineageSettings.Secure.TRUST_WARNINGS, TrustInterface.TRUST_WARN_MAX_VALUE);
        int newValue = value ? (original | feature) : (original & ~feature);
        boolean success = LineageSettings.Secure.putInt(getContext().getContentResolver(),
                LineageSettings.Secure.TRUST_WARNINGS, newValue);
                LineageSettings.Secure.TRUST_WARNINGS,
                newValue & TrustInterface.TRUST_WARN_MAX_VALUE);
        if (success && !value) {
            mInterface.removeNotificationForFeature(feature);
        }