summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/accessibility/ScreenMagnifier.java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-10-05 19:34:40 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2012-10-05 19:39:26 -0700
commita7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4 (patch)
tree45ce002a91ee25ec3ee10b2c6345387977cbfe40 /services/java/com/android/server/accessibility/ScreenMagnifier.java
parent7ef38ea9e5ee1d2fd58e818f37191a589793e236 (diff)
downloadframeworks_base-a7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4.zip
frameworks_base-a7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4.tar.gz
frameworks_base-a7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4.tar.bz2
Screen magnification cannot be engaged in landscape on a phone.
1. The reason is that the screen magnifier computes that the whole screen is not magnifiable. The miscalculation was caused due to an incorrect assumption that the non-magnified area is only at the bottom. In fact, on a phone in landscape the non-magnified area is both on the right and at the bottom. This change adds a correct algorithm for computing the magnified region. 2. Increasing the delay for computing the magnified area when the keyguard goes away to allow all windows hidden by the keyguard to be shown. In rare occasions the previous delay was not long enough resulting in a state where the keyboard is considered a part of the magnified region. 3. Removed some dead code. bug:7293097 Change-Id: Ic5ff91977df8bcf4afd77071685c3eb20555d4f3
Diffstat (limited to 'services/java/com/android/server/accessibility/ScreenMagnifier.java')
-rw-r--r--services/java/com/android/server/accessibility/ScreenMagnifier.java31
1 files changed, 14 insertions, 17 deletions
diff --git a/services/java/com/android/server/accessibility/ScreenMagnifier.java b/services/java/com/android/server/accessibility/ScreenMagnifier.java
index 14762a1..92265ae 100644
--- a/services/java/com/android/server/accessibility/ScreenMagnifier.java
+++ b/services/java/com/android/server/accessibility/ScreenMagnifier.java
@@ -846,7 +846,6 @@ public final class ScreenMagnifier implements EventStreamTransformation {
private static final class DisplayContentObserver {
private static final int MESSAGE_SHOW_VIEWPORT_FRAME = 1;
- private static final int MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS = 2;
private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 3;
private static final int MESSAGE_ON_WINDOW_TRANSITION = 4;
private static final int MESSAGE_ON_ROTATION_CHANGED = 5;
@@ -892,7 +891,9 @@ public final class ScreenMagnifier implements EventStreamTransformation {
|| info.type == WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG
&& (transition == WindowManagerPolicy.TRANSIT_EXIT
|| transition == WindowManagerPolicy.TRANSIT_HIDE)) {
- mHandler.sendMessageDelayed(message, mLongAnimationDuration);
+ final long delay = (long) (2 * mLongAnimationDuration
+ * mWindowAnimationScale);
+ mHandler.sendMessageDelayed(message, delay);
} else {
message.sendToTarget();
}
@@ -1169,10 +1170,6 @@ public final class ScreenMagnifier implements EventStreamTransformation {
case MESSAGE_SHOW_VIEWPORT_FRAME: {
mViewport.setFrameShown(true, true);
} break;
- case MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS: {
- final boolean animate = message.arg1 == 1;
- mViewport.recomputeBounds(animate);
- } break;
case MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED: {
SomeArgs args = (SomeArgs) message.obj;
try {
@@ -1525,8 +1522,10 @@ public final class ScreenMagnifier implements EventStreamTransformation {
Rect magnifiedFrame = mTempRect1;
magnifiedFrame.set(0, 0, 0, 0);
- Rect notMagnifiedFrame = mTempRect2;
- notMagnifiedFrame.set(0, 0, 0, 0);
+ DisplayInfo displayInfo = mDisplayProvider.getDisplayInfo();
+
+ Rect availableFrame = mTempRect2;
+ availableFrame.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
ArrayList<WindowInfo> infos = mTempWindowInfoList;
infos.clear();
@@ -1541,18 +1540,16 @@ public final class ScreenMagnifier implements EventStreamTransformation {
if (info.type == WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY) {
continue;
}
+ Rect windowFrame = mTempRect3;
+ windowFrame.set(info.touchableRegion);
if (isWindowMagnified(info.type)) {
- Rect clippedFrame = mTempRect3;
- clippedFrame.set(info.touchableRegion);
- subtract(clippedFrame, notMagnifiedFrame);
- magnifiedFrame.union(clippedFrame);
+ magnifiedFrame.union(windowFrame);
+ magnifiedFrame.intersect(availableFrame);
} else {
- Rect clippedFrame = mTempRect3;
- clippedFrame.set(info.touchableRegion);
- subtract(clippedFrame, magnifiedFrame);
- notMagnifiedFrame.union(clippedFrame);
+ subtract(windowFrame, magnifiedFrame);
+ subtract(availableFrame, windowFrame);
}
- if (magnifiedFrame.bottom >= notMagnifiedFrame.top) {
+ if (availableFrame.equals(magnifiedFrame)) {
break;
}
}