AccessibilityManager.java revision 7953e7d89b1d4d7297176fbb6aeea882577df8e6
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 17package android.view.accessibility; 18 19import android.content.Context; 20import android.content.pm.ServiceInfo; 21 22import java.util.Collections; 23import 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 */ 37public 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 List<ServiceInfo> services = null; 91 return Collections.unmodifiableList(services); 92 } 93} 94