summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Janis Danisevskis <jdanis@google.com> 2020-01-22 15:56:14 -0800
committer Janis Danisevskis <jdanis@google.com> 2020-01-23 08:17:39 -0800
commit227dddf91046a3ca8a2dc1b2dceffd7cd89ef289 (patch)
treeba2c129c4992393f09c3eb5e701f550e3ef8a01a
parent8afb2bf120847f56b9e488624e5e527227e2c134 (diff)
ConfirmationPrompt: Use default values for UIOptions
ConfirmationPrompt passes magnified and inverted options to the keystore service. While gathering the accessibility_display_inversion_enabled setting, the implementation would throw an exception if this setting was never set by the user. This causes the font scaling property to be ignored. This patch uses default values in case the system setting is not set. Test: Run CTSVerifier Protected Confirmation test with increased font size. Merged-In: I03a3ef56209c73ca7d2b2527a5f145f744148e38 Change-Id: I03a3ef56209c73ca7d2b2527a5f145f744148e38
-rw-r--r--core/java/android/security/ConfirmationPrompt.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/core/java/android/security/ConfirmationPrompt.java b/core/java/android/security/ConfirmationPrompt.java
index 5330cffee3db..f67af85d00e3 100644
--- a/core/java/android/security/ConfirmationPrompt.java
+++ b/core/java/android/security/ConfirmationPrompt.java
@@ -212,20 +212,16 @@ public class ConfirmationPrompt {
private int getUiOptionsAsFlags() {
int uiOptionsAsFlags = 0;
- try {
- ContentResolver contentResolver = mContext.getContentResolver();
- int inversionEnabled = Settings.Secure.getInt(contentResolver,
- Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
- if (inversionEnabled == 1) {
- uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_INVERTED_FLAG;
- }
- float fontScale = Settings.System.getFloat(contentResolver,
- Settings.System.FONT_SCALE);
- if (fontScale > 1.0) {
- uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_MAGNIFIED_FLAG;
- }
- } catch (SettingNotFoundException e) {
- Log.w(TAG, "Unexpected SettingNotFoundException");
+ ContentResolver contentResolver = mContext.getContentResolver();
+ int inversionEnabled = Settings.Secure.getInt(contentResolver,
+ Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0);
+ if (inversionEnabled == 1) {
+ uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_INVERTED_FLAG;
+ }
+ float fontScale = Settings.System.getFloat(contentResolver,
+ Settings.System.FONT_SCALE, (float) 1.0);
+ if (fontScale > 1.0) {
+ uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_MAGNIFIED_FLAG;
}
return uiOptionsAsFlags;
}