2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package android.view.accessibility;
19 import android.content.Context;
20 import android.content.pm.ServiceInfo;
22 import java.util.Collections;
23 import java.util.List;
26 * System level service that serves as an event dispatch for {@link AccessibilityEvent}s.
27 * Such events are generated when something notable happens in the user interface,
28 * for example an {@link android.app.Activity} starts, the focus or selection of a
29 * {@link android.view.View} changes etc. Parties interested in handling accessibility
30 * events implement and register an accessibility service which extends
31 * {@link android.accessibilityservice.AccessibilityService}.
33 * @see AccessibilityEvent
34 * @see android.accessibilityservice.AccessibilityService
35 * @see android.content.Context#getSystemService
37 public final class AccessibilityManager {
38 private static AccessibilityManager sInstance = new AccessibilityManager();
41 * Get an AccessibilityManager instance (create one if necessary).
45 public static AccessibilityManager getInstance(Context context) {
52 * @param context A {@link Context}.
54 private AccessibilityManager() {
58 * Returns if the {@link AccessibilityManager} is enabled.
60 * @return True if this {@link AccessibilityManager} is enabled, false otherwise.
62 public boolean isEnabled() {
67 * Sends an {@link AccessibilityEvent}. If this {@link AccessibilityManager} is not
68 * enabled the call is a NOOP.
70 * @param event The {@link AccessibilityEvent}.
72 * @throws IllegalStateException if a client tries to send an {@link AccessibilityEvent}
73 * while accessibility is not enabled.
75 public void sendAccessibilityEvent(AccessibilityEvent event) {
79 * Requests interruption of the accessibility feedback from all accessibility services.
81 public void interrupt() {
85 * Returns the {@link ServiceInfo}s of the installed accessibility services.
87 * @return An unmodifiable list with {@link ServiceInfo}s.
89 public List<ServiceInfo> getAccessibilityServiceList() {
90 // normal implementation does this in some case, so let's do the same
91 // (unmodifiableList wrapped around null).
92 List<ServiceInfo> services = null;
93 return Collections.unmodifiableList(services);