diff options
7 files changed, 72 insertions, 21 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index f6fee880bf2f..b0327a5decee 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -59,6 +59,7 @@ <item><xliff:g id="id">@string/status_bar_mobile</xliff:g></item> <item><xliff:g id="id">@string/status_bar_airplane</xliff:g></item> <item><xliff:g id="id">@string/status_bar_no_calling</xliff:g></item> + <item><xliff:g id="id">@string/status_bar_call_strength</xliff:g></item> <item><xliff:g id="id">@string/status_bar_battery</xliff:g></item> <item><xliff:g id="id">@string/status_bar_sensors_off</xliff:g></item> </string-array> @@ -96,6 +97,7 @@ <string translatable="false" name="status_bar_camera">camera</string> <string translatable="false" name="status_bar_airplane">airplane</string> <string translatable="false" name="status_bar_no_calling">no_calling</string> + <string translatable="false" name="status_bar_call_strength">call_strength</string> <string translatable="false" name="status_bar_sensors_off">sensors_off</string> <string translatable="false" name="status_bar_screen_record">screen_record</string> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index dad886de6cf6..541c18cc715e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2977,6 +2977,7 @@ <java-symbol type="string" name="status_bar_clock" /> <java-symbol type="string" name="status_bar_airplane" /> <java-symbol type="string" name="status_bar_no_calling" /> + <java-symbol type="string" name="status_bar_call_strength" /> <java-symbol type="string" name="status_bar_mobile" /> <java-symbol type="string" name="status_bar_ethernet" /> <java-symbol type="string" name="status_bar_vpn" /> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java index 862037617374..8fe9a481ccf6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java @@ -66,7 +66,11 @@ public interface StatusBarIconController { /** * Display the no calling & SMS icons. */ - void setCallIndicatorIcons(String slot, List<CallIndicatorIconState> states); + void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states); + /** + * Display the no calling & SMS icons. + */ + void setNoCallingIcons(String slot, List<CallIndicatorIconState> states); public void setIconVisibility(String slot, boolean b); /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java index f0c8527bcb7f..6404aea05a4d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java @@ -219,27 +219,56 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu } /** - * Accept a list of CallIndicatorIconStates, and show them in the same slot - * @param slot StatusBar slot + * Accept a list of CallIndicatorIconStates, and show the call strength icons. + * @param slot StatusBar slot for the call strength icons * @param states All of the no Calling & SMS icon states */ @Override - public void setCallIndicatorIcons(String slot, List<CallIndicatorIconState> states) { + public void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states) { + Slot callStrengthSlot = getSlot(slot); + int callStrengthSlotIndex = getSlotIndex(slot); + Collections.reverse(states); + for (CallIndicatorIconState state : states) { + if (!state.isNoCalling) { + StatusBarIconHolder holder = callStrengthSlot.getHolderForTag(state.subId); + if (holder == null) { + holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state); + setIcon(callStrengthSlotIndex, holder); + } else { + holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(), + Icon.createWithResource(mContext, state.callStrengthResId), 0, 0, + state.callStrengthDescription)); + setIcon(callStrengthSlotIndex, holder); + } + } + setIconVisibility(slot, !state.isNoCalling, state.subId); + } + } + + /** + * Accept a list of CallIndicatorIconStates, and show the no calling icons. + * @param slot StatusBar slot for the no calling icons + * @param states All of the no Calling & SMS icon states + */ + @Override + public void setNoCallingIcons(String slot, List<CallIndicatorIconState> states) { Slot noCallingSlot = getSlot(slot); - int slotIndex = getSlotIndex(slot); + int noCallingSlotIndex = getSlotIndex(slot); + Collections.reverse(states); for (CallIndicatorIconState state : states) { - StatusBarIconHolder holder = noCallingSlot.getHolderForTag(state.subId); - if (holder == null) { - holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state); - setIcon(slotIndex, holder); - } else { - int resId = state.isNoCalling ? state.noCallingResId : state.callStrengthResId; - String contentDescription = state.isNoCalling - ? state.noCallingDescription : state.callStrengthDescription; - holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(), - Icon.createWithResource(mContext, resId), 0, 0, contentDescription)); - setIcon(slotIndex, holder); + if (state.isNoCalling) { + StatusBarIconHolder holder = noCallingSlot.getHolderForTag(state.subId); + if (holder == null) { + holder = StatusBarIconHolder.fromCallIndicatorState(mContext, state); + setIcon(noCallingSlotIndex, holder); + } else { + holder.setIcon(new StatusBarIcon(UserHandle.SYSTEM, mContext.getPackageName(), + Icon.createWithResource(mContext, state.noCallingResId), 0, 0, + state.noCallingDescription)); + setIcon(noCallingSlotIndex, holder); + } } + setIconVisibility(slot, state.isNoCalling, state.subId); } } @@ -282,9 +311,15 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu } } + /** */ public void setIconVisibility(String slot, boolean visibility) { + setIconVisibility(slot, visibility, 0); + } + + /** */ + public void setIconVisibility(String slot, boolean visibility, int tag) { int index = getSlotIndex(slot); - StatusBarIconHolder holder = getIcon(index, 0); + StatusBarIconHolder holder = getIcon(index, tag); if (holder == null || holder.isVisible() == visibility) { return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java index a1a2d30e9b00..19db02a71777 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconHolder.java @@ -83,7 +83,6 @@ public class StatusBarIconHolder { holder.mIcon = new StatusBarIcon(UserHandle.SYSTEM, context.getPackageName(), Icon.createWithResource(context, resId), 0, 0, contentDescription); holder.mTag = state.subId; - holder.setVisible(true); return holder; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java index 9ee7b09589d8..3445826eefbe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java @@ -50,6 +50,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba private final String mSlotEthernet; private final String mSlotVpn; private final String mSlotNoCalling; + private final String mSlotCallStrength; private final Context mContext; private final StatusBarIconController mIconController; @@ -83,6 +84,8 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba mSlotEthernet = mContext.getString(com.android.internal.R.string.status_bar_ethernet); mSlotVpn = mContext.getString(com.android.internal.R.string.status_bar_vpn); mSlotNoCalling = mContext.getString(com.android.internal.R.string.status_bar_no_calling); + mSlotCallStrength = + mContext.getString(com.android.internal.R.string.status_bar_call_strength); mActivityEnabled = mContext.getResources().getBoolean(R.bool.config_showActivity); mIconController = iconController; @@ -212,8 +215,10 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba state.callStrengthResId = statusIcon.icon; state.callStrengthDescription = statusIcon.contentDescription; } - mIconController.setCallIndicatorIcons( - mSlotNoCalling, CallIndicatorIconState.copyStates(mCallIndicatorStates)); + mIconController.setCallStrengthIcons(mSlotCallStrength, + CallIndicatorIconState.copyStates(mCallIndicatorStates)); + mIconController.setNoCallingIcons(mSlotNoCalling, + CallIndicatorIconState.copyStates(mCallIndicatorStates)); } @Override @@ -300,6 +305,7 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba mIconController.removeAllIconsForSlot(mSlotMobile); mIconController.removeAllIconsForSlot(mSlotNoCalling); + mIconController.removeAllIconsForSlot(mSlotCallStrength); mMobileStates.clear(); List<CallIndicatorIconState> noCallingStates = new ArrayList<CallIndicatorIconState>(); noCallingStates.addAll(mCallIndicatorStates); diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeStatusBarIconController.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeStatusBarIconController.java index 203ece9532ef..8ad6271bfc7e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeStatusBarIconController.java +++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeStatusBarIconController.java @@ -66,7 +66,11 @@ public class FakeStatusBarIconController extends BaseLeakChecker<IconManager> } @Override - public void setCallIndicatorIcons(String slot, List<CallIndicatorIconState> states) { + public void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states) { + } + + @Override + public void setNoCallingIcons(String slot, List<CallIndicatorIconState> states) { } @Override |