Loading core/java/android/view/accessibility/AccessibilityManager.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -353,7 +353,18 @@ public final class AccessibilityManager { return; return; } } if (!mIsEnabled) { if (!mIsEnabled) { throw new IllegalStateException("Accessibility off. Did you forget to check that?"); Looper myLooper = Looper.myLooper(); if (myLooper == Looper.getMainLooper()) { throw new IllegalStateException( "Accessibility off. Did you forget to check that?"); } else { // If we're not running on the thread with the main looper, it's possible for // the state of accessibility to change between checking isEnabled and // calling this method. So just log the error rather than throwing the // exception. Log.e(LOG_TAG, "Interrupt called with accessibility disabled"); return; } } } userId = mUserId; userId = mUserId; } } Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +16 −7 Original line number Original line Diff line number Diff line Loading @@ -538,7 +538,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override @Override public void interrupt(int userId) { public void interrupt(int userId) { CopyOnWriteArrayList<Service> services; List<IAccessibilityServiceClient> interfacesToInterrupt; synchronized (mLock) { synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below // share the accessibility state of the parent. The call below Loading @@ -549,15 +549,24 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) { return; return; } } services = getUserStateLocked(resolvedUserId).mBoundServices; List<Service> services = getUserStateLocked(resolvedUserId).mBoundServices; } int numServices = services.size(); for (int i = 0, count = services.size(); i < count; i++) { interfacesToInterrupt = new ArrayList<>(numServices); for (int i = 0; i < numServices; i++) { Service service = services.get(i); Service service = services.get(i); IBinder a11yServiceBinder = service.mService; IAccessibilityServiceClient a11yServiceInterface = service.mServiceInterface; if ((a11yServiceBinder != null) && (a11yServiceInterface != null)) { interfacesToInterrupt.add(a11yServiceInterface); } } } for (int i = 0, count = interfacesToInterrupt.size(); i < count; i++) { try { try { service.mServiceInterface.onInterrupt(); interfacesToInterrupt.get(i).onInterrupt(); } catch (RemoteException re) { } catch (RemoteException re) { Slog.e(LOG_TAG, "Error during sending interrupt request to " Slog.e(LOG_TAG, "Error sending interrupt request to " + service.mService, re); + interfacesToInterrupt.get(i), re); } } } } } } Loading Loading
core/java/android/view/accessibility/AccessibilityManager.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -353,7 +353,18 @@ public final class AccessibilityManager { return; return; } } if (!mIsEnabled) { if (!mIsEnabled) { throw new IllegalStateException("Accessibility off. Did you forget to check that?"); Looper myLooper = Looper.myLooper(); if (myLooper == Looper.getMainLooper()) { throw new IllegalStateException( "Accessibility off. Did you forget to check that?"); } else { // If we're not running on the thread with the main looper, it's possible for // the state of accessibility to change between checking isEnabled and // calling this method. So just log the error rather than throwing the // exception. Log.e(LOG_TAG, "Interrupt called with accessibility disabled"); return; } } } userId = mUserId; userId = mUserId; } } Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +16 −7 Original line number Original line Diff line number Diff line Loading @@ -538,7 +538,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override @Override public void interrupt(int userId) { public void interrupt(int userId) { CopyOnWriteArrayList<Service> services; List<IAccessibilityServiceClient> interfacesToInterrupt; synchronized (mLock) { synchronized (mLock) { // We treat calls from a profile as if made by its parent as profiles // We treat calls from a profile as if made by its parent as profiles // share the accessibility state of the parent. The call below // share the accessibility state of the parent. The call below Loading @@ -549,15 +549,24 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { if (resolvedUserId != mCurrentUserId) { if (resolvedUserId != mCurrentUserId) { return; return; } } services = getUserStateLocked(resolvedUserId).mBoundServices; List<Service> services = getUserStateLocked(resolvedUserId).mBoundServices; } int numServices = services.size(); for (int i = 0, count = services.size(); i < count; i++) { interfacesToInterrupt = new ArrayList<>(numServices); for (int i = 0; i < numServices; i++) { Service service = services.get(i); Service service = services.get(i); IBinder a11yServiceBinder = service.mService; IAccessibilityServiceClient a11yServiceInterface = service.mServiceInterface; if ((a11yServiceBinder != null) && (a11yServiceInterface != null)) { interfacesToInterrupt.add(a11yServiceInterface); } } } for (int i = 0, count = interfacesToInterrupt.size(); i < count; i++) { try { try { service.mServiceInterface.onInterrupt(); interfacesToInterrupt.get(i).onInterrupt(); } catch (RemoteException re) { } catch (RemoteException re) { Slog.e(LOG_TAG, "Error during sending interrupt request to " Slog.e(LOG_TAG, "Error sending interrupt request to " + service.mService, re); + interfacesToInterrupt.get(i), re); } } } } } } Loading