changing language for security screen regarding trust agents
and fixing a bug with multiple trust agents. Change-Id: I14ee45110a20124d8f9ed2dc80214aff4dc521d3
This commit is contained in:
@@ -696,6 +696,8 @@
|
|||||||
<string name="lock_after_timeout">Automatically lock</string>
|
<string name="lock_after_timeout">Automatically lock</string>
|
||||||
<!-- Security settings screen, setting option summary to change screen timeout -->
|
<!-- Security settings screen, setting option summary to change screen timeout -->
|
||||||
<string name="lock_after_timeout_summary"><xliff:g id="timeout_string">%1$s</xliff:g> after sleep</string>
|
<string name="lock_after_timeout_summary"><xliff:g id="timeout_string">%1$s</xliff:g> after sleep</string>
|
||||||
|
<!-- Security settings screen, setting option summary to change screen timeout, with additional explanation-->
|
||||||
|
<string name="lock_after_timeout_summary_with_exception"><xliff:g id="timeout_string">%1$s</xliff:g> after sleep, except when kept unlocked by <xliff:g id="trust_agent_name">%2$s</xliff:g></string>
|
||||||
<!-- Text shown next to checkbox for showing owner info on LockScreen [CHAR LIMIT=50]-->
|
<!-- Text shown next to checkbox for showing owner info on LockScreen [CHAR LIMIT=50]-->
|
||||||
<string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string>
|
<string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string>
|
||||||
<!-- Text shown for title of owner info setting [CHAR LIMIT=20]-->
|
<!-- Text shown for title of owner info setting [CHAR LIMIT=20]-->
|
||||||
@@ -2578,6 +2580,8 @@
|
|||||||
<string name="lockpattern_settings_enable_tactile_feedback_title">Vibrate on touch</string>
|
<string name="lockpattern_settings_enable_tactile_feedback_title">Vibrate on touch</string>
|
||||||
<!-- Security & location settings screen, setting check box title. This controls whether the device locks immediately when the power button is pressed. [CHAR LIMIT=28]-->
|
<!-- Security & location settings screen, setting check box title. This controls whether the device locks immediately when the power button is pressed. [CHAR LIMIT=28]-->
|
||||||
<string name="lockpattern_settings_enable_power_button_instantly_locks">Power button instantly locks</string>
|
<string name="lockpattern_settings_enable_power_button_instantly_locks">Power button instantly locks</string>
|
||||||
|
<!-- Security & location settings screen, setting optional summary when a trust agent is enabled-->
|
||||||
|
<string name="lockpattern_settings_power_button_instantly_locks_summary">Except when kept unlocked by <xliff:g id="trust_agent_name">%1$s</xliff:g></string>
|
||||||
<!-- Security & location settings screen, setting option name when user has never set an unlock pattern -->
|
<!-- Security & location settings screen, setting option name when user has never set an unlock pattern -->
|
||||||
<string name="lockpattern_settings_choose_lock_pattern">Set unlock pattern</string>
|
<string name="lockpattern_settings_choose_lock_pattern">Set unlock pattern</string>
|
||||||
<!-- Security & location settings screen, setting option name when user has previously set an unlock pattern and wants to change to a new pattern -->
|
<!-- Security & location settings screen, setting option name when user has previously set an unlock pattern and wants to change to a new pattern -->
|
||||||
|
@@ -115,6 +115,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private boolean mIsPrimary;
|
private boolean mIsPrimary;
|
||||||
|
|
||||||
|
private Preference mClickedTrustAgentPreference;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -207,6 +209,41 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trust Agent preferences
|
||||||
|
PreferenceGroup securityCategory = (PreferenceGroup)
|
||||||
|
root.findPreference(KEY_SECURITY_CATEGORY);
|
||||||
|
if (securityCategory != null) {
|
||||||
|
PackageManager pm = getPackageManager();
|
||||||
|
List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
|
||||||
|
PackageManager.GET_META_DATA);
|
||||||
|
List<ComponentName> enabledTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
|
||||||
|
if (enabledTrustAgents != null && !enabledTrustAgents.isEmpty()) {
|
||||||
|
for (ResolveInfo resolveInfo : resolveInfos) {
|
||||||
|
if (resolveInfo.serviceInfo == null) continue;
|
||||||
|
if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
|
||||||
|
TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
|
||||||
|
TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
|
||||||
|
if (trustAgentComponentInfo.componentName == null ||
|
||||||
|
!enabledTrustAgents.contains(
|
||||||
|
TrustAgentUtils.getComponentName(resolveInfo)) ||
|
||||||
|
TextUtils.isEmpty(trustAgentComponentInfo.title)) continue;
|
||||||
|
Preference trustAgentPreference =
|
||||||
|
new Preference(securityCategory.getContext());
|
||||||
|
trustAgentPreference.setKey(KEY_TRUST_AGENT);
|
||||||
|
trustAgentPreference.setTitle(trustAgentComponentInfo.title);
|
||||||
|
trustAgentPreference.setSummary(trustAgentComponentInfo.summary);
|
||||||
|
// Create intent for this preference.
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setComponent(trustAgentComponentInfo.componentName);
|
||||||
|
intent.setAction(Intent.ACTION_MAIN);
|
||||||
|
trustAgentPreference.setIntent(intent);
|
||||||
|
// Add preference to the settings menu.
|
||||||
|
securityCategory.addPreference(trustAgentPreference);
|
||||||
|
break; // Only render the first one.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// lock after preference
|
// lock after preference
|
||||||
mLockAfter = (ListPreference) root.findPreference(KEY_LOCK_AFTER_TIMEOUT);
|
mLockAfter = (ListPreference) root.findPreference(KEY_LOCK_AFTER_TIMEOUT);
|
||||||
if (mLockAfter != null) {
|
if (mLockAfter != null) {
|
||||||
@@ -224,13 +261,19 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
// lock instantly on power key press
|
// lock instantly on power key press
|
||||||
mPowerButtonInstantlyLocks = (CheckBoxPreference) root.findPreference(
|
mPowerButtonInstantlyLocks = (CheckBoxPreference) root.findPreference(
|
||||||
KEY_POWER_INSTANTLY_LOCKS);
|
KEY_POWER_INSTANTLY_LOCKS);
|
||||||
|
Preference trustAgentPreference = root.findPreference(KEY_TRUST_AGENT);
|
||||||
|
if (mPowerButtonInstantlyLocks != null &&
|
||||||
|
trustAgentPreference != null &&
|
||||||
|
trustAgentPreference.getTitle().length() > 0) {
|
||||||
|
mPowerButtonInstantlyLocks.setSummary(getString(
|
||||||
|
R.string.lockpattern_settings_power_button_instantly_locks_summary,
|
||||||
|
trustAgentPreference.getTitle()));
|
||||||
|
}
|
||||||
|
|
||||||
// don't display visible pattern if biometric and backup is not pattern
|
// don't display visible pattern if biometric and backup is not pattern
|
||||||
if (resid == R.xml.security_settings_biometric_weak &&
|
if (resid == R.xml.security_settings_biometric_weak &&
|
||||||
mLockPatternUtils.getKeyguardStoredPasswordQuality() !=
|
mLockPatternUtils.getKeyguardStoredPasswordQuality() !=
|
||||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||||
PreferenceGroup securityCategory = (PreferenceGroup)
|
|
||||||
root.findPreference(KEY_SECURITY_CATEGORY);
|
|
||||||
if (securityCategory != null && mVisiblePattern != null) {
|
if (securityCategory != null && mVisiblePattern != null) {
|
||||||
securityCategory.removePreference(root.findPreference(KEY_VISIBLE_PATTERN));
|
securityCategory.removePreference(root.findPreference(KEY_VISIBLE_PATTERN));
|
||||||
}
|
}
|
||||||
@@ -308,41 +351,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
mToggleVerifyApps.setEnabled(false);
|
mToggleVerifyApps.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trust Agent preferences
|
|
||||||
PreferenceGroup securityCategory = (PreferenceGroup)
|
|
||||||
root.findPreference(KEY_SECURITY_CATEGORY);
|
|
||||||
if (securityCategory != null) {
|
|
||||||
PackageManager pm = getPackageManager();
|
|
||||||
List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
|
|
||||||
PackageManager.GET_META_DATA);
|
|
||||||
List<ComponentName> enabledTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
|
|
||||||
if (enabledTrustAgents != null && !enabledTrustAgents.isEmpty()) {
|
|
||||||
for (ResolveInfo resolveInfo : resolveInfos) {
|
|
||||||
if (resolveInfo.serviceInfo == null) continue;
|
|
||||||
if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
|
|
||||||
TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
|
|
||||||
TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
|
|
||||||
if (trustAgentComponentInfo.componentName == null ||
|
|
||||||
!enabledTrustAgents.contains(
|
|
||||||
TrustAgentUtils.getComponentName(resolveInfo)) ||
|
|
||||||
TextUtils.isEmpty(trustAgentComponentInfo.title)) continue;
|
|
||||||
Preference trustAgentPreference =
|
|
||||||
new Preference(securityCategory.getContext());
|
|
||||||
trustAgentPreference.setKey(KEY_TRUST_AGENT);
|
|
||||||
trustAgentPreference.setTitle(trustAgentComponentInfo.title);
|
|
||||||
trustAgentPreference.setSummary(trustAgentComponentInfo.summary);
|
|
||||||
// Create intent for this preference.
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setComponent(trustAgentComponentInfo.componentName);
|
|
||||||
intent.setAction(Intent.ACTION_MAIN);
|
|
||||||
trustAgentPreference.setIntent(intent);
|
|
||||||
// Add preference to the settings menu.
|
|
||||||
securityCategory.addPreference(trustAgentPreference);
|
|
||||||
break; // Only render the first one.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +447,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
best = i;
|
best = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary, entries[best]));
|
|
||||||
|
Preference preference = getPreferenceScreen().findPreference(KEY_TRUST_AGENT);
|
||||||
|
if (preference != null && preference.getTitle().length() > 0) {
|
||||||
|
mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary_with_exception,
|
||||||
|
entries[best], preference.getTitle()));
|
||||||
|
} else {
|
||||||
|
mLockAfter.setSummary(getString(R.string.lock_after_timeout_summary, entries[best]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableUnusableTimeouts(long maxTimeout) {
|
private void disableUnusableTimeouts(long maxTimeout) {
|
||||||
@@ -562,9 +577,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
} else if (KEY_TRUST_AGENT.equals(key)) {
|
} else if (KEY_TRUST_AGENT.equals(key)) {
|
||||||
ChooseLockSettingsHelper helper =
|
ChooseLockSettingsHelper helper =
|
||||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||||
if (!helper.launchConfirmationActivity(CHANGE_TRUST_AGENT_SETTINGS, null, null)) {
|
mClickedTrustAgentPreference = preference;
|
||||||
|
if (!helper.launchConfirmationActivity(CHANGE_TRUST_AGENT_SETTINGS, null, null) &&
|
||||||
|
preference.getIntent() != null) {
|
||||||
// If this returns false, it means no password confirmation is required.
|
// If this returns false, it means no password confirmation is required.
|
||||||
startActivity(preference.getIntent());
|
startActivity(preference.getIntent());
|
||||||
|
mClickedTrustAgentPreference = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we didn't handle it, let preferences handle it.
|
// If we didn't handle it, let preferences handle it.
|
||||||
@@ -597,12 +615,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
// because mBiometricWeakLiveliness could be null
|
// because mBiometricWeakLiveliness could be null
|
||||||
return;
|
return;
|
||||||
} else if (requestCode == CHANGE_TRUST_AGENT_SETTINGS && resultCode == Activity.RESULT_OK) {
|
} else if (requestCode == CHANGE_TRUST_AGENT_SETTINGS && resultCode == Activity.RESULT_OK) {
|
||||||
Preference preference = getPreferenceScreen().findPreference(KEY_TRUST_AGENT);
|
if (mClickedTrustAgentPreference != null) {
|
||||||
if (preference != null) {
|
Intent intent = mClickedTrustAgentPreference.getIntent();
|
||||||
Intent intent = preference.getIntent();
|
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
mClickedTrustAgentPreference = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createPreferenceHierarchy();
|
createPreferenceHierarchy();
|
||||||
|
Reference in New Issue
Block a user