Skip to content

Commit ee44fae

Browse files
committed
Prevent out of range magnification scale to be persisted.
1. If a bad magnification scale is persisted, i.e. it is not between the min and max, the screen magnifier gets into a bad state which even a reboot does not fix since the scale is persisted in settings. This change ensures that only valid scales are presisted. In general a bad value should not be attempted to be persisted but at this point this is the safest change. bug:7288239 Change-Id: I3e9c7c091772fa64128ab8403c2127ce65cb94b8
1 parent 9aefa14 commit ee44fae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

services/java/com/android/server/accessibility/ScreenMagnifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ public void onMotionEvent(MotionEvent event) {
376376
}
377377
if (event.getActionMasked() == MotionEvent.ACTION_UP) {
378378
clear();
379-
final float scale = mMagnificationController.getScale();
379+
final float scale = Math.min(Math.max(mMagnificationController.getScale(),
380+
MIN_SCALE), MAX_SCALE);
380381
if (scale != getPersistedScale()) {
381382
persistScale(scale);
382383
}

0 commit comments

Comments
 (0)