summaryrefslogtreecommitdiffstats
path: root/services/accessibility
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-07-16 15:12:15 -0700
committerChris Craik <ccraik@google.com>2014-07-16 18:25:23 -0700
commitcce47eb580d666ead1f6095d1e3b65233592bbaa (patch)
treebf41e1016cd8e311d44eeb0ecc9fecb11c3c2d39 /services/accessibility
parent5028fb035794c207698e52b276c54de109dd5022 (diff)
downloadframeworks_base-cce47eb580d666ead1f6095d1e3b65233592bbaa.zip
frameworks_base-cce47eb580d666ead1f6095d1e3b65233592bbaa.tar.gz
frameworks_base-cce47eb580d666ead1f6095d1e3b65233592bbaa.tar.bz2
Add accessibility text contrast setting
b/14624452 Adds a feature which draws all text (in the HW accelerated standard path) in a high contrast mode. Text is drawn at full alpha, and either white or black (depending on its original color) with a starkly contrasted outline beneath it. Change-Id: I943f624b6367de35367cced3b2a8298f2bc62377
Diffstat (limited to 'services/accessibility')
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java138
1 files changed, 60 insertions, 78 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index ee7eb9f..07bb713 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1443,6 +1443,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
somthingChanged |= readEnabledAccessibilityServicesLocked(userState);
somthingChanged |= readTouchExplorationGrantedAccessibilityServicesLocked(userState);
somthingChanged |= readTouchExplorationEnabledSettingLocked(userState);
+ somthingChanged |= readHighTextContrastEnabledSettingLocked(userState);
somthingChanged |= readEnhancedWebAccessibilityEnabledChangedLocked(userState);
somthingChanged |= readDisplayMagnificationEnabledSettingLocked(userState);
somthingChanged |= readDisplayColorAdjustmentSettingsLocked(userState);
@@ -1506,6 +1507,18 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
return displayAdjustmentsEnabled;
}
+ private boolean readHighTextContrastEnabledSettingLocked(UserState userState) {
+ final boolean highTextContrastEnabled = Settings.Secure.getIntForUser(
+ mContext.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, 0,
+ userState.mUserId) == 1;
+ if (highTextContrastEnabled != userState.mIsTextHighContrastEnabled) {
+ userState.mIsTextHighContrastEnabled = highTextContrastEnabled;
+ return true;
+ }
+ return false;
+ }
+
private void updateTouchExplorationLocked(UserState userState) {
boolean enabled = false;
final int serviceCount = userState.mBoundServices.size();
@@ -3586,6 +3599,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
public boolean mIsAccessibilityEnabled;
public boolean mIsTouchExplorationEnabled;
+ public boolean mIsTextHighContrastEnabled;
public boolean mIsEnhancedWebAccessibilityEnabled;
public boolean mIsDisplayMagnificationEnabled;
public boolean mIsFilterKeyEventsEnabled;
@@ -3622,6 +3636,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
if (mIsAccessibilityEnabled && mIsTouchExplorationEnabled) {
clientState |= AccessibilityManager.STATE_FLAG_TOUCH_EXPLORATION_ENABLED;
}
+ if (mIsTextHighContrastEnabled) {
+ clientState |= AccessibilityManager.STATE_FLAG_HIGH_TEXT_CONTRAST_ENABLED;
+ }
return clientState;
}
@@ -3687,9 +3704,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private final Uri mDisplayDaltonizerEnabledUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
+
private final Uri mDisplayDaltonizerUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER);
+ private final Uri mHighTextContrastUri = Settings.Secure.getUriFor(
+ Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED);
+
public AccessibilityContentObserver(Handler handler) {
super(handler);
}
@@ -3714,94 +3735,55 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
mDisplayDaltonizerEnabledUri, false, this, UserHandle.USER_ALL);
contentResolver.registerContentObserver(
mDisplayDaltonizerUri, false, this, UserHandle.USER_ALL);
+ contentResolver.registerContentObserver(
+ mHighTextContrastUri, false, this, UserHandle.USER_ALL);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
- if (mAccessibilityEnabledUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readAccessibilityEnabledSettingLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
- }
+ synchronized (mLock) {
+ // Profiles share the accessibility state of the parent. Therefore,
+ // we are checking for changes only the parent settings.
+ UserState userState = getCurrentUserStateLocked();
+
+ // We will update when the automation service dies.
+ if (userState.mUiAutomationService != null) {
+ return;
}
- } else if (mTouchExplorationEnabledUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readTouchExplorationEnabledSettingLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
+
+ if (mAccessibilityEnabledUri.equals(uri)) {
+ if (readAccessibilityEnabledSettingLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
- }
- } else if (mDisplayMagnificationEnabledUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readDisplayMagnificationEnabledSettingLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
+ } else if (mTouchExplorationEnabledUri.equals(uri)) {
+ if (readTouchExplorationEnabledSettingLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
- }
- } else if (mEnabledAccessibilityServicesUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readEnabledAccessibilityServicesLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
+ } else if (mDisplayMagnificationEnabledUri.equals(uri)) {
+ if (readDisplayMagnificationEnabledSettingLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
- }
- } else if (mTouchExplorationGrantedAccessibilityServicesUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readTouchExplorationGrantedAccessibilityServicesLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
+ } else if (mEnabledAccessibilityServicesUri.equals(uri)) {
+ if (readEnabledAccessibilityServicesLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
- }
- } else if (mEnhancedWebAccessibilityUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readEnhancedWebAccessibilityEnabledChangedLocked(userState)) {
- onUserStateChangedLocked(userState);
- }
+ } else if (mTouchExplorationGrantedAccessibilityServicesUri.equals(uri)) {
+ if (readTouchExplorationGrantedAccessibilityServicesLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
- }
- } else if (mDisplayInversionEnabledUri.equals(uri)
- || mDisplayDaltonizerEnabledUri.equals(uri)
- || mDisplayDaltonizerUri.equals(uri)) {
- synchronized (mLock) {
- // Profiles share the accessibility state of the parent. Therefore,
- // we are checking for changes only the parent settings.
- UserState userState = getCurrentUserStateLocked();
- // We will update when the automation service dies.
- if (userState.mUiAutomationService == null) {
- if (readDisplayColorAdjustmentSettingsLocked(userState)) {
- updateDisplayColorAdjustmentSettingsLocked(userState);
- }
+ } else if (mEnhancedWebAccessibilityUri.equals(uri)) {
+ if (readEnhancedWebAccessibilityEnabledChangedLocked(userState)) {
+ onUserStateChangedLocked(userState);
+ }
+ } else if (mDisplayInversionEnabledUri.equals(uri)
+ || mDisplayDaltonizerEnabledUri.equals(uri)
+ || mDisplayDaltonizerUri.equals(uri)) {
+ if (readDisplayColorAdjustmentSettingsLocked(userState)) {
+ updateDisplayColorAdjustmentSettingsLocked(userState);
+ }
+ } else if (mHighTextContrastUri.equals(uri)) {
+ if (readHighTextContrastEnabledSettingLocked(userState)) {
+ onUserStateChangedLocked(userState);
}
}
}