Merge "Support circular magnification frame on circular devices" into lmp-mr1-modular-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6f2dd8a9b1
@@ -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>
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user