History log of /frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1fdbaa100c00e7e93db6f96f8ff9327a0aad968c 03-Oct-2013 Svetoslav <svetoslavganov@google.com> Fix screen magnifier scaling due to ScaleGestureDetector changes.

The scale gesture detector has a new behavior to make onScale
callbacks during swipe after a double tap. The screen magnification
is triggered after a trippe tap so if the user trippe taps and
holds to do a temporary magnification and tries to change the
zoom level with another finger, erroneous results are obtained.

The ScaleGestureDetector uses an APIs level check for the new
behavior but the ScreenMagnifier is a platform feature. We now
explicitly ask for the old behavior.

bug:11033376

Change-Id: I0dfb14dd3abcaa34ad1f40447c631b4203797378
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
545252f4fde6fbb70b07e97a120c7d1405758017 11-Dec-2012 Svetoslav Ganov <svetoslavganov@google.com> Refactoring of the screen magnification feature.

1. This patch takes care of the case where a magnified window is covering an unmagnigied
one. One example is a dialog that covers the IME window.

bug:7634430

2. Ensuring that the UI automator tool can connect and correctly dump the screen.

bug:7694696

3. Removed the partial implementation for multi display magnification. It adds
unnecessary complexity since it cannot be implemented without support for
input from multiple screens. We will revisit when necessary.

4. Moved the magnified border window as a surface in the window manager.

5. Moved the mediator APIs on the window manager and the policy methods on the
WindowManagerPolicy.

6. Implemented batch event processing for the accessibility input filter.

Change-Id: I4ebf68b94fb07201e124794f69611ece388ec116
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
152e9bb81aa5b2ab4637f4b2dae04b3ce89fa891 13-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Refactoring of the screen magnification feature.

1. The screen magnification feature was implemented entirely as a part of the accessibility
manager. To achieve that the window manager had to implement a bunch of hooks for an
external client to observe its internal state. This was problematic since it dilutes
the window manager interface and allows code that is deeply coupled with the window
manager to reside outside of it. Also the observer callbacks were IPCs which cannot
be called with the window manager's lock held. To avoid that the window manager had
to post messages requesting notification of interested parties which makes the code
consuming the callbacks to run asynchronously of the window manager. This causes timing
issues and adds unnecessary complexity.

Now the magnification logic is split in two halves. The first half that is responsible
to track the magnified portion of the screen and serve as a policy which windows can be
magnified and it is a part of the window manager. This part exposes higher level APIs
allowing interested parties with the right permissions to control the magnification
of a given display. The APIs also allow a client to be registered for callbacks on
interesting changes such as resize of the magnified region, etc. This part servers
as a mediator between magnification controllers and the window manager.

The second half is a controller that is responsible to drive the magnification
state based on touch interactions. It also presents a highlight when magnified to
suggest the magnified potion of the screen. The controller is responsible for auto
zooming out in case the user context changes - rotation, new actitivity. The controller
also auto pans if a dialog appears and it does not interesect the magnified frame.

bug:7410464

2. By design screen magnification and touch exploration work separately and together. If
magnification is enabled the user sees a larger version of the widgets and a sub section
of the screen content. Accessibility services use the introspection APIs to "see" what
is on the screen so they can speak it, navigate to the next item in response to a
gesture, etc. Hence, the information returned to accessibility services has to reflect
what a sighted user would see on the screen. Therefore, if the screen is magnified
we need to adjust the bounds and position of the infos describing views in a magnified
window such that the info bounds are equivalent to what the user sees.

To improve performance we keep accessibility node info caches in the client process.
However, when magnification state changes we have to clear these caches since the
bounds of the cached infos no longer reflect the screen content which just got smaller
or larger.

This patch propagates not only the window scale as before but also the X/Y pan and the
bounds of the magnified portion of the screen to the introspected app. This information
is used to adjust the bounds of the node infos coming from this window such that the
reported bounds are the same as the user sees not as the app thinks they are. Note that
if magnification is enabled we zoom the content and pan it along the X and Y axis. Also
recomputed is the isVisibleToUser property of the reported info since in a magnified
state the user sees a subset of the window content and the views not in the magnified
viewport should be reported as not visible to the user.

bug:7344059

Change-Id: I6f7832c7a6a65c5368b390eb1f1518d0c7afd7d2
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
ff6c329f61ea4f00d9cbbe55387adbc2050f4679 19-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot pan in browser if magnification is enabled.

1. We cache some events to see if the user wants to trigger magnification. If no
magnification is triggered we inject these events with adjusted time and down
time to prevent subsequent transformations being confused by stale events.
After the cached events, which always have a down, are injected we need to also
update the down time of all subsequent non cached events.

bug:7379388

Change-Id: I41d8b831cc1016a0ee8f9c5ef5f42eb60a6f64d9
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
444e8aabc12994316315688cc3674a432424adb9 18-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Magnifier not respecting RTL/LTR direction and keyguard dialogs not properly centered.

1. When magnifier, if a dialog that popped up is wider than the scree we pan to its upper
left corner. We now show the upper right corner if the locale direction is RTL.

2. Keyguard dialogs are not centered since they are used as a sign to recompute the
magnified area but an unnecessary else statement prevents such dialogs from being
properly show via a pan.

bug:7374331

Change-Id: I285e46b822a29f0082c502cb642f9da32dabfe6a
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
72e351296046d61ecc5863da2faca0ab4ba0fd62 17-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Long press not working if explore by touch and magnification are on.

1. In the magnifier we are caching the touch events until we figure
out whether the user is triple tapping to enable magnification.
If the user is not trying to engage magnification we deliver the
stashed events. However, these events are stale and the subsequent
transformations such as the touch explorer get confused when trying
to detect a tap since the delay is longer than the tap slop.
This change compensates for the time the events were cached
before sending them to the next transformation in the chain.

bug:7362365

Change-Id: Idd8539ffed7ba4892c5a916bd34910fd2ef50f75
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
55468c64bc4f3c4b16bf144f66907d75bb656b0a 16-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Occasionally triple tap on the keyboard toggles screen magnification.

1. Sometimes unlocking the device when the IME is up and triple tapping on the keyboard
toggles screen magnification. The core reason is that when the kayguard window is
shown we hide all other windows and when it is hidden we show these windows. We did
not notify the screen magnifier for windows being shown and hidden. Also when the
windows are shown we may reassign layers to put the IME or the wallpaper in the
right Z order. The screen magnifier is now notified upon such layer reassignment
since window layers are used when computing the magnified region.

bug:7351531

Change-Id: I0931f4ba6cfa565d8eb1e3c432268ba1818feea6
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
0ea16037c7b6db95b3c23180bd88bdf431bf54a3 11-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification does not auto-pan when fragment dialog pops up.

1. We auto pan when certain type of window pop up to make sure the user
knows about the context change. This does not happen however for
fragment dialog since its window type is not in the list of one
we auto pan for. Updating the window type list.

bug:7332090

Change-Id: I9b097c57df929d2e4e807a948c3a0540f4092a76
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
ee44fae19664594d4a17dd86723106533f4b218a 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> 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
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
f81dc4c08b2985ef369134b73e1b383b8284e912 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Screen magnification cannot be engaged in landscape on a phone." into jb-mr1-dev
a7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> 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
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
88400d3a31139c40c4014faf86c243647087ef6c 30-Sep-2012 Craig Mautner <cmautner@google.com> Add flag for displaying non-user's Windows to user.

Created a new flag that indicates that a window should be shown
to all users. For the flag to be valid the owner of the window
must have system permissions.

Also separated system window types into those that show to all
users (e.g. StatusBar, Keyguard, ....) and those that appear only
to the owning users (e.g. Drag, ANR, TOAST, ...). Those that appear
only to their owner can override their default behavior using
the new flag (e.g. LowBattery).

Fixes bug 7211965.

Change-Id: I1fdca25d57b7b523f0c7f8bceb819af656c388d4
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
6e2bee75cea415621165698fdd9ce857bbb8872e 01-Oct-2012 Jeff Sharkey <jsharkey@android.com> Migrate more System and Secure settings to Global.

Includes telephony, WindowManager, PackageManager, and debugging
settings. Update API to point towards moved values.

Bug: 7231764, 7231252, 7231156
Change-Id: I5828747205708872f19f83a5bc821ed0a801cb79
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
45af84a483165f06c04d74baba67f90da29c6ad2 02-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Touch explorer and magnifier do not work well together.

1. If tocuh exploration and screen magnification are enabled and the screen
is currently magnified, gesture detection does not work well. The reason
is because we are transforming the events if the screen is magnified before
passing them to the touch explorer to compensate for the magnification so
the user can poke what he thinks he pokes. However, when doing gesture
detection/velocity computing this compensating shrinks the gestured shape/
decreases velocity leading to poor gesture reco/incorrect velocity.

This change adds a onRawMotionEvent method in the event transformation chain
which will process the raw touch events. In this method of the touch explorer
we are passing events to the gesture recognized and the velocity tracker.

2. Velocity tracker was not cleared on transitions out of touch exploring state
which is the only one that uses velocity.

bug:7266617

Change-Id: I7887fe5f3c3bb6cfa203b7866a145c7341098a02
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
187f3f94901001792328b40366b434135e3f1dde 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Magnified frame not properly computed when keyguard goes away.

1. The keyguard force hides some windows when it is shown and as soon
as the keyguard goes away there windows are made visible. However,
the window transition that the keyguard is moving away is reported
before the force hidden windows are shown which makes the screen
magnifier compute the magnified region with an incomplete list of
windows of interest.

bug:7215285

Change-Id: I3abc4d97b7a74de8183ad20477dadf66c82da037
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
3e1476a697ad94e638867361a6caba0ede77cb33 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding a scaling threshold in ScreenMagnifier

Change-Id: I1fdd7c93de571a61d88d7386c5c2a423a6b83fb9
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
d420e3ac94afea65173fd0ae43e13dfa6948bff9 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Refactoring the scale and pan detection in the ScreenMagnifier.

Change-Id: I8560f53f88ef0c9244e2b48d40119574cacb544f
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
9b4125e435b6bc8f8bd2f6e569d9b0b296ab16ef 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnifier should handle window rebuilds correctly.

1. The way for computing the magnified region was simplistic and
incorrect. It was ignoring window layering resulting in broken
behavior. For example, if the IME is up, then the everything else
is magnifed and the IME not. Now the keyguard appears and covers
the IME but the magnified region does not expand while it would
since the keyguard completely covers the not magnified IME window.

bug:7138937

Change-Id: I21414635aefab700ce75d40f3e913c1472cba202
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
36e614c110dad174dea6017eb701f55339aee200 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification should disengage on screen off.

1. When the screen goes off the user will be in a completely
different context upon turning the screen on. Therefore,
if magnification auto update is enabled magnification
will be disengaged on screen off.

bug:7139088

Change-Id: I790cfa5b3cf31d34e95fc9548e6246a84096c37b
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
86fe9e14f1a816df32b08e0eb677989cc7444948 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Reducing the click delay while screen magnification is enabled.

1. If screen magnification is enabled the user has to triple tap
and lift or triple tap and hold to engage magnification. Hence,
we delay the touch events until we are sure that it is no longer
possible for the user to perform a multi-tap to engage
magnification. While such a delay is unavoidable it feels a
bit longer than it should be. This change reduces the delay
between taps to be considered a multi-tap, essentially making
the click delay shorter.

bug:7139918

Change-Id: I2100945171fff99600766193f0effdaef1f1db8f
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
662538957f12a7b7c534382a6a4f306d5777375b 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Scaling in viewport moving state locks into a magnified state.

1. If the user changes the magnification level while moving the
viewport the magnification is locked. The gesture handle has
to put device back into a viewport moving state if this was
the last state.

bug:7139363

Change-Id: I24992b973bb15624580114353b004efdb35c2faa
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
6d04712d15e4fe9b44b0d9accf073f5a7f1d334a 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Allow simultaneous scale and pan in magnified state.

1. Before in magnified state the user was able to only scale or
pan. Based on user input this change allows performing pan
or scale or both. If the user scales more than a threshold
we are performing a scale and independently of that if the
use pans more than a threshold we are performing a pan.

bug:7138928

Change-Id: Ic1511500ba3369091dcfd070669d3e4f0286fbe5
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
0c381504a8fce293b3b9ef8ad0333849c43eb6a4 10-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Improve scaling vs pan in screen magnifier.

1. Due to frequent changes of the behavior of ScaleGestureDetector
this patch rolls in a gesture detector used for changing the
screen magnification level. It has an improved algorithm which
uses the diameter of min circle around the points as the span, the
center of this circle as the focal point, and the average slop
of the lines from each pointer to the center to determine the
angle of the diameter used when computing the span x and y.

Change-Id: I5cee8dba84032a0702016b8f9632f78139024bbe
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
add52a975aa78d9e24d3e63a8168c00a9bfb80ec 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Viewport should zoom out when screen magnification is disabled.

1. If screen magnification is disabled when the screen is in a
magnified state we have to zoom out since otherwise the user
is stuck in a magnified state without ability to pan/zoom/
toggle magnification which renders the device useless.

bug:7131030

Change-Id: I8f3339f31310448ec8742f3101c1fdc61a6a5f83
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
5b1720e11d3d5a23c4b0406e1c51e8cd8275f25f 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Viewport should zoom out when screen magnification is disabled." into jb-mr1-dev
6d0df874ce235872bd5fdd4d3bce0905869a099d 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Viewport should zoom out when screen magnification is disabled.

1. If screen magnification is disabled when the screen is in a
magnified state we have to zoom out since otherwise the user
is stuck in a magnified state without ability to pan/zoom/
toggle magnification which renders the device useless.

bug:7131030

Change-Id: Ia620954fbd594e7cd470e43b89d9ed04c0397c3c
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
2cee686498c6141f5a68532ecb79f598e043ec7e 08-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing off by one error in the ScreenMagnifier.

Change-Id: Ia0ccfb6b354b7a18633e7cf26647c6436ebf5c08
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java
1cf70bbf96930662cab0e699d70b62865766ff52 06-Aug-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification - feature - framework.

This change is the initial check in of the screen magnification
feature. This feature enables magnification of the screen via
global gestures (assuming it has been enabled from settings)
to allow a low vision user to efficiently use an Android device.

Interaction model:

1. Triple tap toggles permanent screen magnification which is magnifying
the area around the location of the triple tap. One can think of the
location of the triple tap as the center of the magnified viewport.
For example, a triple tap when not magnified would magnify the screen
and leave it in a magnified state. A triple tapping when magnified would
clear magnification and leave the screen in a not magnified state.

2. Triple tap and hold would magnify the screen if not magnified and enable
viewport dragging mode until the finger goes up. One can think of this
mode as a way to move the magnified viewport since the area around the
moving finger will be magnified to fit the screen. For example, if the
screen was not magnified and the user triple taps and holds the screen
would magnify and the viewport will follow the user's finger. When the
finger goes up the screen will clear zoom out. If the same user interaction
is performed when the screen is magnified, the viewport movement will
be the same but when the finger goes up the screen will stay magnified.
In other words, the initial magnified state is sticky.

3. Pinching with any number of additional fingers when viewport dragging
is enabled, i.e. the user triple tapped and holds, would adjust the
magnification scale which will become the current default magnification
scale. The next time the user magnifies the same magnification scale
would be used.

4. When in a permanent magnified state the user can use two or more fingers
to pan the viewport. Note that in this mode the content is panned as
opposed to the viewport dragging mode in which the viewport is moved.

5. When in a permanent magnified state the user can use three or more
fingers to change the magnification scale which will become the current
default magnification scale. The next time the user magnifies the same
magnification scale would be used.

6. The magnification scale will be persisted in settings and in the cloud.

Note: Since two fingers are used to pan the content in a permanently magnified
state no other two finger gestures in touch exploration or applications
will work unless the uses zooms out to normal state where all gestures
works as expected. This is an intentional tradeoff to allow efficient
panning since in a permanently magnified state this would be the dominant
action to be performed.

Design:

1. The window manager exposes APIs for setting accessibility transformation
which is a scale and offsets for X and Y axis. The window manager queries
the window policy for which windows will not be magnified. For example,
the IME windows and the navigation bar are not magnified including windows
that are attached to them.

2. The accessibility features such a screen magnification and touch
exploration are now impemented as a sequence of transformations on the
event stream. The accessibility manager service may request each
of these features or both. The behavior of the features is not changed
based on the fact that another one is enabled.

3. The screen magnifier keeps a viewport of the content that is magnified
which is surrounded by a glow in a magnified state. Interactions outside
of the viewport are delegated directly to the application without
interpretation. For example, a triple tap on the letter 'a' of the IME
would type three letters instead of toggling magnified state. The viewport
is updated on screen rotation and on window transitions. For example,
when the IME pops up the viewport shrinks.

4. The glow around the viewport is implemented as a special type of window
that does not take input focus, cannot be touched, is laid out in the
screen coordiates with width and height matching these of the screen.
When the magnified region changes the root view of the window draws the
hightlight but the size of the window does not change - unless a rotation
happens. All changes in the viewport size or showing or hiding it are
animated.

5. The viewport is encapsulated in a class that knows how to show,
hide, and resize the viewport - potentially animating that.
This class uses the new animation framework for animations.

6. The magnification is handled by a magnification controller that
keeps track of the current trnasformation to be applied to the screen
content and the desired such. If these two are not the same it is
responsibility of the magnification controller to reconcile them by
potentially animating the transition from one to the other.

7. A dipslay content observer wathces for winodw transitions, screen
rotations, and when a rectange on the screen has been reqeusted. This
class is responsible for handling interesting state changes such
as changing the viewport bounds on IME pop up or screen rotation,
panning the content to make a requested rectangle visible on the
screen, etc.

8. To implement viewport updates the window manger was updated with APIs
to watch for window transitions and when a rectangle has been requested
on the screen. These APIs are protected by a signature level permission.
Also a parcelable and poolable window info class has been added with
APIs for getting the window info given the window token. This enables
getting some useful information about a window. There APIs are also
signature protected.

bug:6795382

Change-Id: Iec93da8bf6376beebbd4f5167ab7723dc7d9bd00
/frameworks/base/services/java/com/android/server/accessibility/ScreenMagnifier.java