public abstract class AccessibilityService extends android.app.Service {
ctor public AccessibilityService();
+ method public final void disableSelf();
method public final boolean dispatchGesture(android.accessibilityservice.GestureDescription, android.accessibilityservice.AccessibilityService.GestureResultCallback, android.os.Handler);
method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
method public final android.accessibilityservice.AccessibilityService.MagnificationController getMagnificationController();
public abstract class AccessibilityService extends android.app.Service {
ctor public AccessibilityService();
+ method public final void disableSelf();
method public final boolean dispatchGesture(android.accessibilityservice.GestureDescription, android.accessibilityservice.AccessibilityService.GestureResultCallback, android.os.Handler);
method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
method public final android.accessibilityservice.AccessibilityService.MagnificationController getMagnificationController();
public abstract class AccessibilityService extends android.app.Service {
ctor public AccessibilityService();
+ method public final void disableSelf();
method public final boolean dispatchGesture(android.accessibilityservice.GestureDescription, android.accessibilityservice.AccessibilityService.GestureResultCallback, android.os.Handler);
method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
method public final android.accessibilityservice.AccessibilityService.MagnificationController getMagnificationController();
}
/**
+ * This method allows accessibility service turn itself off
+ * and the service will become disabled from the Settings.
+ */
+ public final void disableSelf() {
+ final IAccessibilityServiceConnection connection =
+ AccessibilityInteractionClient.getInstance().getConnection(mConnectionId);
+ if (connection != null) {
+ try {
+ connection.disableSelf();
+ } catch (RemoteException re) {
+ throw new RuntimeException(re);
+ }
+ }
+ }
+
+ /**
* Returns the magnification controller, which may be used to query and
* modify the state of display magnification.
* <p>
boolean performGlobalAction(int action);
+ oneway void disableSelf();
+
oneway void setOnKeyEventResult(boolean handled, int sequence);
float getMagnificationScale();
return true;
}
+ @Override
+ public void disableSelf() {
+ synchronized(mLock) {
+ UserState userState = getUserStateLocked(mUserId);
+ if (userState.mEnabledServices.remove(mComponentName)) {
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ persistComponentNamesToSettingLocked(
+ Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ userState.mEnabledServices, mUserId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ onUserStateChangedLocked(userState);
+ }
+ }
+ }
+
public boolean canReceiveEventsLocked() {
return (mEventTypes != 0 && mFeedbackType != 0 && mService != null);
}