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

Commit 99901470 authored by Andrei Stingaceanu's avatar Andrei Stingaceanu
Browse files

Wire in device owner information into SecuritySettings

If the device owner information has been provisioned by device
policy client via the DevicePolicyManager then make the current
user info preference read only and add a summary to specify that
the preference has been disabled by the administrator.

Bug: 22547309
Change-Id: I14952abd2e022607b82ce4361cfa514549243045
parent 403638f1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -690,6 +690,8 @@
    <string name="cdma_security_settings_summary">Set My Location, screen unlock, credential storage lock</string>
    <!-- In the security screen, the header title for settings related to  Passwords-->
    <string name="security_passwords_title">Passwords</string>
    <!-- Summary for settings preference disabled by administrator [CHAR LIMIT=50] -->
    <string name="disabled_by_administrator_summary">Disabled by administrator</string>
    <!-- Fingerprint enrollment and settings --><skip />
    <!-- Title shown for menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
+18 −10
Original line number Diff line number Diff line
@@ -214,6 +214,9 @@ public class SecuritySettings extends SettingsPreferenceFragment

        mOwnerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
        if (mOwnerInfoPref != null) {
            mOwnerInfoPref.setEnabled(!mLockPatternUtils.isDeviceOwnerInfoEnabled());

            if (mOwnerInfoPref.isEnabled()) {
                mOwnerInfoPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
                    @Override
                    public boolean onPreferenceClick(Preference preference) {
@@ -222,6 +225,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
                    }
                });
            }
        }

        if (mIsAdmin) {
            if (LockPatternUtils.isDeviceEncryptionEnabled()) {
@@ -630,11 +634,15 @@ public class SecuritySettings extends SettingsPreferenceFragment

    public void updateOwnerInfo() {
        if (mOwnerInfoPref != null) {
            if (mLockPatternUtils.isDeviceOwnerInfoEnabled()) {
                mOwnerInfoPref.setSummary(R.string.disabled_by_administrator_summary);
            } else {
                mOwnerInfoPref.setSummary(mLockPatternUtils.isOwnerInfoEnabled(MY_USER_ID)
                        ? mLockPatternUtils.getOwnerInfo(MY_USER_ID)
                        : getString(R.string.owner_info_settings_summary));
            }
        }
    }

    @Override
    public boolean onPreferenceTreeClick(Preference preference) {