Loading core/java/android/view/MagnificationSpec.java +3 −3 Original line number Diff line number Diff line Loading @@ -131,11 +131,11 @@ public class MagnificationSpec implements Parcelable { public String toString() { StringBuilder builder = new StringBuilder(); builder.append("<scale:"); builder.append(scale); builder.append(Float.toString(scale)); builder.append(",offsetX:"); builder.append(offsetX); builder.append(Float.toString(offsetX)); builder.append(",offsetY:"); builder.append(offsetY); builder.append(Float.toString(offsetY)); builder.append(">"); return builder.toString(); } Loading services/accessibility/java/com/android/server/accessibility/MagnificationController.java +46 −32 Original line number Diff line number Diff line Loading @@ -144,12 +144,18 @@ class MagnificationController { * @param updateSpec {@code true} to update the scale and center based on * the region bounds, {@code false} to leave them as-is */ public void setMagnifiedRegion(Region magnified, Region available, boolean updateSpec) { private void setMagnifiedRegion(Region magnified, Region available, boolean updateSpec) { synchronized (mLock) { boolean magnificationChanged = false; boolean boundsChanged = false; if (!mMagnifiedRegion.equals(magnified)) { mMagnifiedRegion.set(magnified); mMagnifiedRegion.getBounds(mMagnifiedBounds); boundsChanged = true; } mAvailableRegion.set(available); if (updateSpec) { final MagnificationSpec sentSpec = mSpecAnimationBridge.mSentMagnificationSpec; final float scale = sentSpec.scale; final float offsetX = sentSpec.offsetX; Loading @@ -160,11 +166,13 @@ class MagnificationController { + mMagnifiedBounds.left - offsetX) / scale; final float centerY = (mMagnifiedBounds.height() / 2.0f + mMagnifiedBounds.top - offsetY) / scale; if (updateSpec) { setScaleAndCenter(scale, centerX, centerY, false); } else { mAms.onMagnificationStateChanged(); mAms.notifyMagnificationChanged(mMagnifiedRegion, scale, centerX, centerY); magnificationChanged = setScaleAndCenterLocked( scale, centerX, centerY, false); } // If magnification changed we already notified for the change. if (boundsChanged && updateSpec && !magnificationChanged) { onMagnificationChangedLocked(); } } } Loading Loading @@ -327,20 +335,16 @@ class MagnificationController { */ public boolean reset(boolean animate) { synchronized (mLock) { return resetLocked(animate); } } private boolean resetLocked(boolean animate) { final MagnificationSpec spec = mCurrentMagnificationSpec; final boolean changed = !spec.isNop(); if (changed) { spec.clear(); onMagnificationChangedLocked(); } mSpecAnimationBridge.updateSentSpec(spec, animate); return changed; } } /** * Scales the magnified region around the specified pivot point, Loading Loading @@ -416,8 +420,8 @@ class MagnificationController { } } private boolean setScaleAndCenterLocked( float scale, float centerX, float centerY, boolean animate) { private boolean setScaleAndCenterLocked(float scale, float centerX, float centerY, boolean animate) { final boolean changed = updateMagnificationSpecLocked(scale, centerX, centerY); mSpecAnimationBridge.updateSentSpec(mCurrentMagnificationSpec, animate); return changed; Loading @@ -440,6 +444,12 @@ class MagnificationController { } } private void onMagnificationChangedLocked() { mAms.onMagnificationStateChanged(); mAms.notifyMagnificationChanged(mMagnifiedRegion, getScale(), getCenterX(), getCenterY()); } /** * Persists the current magnification scale to the current user's settings. */ Loading Loading @@ -524,6 +534,10 @@ class MagnificationController { changed = true; } if (changed) { onMagnificationChangedLocked(); } return changed; } Loading Loading
core/java/android/view/MagnificationSpec.java +3 −3 Original line number Diff line number Diff line Loading @@ -131,11 +131,11 @@ public class MagnificationSpec implements Parcelable { public String toString() { StringBuilder builder = new StringBuilder(); builder.append("<scale:"); builder.append(scale); builder.append(Float.toString(scale)); builder.append(",offsetX:"); builder.append(offsetX); builder.append(Float.toString(offsetX)); builder.append(",offsetY:"); builder.append(offsetY); builder.append(Float.toString(offsetY)); builder.append(">"); return builder.toString(); } Loading
services/accessibility/java/com/android/server/accessibility/MagnificationController.java +46 −32 Original line number Diff line number Diff line Loading @@ -144,12 +144,18 @@ class MagnificationController { * @param updateSpec {@code true} to update the scale and center based on * the region bounds, {@code false} to leave them as-is */ public void setMagnifiedRegion(Region magnified, Region available, boolean updateSpec) { private void setMagnifiedRegion(Region magnified, Region available, boolean updateSpec) { synchronized (mLock) { boolean magnificationChanged = false; boolean boundsChanged = false; if (!mMagnifiedRegion.equals(magnified)) { mMagnifiedRegion.set(magnified); mMagnifiedRegion.getBounds(mMagnifiedBounds); boundsChanged = true; } mAvailableRegion.set(available); if (updateSpec) { final MagnificationSpec sentSpec = mSpecAnimationBridge.mSentMagnificationSpec; final float scale = sentSpec.scale; final float offsetX = sentSpec.offsetX; Loading @@ -160,11 +166,13 @@ class MagnificationController { + mMagnifiedBounds.left - offsetX) / scale; final float centerY = (mMagnifiedBounds.height() / 2.0f + mMagnifiedBounds.top - offsetY) / scale; if (updateSpec) { setScaleAndCenter(scale, centerX, centerY, false); } else { mAms.onMagnificationStateChanged(); mAms.notifyMagnificationChanged(mMagnifiedRegion, scale, centerX, centerY); magnificationChanged = setScaleAndCenterLocked( scale, centerX, centerY, false); } // If magnification changed we already notified for the change. if (boundsChanged && updateSpec && !magnificationChanged) { onMagnificationChangedLocked(); } } } Loading Loading @@ -327,20 +335,16 @@ class MagnificationController { */ public boolean reset(boolean animate) { synchronized (mLock) { return resetLocked(animate); } } private boolean resetLocked(boolean animate) { final MagnificationSpec spec = mCurrentMagnificationSpec; final boolean changed = !spec.isNop(); if (changed) { spec.clear(); onMagnificationChangedLocked(); } mSpecAnimationBridge.updateSentSpec(spec, animate); return changed; } } /** * Scales the magnified region around the specified pivot point, Loading Loading @@ -416,8 +420,8 @@ class MagnificationController { } } private boolean setScaleAndCenterLocked( float scale, float centerX, float centerY, boolean animate) { private boolean setScaleAndCenterLocked(float scale, float centerX, float centerY, boolean animate) { final boolean changed = updateMagnificationSpecLocked(scale, centerX, centerY); mSpecAnimationBridge.updateSentSpec(mCurrentMagnificationSpec, animate); return changed; Loading @@ -440,6 +444,12 @@ class MagnificationController { } } private void onMagnificationChangedLocked() { mAms.onMagnificationStateChanged(); mAms.notifyMagnificationChanged(mMagnifiedRegion, getScale(), getCenterX(), getCenterY()); } /** * Persists the current magnification scale to the current user's settings. */ Loading Loading @@ -524,6 +534,10 @@ class MagnificationController { changed = true; } if (changed) { onMagnificationChangedLocked(); } return changed; } Loading