1 /*
2  * Copyright (C) 2014 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.systemui.statusbar.phone;
18 
19 import android.content.Context;
20 import android.text.TextUtils;
21 import android.util.AttributeSet;
22 import android.view.accessibility.AccessibilityEvent;
23 import android.view.accessibility.AccessibilityNodeInfo;
24 import android.widget.Button;
25 import android.widget.FrameLayout;
26 
27 import com.android.systemui.R;
28 
29 /**
30  * Container for image of the multi user switcher (tappable).
31  */
32 // TODO(b/242040009): Remove this file.
33 public class MultiUserSwitch extends FrameLayout {
MultiUserSwitch(Context context, AttributeSet attrs)34     public MultiUserSwitch(Context context, AttributeSet attrs) {
35         super(context, attrs);
36     }
37 
refreshContentDescription(String currentUser)38     void refreshContentDescription(String currentUser) {
39         String text = null;
40 
41         if (!TextUtils.isEmpty(currentUser)) {
42             text = mContext.getString(
43                     R.string.accessibility_quick_settings_user,
44                     currentUser);
45         }
46 
47         if (!TextUtils.equals(getContentDescription(), text)) {
48             setContentDescription(text);
49         }
50     }
51 
52     @Override
onInitializeAccessibilityEvent(AccessibilityEvent event)53     public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
54         super.onInitializeAccessibilityEvent(event);
55         event.setClassName(Button.class.getName());
56     }
57 
58     @Override
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)59     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
60         super.onInitializeAccessibilityNodeInfo(info);
61         info.setClassName(Button.class.getName());
62     }
63 
64     @Override
hasOverlappingRendering()65     public boolean hasOverlappingRendering() {
66         return false;
67     }
68 }
69