summaryrefslogtreecommitdiffstats
path: root/services/accessibility
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2014-10-14 09:54:26 -0700
committerSvetoslav <svetoslavganov@google.com>2014-10-21 14:45:53 -0700
commit3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb (patch)
tree764dfd933c0a80c42fd4214f375c456e6370e548 /services/accessibility
parentd00e68c3b6a4c727bd59a7e7c4524fb3fdd193f0 (diff)
downloadframeworks_base-3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb.zip
frameworks_base-3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb.tar.gz
frameworks_base-3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb.tar.bz2
APIs for an accessibility service to put interaction tracking overlays.
An accessibility service may register to observe the interactive windows on the primary display. These windows are the one that has input focus and ones a sighted user can touch. It is sometimes beneficial for an accessibility service to overlay a window to intercept user interaction and based on that introspect and perform an action on the windows that are on the screen. This is problematic as overlaying a full screen window that is touchable prevents the accessibility service to introspect the content under this window. This change adds a special type of window that only an accessibility service can place which does not affect what an accessibility service can "see" on the screen. Hence, even putting such a window full screen the service will be able to interact with the other interactive windows it covers. Change-Id: I053ccc3a5c6360a98dc40bdb172b54dab35d8b31
Diffstat (limited to 'services/accessibility')
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index e1a74d1..2781890 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1040,7 +1040,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void addServiceLocked(Service service, UserState userState) {
try {
- service.linkToOwnDeathLocked();
+ service.onAdded();
userState.mBoundServices.add(service);
userState.mComponentNameToServiceMap.put(service.mComponentName, service);
} catch (RemoteException re) {
@@ -1056,7 +1056,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private void removeServiceLocked(Service service, UserState userState) {
userState.mBoundServices.remove(service);
userState.mComponentNameToServiceMap.remove(service.mComponentName);
- service.unlinkToOwnDeathLocked();
+ service.onRemoved();
}
/**
@@ -1931,6 +1931,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
final ResolveInfo mResolveInfo;
+ final IBinder mOverlayWindowToken = new Binder();
+
// the events pending events to be dispatched to this service
final SparseArray<AccessibilityEvent> mPendingEvents =
new SparseArray<>();
@@ -2112,7 +2114,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
userState.mBindingServices.remove(mComponentName);
mWasConnectedAndDied = false;
try {
- mServiceInterface.setConnection(this, mId);
+ mServiceInterface.init(this, mId, mOverlayWindowToken);
onUserStateChangedLocked(userState);
} catch (RemoteException re) {
Slog.w(LOG_TAG, "Error while setting connection for service: "
@@ -2602,6 +2604,27 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
/* do nothing - #binderDied takes care */
}
+ public void onAdded() throws RemoteException {
+ linkToOwnDeathLocked();
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mWindowManagerService.addWindowToken(mOverlayWindowToken,
+ WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ public void onRemoved() {
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mWindowManagerService.removeWindowToken(mOverlayWindowToken, true);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ unlinkToOwnDeathLocked();
+ }
+
public void linkToOwnDeathLocked() throws RemoteException {
mService.linkToDeath(this, 0);
}
@@ -2614,7 +2637,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
try {
// Clear the proxy in the other process so this
// IAccessibilityServiceConnection can be garbage collected.
- mServiceInterface.setConnection(null, mId);
+ mServiceInterface.init(null, mId, null);
} catch (RemoteException re) {
/* ignore */
}
@@ -3164,6 +3187,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
return AccessibilityWindowInfo.TYPE_SYSTEM;
}
+ case WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY: {
+ return AccessibilityWindowInfo.TYPE_ACCESSIBILITY_OVERLAY;
+ }
+
default: {
return -1;
}