1 /* 2 * Copyright (C) 2019 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.view.View; 20 21 /** 22 * Class that replaces the original AccessibilityNodeIdManager with a no-op version. This avoids 23 * the accidental leaking of views referenced by the originalin layoutlib. 24 */ 25 public final class AccessibilityNodeIdManager { 26 private static AccessibilityNodeIdManager sIdManager = new AccessibilityNodeIdManager(); 27 28 getInstance()29 public static synchronized AccessibilityNodeIdManager getInstance() { 30 return sIdManager; 31 } 32 AccessibilityNodeIdManager()33 private AccessibilityNodeIdManager() { 34 } 35 36 /** 37 * Register view to be kept track of by the accessibility system. 38 * Must be paired with unregisterView, otherwise this will leak. 39 * @param view The view to be registered. 40 * @param id The accessibilityViewId of the view. 41 */ registerViewWithId(View view, int id)42 public void registerViewWithId(View view, int id) { 43 } 44 45 /** 46 * Unregister view, accessibility won't keep track of this view after this call. 47 * @param id The id returned from registerView when the view as first associated. 48 */ unregisterViewWithId(int id)49 public void unregisterViewWithId(int id) { 50 } 51 52 /** 53 * Accessibility uses this to find the view in the hierarchy. 54 * @param id The accessibility view id. 55 * @return The view. 56 */ findView(int id)57 public View findView(int id) { 58 return null; 59 } 60 } 61 62