1 /* 2 * Copyright (C) 2008 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.app.ActivityManager; 20 import android.app.ActivityManagerNative; 21 import android.app.AlarmManager; 22 import android.app.AlarmManager.AlarmClockInfo; 23 import android.app.SynchronousUserSwitchObserver; 24 import android.content.BroadcastReceiver; 25 import android.content.Context; 26 import android.content.Intent; 27 import android.content.IntentFilter; 28 import android.content.pm.UserInfo; 29 import android.media.AudioManager; 30 import android.os.Handler; 31 import android.os.RemoteException; 32 import android.os.UserHandle; 33 import android.os.UserManager; 34 import android.provider.Settings.Global; 35 import android.telecom.TelecomManager; 36 import android.util.Log; 37 38 import com.android.internal.telephony.IccCardConstants; 39 import com.android.internal.telephony.TelephonyIntents; 40 import com.android.systemui.R; 41 import com.android.systemui.qs.tiles.DndTile; 42 import com.android.systemui.qs.tiles.RotationLockTile; 43 import com.android.systemui.statusbar.policy.BluetoothController; 44 import com.android.systemui.statusbar.policy.BluetoothController.Callback; 45 import com.android.systemui.statusbar.policy.CastController; 46 import com.android.systemui.statusbar.policy.CastController.CastDevice; 47 import com.android.systemui.statusbar.policy.DataSaverController; 48 import com.android.systemui.statusbar.policy.HotspotController; 49 import com.android.systemui.statusbar.policy.RotationLockController; 50 import com.android.systemui.statusbar.policy.UserInfoController; 51 52 /** 53 * This class contains all of the policy about which icons are installed in the status 54 * bar at boot time. It goes through the normal API for icons, even though it probably 55 * strictly doesn't need to. 56 */ 57 public class PhoneStatusBarPolicy implements Callback, RotationLockController.RotationLockControllerCallback, DataSaverController.Listener { 58 private static final String TAG = "PhoneStatusBarPolicy"; 59 private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); 60 61 private final String mSlotCast; 62 private final String mSlotHotspot; 63 private final String mSlotBluetooth; 64 private final String mSlotTty; 65 private final String mSlotZen; 66 private final String mSlotVolume; 67 private final String mSlotAlarmClock; 68 private final String mSlotManagedProfile; 69 private final String mSlotRotate; 70 private final String mSlotHeadset; 71 private final String mSlotDataSaver; 72 73 private final Context mContext; 74 private final Handler mHandler = new Handler(); 75 private final CastController mCast; 76 private final HotspotController mHotspot; 77 private final AlarmManager mAlarmManager; 78 private final UserInfoController mUserInfoController; 79 private final UserManager mUserManager; 80 private final StatusBarIconController mIconController; 81 private final RotationLockController mRotationLockController; 82 private final DataSaverController mDataSaver; 83 private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; 84 85 // Assume it's all good unless we hear otherwise. We don't always seem 86 // to get broadcasts that it *is* there. 87 IccCardConstants.State mSimState = IccCardConstants.State.READY; 88 89 private boolean mZenVisible; 90 private boolean mVolumeVisible; 91 private boolean mCurrentUserSetup; 92 93 private int mZen; 94 95 private boolean mManagedProfileFocused = false; 96 private boolean mManagedProfileIconVisible = false; 97 private boolean mManagedProfileInQuietMode = false; 98 99 private BluetoothController mBluetooth; 100 PhoneStatusBarPolicy(Context context, StatusBarIconController iconController, CastController cast, HotspotController hotspot, UserInfoController userInfoController, BluetoothController bluetooth, RotationLockController rotationLockController, DataSaverController dataSaver)101 public PhoneStatusBarPolicy(Context context, StatusBarIconController iconController, 102 CastController cast, HotspotController hotspot, UserInfoController userInfoController, 103 BluetoothController bluetooth, RotationLockController rotationLockController, 104 DataSaverController dataSaver) { 105 mContext = context; 106 mIconController = iconController; 107 mCast = cast; 108 mHotspot = hotspot; 109 mBluetooth = bluetooth; 110 mBluetooth.addStateChangedCallback(this); 111 mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); 112 mUserInfoController = userInfoController; 113 mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); 114 mRotationLockController = rotationLockController; 115 mDataSaver = dataSaver; 116 117 mSlotCast = context.getString(com.android.internal.R.string.status_bar_cast); 118 mSlotHotspot = context.getString(com.android.internal.R.string.status_bar_hotspot); 119 mSlotBluetooth = context.getString(com.android.internal.R.string.status_bar_bluetooth); 120 mSlotTty = context.getString(com.android.internal.R.string.status_bar_tty); 121 mSlotZen = context.getString(com.android.internal.R.string.status_bar_zen); 122 mSlotVolume = context.getString(com.android.internal.R.string.status_bar_volume); 123 mSlotAlarmClock = context.getString(com.android.internal.R.string.status_bar_alarm_clock); 124 mSlotManagedProfile = context.getString( 125 com.android.internal.R.string.status_bar_managed_profile); 126 mSlotRotate = context.getString(com.android.internal.R.string.status_bar_rotate); 127 mSlotHeadset = context.getString(com.android.internal.R.string.status_bar_headset); 128 mSlotDataSaver = context.getString(com.android.internal.R.string.status_bar_data_saver); 129 130 mRotationLockController.addRotationLockControllerCallback(this); 131 132 // listen for broadcasts 133 IntentFilter filter = new IntentFilter(); 134 filter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED); 135 filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); 136 filter.addAction(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION); 137 filter.addAction(AudioManager.ACTION_HEADSET_PLUG); 138 filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); 139 filter.addAction(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED); 140 filter.addAction(Intent.ACTION_MANAGED_PROFILE_AVAILABLE); 141 filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); 142 filter.addAction(Intent.ACTION_MANAGED_PROFILE_REMOVED); 143 mContext.registerReceiver(mIntentReceiver, filter, null, mHandler); 144 145 // listen for user / profile change. 146 try { 147 ActivityManagerNative.getDefault().registerUserSwitchObserver(mUserSwitchListener); 148 } catch (RemoteException e) { 149 // Ignore 150 } 151 152 // TTY status 153 mIconController.setIcon(mSlotTty, R.drawable.stat_sys_tty_mode, null); 154 mIconController.setIconVisibility(mSlotTty, false); 155 156 // bluetooth status 157 updateBluetooth(); 158 159 // Alarm clock 160 mIconController.setIcon(mSlotAlarmClock, R.drawable.stat_sys_alarm, null); 161 mIconController.setIconVisibility(mSlotAlarmClock, false); 162 163 // zen 164 mIconController.setIcon(mSlotZen, R.drawable.stat_sys_zen_important, null); 165 mIconController.setIconVisibility(mSlotZen, false); 166 167 // volume 168 mIconController.setIcon(mSlotVolume, R.drawable.stat_sys_ringer_vibrate, null); 169 mIconController.setIconVisibility(mSlotVolume, false); 170 updateVolumeZen(); 171 172 // cast 173 mIconController.setIcon(mSlotCast, R.drawable.stat_sys_cast, null); 174 mIconController.setIconVisibility(mSlotCast, false); 175 mCast.addCallback(mCastCallback); 176 177 // hotspot 178 mIconController.setIcon(mSlotHotspot, R.drawable.stat_sys_hotspot, 179 mContext.getString(R.string.accessibility_status_bar_hotspot)); 180 mIconController.setIconVisibility(mSlotHotspot, mHotspot.isHotspotEnabled()); 181 mHotspot.addCallback(mHotspotCallback); 182 183 // managed profile 184 mIconController.setIcon(mSlotManagedProfile, R.drawable.stat_sys_managed_profile_status, 185 mContext.getString(R.string.accessibility_managed_profile)); 186 mIconController.setIconVisibility(mSlotManagedProfile, mManagedProfileIconVisible); 187 188 // data saver 189 mIconController.setIcon(mSlotDataSaver, R.drawable.stat_sys_data_saver, 190 context.getString(R.string.accessibility_data_saver_on)); 191 mIconController.setIconVisibility(mSlotDataSaver, false); 192 mDataSaver.addListener(this); 193 } 194 setStatusBarKeyguardViewManager( StatusBarKeyguardViewManager statusBarKeyguardViewManager)195 public void setStatusBarKeyguardViewManager( 196 StatusBarKeyguardViewManager statusBarKeyguardViewManager) { 197 mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; 198 } 199 setZenMode(int zen)200 public void setZenMode(int zen) { 201 mZen = zen; 202 updateVolumeZen(); 203 } 204 updateAlarm()205 private void updateAlarm() { 206 final AlarmClockInfo alarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT); 207 final boolean hasAlarm = alarm != null && alarm.getTriggerTime() > 0; 208 final boolean zenNone = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS; 209 mIconController.setIcon(mSlotAlarmClock, zenNone ? R.drawable.stat_sys_alarm_dim 210 : R.drawable.stat_sys_alarm, null); 211 mIconController.setIconVisibility(mSlotAlarmClock, mCurrentUserSetup && hasAlarm); 212 } 213 updateSimState(Intent intent)214 private final void updateSimState(Intent intent) { 215 String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); 216 if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) { 217 mSimState = IccCardConstants.State.ABSENT; 218 } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(stateExtra)) { 219 mSimState = IccCardConstants.State.CARD_IO_ERROR; 220 } else if (IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)) { 221 mSimState = IccCardConstants.State.READY; 222 } else if (IccCardConstants.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) { 223 final String lockedReason = 224 intent.getStringExtra(IccCardConstants.INTENT_KEY_LOCKED_REASON); 225 if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { 226 mSimState = IccCardConstants.State.PIN_REQUIRED; 227 } else if (IccCardConstants.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { 228 mSimState = IccCardConstants.State.PUK_REQUIRED; 229 } else { 230 mSimState = IccCardConstants.State.NETWORK_LOCKED; 231 } 232 } else { 233 mSimState = IccCardConstants.State.UNKNOWN; 234 } 235 } 236 updateVolumeZen()237 private final void updateVolumeZen() { 238 AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); 239 240 boolean zenVisible = false; 241 int zenIconId = 0; 242 String zenDescription = null; 243 244 boolean volumeVisible = false; 245 int volumeIconId = 0; 246 String volumeDescription = null; 247 248 if (DndTile.isVisible(mContext) || DndTile.isCombinedIcon(mContext)) { 249 zenVisible = mZen != Global.ZEN_MODE_OFF; 250 zenIconId = mZen == Global.ZEN_MODE_NO_INTERRUPTIONS 251 ? R.drawable.stat_sys_dnd_total_silence : R.drawable.stat_sys_dnd; 252 zenDescription = mContext.getString(R.string.quick_settings_dnd_label); 253 } else if (mZen == Global.ZEN_MODE_NO_INTERRUPTIONS) { 254 zenVisible = true; 255 zenIconId = R.drawable.stat_sys_zen_none; 256 zenDescription = mContext.getString(R.string.interruption_level_none); 257 } else if (mZen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS) { 258 zenVisible = true; 259 zenIconId = R.drawable.stat_sys_zen_important; 260 zenDescription = mContext.getString(R.string.interruption_level_priority); 261 } 262 263 if (DndTile.isVisible(mContext) && !DndTile.isCombinedIcon(mContext) 264 && audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_SILENT) { 265 volumeVisible = true; 266 volumeIconId = R.drawable.stat_sys_ringer_silent; 267 volumeDescription = mContext.getString(R.string.accessibility_ringer_silent); 268 } else if (mZen != Global.ZEN_MODE_NO_INTERRUPTIONS && mZen != Global.ZEN_MODE_ALARMS && 269 audioManager.getRingerModeInternal() == AudioManager.RINGER_MODE_VIBRATE) { 270 volumeVisible = true; 271 volumeIconId = R.drawable.stat_sys_ringer_vibrate; 272 volumeDescription = mContext.getString(R.string.accessibility_ringer_vibrate); 273 } 274 275 if (zenVisible) { 276 mIconController.setIcon(mSlotZen, zenIconId, zenDescription); 277 } 278 if (zenVisible != mZenVisible) { 279 mIconController.setIconVisibility(mSlotZen, zenVisible); 280 mZenVisible = zenVisible; 281 } 282 283 if (volumeVisible) { 284 mIconController.setIcon(mSlotVolume, volumeIconId, volumeDescription); 285 } 286 if (volumeVisible != mVolumeVisible) { 287 mIconController.setIconVisibility(mSlotVolume, volumeVisible); 288 mVolumeVisible = volumeVisible; 289 } 290 updateAlarm(); 291 } 292 293 @Override onBluetoothDevicesChanged()294 public void onBluetoothDevicesChanged() { 295 updateBluetooth(); 296 } 297 298 @Override onBluetoothStateChange(boolean enabled)299 public void onBluetoothStateChange(boolean enabled) { 300 updateBluetooth(); 301 } 302 updateBluetooth()303 private final void updateBluetooth() { 304 int iconId = R.drawable.stat_sys_data_bluetooth; 305 String contentDescription = 306 mContext.getString(R.string.accessibility_quick_settings_bluetooth_on); 307 boolean bluetoothEnabled = false; 308 if (mBluetooth != null) { 309 bluetoothEnabled = mBluetooth.isBluetoothEnabled(); 310 if (mBluetooth.isBluetoothConnected()) { 311 iconId = R.drawable.stat_sys_data_bluetooth_connected; 312 contentDescription = mContext.getString(R.string.accessibility_bluetooth_connected); 313 } 314 } 315 316 mIconController.setIcon(mSlotBluetooth, iconId, contentDescription); 317 mIconController.setIconVisibility(mSlotBluetooth, bluetoothEnabled); 318 } 319 updateTTY(Intent intent)320 private final void updateTTY(Intent intent) { 321 int currentTtyMode = intent.getIntExtra(TelecomManager.EXTRA_CURRENT_TTY_MODE, 322 TelecomManager.TTY_MODE_OFF); 323 boolean enabled = currentTtyMode != TelecomManager.TTY_MODE_OFF; 324 325 if (DEBUG) Log.v(TAG, "updateTTY: enabled: " + enabled); 326 327 if (enabled) { 328 // TTY is on 329 if (DEBUG) Log.v(TAG, "updateTTY: set TTY on"); 330 mIconController.setIcon(mSlotTty, R.drawable.stat_sys_tty_mode, 331 mContext.getString(R.string.accessibility_tty_enabled)); 332 mIconController.setIconVisibility(mSlotTty, true); 333 } else { 334 // TTY is off 335 if (DEBUG) Log.v(TAG, "updateTTY: set TTY off"); 336 mIconController.setIconVisibility(mSlotTty, false); 337 } 338 } 339 updateCast()340 private void updateCast() { 341 boolean isCasting = false; 342 for (CastDevice device : mCast.getCastDevices()) { 343 if (device.state == CastDevice.STATE_CONNECTING 344 || device.state == CastDevice.STATE_CONNECTED) { 345 isCasting = true; 346 break; 347 } 348 } 349 if (DEBUG) Log.v(TAG, "updateCast: isCasting: " + isCasting); 350 mHandler.removeCallbacks(mRemoveCastIconRunnable); 351 if (isCasting) { 352 mIconController.setIcon(mSlotCast, R.drawable.stat_sys_cast, 353 mContext.getString(R.string.accessibility_casting)); 354 mIconController.setIconVisibility(mSlotCast, true); 355 } else { 356 // don't turn off the screen-record icon for a few seconds, just to make sure the user 357 // has seen it 358 if (DEBUG) Log.v(TAG, "updateCast: hiding icon in 3 sec..."); 359 mHandler.postDelayed(mRemoveCastIconRunnable, 3000); 360 } 361 } 362 updateQuietState()363 private void updateQuietState() { 364 mManagedProfileInQuietMode = false; 365 int currentUserId = ActivityManager.getCurrentUser(); 366 for (UserInfo ui : mUserManager.getEnabledProfiles(currentUserId)) { 367 if (ui.isManagedProfile() && ui.isQuietModeEnabled()) { 368 mManagedProfileInQuietMode = true; 369 return; 370 } 371 } 372 } 373 profileChanged(int userId)374 private void profileChanged(int userId) { 375 UserInfo user = null; 376 if (userId == UserHandle.USER_CURRENT) { 377 try { 378 user = ActivityManagerNative.getDefault().getCurrentUser(); 379 } catch (RemoteException e) { 380 // Ignore 381 } 382 } else { 383 user = mUserManager.getUserInfo(userId); 384 } 385 386 mManagedProfileFocused = user != null && user.isManagedProfile(); 387 if (DEBUG) Log.v(TAG, "profileChanged: mManagedProfileFocused: " + mManagedProfileFocused); 388 // Actually update the icon later when transition starts. 389 } 390 updateManagedProfile()391 private void updateManagedProfile() { 392 if (DEBUG) Log.v(TAG, "updateManagedProfile: mManagedProfileFocused: " 393 + mManagedProfileFocused); 394 final boolean showIcon; 395 if (mManagedProfileFocused && !mStatusBarKeyguardViewManager.isShowing()) { 396 showIcon = true; 397 mIconController.setIcon(mSlotManagedProfile, 398 R.drawable.stat_sys_managed_profile_status, 399 mContext.getString(R.string.accessibility_managed_profile)); 400 } else if (mManagedProfileInQuietMode) { 401 showIcon = true; 402 mIconController.setIcon(mSlotManagedProfile, 403 R.drawable.stat_sys_managed_profile_status_off, 404 mContext.getString(R.string.accessibility_managed_profile)); 405 } else { 406 showIcon = false; 407 } 408 if (mManagedProfileIconVisible != showIcon) { 409 mIconController.setIconVisibility(mSlotManagedProfile, showIcon); 410 mManagedProfileIconVisible = showIcon; 411 } 412 } 413 414 private final SynchronousUserSwitchObserver mUserSwitchListener = 415 new SynchronousUserSwitchObserver() { 416 @Override 417 public void onUserSwitching(int newUserId) throws RemoteException { 418 mHandler.post(new Runnable() { 419 @Override 420 public void run() { 421 mUserInfoController.reloadUserInfo(); 422 } 423 }); 424 } 425 426 @Override 427 public void onUserSwitchComplete(int newUserId) throws RemoteException { 428 mHandler.post(new Runnable() { 429 @Override 430 public void run() { 431 updateAlarm(); 432 profileChanged(newUserId); 433 updateQuietState(); 434 updateManagedProfile(); 435 } 436 }); 437 } 438 439 @Override 440 public void onForegroundProfileSwitch(int newProfileId) { 441 mHandler.post(new Runnable() { 442 @Override 443 public void run() { 444 profileChanged(newProfileId); 445 } 446 }); 447 } 448 }; 449 450 private final HotspotController.Callback mHotspotCallback = new HotspotController.Callback() { 451 @Override 452 public void onHotspotChanged(boolean enabled) { 453 mIconController.setIconVisibility(mSlotHotspot, enabled); 454 } 455 }; 456 457 private final CastController.Callback mCastCallback = new CastController.Callback() { 458 @Override 459 public void onCastDevicesChanged() { 460 updateCast(); 461 } 462 }; 463 appTransitionStarting(long startTime, long duration)464 public void appTransitionStarting(long startTime, long duration) { 465 updateManagedProfile(); 466 } 467 notifyKeyguardShowingChanged()468 public void notifyKeyguardShowingChanged() { 469 updateManagedProfile(); 470 } 471 setCurrentUserSetup(boolean userSetup)472 public void setCurrentUserSetup(boolean userSetup) { 473 if (mCurrentUserSetup == userSetup) return; 474 mCurrentUserSetup = userSetup; 475 updateAlarm(); 476 updateQuietState(); 477 } 478 479 @Override onRotationLockStateChanged(boolean rotationLocked, boolean affordanceVisible)480 public void onRotationLockStateChanged(boolean rotationLocked, boolean affordanceVisible) { 481 boolean portrait = RotationLockTile.isCurrentOrientationLockPortrait( 482 mRotationLockController, mContext); 483 if (rotationLocked) { 484 if (portrait) { 485 mIconController.setIcon(mSlotRotate, R.drawable.stat_sys_rotate_portrait, 486 mContext.getString(R.string.accessibility_rotation_lock_on_portrait)); 487 } else { 488 mIconController.setIcon(mSlotRotate, R.drawable.stat_sys_rotate_landscape, 489 mContext.getString(R.string.accessibility_rotation_lock_on_landscape)); 490 } 491 mIconController.setIconVisibility(mSlotRotate, true); 492 } else { 493 mIconController.setIconVisibility(mSlotRotate, false); 494 } 495 } 496 updateHeadsetPlug(Intent intent)497 private void updateHeadsetPlug(Intent intent) { 498 boolean connected = intent.getIntExtra("state", 0) != 0; 499 boolean hasMic = intent.getIntExtra("microphone", 0) != 0; 500 if (connected) { 501 String contentDescription = mContext.getString(hasMic 502 ? R.string.accessibility_status_bar_headset 503 : R.string.accessibility_status_bar_headphones); 504 mIconController.setIcon(mSlotHeadset, hasMic ? R.drawable.ic_headset_mic 505 : R.drawable.ic_headset, contentDescription); 506 mIconController.setIconVisibility(mSlotHeadset, true); 507 } else { 508 mIconController.setIconVisibility(mSlotHeadset, false); 509 } 510 } 511 512 @Override onDataSaverChanged(boolean isDataSaving)513 public void onDataSaverChanged(boolean isDataSaving) { 514 mIconController.setIconVisibility(mSlotDataSaver, isDataSaving); 515 } 516 517 private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { 518 @Override 519 public void onReceive(Context context, Intent intent) { 520 String action = intent.getAction(); 521 if (action.equals(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED)) { 522 updateAlarm(); 523 } else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION) || 524 action.equals(AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION)) { 525 updateVolumeZen(); 526 } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { 527 updateSimState(intent); 528 } else if (action.equals(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED)) { 529 updateTTY(intent); 530 } else if (action.equals(Intent.ACTION_MANAGED_PROFILE_AVAILABLE) || 531 action.equals(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE) || 532 action.equals(Intent.ACTION_MANAGED_PROFILE_REMOVED)) { 533 updateQuietState(); 534 updateManagedProfile(); 535 } else if (action.equals(AudioManager.ACTION_HEADSET_PLUG)) { 536 updateHeadsetPlug(intent); 537 } 538 } 539 }; 540 541 private Runnable mRemoveCastIconRunnable = new Runnable() { 542 @Override 543 public void run() { 544 if (DEBUG) Log.v(TAG, "updateCast: hiding icon NOW"); 545 mIconController.setIconVisibility(mSlotCast, false); 546 } 547 }; 548 } 549