diff options
Diffstat (limited to 'packages/SystemUI/src')
13 files changed, 117 insertions, 106 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java index 1e7ee98..445ecb6 100644 --- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java +++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java @@ -16,7 +16,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; @@ -28,12 +27,15 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; -import com.android.internal.app.IVoiceInteractionManagerService; +import com.android.internal.app.AssistUtils; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.systemui.R; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.PhoneStatusBar; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * Class to manage everything related to assist in SystemUI. */ @@ -55,7 +57,7 @@ public class AssistManager { private final WindowManager mWindowManager; private AssistOrbContainer mView; private final PhoneStatusBar mBar; - private final IVoiceInteractionManagerService mVoiceInteractionManagerService; + private final AssistUtils mAssistUtils; private ComponentName mAssistComponent; @@ -92,8 +94,7 @@ public class AssistManager { mContext = context; mBar = bar; mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); - mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface( - ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE)); + mAssistUtils = new AssistUtils(context); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false, @@ -140,11 +141,7 @@ public class AssistManager { } public void hideAssist() { - try { - mVoiceInteractionManagerService.hideCurrentSession(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call hideCurrentSession", e); - } + mAssistUtils.hideCurrentSession(); } private WindowManager.LayoutParams getLayoutParams() { @@ -216,58 +213,27 @@ public class AssistManager { } private void startVoiceInteractor() { - try { - mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call showSessionForActiveService", e); - } + mAssistUtils.showSessionForActiveService(mShowCallback); } public void launchVoiceAssistFromKeyguard() { - try { - mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e); - } + mAssistUtils.launchVoiceAssistFromKeyguard(); } private boolean getVoiceInteractorSupportsAssistGesture() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsAssist(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e); - return false; - } + return mAssistUtils.activeServiceSupportsAssistGesture(); } public boolean canVoiceAssistBeLaunchedFromKeyguard() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e); - return false; - } + return mAssistUtils.activeServiceSupportsLaunchFromKeyguard(); } public ComponentName getVoiceInteractorComponentName() { - try { - return mVoiceInteractionManagerService.getActiveServiceComponentName(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call getActiveServiceComponentName", e); - return null; - } + return mAssistUtils.getActiveServiceComponentName(); } private boolean isVoiceSessionRunning() { - try { - return mVoiceInteractionManagerService != null - && mVoiceInteractionManagerService.isSessionRunning(); - } catch (RemoteException e) { - Log.w(TAG, "Failed to call isSessionRunning", e); - return false; - } + return mAssistUtils.isSessionRunning(); } public void destroy() { @@ -324,26 +290,11 @@ public class AssistManager { } private void updateAssistInfo() { - final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(), - Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT); - if (setting != null) { - mAssistComponent = ComponentName.unflattenFromString(setting); - return; - } - - // Fallback to keep backward compatible behavior when there is no user setting. - if (getVoiceInteractorSupportsAssistGesture()) { - mAssistComponent = getVoiceInteractorComponentName(); - return; - } - - Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)) - .getAssistIntent(mContext, false, UserHandle.USER_CURRENT); - if (intent != null) { - mAssistComponent = intent.getComponent(); - return; - } + mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT); + } - mAssistComponent = null; + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("AssistManager state:"); + pw.print(" mAssistComponent="); pw.println(mAssistComponent); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f00fed5..c06b34f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -371,7 +371,6 @@ public class KeyguardViewMediator extends SystemUI { @Override public void onDeviceProvisioned() { sendUserPresentBroadcast(); - updateInputRestricted(); } @Override @@ -947,7 +946,7 @@ public class KeyguardViewMediator extends SystemUI { * was suppressed by an app that disabled the keyguard or we haven't been provisioned yet. */ public boolean isInputRestricted() { - return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning(); + return mShowing || mNeedToReshowWhenReenabled; } private void updateInputRestricted() { diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java index 95ac558..25b9105 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailItems.java @@ -193,8 +193,6 @@ public class QSDetailItems extends FrameLayout { title.setMaxLines(twoLines ? 1 : 2); summary.setVisibility(twoLines ? VISIBLE : GONE); summary.setText(twoLines ? item.line2 : null); - view.setMinimumHeight(mContext.getResources() .getDimensionPixelSize( - twoLines ? R.dimen.qs_detail_item_height_twoline : R.dimen.qs_detail_item_height)); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { @@ -239,8 +237,8 @@ public class QSDetailItems extends FrameLayout { public static class Item { public int icon; public Drawable overlay; - public String line1; - public String line2; + public CharSequence line1; + public CharSequence line2; public Object tag; public boolean canDisconnect; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index c8212c2..9761cd1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -242,6 +242,9 @@ public class QSPanel extends ViewGroup { } private void handleSetTileVisibility(View v, int visibility) { + if (visibility == VISIBLE && !mGridContentVisible) { + visibility = INVISIBLE; + } if (visibility == v.getVisibility()) return; v.setVisibility(visibility); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java index f4d6f04..f97f519 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java @@ -38,6 +38,7 @@ import com.android.systemui.volume.ZenModePanel; /** Quick settings tile: Do not disturb **/ public class DndTile extends QSTile<QSTile.BooleanState> { + private static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS); @@ -47,6 +48,14 @@ public class DndTile extends QSTile<QSTile.BooleanState> { private static final String ACTION_SET_VISIBLE = "com.android.systemui.dndtile.SET_VISIBLE"; private static final String EXTRA_VISIBLE = "visible"; + private static final QSTile.Icon TOTAL_SILENCE = + ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence); + + private final AnimationIcon mDisable = + new AnimationIcon(R.drawable.ic_dnd_disable_animation); + private final AnimationIcon mDisableTotalSilence = + new AnimationIcon(R.drawable.ic_dnd_total_silence_disable_animation); + private final ZenModeController mController; private final DndDetailAdapter mDetailAdapter; @@ -89,6 +98,8 @@ public class DndTile extends QSTile<QSTile.BooleanState> { @Override public void handleClick() { + mDisable.setAllowAnimation(true); + mDisableTotalSilence.setAllowAnimation(true); MetricsLogger.action(mContext, getMetricsCategory(), !mState.value); if (mState.value) { mController.setZen(Global.ZEN_MODE_OFF, null, TAG); @@ -114,7 +125,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { R.string.accessibility_quick_settings_dnd_priority_on); break; case Global.ZEN_MODE_NO_INTERRUPTIONS: - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence); + state.icon = TOTAL_SILENCE; state.label = mContext.getString(R.string.quick_settings_dnd_none_label); state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_dnd_none_on); @@ -126,7 +137,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> { R.string.accessibility_quick_settings_dnd_alarms_on); break; default: - state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_off); + state.icon = TOTAL_SILENCE.equals(state.icon) ? mDisableTotalSilence : mDisable; state.label = mContext.getString(R.string.quick_settings_dnd_label); state.contentDescription = mContext.getString( R.string.accessibility_quick_settings_dnd_off); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 915867b..6d2c8c0 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -73,8 +73,8 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { : mController.isRotationLocked(); final boolean userInitiated = arg != null ? ((UserBoolean) arg).userInitiated : false; state.visible = mController.isRotationLockAffordanceVisible(); - if (state.value == rotationLocked) { - // No change, no need to update all the values. + if (state.value == rotationLocked && state.contentDescription != null) { + // No change and initialized, no need to update all the values. return; } state.value = rotationLocked; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java index ff7b37f..9e0b08b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -114,14 +114,21 @@ public class SignalClusterView return; } ArraySet<String> blockList = StatusBarIconController.getIconBlacklist(newValue); - mBlockAirplane = blockList.contains(SLOT_AIRPLANE); - mBlockMobile = blockList.contains(SLOT_MOBILE); - mBlockWifi = blockList.contains(SLOT_WIFI); - mBlockEthernet = blockList.contains(SLOT_ETHERNET); - - // Re-register to get new callbacks. - mNC.removeSignalCallback(SignalClusterView.this); - mNC.addSignalCallback(SignalClusterView.this); + boolean blockAirplane = blockList.contains(SLOT_AIRPLANE); + boolean blockMobile = blockList.contains(SLOT_MOBILE); + boolean blockWifi = blockList.contains(SLOT_WIFI); + boolean blockEthernet = blockList.contains(SLOT_ETHERNET); + + if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile + || blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) { + mBlockAirplane = blockAirplane; + mBlockMobile = blockMobile; + mBlockEthernet = blockEthernet; + mBlockWifi = blockWifi; + // Re-register to get new callbacks. + mNC.removeSignalCallback(this); + mNC.addSignalCallback(this); + } } public void setNetworkController(NetworkControllerImpl nc) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index a750572..5ac436a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -1180,7 +1180,9 @@ public class NotificationPanelView extends PanelView implements } else if (statusBarState == StatusBarState.KEYGUARD || statusBarState == StatusBarState.SHADE_LOCKED) { mKeyguardBottomArea.animate().cancel(); - mKeyguardBottomArea.setVisibility(View.VISIBLE); + if (!mDozing) { + mKeyguardBottomArea.setVisibility(View.VISIBLE); + } mKeyguardBottomArea.setAlpha(1f); } else { mKeyguardBottomArea.animate().cancel(); @@ -1263,7 +1265,7 @@ public class NotificationPanelView extends PanelView implements setQsExpanded(true); } else if (height <= mQsMinExpansionHeight && mQsExpanded) { setQsExpanded(false); - if (mLastAnnouncementWasQuickSettings && !mTracking) { + if (mLastAnnouncementWasQuickSettings && !mTracking && !isCollapsing()) { announceForAccessibility(getKeyguardOrLockScreenString()); mLastAnnouncementWasQuickSettings = false; } @@ -1717,7 +1719,8 @@ public class NotificationPanelView extends PanelView implements float alphaQsExpansion = 1 - Math.min(1, getQsExpansionFraction() * 2); mKeyguardStatusBar.setAlpha(Math.min(getKeyguardContentsAlpha(), alphaQsExpansion) * mKeyguardStatusBarAnimateAlpha); - mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f ? VISIBLE : INVISIBLE); + mKeyguardStatusBar.setVisibility(mKeyguardStatusBar.getAlpha() != 0f + && !mDozing ? VISIBLE : INVISIBLE); setQsTranslation(mQsExpansionHeight); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 33e8e59..69198ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -812,12 +812,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, signalClusterQs.setNetworkController(mNetworkController); final boolean isAPhone = mNetworkController.hasVoiceCallingFeature(); if (isAPhone) { - mNetworkController.addEmergencyListener(new NetworkControllerImpl.EmergencyListener() { - @Override - public void setEmergencyCallsOnly(boolean emergencyOnly) { - mHeader.setShowEmergencyCallsOnly(emergencyOnly); - } - }); + mNetworkController.addEmergencyListener(mHeader); } mFlashlightController = new FlashlightController(mContext); @@ -2692,6 +2687,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mNextAlarmController != null) { mNextAlarmController.dump(fd, pw, args); } + if (mAssistManager != null) { + mAssistManager.dump(fd, pw, args); + } if (mSecurityController != null) { mSecurityController.dump(fd, pw, args); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index dfc6924..a81f06e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -45,6 +45,7 @@ import com.android.systemui.R; import com.android.systemui.qs.QSPanel; import com.android.systemui.qs.QSTile; import com.android.systemui.statusbar.policy.BatteryController; +import com.android.systemui.statusbar.policy.NetworkControllerImpl.EmergencyListener; import com.android.systemui.statusbar.policy.NextAlarmController; import com.android.systemui.statusbar.policy.UserInfoController; @@ -54,7 +55,8 @@ import java.text.NumberFormat; * The view to manage the header area in the expanded status bar. */ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickListener, - BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback { + BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback, + EmergencyListener { private boolean mExpanded; private boolean mListening; @@ -527,7 +529,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL return true; } - public void setShowEmergencyCallsOnly(boolean show) { + @Override + public void setEmergencyCallsOnly(boolean show) { boolean changed = show != mShowEmergencyCallsOnly; if (changed) { mShowEmergencyCallsOnly = show; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index 686e24c..0aa0b4a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -34,6 +34,7 @@ import com.android.internal.telephony.cdma.EriInfo; import com.android.systemui.R; import com.android.systemui.statusbar.policy.NetworkController.IconState; import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config; +import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionDefaults; import java.io.PrintWriter; import java.util.BitSet; @@ -43,6 +44,7 @@ import java.util.Objects; public class MobileSignalController extends SignalController< MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> { private final TelephonyManager mPhone; + private final SubscriptionDefaults mDefaults; private final String mNetworkNameDefault; private final String mNetworkNameSeparator; @VisibleForTesting @@ -67,13 +69,15 @@ public class MobileSignalController extends SignalController< // need listener lists anymore. public MobileSignalController(Context context, Config config, boolean hasMobileData, TelephonyManager phone, CallbackHandler callbackHandler, - NetworkControllerImpl networkController, SubscriptionInfo info, Looper receiverLooper) { + NetworkControllerImpl networkController, SubscriptionInfo info, + SubscriptionDefaults defaults, Looper receiverLooper) { super("MobileSignalController(" + info.getSubscriptionId() + ")", context, NetworkCapabilities.TRANSPORT_CELLULAR, callbackHandler, networkController); mNetworkToIconLookup = new SparseArray<>(); mConfig = config; mPhone = phone; + mDefaults = defaults; mSubscriptionInfo = info; mPhoneStateListener = new MobilePhoneStateListener(info.getSubscriptionId(), receiverLooper); @@ -290,7 +294,7 @@ public class MobileSignalController extends SignalController< } private void updateDataSim() { - int defaultDataSub = SubscriptionManager.getDefaultDataSubId(); + int defaultDataSub = mDefaults.getDefaultDataSubId(); if (SubscriptionManager.isValidSubscriptionId(defaultDataSub)) { mCurrentState.dataSim = defaultDataSub == mSubscriptionInfo.getSubscriptionId(); } else { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index e8957f9..18b5820 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -71,6 +71,7 @@ public class NetworkControllerImpl extends BroadcastReceiver private final ConnectivityManager mConnectivityManager; private final SubscriptionManager mSubscriptionManager; private final boolean mHasMobileDataFeature; + private final SubscriptionDefaults mSubDefaults; private Config mConfig; // Subcontrollers. @@ -124,7 +125,8 @@ public class NetworkControllerImpl extends BroadcastReceiver SubscriptionManager.from(context), Config.readConfig(context), bgLooper, new CallbackHandler(), new AccessPointControllerImpl(context, bgLooper), - new MobileDataControllerImpl(context)); + new MobileDataControllerImpl(context), + new SubscriptionDefaults()); mReceiverHandler.post(mRegisterListeners); } @@ -134,13 +136,15 @@ public class NetworkControllerImpl extends BroadcastReceiver SubscriptionManager subManager, Config config, Looper bgLooper, CallbackHandler callbackHandler, AccessPointControllerImpl accessPointController, - MobileDataControllerImpl mobileDataController) { + MobileDataControllerImpl mobileDataController, + SubscriptionDefaults defaultsHandler) { mContext = context; mConfig = config; mReceiverHandler = new Handler(bgLooper); mCallbackHandler = callbackHandler; mSubscriptionManager = subManager; + mSubDefaults = defaultsHandler; mConnectivityManager = connectivityManager; mHasMobileDataFeature = mConnectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE); @@ -233,7 +237,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } private MobileSignalController getDataController() { - int dataSubId = SubscriptionManager.getDefaultDataSubId(); + int dataSubId = mSubDefaults.getDefaultDataSubId(); if (!SubscriptionManager.isValidSubscriptionId(dataSubId)) { if (DEBUG) Log.e(TAG, "No data sim selected"); return mDefaultSignalController; @@ -251,17 +255,19 @@ public class NetworkControllerImpl extends BroadcastReceiver } public boolean isEmergencyOnly() { - int voiceSubId = SubscriptionManager.getDefaultVoiceSubId(); + int voiceSubId = mSubDefaults.getDefaultVoiceSubId(); if (!SubscriptionManager.isValidSubscriptionId(voiceSubId)) { for (MobileSignalController mobileSignalController : mMobileSignalControllers.values()) { - if (!mobileSignalController.isEmergencyOnly()) { + if (!mobileSignalController.getState().isEmergency) { + if (DEBUG) Log.d(TAG, "Found emergency " + mobileSignalController.mTag); return false; } } } if (mMobileSignalControllers.containsKey(voiceSubId)) { - return mMobileSignalControllers.get(voiceSubId).isEmergencyOnly(); + if (DEBUG) Log.d(TAG, "Getting emergency from " + voiceSubId); + return mMobileSignalControllers.get(voiceSubId).getState().isEmergency; } if (DEBUG) Log.e(TAG, "Cannot find controller for voice sub: " + voiceSubId); // Something is wrong, better assume we can't make calls... @@ -375,6 +381,11 @@ public class NetworkControllerImpl extends BroadcastReceiver if (!mListening) { return; } + doUpdateMobileControllers(); + } + + @VisibleForTesting + void doUpdateMobileControllers() { List<SubscriptionInfo> subscriptions = mSubscriptionManager.getActiveSubscriptionInfoList(); if (subscriptions == null) { subscriptions = Collections.emptyList(); @@ -389,6 +400,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } setCurrentSubscriptions(subscriptions); updateNoSims(); + recalculateEmergency(); } @VisibleForTesting @@ -425,7 +437,7 @@ public class NetworkControllerImpl extends BroadcastReceiver } else { MobileSignalController controller = new MobileSignalController(mContext, mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, - this, subscriptions.get(i), mReceiverHandler.getLooper()); + this, subscriptions.get(i), mSubDefaults, mReceiverHandler.getLooper()); mMobileSignalControllers.put(subId, controller); if (subscriptions.get(i).getSimSlotIndex() == 0) { mDefaultSignalController = controller; @@ -708,7 +720,7 @@ public class NetworkControllerImpl extends BroadcastReceiver null, 0, 0, ""); mMobileSignalControllers.put(id, new MobileSignalController(mContext, mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info, - mReceiverHandler.getLooper())); + mSubDefaults, mReceiverHandler.getLooper())); return info; } @@ -735,6 +747,16 @@ public class NetworkControllerImpl extends BroadcastReceiver void setEmergencyCallsOnly(boolean emergencyOnly); } + public static class SubscriptionDefaults { + public int getDefaultVoiceSubId() { + return SubscriptionManager.getDefaultVoiceSubId(); + } + + public int getDefaultDataSubId() { + return SubscriptionManager.getDefaultDataSubId(); + } + } + @VisibleForTesting static class Config { boolean showAtLeast3G = false; diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 05ee9c2..d360875 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -53,6 +53,7 @@ public class StorageNotification extends SystemUI { private static final int MOVE_ID = 0x534d4f56; // SMOV private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME"; + private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD"; // TODO: delay some notifications to avoid bumpy fast operations @@ -107,6 +108,15 @@ public class StorageNotification extends SystemUI { } }; + private final BroadcastReceiver mFinishReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + // When finishing the adoption wizard, clean up any notifications + // for moving primary storage + mNotificationManager.cancelAsUser(null, MOVE_ID, UserHandle.ALL); + } + }; + private final MoveCallback mMoveCallback = new MoveCallback() { @Override public void onCreated(int moveId, Bundle extras) { @@ -146,6 +156,8 @@ public class StorageNotification extends SystemUI { mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null); + mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD), + android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null); // Kick current state into place final List<DiskInfo> disks = mStorageManager.getDisks(); |
