blob: 8ddc5b0a71d0a2cc14602d5bfb043bb703693e94 [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
Anthony Chen54daefe2017-04-07 17:19:54 -070021import android.content.Context;
22import android.content.Intent;
Amin Shaikh50c17892018-03-21 18:15:22 -040023import android.content.pm.UserInfo;
Amin Shaikh0e003312018-03-08 11:39:01 -050024import android.content.res.ColorStateList;
Anthony Chen54daefe2017-04-07 17:19:54 -070025import android.content.res.Configuration;
Anthony Chen54daefe2017-04-07 17:19:54 -070026import android.graphics.PorterDuff.Mode;
27import android.graphics.drawable.Drawable;
28import android.graphics.drawable.RippleDrawable;
Amin Shaikh8a3e23c2018-04-17 11:14:32 -040029import android.os.Bundle;
Anthony Chen54daefe2017-04-07 17:19:54 -070030import android.os.UserManager;
Aurimas Liutikasd3667712018-04-17 09:50:46 -070031import androidx.annotation.Nullable;
32import androidx.annotation.VisibleForTesting;
Amin Shaikh0e003312018-03-08 11:39:01 -050033import android.text.TextUtils;
Anthony Chen54daefe2017-04-07 17:19:54 -070034import android.util.AttributeSet;
35import android.view.View;
36import android.view.View.OnClickListener;
Amin Shaikh8a3e23c2018-04-17 11:14:32 -040037import android.view.accessibility.AccessibilityNodeInfo;
Anthony Chen54daefe2017-04-07 17:19:54 -070038import android.widget.FrameLayout;
39import android.widget.ImageView;
Rohan Shah3090e792018-04-12 00:01:00 -040040import android.widget.LinearLayout;
Anthony Chen54daefe2017-04-07 17:19:54 -070041import android.widget.Toast;
42
43import com.android.internal.logging.MetricsLogger;
44import com.android.internal.logging.nano.MetricsProto;
Amin Shaikh0e003312018-03-08 11:39:01 -050045import com.android.keyguard.CarrierText;
Selim Cinek1a891a92017-12-04 17:41:27 +010046import com.android.keyguard.KeyguardUpdateMonitor;
Anthony Chen54daefe2017-04-07 17:19:54 -070047import com.android.settingslib.Utils;
Jason Monk826b6092017-08-29 11:30:52 -040048import com.android.settingslib.drawable.UserIconDrawable;
Amin Shaikh0e003312018-03-08 11:39:01 -050049import com.android.settingslib.graph.SignalDrawable;
Anthony Chen54daefe2017-04-07 17:19:54 -070050import com.android.systemui.Dependency;
Anthony Chen54daefe2017-04-07 17:19:54 -070051import com.android.systemui.R;
52import com.android.systemui.R.dimen;
Anthony Chen54daefe2017-04-07 17:19:54 -070053import com.android.systemui.plugins.ActivityStarter;
54import com.android.systemui.qs.TouchAnimator.Builder;
Anthony Chen54daefe2017-04-07 17:19:54 -070055import com.android.systemui.statusbar.phone.MultiUserSwitch;
56import com.android.systemui.statusbar.phone.SettingsButton;
57import com.android.systemui.statusbar.policy.DeviceProvisionedController;
58import com.android.systemui.statusbar.policy.NetworkController;
59import com.android.systemui.statusbar.policy.NetworkController.EmergencyListener;
60import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
Anthony Chen54daefe2017-04-07 17:19:54 -070061import com.android.systemui.statusbar.policy.UserInfoController;
62import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
63import com.android.systemui.tuner.TunerService;
64
65public class QSFooterImpl extends FrameLayout implements QSFooter,
Amin Shaikhf09450b2018-04-06 17:32:45 -040066 OnClickListener, OnUserInfoChangedListener, EmergencyListener, SignalCallback {
Evan Lairdeb38aa72018-02-02 11:10:30 -050067
Anthony Chen54daefe2017-04-07 17:19:54 -070068 private ActivityStarter mActivityStarter;
Anthony Chen54daefe2017-04-07 17:19:54 -070069 private UserInfoController mUserInfoController;
70 private SettingsButton mSettingsButton;
71 protected View mSettingsContainer;
Rohan Shah3090e792018-04-12 00:01:00 -040072 private PageIndicator mPageIndicator;
Amin Shaikh0e003312018-03-08 11:39:01 -050073 private CarrierText mCarrierText;
Anthony Chen54daefe2017-04-07 17:19:54 -070074
Charles Hece2a7c02017-10-11 20:25:20 +010075 private boolean mQsDisabled;
Anthony Chen54daefe2017-04-07 17:19:54 -070076 private QSPanel mQsPanel;
77
78 private boolean mExpanded;
Anthony Chen54daefe2017-04-07 17:19:54 -070079
80 private boolean mListening;
Anthony Chen54daefe2017-04-07 17:19:54 -070081
82 private boolean mShowEmergencyCallsOnly;
Amin Shaikhacf322d2018-01-31 17:04:56 -050083 private View mDivider;
Anthony Chen54daefe2017-04-07 17:19:54 -070084 protected MultiUserSwitch mMultiUserSwitch;
85 private ImageView mMultiUserAvatar;
86
Evan Lairdeb38aa72018-02-02 11:10:30 -050087 protected TouchAnimator mFooterAnimator;
Anthony Chen54daefe2017-04-07 17:19:54 -070088 private float mExpansionAmount;
89
90 protected View mEdit;
Evan Lairdeb38aa72018-02-02 11:10:30 -050091 private TouchAnimator mSettingsCogAnimator;
Anthony Chen54daefe2017-04-07 17:19:54 -070092
Evan Laird00e43c42018-01-22 20:25:45 -050093 private View mActionsContainer;
Evan Lairdeb38aa72018-02-02 11:10:30 -050094 private View mDragHandle;
Amin Shaikh0e003312018-03-08 11:39:01 -050095 private View mMobileGroup;
96 private ImageView mMobileSignal;
97 private ImageView mMobileRoaming;
98 private final int mColorForeground;
99 private final CellSignalState mInfo = new CellSignalState();
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400100 private OnClickListener mExpandClickListener;
Evan Laird00e43c42018-01-22 20:25:45 -0500101
Anthony Chen54daefe2017-04-07 17:19:54 -0700102 public QSFooterImpl(Context context, AttributeSet attrs) {
103 super(context, attrs);
Amin Shaikh0e003312018-03-08 11:39:01 -0500104 mColorForeground = Utils.getColorAttr(context, android.R.attr.colorForeground);
Anthony Chen54daefe2017-04-07 17:19:54 -0700105 }
106
107 @Override
108 protected void onFinishInflate() {
109 super.onFinishInflate();
Amin Shaikhacf322d2018-01-31 17:04:56 -0500110 mDivider = findViewById(R.id.qs_footer_divider);
Anthony Chen54daefe2017-04-07 17:19:54 -0700111 mEdit = findViewById(android.R.id.edit);
112 mEdit.setOnClickListener(view ->
113 Dependency.get(ActivityStarter.class).postQSRunnableDismissingKeyguard(() ->
114 mQsPanel.showEdit(view)));
115
Rohan Shah3090e792018-04-12 00:01:00 -0400116 mPageIndicator = findViewById(R.id.footer_page_indicator);
117
Anthony Chen54daefe2017-04-07 17:19:54 -0700118 mSettingsButton = findViewById(R.id.settings_button);
119 mSettingsContainer = findViewById(R.id.settings_button_container);
120 mSettingsButton.setOnClickListener(this);
121
Amin Shaikh0e003312018-03-08 11:39:01 -0500122 mMobileGroup = findViewById(R.id.mobile_combo);
123 mMobileSignal = findViewById(R.id.mobile_signal);
124 mMobileRoaming = findViewById(R.id.mobile_roaming);
Evan Laird39254d42018-01-18 16:05:30 -0500125 mCarrierText = findViewById(R.id.qs_carrier_text);
126
Anthony Chen54daefe2017-04-07 17:19:54 -0700127 mMultiUserSwitch = findViewById(R.id.multi_user_switch);
128 mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
129
Evan Lairdeb38aa72018-02-02 11:10:30 -0500130 mDragHandle = findViewById(R.id.qs_drag_handle_view);
Evan Laird00e43c42018-01-22 20:25:45 -0500131 mActionsContainer = findViewById(R.id.qs_footer_actions_container);
132
Anthony Chen54daefe2017-04-07 17:19:54 -0700133 // RenderThread is doing more harm than good when touching the header (to expand quick
134 // settings), so disable it for this view
135 ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true);
Anthony Chen54daefe2017-04-07 17:19:54 -0700136
137 updateResources();
138
Anthony Chen54daefe2017-04-07 17:19:54 -0700139 mUserInfoController = Dependency.get(UserInfoController.class);
140 mActivityStarter = Dependency.get(ActivityStarter.class);
141 addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
142 oldBottom) -> updateAnimator(right - left));
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400143 setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
Anthony Chen54daefe2017-04-07 17:19:54 -0700144 }
145
146 private void updateAnimator(int width) {
147 int numTiles = QuickQSPanel.getNumQuickTiles(mContext);
148 int size = mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size)
149 - mContext.getResources().getDimensionPixelSize(dimen.qs_quick_tile_padding);
150 int remaining = (width - numTiles * size) / (numTiles - 1);
151 int defSpace = mContext.getResources().getDimensionPixelOffset(R.dimen.default_gear_space);
152
Evan Lairdeb38aa72018-02-02 11:10:30 -0500153 mSettingsCogAnimator = new Builder()
Jason Monk6dadd3e42017-09-01 09:36:19 -0400154 .addFloat(mSettingsContainer, "translationX",
155 isLayoutRtl() ? (remaining - defSpace) : -(remaining - defSpace), 0)
Anthony Chen54daefe2017-04-07 17:19:54 -0700156 .addFloat(mSettingsButton, "rotation", -120, 0)
157 .build();
Anthony Chen54daefe2017-04-07 17:19:54 -0700158
Anthony Chen54daefe2017-04-07 17:19:54 -0700159 setExpansion(mExpansionAmount);
160 }
161
162 @Override
163 protected void onConfigurationChanged(Configuration newConfig) {
164 super.onConfigurationChanged(newConfig);
165 updateResources();
166 }
167
168 @Override
169 public void onRtlPropertiesChanged(int layoutDirection) {
170 super.onRtlPropertiesChanged(layoutDirection);
171 updateResources();
172 }
173
174 private void updateResources() {
Evan Lairdeb38aa72018-02-02 11:10:30 -0500175 updateFooterAnimator();
Rohan Shah3090e792018-04-12 00:01:00 -0400176
177 // Update the width and weight of the actions container as the page indicator can sometimes
178 // show and the layout needs to center it between the carrier text and actions container.
179 LinearLayout.LayoutParams params =
180 (LinearLayout.LayoutParams) mActionsContainer.getLayoutParams();
181 params.width = mContext.getResources().getInteger(R.integer.qs_footer_actions_width);
182 params.weight = mContext.getResources().getInteger(R.integer.qs_footer_actions_weight);
183 mActionsContainer.setLayoutParams(params);
Anthony Chen54daefe2017-04-07 17:19:54 -0700184 }
185
Evan Lairdeb38aa72018-02-02 11:10:30 -0500186 private void updateFooterAnimator() {
187 mFooterAnimator = createFooterAnimator();
Anthony Chen54daefe2017-04-07 17:19:54 -0700188 }
189
190 @Nullable
Evan Lairdeb38aa72018-02-02 11:10:30 -0500191 private TouchAnimator createFooterAnimator() {
Anthony Chen54daefe2017-04-07 17:19:54 -0700192 return new TouchAnimator.Builder()
Amin Shaikhacf322d2018-01-31 17:04:56 -0500193 .addFloat(mDivider, "alpha", 0, 1)
Amin Shaikhd620def2018-02-27 16:52:53 -0500194 .addFloat(mCarrierText, "alpha", 0, 0, 1)
Amin Shaikh0e003312018-03-08 11:39:01 -0500195 .addFloat(mMobileGroup, "alpha", 0, 1)
Evan Laird00e43c42018-01-22 20:25:45 -0500196 .addFloat(mActionsContainer, "alpha", 0, 1)
Amin Shaikhd620def2018-02-27 16:52:53 -0500197 .addFloat(mDragHandle, "alpha", 1, 0, 0)
Rohan Shah3090e792018-04-12 00:01:00 -0400198 .addFloat(mPageIndicator, "alpha", 0, 1)
Amin Shaikh92fac562018-02-16 15:08:16 -0500199 .setStartDelay(0.15f)
Anthony Chen54daefe2017-04-07 17:19:54 -0700200 .build();
201 }
202
203 @Override
204 public void setKeyguardShowing(boolean keyguardShowing) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700205 setExpansion(mExpansionAmount);
206 }
207
208 @Override
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400209 public void setExpandClickListener(OnClickListener onClickListener) {
210 mExpandClickListener = onClickListener;
211 }
212
213 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700214 public void setExpanded(boolean expanded) {
215 if (mExpanded == expanded) return;
216 mExpanded = expanded;
217 updateEverything();
218 }
219
220 @Override
Anthony Chen54daefe2017-04-07 17:19:54 -0700221 public void setExpansion(float headerExpansionFraction) {
222 mExpansionAmount = headerExpansionFraction;
Evan Lairdeb38aa72018-02-02 11:10:30 -0500223 if (mSettingsCogAnimator != null) mSettingsCogAnimator.setPosition(headerExpansionFraction);
Anthony Chen54daefe2017-04-07 17:19:54 -0700224
Evan Lairdeb38aa72018-02-02 11:10:30 -0500225 if (mFooterAnimator != null) {
226 mFooterAnimator.setPosition(headerExpansionFraction);
Anthony Chen54daefe2017-04-07 17:19:54 -0700227 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700228 }
229
230 @Override
231 @VisibleForTesting
232 public void onDetachedFromWindow() {
233 setListening(false);
234 super.onDetachedFromWindow();
235 }
236
Anthony Chen54daefe2017-04-07 17:19:54 -0700237 @Override
238 public void setListening(boolean listening) {
239 if (listening == mListening) {
240 return;
241 }
242 mListening = listening;
243 updateListeners();
244 }
245
246 @Override
Amin Shaikh8a3e23c2018-04-17 11:14:32 -0400247 public boolean performAccessibilityAction(int action, Bundle arguments) {
248 if (action == AccessibilityNodeInfo.ACTION_EXPAND) {
249 if (mExpandClickListener != null) {
250 mExpandClickListener.onClick(null);
251 return true;
252 }
253 }
254 return super.performAccessibilityAction(action, arguments);
255 }
256
257 @Override
258 public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
259 super.onInitializeAccessibilityNodeInfo(info);
260 info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
Anthony Chen54daefe2017-04-07 17:19:54 -0700261 }
262
Charles Hece2a7c02017-10-11 20:25:20 +0100263 @Override
264 public void disable(int state1, int state2, boolean animate) {
265 final boolean disabled = (state2 & DISABLE2_QUICK_SETTINGS) != 0;
266 if (disabled == mQsDisabled) return;
267 mQsDisabled = disabled;
268 updateEverything();
269 }
270
Anthony Chen54daefe2017-04-07 17:19:54 -0700271 public void updateEverything() {
272 post(() -> {
273 updateVisibilities();
274 setClickable(false);
275 });
276 }
277
278 private void updateVisibilities() {
Charles Hece2a7c02017-10-11 20:25:20 +0100279 mSettingsContainer.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
Anthony Chen54daefe2017-04-07 17:19:54 -0700280 mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility(
281 TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE);
282 final boolean isDemo = UserManager.isDeviceInDemoMode(mContext);
Amin Shaikh50c17892018-03-21 18:15:22 -0400283 mMultiUserSwitch.setVisibility(showUserSwitcher(isDemo) ? View.VISIBLE : View.INVISIBLE);
Anthony Chen54daefe2017-04-07 17:19:54 -0700284 mEdit.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
Amin Shaikha59215a2018-04-23 08:52:38 -0400285 mSettingsButton.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE);
Anthony Chen54daefe2017-04-07 17:19:54 -0700286 }
287
Amin Shaikh50c17892018-03-21 18:15:22 -0400288 private boolean showUserSwitcher(boolean isDemo) {
289 if (!mExpanded || isDemo || !UserManager.supportsMultipleUsers()) {
290 return false;
291 }
292 UserManager userManager = UserManager.get(mContext);
293 if (userManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)) {
294 return false;
295 }
296 int switchableUserCount = 0;
297 for (UserInfo user : userManager.getUsers(true)) {
298 if (user.supportsSwitchToByUser()) {
299 ++switchableUserCount;
300 if (switchableUserCount > 1) {
301 return true;
302 }
303 }
304 }
305 return getResources().getBoolean(R.bool.qs_show_user_switcher_for_single_user);
306 }
307
Anthony Chen54daefe2017-04-07 17:19:54 -0700308 private void updateListeners() {
309 if (mListening) {
Anthony Chen54daefe2017-04-07 17:19:54 -0700310 mUserInfoController.addCallback(this);
311 if (Dependency.get(NetworkController.class).hasVoiceCallingFeature()) {
312 Dependency.get(NetworkController.class).addEmergencyListener(this);
313 Dependency.get(NetworkController.class).addCallback(this);
314 }
315 } else {
Anthony Chen54daefe2017-04-07 17:19:54 -0700316 mUserInfoController.removeCallback(this);
317 Dependency.get(NetworkController.class).removeEmergencyListener(this);
318 Dependency.get(NetworkController.class).removeCallback(this);
319 }
320 }
321
322 @Override
323 public void setQSPanel(final QSPanel qsPanel) {
324 mQsPanel = qsPanel;
325 if (mQsPanel != null) {
326 mMultiUserSwitch.setQsPanel(qsPanel);
Rohan Shah3090e792018-04-12 00:01:00 -0400327 mQsPanel.setFooterPageIndicator(mPageIndicator);
Anthony Chen54daefe2017-04-07 17:19:54 -0700328 }
329 }
330
331 @Override
332 public void onClick(View v) {
Evan Laird00e43c42018-01-22 20:25:45 -0500333 // Don't do anything until view are unhidden
334 if (!mExpanded) {
335 return;
336 }
337
Anthony Chen54daefe2017-04-07 17:19:54 -0700338 if (v == mSettingsButton) {
339 if (!Dependency.get(DeviceProvisionedController.class).isCurrentUserSetup()) {
340 // If user isn't setup just unlock the device and dump them back at SUW.
341 mActivityStarter.postQSRunnableDismissingKeyguard(() -> { });
342 return;
343 }
344 MetricsLogger.action(mContext,
345 mExpanded ? MetricsProto.MetricsEvent.ACTION_QS_EXPANDED_SETTINGS_LAUNCH
346 : MetricsProto.MetricsEvent.ACTION_QS_COLLAPSED_SETTINGS_LAUNCH);
347 if (mSettingsButton.isTunerClick()) {
348 Dependency.get(ActivityStarter.class).postQSRunnableDismissingKeyguard(() -> {
349 if (TunerService.isTunerEnabled(mContext)) {
350 TunerService.showResetRequest(mContext, () -> {
351 // Relaunch settings so that the tuner disappears.
352 startSettingsActivity();
353 });
354 } else {
355 Toast.makeText(getContext(), R.string.tuner_toast,
356 Toast.LENGTH_LONG).show();
357 TunerService.setTunerEnabled(mContext, true);
358 }
359 startSettingsActivity();
360
361 });
362 } else {
363 startSettingsActivity();
364 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700365 }
366 }
367
368 private void startSettingsActivity() {
369 mActivityStarter.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS),
370 true /* dismissShade */);
371 }
372
373 @Override
374 public void setEmergencyCallsOnly(boolean show) {
375 boolean changed = show != mShowEmergencyCallsOnly;
376 if (changed) {
377 mShowEmergencyCallsOnly = show;
378 if (mExpanded) {
379 updateEverything();
380 }
381 }
382 }
383
384 @Override
385 public void onUserInfoChanged(String name, Drawable picture, String userAccount) {
386 if (picture != null &&
Selim Cinek1a891a92017-12-04 17:41:27 +0100387 UserManager.get(mContext).isGuestUser(KeyguardUpdateMonitor.getCurrentUser()) &&
Jason Monk826b6092017-08-29 11:30:52 -0400388 !(picture instanceof UserIconDrawable)) {
389 picture = picture.getConstantState().newDrawable(mContext.getResources()).mutate();
Anthony Chen54daefe2017-04-07 17:19:54 -0700390 picture.setColorFilter(
391 Utils.getColorAttr(mContext, android.R.attr.colorForeground),
392 Mode.SRC_IN);
393 }
394 mMultiUserAvatar.setImageDrawable(picture);
395 }
Amin Shaikh0e003312018-03-08 11:39:01 -0500396
397 private void handleUpdateState() {
398 mMobileGroup.setVisibility(mInfo.visible ? View.VISIBLE : View.GONE);
399 if (mInfo.visible) {
400 mMobileRoaming.setVisibility(mInfo.roaming ? View.VISIBLE : View.GONE);
401 mMobileRoaming.setImageTintList(ColorStateList.valueOf(mColorForeground));
402 SignalDrawable d = new SignalDrawable(mContext);
403 d.setDarkIntensity(QuickStatusBarHeader.getColorIntensity(mColorForeground));
404 mMobileSignal.setImageDrawable(d);
405 mMobileSignal.setImageLevel(mInfo.mobileSignalIconId);
406
407 StringBuilder contentDescription = new StringBuilder();
408 if (mInfo.contentDescription != null) {
409 contentDescription.append(mInfo.contentDescription).append(", ");
410 }
411 if (mInfo.roaming) {
412 contentDescription
413 .append(mContext.getString(R.string.data_connection_roaming))
414 .append(", ");
415 }
416 // TODO: show mobile data off/no internet text for 5 seconds before carrier text
417 if (TextUtils.equals(mInfo.typeContentDescription,
418 mContext.getString(R.string.data_connection_no_internet))
419 || TextUtils.equals(mInfo.typeContentDescription,
Rohan Shah7bc37442018-04-10 00:34:50 -0400420 mContext.getString(R.string.cell_data_off_content_description))) {
Amin Shaikh0e003312018-03-08 11:39:01 -0500421 contentDescription.append(mInfo.typeContentDescription);
422 }
423 mMobileSignal.setContentDescription(contentDescription);
424 }
425 }
426
427 @Override
428 public void setMobileDataIndicators(NetworkController.IconState statusIcon,
429 NetworkController.IconState qsIcon, int statusType,
430 int qsType, boolean activityIn, boolean activityOut,
431 String typeContentDescription,
432 String description, boolean isWide, int subId, boolean roaming) {
433 mInfo.visible = statusIcon.visible;
434 mInfo.mobileSignalIconId = statusIcon.icon;
435 mInfo.contentDescription = statusIcon.contentDescription;
436 mInfo.typeContentDescription = typeContentDescription;
437 mInfo.roaming = roaming;
438 handleUpdateState();
439 }
440
441 @Override
442 public void setNoSims(boolean hasNoSims, boolean simDetected) {
443 if (hasNoSims) {
444 mInfo.visible = false;
445 }
446 handleUpdateState();
447 }
448
449 private final class CellSignalState {
450 boolean visible;
451 int mobileSignalIconId;
452 public String contentDescription;
453 String typeContentDescription;
454 boolean roaming;
455 }
Anthony Chen54daefe2017-04-07 17:19:54 -0700456}