1 /* 2 * Copyright (C) 2024 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 com.android.settings.testutils.shadow; 18 19 import android.annotation.NonNull; 20 import android.annotation.UserIdInt; 21 import android.content.ComponentName; 22 import android.util.ArrayMap; 23 import android.view.accessibility.AccessibilityManager; 24 25 import org.robolectric.annotation.Implementation; 26 import org.robolectric.annotation.Implements; 27 28 import java.util.Map; 29 30 /** 31 * Shadow of {@link AccessibilityManager} with the hidden methods 32 */ 33 @Implements(AccessibilityManager.class) 34 public class ShadowAccessibilityManager extends org.robolectric.shadows.ShadowAccessibilityManager { 35 private Map<ComponentName, ComponentName> mA11yFeatureToTileMap = new ArrayMap<>(); 36 37 /** 38 * Implements a hidden method {@link AccessibilityManager.getA11yFeatureToTileMap} 39 */ 40 @Implementation getA11yFeatureToTileMap(@serIdInt int userId)41 public Map<ComponentName, ComponentName> getA11yFeatureToTileMap(@UserIdInt int userId) { 42 return mA11yFeatureToTileMap; 43 } 44 45 /** 46 * Set fake a11y feature to tile mapping 47 */ setA11yFeatureToTileMap( @onNull Map<ComponentName, ComponentName> a11yFeatureToTileMap)48 public void setA11yFeatureToTileMap( 49 @NonNull Map<ComponentName, ComponentName> a11yFeatureToTileMap) { 50 mA11yFeatureToTileMap = a11yFeatureToTileMap; 51 } 52 } 53