diff options
author | Roman Birg <roman@cyngn.com> | 2016-01-08 16:29:34 -0800 |
---|---|---|
committer | Roman Birg <roman@cyngn.com> | 2016-01-13 13:00:57 -0800 |
commit | c971ae3f9f34b0b4ca5aabacb6de7e1afb9f320d (patch) | |
tree | 804146c614568f36785bb01d53f23f320cae1919 /src/com/android/settings/SecuritySettings.java | |
parent | 19aa1dc65643f782045e645a6934bb666a4aabf2 (diff) | |
download | packages_apps_Settings-c971ae3f9f34b0b4ca5aabacb6de7e1afb9f320d.zip packages_apps_Settings-c971ae3f9f34b0b4ca5aabacb6de7e1afb9f320d.tar.gz packages_apps_Settings-c971ae3f9f34b0b4ca5aabacb6de7e1afb9f320d.tar.bz2 |
Settings: show warning in lock screen settings when disabled by qs
Tapping the setting will re-enable the lock screen.
Ref: CYNGNOS-1513
Change-Id: Ifbd53fb3d1cd199c85dedb0d96b01e8f29e7c024
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'src/com/android/settings/SecuritySettings.java')
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index a500520..699f5de 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -61,6 +61,7 @@ import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Index; import com.android.settings.search.Indexable; import com.android.settings.search.SearchIndexableRaw; +import cyanogenmod.providers.CMSettings; import java.util.ArrayList; import java.util.List; @@ -94,6 +95,8 @@ public class SecuritySettings extends SettingsPreferenceFragment private static final String KEY_MANAGE_TRUST_AGENTS = "manage_trust_agents"; private static final String KEY_FINGERPRINT_SETTINGS = "fingerprint_settings"; + private static final String KEY_LOCKSCREEN_ENABLED_INTERNAL = "lockscreen_enabled_internally"; + private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123; private static final int CHANGE_TRUST_AGENT_SETTINGS = 126; @@ -150,6 +153,8 @@ public class SecuritySettings extends SettingsPreferenceFragment private Preference mOwnerInfoPref; private int mFilterType = TYPE_SECURITY_EXTRA; + private Preference mLockscreenDisabledPreference; + @Override protected int getMetricsCategory() { return MetricsLogger.SECURITY; @@ -234,6 +239,16 @@ public class SecuritySettings extends SettingsPreferenceFragment // Add options for device encryption mIsPrimary = MY_USER_ID == UserHandle.USER_OWNER; + if (CMSettings.Secure.getIntForUser(getContentResolver(), + CMSettings.Secure.LOCKSCREEN_INTERNALLY_ENABLED, 1, UserHandle.USER_OWNER) != 1) { + // lock screen is disabled by quick settings tile, let the user know!~ + mLockscreenDisabledPreference = new Preference(getActivity()); + mLockscreenDisabledPreference.setKey(KEY_LOCKSCREEN_ENABLED_INTERNAL); + mLockscreenDisabledPreference.setTitle(R.string.lockscreen_disabled_by_qs_tile_title); + mLockscreenDisabledPreference.setSummary(R.string.lockscreen_disabled_by_qs_tile_summary); + root.addPreference(mLockscreenDisabledPreference); + } + if (mFilterType == TYPE_LOCKSCREEN_EXTRA) { // Add options for lock/unlock screen final int resid = getResIdForLockUnlockScreen(getActivity(), mLockPatternUtils); @@ -705,11 +720,18 @@ public class SecuritySettings extends SettingsPreferenceFragment mTrustAgentClickIntent = preference.getIntent(); boolean confirmationLaunched = helper.launchConfirmationActivity( CHANGE_TRUST_AGENT_SETTINGS, preference.getTitle()); - if (!confirmationLaunched&& mTrustAgentClickIntent != null) { + if (!confirmationLaunched && mTrustAgentClickIntent != null) { // If this returns false, it means no password confirmation is required. startActivity(mTrustAgentClickIntent); mTrustAgentClickIntent = null; } + } else if (KEY_LOCKSCREEN_ENABLED_INTERNAL.equals(key)) { + CMSettings.Secure.putIntForUser(getActivity().getContentResolver(), + CMSettings.Secure.LOCKSCREEN_INTERNALLY_ENABLED, + 1, UserHandle.USER_CURRENT); + mLockscreenDisabledPreference.setEnabled(false); + mLockscreenDisabledPreference.setSummary( + R.string.lockscreen_disabled_by_qs_tile_summary_enabled); } else { // If we didn't handle it, let preferences handle it. return super.onPreferenceTreeClick(preferenceScreen, preference); |