Customize VoWiFi icon and service name
Issue: FP3-A11#231
Change-Id: Ic952acd40c1ba61e9b6ec288789ed973a044e2d5
(cherry picked from commit 16684940f6a85bc81b4f2c3052e41c0a33d96708)
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 4925e42..0e4d553 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -60,6 +60,8 @@
<item><xliff:g id="id">@string/status_bar_airplane</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>
+ <item><xliff:g id="id">@string/status_bar_vowifi1</xliff:g></item>
+ <item><xliff:g id="id">@string/status_bar_vowifi2</xliff:g></item>
</string-array>
<string translatable="false" name="status_bar_rotate">rotate</string>
@@ -97,6 +99,9 @@
<string translatable="false" name="status_bar_sensors_off">sensors_off</string>
<string translatable="false" name="status_bar_screen_record">screen_record</string>
+ <string translatable="false" name="status_bar_vowifi1">vowifi1</string>
+ <string translatable="false" name="status_bar_vowifi2">vowifi2</string>
+
<!-- Flag indicating whether the surface flinger has limited
alpha compositing functionality in hardware. If set, the window
manager will disable alpha trasformation in animations where not
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 8a9c8c1..94ded05 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2937,6 +2937,9 @@
<java-symbol type="string" name="status_bar_sensors_off" />
<java-symbol type="string" name="status_bar_screen_record" />
+ <java-symbol type="string" name="status_bar_vowifi1" />
+ <java-symbol type="string" name="status_bar_vowifi2" />
+
<!-- Locale picker -->
<java-symbol type="id" name="locale_search_menu" />
<java-symbol type="layout" name="language_picker_item" />
diff --git a/packages/SystemUI/res/values/config_qti.xml b/packages/SystemUI/res/values/config_qti.xml
index ff999e0..b2bcab3 100644
--- a/packages/SystemUI/res/values/config_qti.xml
+++ b/packages/SystemUI/res/values/config_qti.xml
@@ -34,6 +34,6 @@
<bool name="config_showRsrpSignalLevelforLTE">false</bool>
<bool name="config_alwaysShowTypeIcon">false</bool>
<bool name="config_hideNoInternetState">false</bool>
- <bool name="config_display_volte">false</bool>
+ <bool name="config_display_volte">true</bool>
<bool name="config_display_vowifi">false</bool>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
index 0a7ee3b..335fc4f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/OperatorNameView.java
@@ -37,6 +37,10 @@
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;
+import android.content.BroadcastReceiver;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
import java.util.List;
@@ -44,6 +48,26 @@
SignalCallback, Tunable {
private static final String KEY_SHOW_OPERATOR_NAME = "show_operator_name";
+ private static final String TAG = "OperatorNameView";
+
+ private final BroadcastReceiver mVowifiChanged =
+ new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ boolean showVOWIFIIcon = intent.getBooleanExtra("showVOWIFIIcon", false);
+ if (WirelessUtils.isAirplaneModeOn(mContext)) {
+ boolean showOperatorName =
+ Dependency.get(TunerService.class)
+ .getValue(KEY_SHOW_OPERATOR_NAME, 1)
+ != 0;
+ Log.i(
+ TAG,
+ "mVowifiChanged: setVisibility showOperatorName = "
+ + showOperatorName);
+ setVisibility(showOperatorName ? VISIBLE : GONE);
+ updateText();
+ }
+ }
+ };
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private boolean mDemoMode;
@@ -75,6 +99,10 @@
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this);
Dependency.get(NetworkController.class).addCallback(this);
Dependency.get(TunerService.class).addTunable(this, KEY_SHOW_OPERATOR_NAME);
+ if (mContext != null) {
+ mContext.registerReceiver(
+ mVowifiChanged, new IntentFilter("arima.intent.action.VOWIFI_STATE_CHANGED"));
+ }
}
@Override
@@ -84,6 +112,9 @@
Dependency.get(DarkIconDispatcher.class).removeDarkReceiver(this);
Dependency.get(NetworkController.class).removeCallback(this);
Dependency.get(TunerService.class).removeTunable(this);
+ if (mContext != null) {
+ mContext.unregisterReceiver(mVowifiChanged);
+ }
}
@Override
@@ -142,7 +173,9 @@
CharSequence carrierName = subs.get(i).getCarrierName();
if (!TextUtils.isEmpty(carrierName) && simState == TelephonyManager.SIM_STATE_READY) {
ServiceState ss = mKeyguardUpdateMonitor.getServiceState(subId);
- if (ss != null && ss.getState() == ServiceState.STATE_IN_SERVICE) {
+ if (ss != null
+ && (ss.getState() == ServiceState.STATE_IN_SERVICE
+ || ss.getDataRegState() == ServiceState.STATE_IN_SERVICE)) {
displayText = carrierName;
break;
}
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 a232fa4..0905715 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarSignalPolicy.java
@@ -35,6 +35,10 @@
import java.util.List;
import java.util.Objects;
+import android.content.IntentFilter;
+import android.content.BroadcastReceiver;
+import android.content.Intent;
+import android.telephony.SubscriptionManager;
public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallback,
SecurityController.SecurityControllerCallback, Tunable {
@@ -65,6 +69,11 @@
private ArrayList<MobileIconState> mMobileStates = new ArrayList<MobileIconState>();
private WifiIconState mWifiIconState = new WifiIconState();
+ private final String mVowifiIcon1;
+ private final String mVowifiIcon2;
+ private boolean mIsVowifiSlot1 = false;
+ private boolean mIsVowifiSlot2 = false;
+
public StatusBarSignalPolicy(Context context, StatusBarIconController iconController) {
mContext = context;
@@ -82,12 +91,21 @@
Dependency.get(TunerService.class).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
mNetworkController.addCallback(this);
mSecurityController.addCallback(this);
+
+ mVowifiIcon1 = mContext.getString(com.android.internal.R.string.status_bar_vowifi1);
+ mVowifiIcon2 = mContext.getString(com.android.internal.R.string.status_bar_vowifi2);
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ filter.addAction("arima.intent.action.VOWIFI_STATE_CHANGED");
+ context.registerReceiver(mVowifiChanged, filter);
}
public void destroy() {
Dependency.get(TunerService.class).removeTunable(this);
mNetworkController.removeCallback(this);
mSecurityController.removeCallback(this);
+ mContext.unregisterReceiver(mVowifiChanged);
}
private void updateVpn() {
@@ -457,4 +475,43 @@
+ ", visible=" + visible + ")";
}
}
+
+ private BroadcastReceiver mVowifiChanged =
+ new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (("arima.intent.action.VOWIFI_STATE_CHANGED".equals(action))
+ && mIsAirplaneMode) {
+ int wfcPhoneId =
+ intent.getIntExtra(
+ "phoneId", SubscriptionManager.INVALID_PHONE_INDEX);
+ if (wfcPhoneId == 0) {
+ mIsVowifiSlot1 = intent.getBooleanExtra("showVOWIFIIcon", false);
+ if (mIsVowifiSlot1) {
+ mIconController.setIcon(
+ mVowifiIcon1, R.drawable.ic_vowifi_v2_white, null);
+ mIconController.setIconVisibility(mVowifiIcon1, true);
+ } else {
+ mIconController.setIconVisibility(mVowifiIcon1, false);
+ }
+ } else if (wfcPhoneId == 1) {
+ mIsVowifiSlot2 = intent.getBooleanExtra("showVOWIFIIcon", false);
+ if (mIsVowifiSlot2) {
+ mIconController.setIcon(
+ mVowifiIcon2, R.drawable.ic_vowifi_v2_white, null);
+ mIconController.setIconVisibility(mVowifiIcon2, true);
+ } else {
+ mIconController.setIconVisibility(mVowifiIcon2, false);
+ }
+ }
+ } else if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) {
+ boolean isAirplaneModeOn = intent.getBooleanExtra("state", false);
+ if (!isAirplaneModeOn) {
+ mIconController.setIconVisibility(mVowifiIcon1, false);
+ mIconController.setIconVisibility(mVowifiIcon2, false);
+ }
+ }
+ }
+ };
}
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 6db9970..b5a0465 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -262,7 +262,7 @@
mContext.registerReceiver(mVolteSwitchObserver,
new IntentFilter("org.codeaurora.intent.action.ACTION_ENHANCE_4G_SWITCH"));
mContext.registerReceiver(
- mVowifiChanged, new IntentFilter("android.intent.action.VOWIFI_STATE_CHANGED"));
+ mVowifiChanged, new IntentFilter("arima.intent.action.VOWIFI_STATE_CHANGED"));
mFeatureConnector.connect();
}
@@ -475,7 +475,7 @@
private int getVolteResId() {
int resId = 0;
int voiceNetTye = getVoiceNetworkType();
- if (mShowWFCIcon) {
+ if (mCurrentState.showWFC) {
resId = R.drawable.ic_vowifi_v2_white;
} else if ((mCurrentState.voiceCapable || mCurrentState.videoCapable)
&& mCurrentState.imsRegistered) {
@@ -1384,8 +1384,15 @@
private final BroadcastReceiver mVowifiChanged =
new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
- mShowWFCIcon = intent.getBooleanExtra("showVOWIFIIcon", false);
- notifyListeners();
+ boolean showVOWIFIIcon = intent.getBooleanExtra("showVOWIFIIcon", false);
+ int wfcPhoneId =
+ intent.getIntExtra("phoneId", SubscriptionManager.INVALID_PHONE_INDEX);
+ int phoneId =
+ SubscriptionManager.getPhoneId(mSubscriptionInfo.getSubscriptionId());
+ if (wfcPhoneId == phoneId) {
+ mCurrentState.showWFC = showVOWIFIIcon;
+ notifyListeners();
+ }
}
};
@@ -1425,6 +1432,8 @@
boolean mobileDataEnabled;
boolean roamingDataEnabled;
+ boolean showWFC;
+
@Override
public void copyFrom(State s) {
super.copyFrom(s);
@@ -1445,6 +1454,7 @@
videoCapable = state.videoCapable;
mobileDataEnabled = state.mobileDataEnabled;
roamingDataEnabled = state.roamingDataEnabled;
+ showWFC = state.showWFC;
}
@Override
@@ -1468,6 +1478,7 @@
builder.append("videoCapable=").append(videoCapable).append(',');
builder.append("mobileDataEnabled=").append(mobileDataEnabled).append(',');
builder.append("roamingDataEnabled=").append(roamingDataEnabled);
+ builder.append("showWFC=").append(showWFC);
}
@Override
@@ -1488,7 +1499,8 @@
&& ((MobileState) o).voiceCapable == voiceCapable
&& ((MobileState) o).videoCapable == videoCapable
&& ((MobileState) o).mobileDataEnabled == mobileDataEnabled
- && ((MobileState) o).roamingDataEnabled == roamingDataEnabled;
+ && ((MobileState) o).roamingDataEnabled == roamingDataEnabled
+ && ((MobileState) o).showWFC == showWFC;
}
}