diff options
Diffstat (limited to 'core/java')
6 files changed, 41 insertions, 30 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index a09607a..41a3eac 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -75,6 +75,17 @@ public class AccessibilityServiceInfo implements Parcelable { public static final int FEEDBACK_GENERIC = 0x0000010; /** + * Mask for all feedback types. + * + * @see #FEEDBACK_SPOKEN + * @see #FEEDBACK_HAPTIC + * @see #FEEDBACK_AUDIBLE + * @see #FEEDBACK_VISUAL + * @see #FEEDBACK_GENERIC + */ + public static final int FEEDBACK_ALL_MASK = 0xFFFFFFFF; + + /** * If an {@link AccessibilityService} is the default for a given type. * Default service is invoked only if no package specific one exists. In case of * more than one package specific service only the earlier registered is notified. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 6ebbe7c..cd4e32e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2688,11 +2688,9 @@ public final class Settings { public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; /** - * If touch exploration is requested. Touch exploration is enabled if it is - * requested by this setting, accessibility is enabled and there is at least - * one enabled accessibility serivce that provides spoken feedback. + * If touch exploration is enabled. */ - public static final String TOUCH_EXPLORATION_REQUESTED = "touch_exploration_requested"; + public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; /** * List of the enabled accessibility providers. diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index 83c73cb..a80c2a7 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -67,13 +67,17 @@ public final class AccessibilityManager { private static final String LOG_TAG = "AccessibilityManager"; + /** @hide */ + public static final int STATE_FLAG_ACCESSIBILITY_ENABLED = 0x00000001; + + /** @hide */ + public static final int STATE_FLAG_TOUCH_EXPLORATION_ENABLED = 0x00000002; + static final Object sInstanceSync = new Object(); private static AccessibilityManager sInstance; - private static final int DO_SET_ACCESSIBILITY_ENABLED = 10; - - private static final int DO_SET_TOUCH_EXPLORATION_ENABLED = 20; + private static final int DO_SET_STATE = 10; final IAccessibilityManager mService; @@ -100,13 +104,8 @@ public final class AccessibilityManager { } final IAccessibilityManagerClient.Stub mClient = new IAccessibilityManagerClient.Stub() { - public void setEnabled(boolean enabled) { - mHandler.obtainMessage(DO_SET_ACCESSIBILITY_ENABLED, enabled ? 1 : 0, 0).sendToTarget(); - } - - public void setTouchExplorationEnabled(boolean enabled) { - mHandler.obtainMessage(DO_SET_TOUCH_EXPLORATION_ENABLED, - enabled ? 1 : 0, 0).sendToTarget(); + public void setState(int state) { + mHandler.obtainMessage(DO_SET_STATE, state, 0).sendToTarget(); } }; @@ -119,14 +118,8 @@ public final class AccessibilityManager { @Override public void handleMessage(Message message) { switch (message.what) { - case DO_SET_ACCESSIBILITY_ENABLED : - final boolean isAccessibilityEnabled = (message.arg1 == 1); - setAccessibilityState(isAccessibilityEnabled); - return; - case DO_SET_TOUCH_EXPLORATION_ENABLED : - synchronized (mHandler) { - mIsTouchExplorationEnabled = (message.arg1 == 1); - } + case DO_SET_STATE : + setState(message.arg1); return; default : Log.w(LOG_TAG, "Unknown message type: " + message.what); @@ -163,8 +156,8 @@ public final class AccessibilityManager { mService = service; try { - final boolean isEnabled = mService.addClient(mClient); - setAccessibilityState(isEnabled); + final int stateFlags = mService.addClient(mClient); + setState(stateFlags); } catch (RemoteException re) { Log.e(LOG_TAG, "AccessibilityManagerService is dead", re); } @@ -341,6 +334,17 @@ public final class AccessibilityManager { } /** + * Sets the current state. + * + * @param stateFlags The state flags. + */ + private void setState(int stateFlags) { + final boolean accessibilityEnabled = (stateFlags & STATE_FLAG_ACCESSIBILITY_ENABLED) != 0; + setAccessibilityState(accessibilityEnabled); + mIsTouchExplorationEnabled = (stateFlags & STATE_FLAG_TOUCH_EXPLORATION_ENABLED) != 0; + } + + /** * Sets the enabled state. * * @param isEnabled The accessibility state. diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 0e04471..6469b35 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -294,14 +294,14 @@ public class AccessibilityNodeInfo implements Parcelable { } /** - * Gets the unique id identifying this node's parent. + * Gets the parent. * <p> * <strong>Note:</strong> It is a client responsibility to recycle the * received info by calling {@link AccessibilityNodeInfo#recycle()} * to avoid creating of multiple instances. * </p> * - * @return The node's patent id. + * @return The parent. */ public AccessibilityNodeInfo getParent() { enforceSealed(); diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl index b14f02a..c621ff6 100644 --- a/core/java/android/view/accessibility/IAccessibilityManager.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl @@ -34,7 +34,7 @@ import android.view.IWindow; */ interface IAccessibilityManager { - boolean addClient(IAccessibilityManagerClient client); + int addClient(IAccessibilityManagerClient client); boolean sendAccessibilityEvent(in AccessibilityEvent uiEvent); diff --git a/core/java/android/view/accessibility/IAccessibilityManagerClient.aidl b/core/java/android/view/accessibility/IAccessibilityManagerClient.aidl index 4e69692..5e7e813 100644 --- a/core/java/android/view/accessibility/IAccessibilityManagerClient.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManagerClient.aidl @@ -24,7 +24,5 @@ package android.view.accessibility; */ oneway interface IAccessibilityManagerClient { - void setEnabled(boolean enabled); - - void setTouchExplorationEnabled(boolean enabled); + void setState(int stateFlags); } |