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

Commit 53047194 authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

Lockscreen: Show redaction interstitial when swipe selected

If the user is switching from a secure lock screen to an insecure
one and they have chosen to redact sensitive/all notififcations,
show the RedactionInterstitial so the user has the option to change
this setting.

Change-Id: I2bcfd01fb322eb66a10a0f29feb9da696c524cdf
TICKET: YAM-103
parent 1a15dc2d
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Process;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.security.KeyStore;
import android.util.EventLog;
import android.util.Log;
@@ -46,6 +47,7 @@ import android.widget.ListView;
import android.widget.TextView;

import com.android.internal.widget.LockPatternUtils;
import com.android.settings.notification.RedactionInterstitial;

import java.util.List;

@@ -555,6 +557,7 @@ public class ChooseLockGeneric extends SettingsActivity {
            } else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
                mChooseLockSettingsHelper.utils().clearLock(false);
                mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
                maybeShowRedactionInterstitial();
                getActivity().setResult(Activity.RESULT_OK);
                finish();
            } else {
@@ -562,6 +565,22 @@ public class ChooseLockGeneric extends SettingsActivity {
            }
        }

        private void maybeShowRedactionInterstitial() {
            // do nothing if lock screen disabled
            if (mLockPatternUtils.isLockScreenDisabled()) return;

            final boolean enabled = Settings.Secure.getInt(getContentResolver(),
                    Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0;
            final boolean show = Settings.Secure.getInt(getContentResolver(),
                    Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1) != 0;
            if (!(enabled && show)) {
                Intent intent = RedactionInterstitial.createStartIntent(getActivity());
                if (intent != null) {
                    startActivity(intent);
                }
            }
        }

        @Override
        protected int getHelpResource() {
            return R.string.help_url_choose_lockscreen;