import android.util.Pools.SimplePool;
import android.util.Slog;
import android.util.SparseArray;
-import android.view.AccessibilityManagerInternal;
import android.view.Display;
import android.view.IWindow;
import android.view.InputDevice;
private static final int MAX_POOL_SIZE = 10;
+ private static final int WINDOW_ID_UNKNOWN = -1;
+
private static int sIdCounter = 0;
private static int sNextWindowId;
registerBroadcastReceivers();
new AccessibilityContentObserver(mMainHandler).register(
context.getContentResolver());
- LocalServices.addService(AccessibilityManagerInternal.class, new LocalService());
}
private UserState getUserStateLocked(int userId) {
return false;
}
+ boolean accessibilityFocusOnlyInActiveWindow() {
+ synchronized (mLock) {
+ return mWindowsForAccessibilityCallback == null;
+ }
+ }
+
int getActiveWindowId() {
return mSecurityPolicy.getActiveWindowId();
}
return false;
}
- if (!event.isImportantForAccessibility()
+ if (event.getWindowId() != WINDOW_ID_UNKNOWN && !event.isImportantForAccessibility()
&& (service.mFetchFlags
& AccessibilityNodeInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) == 0) {
return false;
updateTouchExplorationLocked(userState);
updateEnhancedWebAccessibilityLocked(userState);
updateDisplayColorAdjustmentSettingsLocked(userState);
- updateEncryptionState(userState);
scheduleUpdateInputFilter(userState);
scheduleUpdateClientsIfNeededLocked(userState);
}
DisplayAdjustmentUtils.applyAdjustments(mContext, userState.mUserId);
}
- private void updateEncryptionState(UserState userState) {
- if (userState.mUserId != UserHandle.USER_OWNER) {
- return;
- }
- if (hasRunningServicesLocked(userState) && LockPatternUtils.isDeviceEncrypted()) {
- // If there are running accessibility services we do not have encryption as
- // the user needs the accessibility layer to be running to authenticate.
- mLockPatternUtils.clearEncryptionPassword();
- }
- }
-
private boolean hasRunningServicesLocked(UserState userState) {
return !userState.mBoundServices.isEmpty() || !userState.mBindingServices.isEmpty();
}
}
// $fall-through$
case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
+ case AccessibilityEvent.TYPE_ANNOUNCEMENT:
// All events generated by the user touching the
// screen should *always* be dispatched.
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
}
private void notifyWindowsChanged() {
+ if (mWindowsForAccessibilityCallback == null) {
+ return;
+ }
final long identity = Binder.clearCallingIdentity();
try {
// Let the client know the windows changed.
}
private boolean isRetrievalAllowingWindow(int windowId) {
+ // The system gets to interact with any window it wants.
+ if (Binder.getCallingUid() == Process.SYSTEM_UID) {
+ return true;
+ }
if (windowId == mActiveWindowId) {
return true;
}
}
}
}
-
- private final class LocalService extends AccessibilityManagerInternal {
- @Override
- public boolean isNonDefaultEncryptionPasswordAllowed() {
- synchronized (mLock) {
- UserState userState = getCurrentUserStateLocked();
- return !hasRunningServicesLocked(userState);
- }
- }
- }
}