Merge "Revert "Hide the call strength icons from the statusbar"" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8382c6c7d0
@@ -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>
|
||||
|
||||
|
||||
@@ -2979,6 +2979,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" />
|
||||
|
||||
@@ -158,6 +158,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
||||
mDarkIconManager.setShouldLog(true);
|
||||
mBlockedIcons.add(getString(com.android.internal.R.string.status_bar_volume));
|
||||
mBlockedIcons.add(getString(com.android.internal.R.string.status_bar_alarm_clock));
|
||||
mBlockedIcons.add(getString(com.android.internal.R.string.status_bar_call_strength));
|
||||
mDarkIconManager.setBlockList(mBlockedIcons);
|
||||
Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
|
||||
mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
|
||||
|
||||
@@ -200,6 +200,7 @@ public class KeyguardStatusBarView extends RelativeLayout implements
|
||||
Resources r = getResources();
|
||||
mBlockedIcons.add(r.getString(com.android.internal.R.string.status_bar_volume));
|
||||
mBlockedIcons.add(r.getString(com.android.internal.R.string.status_bar_alarm_clock));
|
||||
mBlockedIcons.add(r.getString(com.android.internal.R.string.status_bar_call_strength));
|
||||
}
|
||||
|
||||
private void updateVisibilities() {
|
||||
|
||||
@@ -71,6 +71,10 @@ public interface StatusBarIconController {
|
||||
void setSignalIcon(String slot, WifiIconState state);
|
||||
/** */
|
||||
void setMobileIcons(String slot, List<MobileIconState> states);
|
||||
/**
|
||||
* Display the no calling & SMS icons.
|
||||
*/
|
||||
void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states);
|
||||
/**
|
||||
* Display the no calling & SMS icons.
|
||||
*/
|
||||
|
||||
@@ -223,6 +223,33 @@ public class StatusBarIconControllerImpl extends StatusBarIconList implements Tu
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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
|
||||
|
||||
@@ -86,9 +86,11 @@ public class StatusBarIconHolder {
|
||||
Context context,
|
||||
CallIndicatorIconState state) {
|
||||
StatusBarIconHolder holder = new StatusBarIconHolder();
|
||||
int resId = state.isNoCalling ? state.noCallingResId : state.callStrengthResId;
|
||||
String contentDescription = state.isNoCalling
|
||||
? state.noCallingDescription : state.callStrengthDescription;
|
||||
holder.mIcon = new StatusBarIcon(UserHandle.SYSTEM, context.getPackageName(),
|
||||
Icon.createWithResource(context, state.noCallingResId),
|
||||
0, 0, state.noCallingDescription);
|
||||
Icon.createWithResource(context, resId), 0, 0, contentDescription);
|
||||
holder.mTag = state.subId;
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.telephony.SubscriptionInfo;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settingslib.mobile.TelephonyIcons;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.policy.NetworkController;
|
||||
@@ -49,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;
|
||||
@@ -82,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;
|
||||
@@ -207,9 +211,14 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
|
||||
if (statusIcon.icon == R.drawable.ic_qs_no_calling_sms) {
|
||||
state.isNoCalling = statusIcon.visible;
|
||||
state.noCallingDescription = statusIcon.contentDescription;
|
||||
mIconController.setNoCallingIcons(mSlotNoCalling,
|
||||
CallIndicatorIconState.copyStates(mCallIndicatorStates));
|
||||
} else {
|
||||
state.callStrengthResId = statusIcon.icon;
|
||||
state.callStrengthDescription = statusIcon.contentDescription;
|
||||
}
|
||||
mIconController.setCallStrengthIcons(mSlotCallStrength,
|
||||
CallIndicatorIconState.copyStates(mCallIndicatorStates));
|
||||
mIconController.setNoCallingIcons(mSlotNoCalling,
|
||||
CallIndicatorIconState.copyStates(mCallIndicatorStates));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -296,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);
|
||||
@@ -410,12 +420,15 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
|
||||
public static class CallIndicatorIconState {
|
||||
public boolean isNoCalling;
|
||||
public int noCallingResId;
|
||||
public int callStrengthResId;
|
||||
public int subId;
|
||||
public String noCallingDescription;
|
||||
public String callStrengthDescription;
|
||||
|
||||
private CallIndicatorIconState(int subId) {
|
||||
this.subId = subId;
|
||||
this.noCallingResId = R.drawable.ic_qs_no_calling_sms;
|
||||
this.callStrengthResId = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -427,21 +440,26 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
|
||||
CallIndicatorIconState that = (CallIndicatorIconState) o;
|
||||
return isNoCalling == that.isNoCalling
|
||||
&& noCallingResId == that.noCallingResId
|
||||
&& callStrengthResId == that.callStrengthResId
|
||||
&& subId == that.subId
|
||||
&& noCallingDescription == that.noCallingDescription;
|
||||
&& noCallingDescription == that.noCallingDescription
|
||||
&& callStrengthDescription == that.callStrengthDescription;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isNoCalling, noCallingResId, subId, noCallingDescription);
|
||||
return Objects.hash(isNoCalling, noCallingResId,
|
||||
callStrengthResId, subId, noCallingDescription, callStrengthDescription);
|
||||
}
|
||||
|
||||
private void copyTo(CallIndicatorIconState other) {
|
||||
other.isNoCalling = isNoCalling;
|
||||
other.noCallingResId = noCallingResId;
|
||||
other.callStrengthResId = callStrengthResId;
|
||||
other.subId = subId;
|
||||
other.noCallingDescription = noCallingDescription;
|
||||
other.callStrengthDescription = callStrengthDescription;
|
||||
}
|
||||
|
||||
private static List<CallIndicatorIconState> copyStates(
|
||||
|
||||
@@ -65,6 +65,10 @@ public class FakeStatusBarIconController extends BaseLeakChecker<IconManager>
|
||||
public void setMobileIcons(String slot, List<MobileIconState> states) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallStrengthIcons(String slot, List<CallIndicatorIconState> states) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoCallingIcons(String slot, List<CallIndicatorIconState> states) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user