summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Casey Burkhardt <caseyburkhardt@google.com> 2015-02-12 14:07:55 -0800
committer Casey Burkhardt <caseyburkhardt@google.com> 2015-02-12 14:13:10 -0800
commitd29a1e47d44ac072502342c3b9f55e9870e914ba (patch)
treeee25f10ff1a94665c4e7ea3b45365eac6521270f
parenta673af77d95f4a3d46e5d71188256b27e06cc442 (diff)
Support circular magnification frame on circular devices
The magnification viewport expects its boundary to be a rectangular region, and always draws it as such. This change causes the indicator to draw as a circle on devices with circular displays. This also refactors the width of the indicator's frame to use a proper dimension resource and updates the width to 4dip. Bug:18242438 Change-Id: I1d86647b6d1ef84f5dd506f4141223ec050a79b5
-rw-r--r--core/res/res/values/dimens.xml3
-rwxr-xr-xcore/res/res/values/symbols.xml1
-rw-r--r--services/core/java/com/android/server/wm/AccessibilityController.java24
3 files changed, 23 insertions, 5 deletions
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 02fa128c550e..30ea7c1e18c4 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -304,6 +304,9 @@
<!-- Touch slop for the global toggle accessibility gesture -->
<dimen name="accessibility_touch_slop">80dip</dimen>
+ <!-- Width of the outline stroke used by the accessibility screen magnification indicator -->
+ <dimen name="accessibility_magnification_indicator_width">4dip</dimen>
+
<!-- Width of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_margin) -->
<dimen name="keyguard_security_width">320dp</dimen>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 77c981a98096..bd69fb0823a9 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -412,6 +412,7 @@
<java-symbol type="dimen" name="notification_badge_size" />
<java-symbol type="dimen" name="immersive_mode_cling_width" />
<java-symbol type="dimen" name="circular_display_mask_offset" />
+ <java-symbol type="dimen" name="accessibility_magnification_indicator_width" />
<java-symbol type="string" name="add_account_button_label" />
<java-symbol type="string" name="addToDictionary" />
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index 08754f9942a2..37ca0db39040 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -397,8 +397,6 @@ final class AccessibilityController {
private final class MagnifiedViewport {
- private static final int DEFAUTLT_BORDER_WIDTH_DIP = 5;
-
private final SparseArray<WindowState> mTempWindowStates =
new SparseArray<WindowState>();
@@ -411,6 +409,8 @@ final class AccessibilityController {
private final Region mMagnifiedBounds = new Region();
private final Region mOldMagnifiedBounds = new Region();
+ private final Path mCircularPath;
+
private final MagnificationSpec mMagnificationSpec = MagnificationSpec.obtain();
private final WindowManager mWindowManager;
@@ -425,12 +425,22 @@ final class AccessibilityController {
public MagnifiedViewport() {
mWindowManager = (WindowManager) mContext.getSystemService(Service.WINDOW_SERVICE);
- mBorderWidth = TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP, DEFAUTLT_BORDER_WIDTH_DIP,
- mContext.getResources().getDisplayMetrics());
+ mBorderWidth = mContext.getResources().getDimension(
+ com.android.internal.R.dimen.accessibility_magnification_indicator_width);
mHalfBorderWidth = (int) Math.ceil(mBorderWidth / 2);
mDrawBorderInset = (int) mBorderWidth / 2;
mWindow = new ViewportWindow(mContext);
+
+ if (mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_windowIsRound)) {
+ mCircularPath = new Path();
+ mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
+ final int centerXY = mTempPoint.x / 2;
+ mCircularPath.addCircle(centerXY, centerXY, centerXY, Path.Direction.CW);
+ } else {
+ mCircularPath = null;
+ }
+
recomputeBoundsLocked();
}
@@ -459,6 +469,10 @@ final class AccessibilityController {
Region availableBounds = mTempRegion1;
availableBounds.set(0, 0, screenWidth, screenHeight);
+ if (mCircularPath != null) {
+ availableBounds.setPath(mCircularPath, availableBounds);
+ }
+
Region nonMagnifiedBounds = mTempRegion4;
nonMagnifiedBounds.set(0, 0, 0, 0);