OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / tools / layoutlib / bridge / src / android / view / accessibility / AccessibilityManager.java
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package android.view.accessibility;
18
19 import android.content.Context;
20 import android.content.pm.ServiceInfo;
21
22 import java.util.Collections;
23 import java.util.List;
24
25 /**
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}.
32  *
33  * @see AccessibilityEvent
34  * @see android.accessibilityservice.AccessibilityService
35  * @see android.content.Context#getSystemService
36  */
37 public final class AccessibilityManager {
38     private static AccessibilityManager sInstance = new AccessibilityManager();
39
40     /**
41      * Get an AccessibilityManager instance (create one if necessary).
42      *
43      * @hide
44      */
45     public static AccessibilityManager getInstance(Context context) {
46         return sInstance;
47     }
48
49     /**
50      * Create an instance.
51      *
52      * @param context A {@link Context}.
53      */
54     private AccessibilityManager() {
55     }
56
57     /**
58      * Returns if the {@link AccessibilityManager} is enabled.
59      *
60      * @return True if this {@link AccessibilityManager} is enabled, false otherwise.
61      */
62     public boolean isEnabled() {
63         return false;
64     }
65
66     /**
67      * Sends an {@link AccessibilityEvent}. If this {@link AccessibilityManager} is not
68      * enabled the call is a NOOP.
69      *
70      * @param event The {@link AccessibilityEvent}.
71      *
72      * @throws IllegalStateException if a client tries to send an {@link AccessibilityEvent}
73      *         while accessibility is not enabled.
74      */
75     public void sendAccessibilityEvent(AccessibilityEvent event) {
76     }
77
78     /**
79      * Requests interruption of the accessibility feedback from all accessibility services.
80      */
81     public void interrupt() {
82     }
83
84     /**
85      * Returns the {@link ServiceInfo}s of the installed accessibility services.
86      *
87      * @return An unmodifiable list with {@link ServiceInfo}s.
88      */
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);
94     }
95 }