blob: 0134aa3a15df6120e5e79ff18d45a4d58aede1e3 [file] [log] [blame]
Anthony Chen54daefe2017-04-07 17:19:54 -07001/*
2 * Copyright (C) 2017 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 com.android.systemui.qs;
18
Charles Hece2a7c02017-10-11 20:25:20 +010019import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
20
Jason Monk7a56b832018-12-27 13:45:51 -050021import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
22
Anthony Chen54daefe2017-04-07 17:19:54 -070023import android.content.Context;
24import android.content.Intent;
25import android.content.res.Configuration;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050026import android.database.ContentObserver;
Anthony Chen54daefe2017-04-07 17:19:54 -070027import android.graphics.PorterDuff.Mode;
28import android.graphics.drawable.Drawable;
29import android.graphics.drawable.RippleDrawable;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050030import android.net.Uri;
31import android.os.Build;
Amin Shaikh8a3e23c2018-04-17 11:14:32 -040032import android.os.Bundle;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050033import android.os.Handler;
34import android.os.UserHandle;
Anthony Chen54daefe2017-04-07 17:19:54 -070035import android.os.UserManager;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050036import android.provider.Settings;
Anthony Chen54daefe2017-04-07 17:19:54 -070037import android.util.AttributeSet;
38import android.view.View;
39import android.view.View.OnClickListener;
Amin Shaikh8a3e23c2018-04-17 11:14:32 -040040import android.view.accessibility.AccessibilityNodeInfo;
Anthony Chen54daefe2017-04-07 17:19:54 -070041import android.widget.FrameLayout;
42import android.widget.ImageView;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050043import android.widget.TextView;
Anthony Chen54daefe2017-04-07 17:19:54 -070044import android.widget.Toast;
45
Gus Prevasab336792018-11-14 13:52:20 -050046import androidx.annotation.Nullable;
47import androidx.annotation.VisibleForTesting;
48
Anthony Chen54daefe2017-04-07 17:19:54 -070049import com.android.internal.logging.MetricsLogger;
50import com.android.internal.logging.nano.MetricsProto;
Selim Cinek1a891a92017-12-04 17:41:27 +010051import com.android.keyguard.KeyguardUpdateMonitor;
Anthony Chen54daefe2017-04-07 17:19:54 -070052import com.android.settingslib.Utils;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050053import com.android.settingslib.development.DevelopmentSettingsEnabler;
Jason Monk826b6092017-08-29 11:30:52 -040054import com.android.settingslib.drawable.UserIconDrawable;
Fabian Kozynskibf6fef32019-02-04 09:21:38 -050055import com.android.systemui.Dependency;
Anthony Chen54daefe2017-04-07 17:19:54 -070056import com.android.systemui.R;
57import com.android.systemui.R.dimen;
Anthony Chen54daefe2017-04-07 17:19:54 -070058import com.android.systemui.plugins.ActivityStarter;
59import com.android.systemui.qs.TouchAnimator.Builder;
Anthony Chen54daefe2017-04-07 17:19:54 -070060import com.android.systemui.statusbar.phone.MultiUserSwitch;
61import com.android.systemui.statusbar.phone.SettingsButton;
62import com.android.systemui.statusbar.policy.DeviceProvisionedController;
Anthony Chen54daefe2017-04-07 17:19:54 -070063import com.android.systemui.statusbar.policy.UserInfoController;
64import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
65import com.android.systemui.tuner.TunerService;
66
Jason Monk7a56b832018-12-27 13:45:51 -050067import javax.inject.Inject;
68import javax.inject.Named;
69
Anthony Chen54daefe2017-04-07 17:19:54 -070070public class QSFooterImpl extends FrameLayout implements QSFooter,
Fabian Kozynskia48d2d02019-02-27 11:36:02 -050071 OnClickListener, OnUserInfoChangedListener {
Fabian Kozynski1823f112019-01-18 11:43:29 -050072
Fabian Kozynski1823f112019-01-18 11:43:29 -050073 private static final String TAG = "QSFooterImpl";
Evan Lairdeb38aa72018-02-02 11:10:30 -050074
Jason Monk7a56b832018-12-27 13:45:51 -050075 private final ActivityStarter mActivityStarter;
76 private final UserInfoController mUserInfoController;
Jason Monk7a56b832018-12-27 13:45:51 -050077 private final DeviceProvisionedController mDeviceProvisionedController;
Anthony Chen54daefe2017-04-07 17:19:54 -070078 private SettingsButton mSettingsButton;
79 protected View mSettingsContainer;
Rohan Shah3090e792018-04-12 00:01:00 -040080 private PageIndicator mPageIndicator;
Anthony Chen54daefe2017-04-07 17:19:54 -070081
Charles Hece2a7c02017-10-11 20:25:20 +010082 private boolean mQsDisabled;
Anthony Chen54daefe2017-04-07 17:19:54 -070083 private QSPanel mQsPanel;
Fabian Kozynskic8d8f052019-09-09 09:15:04 -040084 private QuickQSPanel mQuickQsPanel;
Anthony Chen54daefe2017-04-07 17:19:54 -070085
86 private boolean mExpanded;
Anthony Chen54daefe2017-04-07 17:19:54 -070087
88 private boolean mListening;
Anthony Chen54daefe2017-04-07 17:19:54 -070089
Anthony Chen54daefe2017-04-07 17:19:54 -070090 protected MultiUserSwitch mMultiUserSwitch;
91 private ImageView mMultiUserAvatar;
92
Evan Lairdeb38aa72018-02-02 11:10:30 -050093 protected TouchAnimator mFooterAnimator;
Anthony Chen54daefe2017-04-07 17:19:54 -070094 private float mExpansionAmount;
95
96 protected View mEdit;
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -050097 protected View mEditContainer;
Evan Lairdeb38aa72018-02-02 11:10:30 -050098 private TouchAnimator mSettingsCogAnimator;
Anthony Chen54daefe2017-04-07 17:19:54 -070099
Evan Laird00e43c42018-01-22 20:25:45 -0500100 private View mActionsContainer;
Evan Lairdeb38aa72018-02-02 11:10:30 -0500101 private View mDragHandle;
Fabian Kozynski1823f112019-01-18 11:43:29 -0500102
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400103 private OnClickListener mExpandClickListener;
Evan Laird00e43c42018-01-22 20:25:45 -0500104
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500105 private final ContentObserver mDeveloperSettingsObserver = new ContentObserver(
106 new Handler(mContext.getMainLooper())) {
107 @Override
108 public void onChange(boolean selfChange, Uri uri) {
109 super.onChange(selfChange, uri);
110 setBuildText();
111 }
112 };
113
Jason Monk7a56b832018-12-27 13:45:51 -0500114 @Inject
115 public QSFooterImpl(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
116 ActivityStarter activityStarter, UserInfoController userInfoController,
Jason Monk7a56b832018-12-27 13:45:51 -0500117 DeviceProvisionedController deviceProvisionedController) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700118 super(context, attrs);
Jason Monk7a56b832018-12-27 13:45:51 -0500119 mActivityStarter = activityStarter;
120 mUserInfoController = userInfoController;
Jason Monk7a56b832018-12-27 13:45:51 -0500121 mDeviceProvisionedController = deviceProvisionedController;
Anthony Chen54daefe2017-04-07 17:19:54 -0700122 }
123
Fabian Kozynskibf6fef32019-02-04 09:21:38 -0500124 @VisibleForTesting
125 public QSFooterImpl(Context context, AttributeSet attrs) {
126 this(context, attrs,
127 Dependency.get(ActivityStarter.class),
128 Dependency.get(UserInfoController.class),
Fabian Kozynskibf6fef32019-02-04 09:21:38 -0500129 Dependency.get(DeviceProvisionedController.class));
130 }
131
Anthony Chen54daefe2017-04-07 17:19:54 -0700132 @Override
133 protected void onFinishInflate() {
134 super.onFinishInflate();
Anthony Chen54daefe2017-04-07 17:19:54 -0700135 mEdit = findViewById(android.R.id.edit);
136 mEdit.setOnClickListener(view ->
Jason Monk7a56b832018-12-27 13:45:51 -0500137 mActivityStarter.postQSRunnableDismissingKeyguard(() ->
Anthony Chen54daefe2017-04-07 17:19:54 -0700138 mQsPanel.showEdit(view)));
139
Rohan Shah3090e792018-04-12 00:01:00 -0400140 mPageIndicator = findViewById(R.id.footer_page_indicator);
141
Anthony Chen54daefe2017-04-07 17:19:54 -0700142 mSettingsButton = findViewById(R.id.settings_button);
143 mSettingsContainer = findViewById(R.id.settings_button_container);
144 mSettingsButton.setOnClickListener(this);
145
Anthony Chen54daefe2017-04-07 17:19:54 -0700146 mMultiUserSwitch = findViewById(R.id.multi_user_switch);
147 mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
148
Evan Lairdeb38aa72018-02-02 11:10:30 -0500149 mDragHandle = findViewById(R.id.qs_drag_handle_view);
Evan Laird00e43c42018-01-22 20:25:45 -0500150 mActionsContainer = findViewById(R.id.qs_footer_actions_container);
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500151 mEditContainer = findViewById(R.id.qs_footer_actions_edit_container);
Evan Laird00e43c42018-01-22 20:25:45 -0500152
Anthony Chen54daefe2017-04-07 17:19:54 -0700153 // RenderThread is doing more harm than good when touching the header (to expand quick
154 // settings), so disable it for this view
155 ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true);
Anthony Chen54daefe2017-04-07 17:19:54 -0700156
157 updateResources();
158
Anthony Chen54daefe2017-04-07 17:19:54 -0700159 addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
160 oldBottom) -> updateAnimator(right - left));
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400161 setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
Fabian Kozynskic99b3792019-02-07 11:15:29 -0500162 updateEverything();
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500163 setBuildText();
164 }
165
166 private void setBuildText() {
167 TextView v = findViewById(R.id.build);
168 if (v == null) return;
169 if (DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)) {
170 v.setText(mContext.getString(
171 com.android.internal.R.string.bugreport_status,
Kevin Lau Fang01e16a52019-11-14 20:07:11 +0000172 Build.VERSION.RELEASE,
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500173 Build.ID));
174 v.setVisibility(View.VISIBLE);
175 } else {
176 v.setVisibility(View.GONE);
177 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700178 }
179
180 private void updateAnimator(int width) {
Fabian Kozynskic8d8f052019-09-09 09:15:04 -0400181 int numTiles = mQuickQsPanel != null ? mQuickQsPanel.getNumQuickTiles()
182 : QuickQSPanel.getDefaultMaxTiles();
Anthony Chen54daefe2017-04-07 17:19:54 -0700183 int size = mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size)
184 - mContext.getResources().getDimensionPixelSize(dimen.qs_quick_tile_padding);
185 int remaining = (width - numTiles * size) / (numTiles - 1);
186 int defSpace = mContext.getResources().getDimensionPixelOffset(R.dimen.default_gear_space);
187
Evan Lairdeb38aa72018-02-02 11:10:30 -0500188 mSettingsCogAnimator = new Builder()
Jason Monk6dadd3e42017-09-01 09:36:19 -0400189 .addFloat(mSettingsContainer, "translationX",
190 isLayoutRtl() ? (remaining - defSpace) : -(remaining - defSpace), 0)
Anthony Chen54daefe2017-04-07 17:19:54 -0700191 .addFloat(mSettingsButton, "rotation", -120, 0)
192 .build();
Anthony Chen54daefe2017-04-07 17:19:54 -0700193
Anthony Chen54daefe2017-04-07 17:19:54 -0700194 setExpansion(mExpansionAmount);
195 }
196
197 @Override
198 protected void onConfigurationChanged(Configuration newConfig) {
199 super.onConfigurationChanged(newConfig);
200 updateResources();
201 }
202
203 @Override
204 public void onRtlPropertiesChanged(int layoutDirection) {
205 super.onRtlPropertiesChanged(layoutDirection);
206 updateResources();
207 }
208
209 private void updateResources() {
Evan Lairdeb38aa72018-02-02 11:10:30 -0500210 updateFooterAnimator();
Anthony Chen54daefe2017-04-07 17:19:54 -0700211 }
212
Evan Lairdeb38aa72018-02-02 11:10:30 -0500213 private void updateFooterAnimator() {
214 mFooterAnimator = createFooterAnimator();
Anthony Chen54daefe2017-04-07 17:19:54 -0700215 }
216
217 @Nullable
Evan Lairdeb38aa72018-02-02 11:10:30 -0500218 private TouchAnimator createFooterAnimator() {
Anthony Chen54daefe2017-04-07 17:19:54 -0700219 return new TouchAnimator.Builder()
Evan Laird00e43c42018-01-22 20:25:45 -0500220 .addFloat(mActionsContainer, "alpha", 0, 1)
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500221 .addFloat(mEditContainer, "alpha", 0, 1)
Amin Shaikhd620def2018-02-27 16:52:53 -0500222 .addFloat(mDragHandle, "alpha", 1, 0, 0)
Rohan Shah3090e792018-04-12 00:01:00 -0400223 .addFloat(mPageIndicator, "alpha", 0, 1)
Amin Shaikh92fac562018-02-16 15:08:16 -0500224 .setStartDelay(0.15f)
Anthony Chen54daefe2017-04-07 17:19:54 -0700225 .build();
226 }
227
228 @Override
229 public void setKeyguardShowing(boolean keyguardShowing) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700230 setExpansion(mExpansionAmount);
231 }
232
233 @Override
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400234 public void setExpandClickListener(OnClickListener onClickListener) {
235 mExpandClickListener = onClickListener;
236 }
237
238 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700239 public void setExpanded(boolean expanded) {
240 if (mExpanded == expanded) return;
241 mExpanded = expanded;
242 updateEverything();
243 }
244
245 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700246 public void setExpansion(float headerExpansionFraction) {
247 mExpansionAmount = headerExpansionFraction;
Evan Lairdeb38aa72018-02-02 11:10:30 -0500248 if (mSettingsCogAnimator != null) mSettingsCogAnimator.setPosition(headerExpansionFraction);
Anthony Chen54daefe2017-04-07 17:19:54 -0700249
Evan Lairdeb38aa72018-02-02 11:10:30 -0500250 if (mFooterAnimator != null) {
251 mFooterAnimator.setPosition(headerExpansionFraction);
Anthony Chen54daefe2017-04-07 17:19:54 -0700252 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700253 }
254
255 @Override
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500256 protected void onAttachedToWindow() {
257 super.onAttachedToWindow();
258 mContext.getContentResolver().registerContentObserver(
259 Settings.Global.getUriFor(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED), false,
260 mDeveloperSettingsObserver, UserHandle.USER_ALL);
261 }
262
263 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700264 @VisibleForTesting
265 public void onDetachedFromWindow() {
266 setListening(false);
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500267 mContext.getContentResolver().unregisterContentObserver(mDeveloperSettingsObserver);
Anthony Chen54daefe2017-04-07 17:19:54 -0700268 super.onDetachedFromWindow();
269 }
270
Anthony Chen54daefe2017-04-07 17:19:54 -0700271 @Override
272 public void setListening(boolean listening) {
273 if (listening == mListening) {
274 return;
275 }
276 mListening = listening;
277 updateListeners();
278 }
279
280 @Override
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400281 public boolean performAccessibilityAction(int action, Bundle arguments) {
282 if (action == AccessibilityNodeInfo.ACTION_EXPAND) {
283 if (mExpandClickListener != null) {
284 mExpandClickListener.onClick(null);
285 return true;
286 }
287 }
288 return super.performAccessibilityAction(action, arguments);
289 }
290
291 @Override
292 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
293 super.onInitializeAccessibilityNodeInfo(info);
294 info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
Anthony Chen54daefe2017-04-07 17:19:54 -0700295 }
296
Charles Hece2a7c02017-10-11 20:25:20 +0100297 @Override
298 public void disable(int state1, int state2, boolean animate) {
299 final boolean disabled = (state2 & DISABLE2_QUICK_SETTINGS) != 0;
300 if (disabled == mQsDisabled) return;
301 mQsDisabled = disabled;
302 updateEverything();
303 }
304
Anthony Chen54daefe2017-04-07 17:19:54 -0700305 public void updateEverything() {
306 post(() -> {
307 updateVisibilities();
Fabian Kozynskife90f562019-01-10 10:21:19 -0500308 updateClickabilities();
Anthony Chen54daefe2017-04-07 17:19:54 -0700309 setClickable(false);
310 });
311 }
312
Fabian Kozynskife90f562019-01-10 10:21:19 -0500313 private void updateClickabilities() {
314 mMultiUserSwitch.setClickable(mMultiUserSwitch.getVisibility() == View.VISIBLE);
315 mEdit.setClickable(mEdit.getVisibility() == View.VISIBLE);
316 mSettingsButton.setClickable(mSettingsButton.getVisibility() == View.VISIBLE);
317 }
318
Anthony Chen54daefe2017-04-07 17:19:54 -0700319 private void updateVisibilities() {
Charles Hece2a7c02017-10-11 20:25:20 +0100320 mSettingsContainer.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
Anthony Chen54daefe2017-04-07 17:19:54 -0700321 mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
322 TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
323 final boolean isDemo = UserManager.isDeviceInDemoMode(mContext);
Fabian Kozynski0f46c342019-03-25 13:23:38 -0400324 mMultiUserSwitch.setVisibility(showUserSwitcher() ? View.VISIBLE : View.INVISIBLE);
Fabian Kozynski4e76d1f2019-02-25 16:30:04 -0500325 mEditContainer.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
Amin Shaikha59215a2018-04-23 08:52:38 -0400326 mSettingsButton.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
Anthony Chen54daefe2017-04-07 17:19:54 -0700327 }
328
Fabian Kozynski0f46c342019-03-25 13:23:38 -0400329 private boolean showUserSwitcher() {
330 return mExpanded && mMultiUserSwitch.isMultiUserEnabled();
Amin Shaikh50c17892018-03-21 18:15:22 -0400331 }
332
Anthony Chen54daefe2017-04-07 17:19:54 -0700333 private void updateListeners() {
334 if (mListening) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700335 mUserInfoController.addCallback(this);
Anthony Chen54daefe2017-04-07 17:19:54 -0700336 } else {
Anthony Chen54daefe2017-04-07 17:19:54 -0700337 mUserInfoController.removeCallback(this);
Anthony Chen54daefe2017-04-07 17:19:54 -0700338 }
339 }
340
341 @Override
342 public void setQSPanel(final QSPanel qsPanel) {
343 mQsPanel = qsPanel;
344 if (mQsPanel != null) {
345 mMultiUserSwitch.setQsPanel(qsPanel);
Rohan Shah3090e792018-04-12 00:01:00 -0400346 mQsPanel.setFooterPageIndicator(mPageIndicator);
Anthony Chen54daefe2017-04-07 17:19:54 -0700347 }
348 }
349
350 @Override
Fabian Kozynskic8d8f052019-09-09 09:15:04 -0400351 public void setQQSPanel(@Nullable QuickQSPanel panel) {
352 mQuickQsPanel = panel;
353 }
354
355 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700356 public void onClick(View v) {
Evan Laird00e43c42018-01-22 20:25:45 -0500357 // Don't do anything until view are unhidden
358 if (!mExpanded) {
359 return;
360 }
361
Anthony Chen54daefe2017-04-07 17:19:54 -0700362 if (v == mSettingsButton) {
Jason Monk7a56b832018-12-27 13:45:51 -0500363 if (!mDeviceProvisionedController.isCurrentUserSetup()) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700364 // If user isn't setup just unlock the device and dump them back at SUW.
Fabian Kozynski1823f112019-01-18 11:43:29 -0500365 mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
366 });
Anthony Chen54daefe2017-04-07 17:19:54 -0700367 return;
368 }
369 MetricsLogger.action(mContext,
370 mExpanded ? MetricsProto.MetricsEvent.ACTION_QS_EXPANDED_SETTINGS_LAUNCH
371 : MetricsProto.MetricsEvent.ACTION_QS_COLLAPSED_SETTINGS_LAUNCH);
372 if (mSettingsButton.isTunerClick()) {
Jason Monk7a56b832018-12-27 13:45:51 -0500373 mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
Anthony Chen54daefe2017-04-07 17:19:54 -0700374 if (TunerService.isTunerEnabled(mContext)) {
375 TunerService.showResetRequest(mContext, () -> {
376 // Relaunch settings so that the tuner disappears.
377 startSettingsActivity();
378 });
379 } else {
380 Toast.makeText(getContext(), R.string.tuner_toast,
381 Toast.LENGTH_LONG).show();
382 TunerService.setTunerEnabled(mContext, true);
383 }
384 startSettingsActivity();
385
386 });
387 } else {
388 startSettingsActivity();
389 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700390 }
391 }
392
393 private void startSettingsActivity() {
394 mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
395 true /* dismissShade */);
396 }
397
398 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700399 public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
400 if (picture != null &&
Selim Cinek1a891a92017-12-04 17:41:27 +0100401 UserManager.get(mContext).isGuestUser(KeyguardUpdateMonitor.getCurrentUser()) &&
Jason Monk826b6092017-08-29 11:30:52 -0400402 !(picture instanceof UserIconDrawable)) {
403 picture = picture.getConstantState().newDrawable(mContext.getResources()).mutate();
Anthony Chen54daefe2017-04-07 17:19:54 -0700404 picture.setColorFilter(
Jason Changb4e879d2018-04-11 11:17:58 +0800405 Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorForeground),
Anthony Chen54daefe2017-04-07 17:19:54 -0700406 Mode.SRC_IN);
407 }
408 mMultiUserAvatar.setImageDrawable(picture);
409 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700410}