Merge "Add "Mobile data" and "Data usage" into Mobile network setting UI."
diff --git a/res/drawable-hdpi/ic_sim_sub1.png b/res/drawable-hdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..dc24b06
--- /dev/null
+++ b/res/drawable-hdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_sim_sub2.png b/res/drawable-hdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..297bc72
--- /dev/null
+++ b/res/drawable-hdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-hdpi/stat_sys_phone_call_forward.png b/res/drawable-hdpi/stat_sys_phone_call_forward.png
index 4b7c236..e8d3149 100644
--- a/res/drawable-hdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-hdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_sim_sub1.png b/res/drawable-ldrtl-hdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..9ec62ca
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_sim_sub2.png b/res/drawable-ldrtl-hdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..23559bf
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/stat_sys_phone_call_forward.png b/res/drawable-ldrtl-hdpi/stat_sys_phone_call_forward.png
index 132b0e5..ff5451c 100644
--- a/res/drawable-ldrtl-hdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-ldrtl-hdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_sim_sub1.png b/res/drawable-ldrtl-mdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..64ab4c6
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_sim_sub2.png b/res/drawable-ldrtl-mdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..c0aebdd
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/stat_sys_phone_call_forward.png b/res/drawable-ldrtl-mdpi/stat_sys_phone_call_forward.png
index d49745f..a42b5bb 100644
--- a/res/drawable-ldrtl-mdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-ldrtl-mdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_sim_sub1.png b/res/drawable-ldrtl-xhdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..2513c24
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_sim_sub2.png b/res/drawable-ldrtl-xhdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..1d50b29
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/stat_sys_phone_call_forward.png b/res/drawable-ldrtl-xhdpi/stat_sys_phone_call_forward.png
index 4cce562..81791a8 100644
--- a/res/drawable-ldrtl-xhdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-ldrtl-xhdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-ldrtl-xxhdpi/ic_sim_sub1.png b/res/drawable-ldrtl-xxhdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..4355c12
--- /dev/null
+++ b/res/drawable-ldrtl-xxhdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-ldrtl-xxhdpi/ic_sim_sub2.png b/res/drawable-ldrtl-xxhdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..2bbc1ef
--- /dev/null
+++ b/res/drawable-ldrtl-xxhdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-ldrtl-xxhdpi/stat_sys_phone_call_forward.png b/res/drawable-ldrtl-xxhdpi/stat_sys_phone_call_forward.png
new file mode 100644
index 0000000..8c68bf8
--- /dev/null
+++ b/res/drawable-ldrtl-xxhdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sim_sub1.png b/res/drawable-mdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..8d04637
--- /dev/null
+++ b/res/drawable-mdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_sim_sub2.png b/res/drawable-mdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..f3201d6
--- /dev/null
+++ b/res/drawable-mdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-mdpi/stat_sys_phone_call_forward.png b/res/drawable-mdpi/stat_sys_phone_call_forward.png
index a21718c..5975172 100644
--- a/res/drawable-mdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-mdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sim_sub1.png b/res/drawable-xhdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..2f512ee
--- /dev/null
+++ b/res/drawable-xhdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_sim_sub2.png b/res/drawable-xhdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..777a7a6
--- /dev/null
+++ b/res/drawable-xhdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-xhdpi/stat_sys_phone_call_forward.png b/res/drawable-xhdpi/stat_sys_phone_call_forward.png
index 578a42a..76ffc5c 100644
--- a/res/drawable-xhdpi/stat_sys_phone_call_forward.png
+++ b/res/drawable-xhdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sim_sub1.png b/res/drawable-xxhdpi/ic_sim_sub1.png
new file mode 100644
index 0000000..720c326
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sim_sub1.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_sim_sub2.png b/res/drawable-xxhdpi/ic_sim_sub2.png
new file mode 100644
index 0000000..992aff6
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_sim_sub2.png
Binary files differ
diff --git a/res/drawable-xxhdpi/stat_sys_phone_call_forward.png b/res/drawable-xxhdpi/stat_sys_phone_call_forward.png
new file mode 100644
index 0000000..9bc3435
--- /dev/null
+++ b/res/drawable-xxhdpi/stat_sys_phone_call_forward.png
Binary files differ
diff --git a/res/drawable/stat_notify_voicemail_sub1.xml b/res/drawable/stat_notify_voicemail_sub1.xml
new file mode 100644
index 0000000..0884557
--- /dev/null
+++ b/res/drawable/stat_notify_voicemail_sub1.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:drawable="@android:drawable/stat_notify_voicemail"
+ android:gravity="center">
+ </item>
+ <item
+ android:drawable="@drawable/ic_sim_sub1"
+ android:gravity="center|top">
+ </item>
+</layer-list>
diff --git a/res/drawable/stat_notify_voicemail_sub2.xml b/res/drawable/stat_notify_voicemail_sub2.xml
new file mode 100644
index 0000000..3b63649
--- /dev/null
+++ b/res/drawable/stat_notify_voicemail_sub2.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:drawable="@android:drawable/stat_notify_voicemail"
+ android:gravity="center">
+ </item>
+ <item
+ android:drawable="@drawable/ic_sim_sub2"
+ android:gravity="center|top">
+ </item>
+</layer-list>
diff --git a/res/drawable/stat_sys_phone_call_forward_sub1.xml b/res/drawable/stat_sys_phone_call_forward_sub1.xml
new file mode 100644
index 0000000..93f4ff6
--- /dev/null
+++ b/res/drawable/stat_sys_phone_call_forward_sub1.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:drawable="@drawable/stat_sys_phone_call_forward"
+ android:gravity="center">
+ </item>
+ <item
+ android:drawable="@drawable/ic_sim_sub1"
+ android:autoMirrored="true"
+ android:gravity="start|bottom">
+ </item>
+</layer-list>
diff --git a/res/drawable/stat_sys_phone_call_forward_sub2.xml b/res/drawable/stat_sys_phone_call_forward_sub2.xml
new file mode 100644
index 0000000..fa91222
--- /dev/null
+++ b/res/drawable/stat_sys_phone_call_forward_sub2.xml
@@ -0,0 +1,26 @@
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:drawable="@drawable/stat_sys_phone_call_forward"
+ android:gravity="center">
+ </item>
+ <item
+ android:drawable="@drawable/ic_sim_sub2"
+ android:autoMirrored="true"
+ android:gravity="start|bottom">
+ </item>
+</layer-list>
diff --git a/res/layout/edit_fdn_contact_screen.xml b/res/layout/edit_fdn_contact_screen.xml
index 24e0c6b..c7ba0d4 100644
--- a/res/layout/edit_fdn_contact_screen.xml
+++ b/res/layout/edit_fdn_contact_screen.xml
@@ -31,7 +31,8 @@
android:singleLine="true"
android:scrollHorizontally="true"
android:autoText="false"
- android:capitalize="words" />
+ android:capitalize="words"
+ android:textAlignment="viewStart" />
<EditText android:id="@+id/fdn_number"
android:hint="@string/number"
@@ -42,7 +43,8 @@
android:singleLine="true"
android:scrollHorizontally="true"
android:autoText="false"
- android:capitalize="none" />
+ android:capitalize="none"
+ android:textAlignment="viewStart" />
<Button android:id="@+id/button"
android:layout_width="wrap_content"
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 1d264fb..e5527bc 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -42,6 +42,7 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
+import android.telephony.ims.feature.ImsFeature;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -50,6 +51,7 @@
import android.widget.Toast;
import com.android.ims.ImsConfig;
+import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.internal.telephony.CallForwardInfo;
import com.android.internal.telephony.Phone;
@@ -105,6 +107,7 @@
private static final String ENABLE_VIDEO_CALLING_KEY = "button_enable_video_calling";
private Phone mPhone;
+ private ImsManager mImsMgr;
private SubscriptionInfoHelper mSubscriptionInfoHelper;
private TelecomManager mTelecomManager;
@@ -188,6 +191,17 @@
mTelecomManager = TelecomManager.from(this);
}
+ private void updateImsManager(Phone phone) {
+ log("updateImsManager :: phone.getContext()=" + phone.getContext()
+ + " phone.getPhoneId()=" + phone.getPhoneId());
+ mImsMgr = ImsManager.getInstance(phone.getContext(), phone.getPhoneId());
+ if (mImsMgr == null) {
+ log("updateImsManager :: Could not get ImsManager instance!");
+ } else {
+ log("updateImsManager :: mImsMgr=" + mImsMgr);
+ }
+ }
+
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
@@ -210,6 +224,7 @@
protected void onResume() {
super.onResume();
+ updateImsManager(mPhone);
PreferenceScreen preferenceScreen = getPreferenceScreen();
if (preferenceScreen != null) {
preferenceScreen.removeAll();
@@ -347,6 +362,19 @@
}
wifiCallingSettings.setSummary(resId);
}
+
+ try {
+ if (mImsMgr.getImsServiceStatus() != ImsFeature.STATE_READY) {
+ log("Feature state not ready so remove vt and wfc settings for "
+ + " phone =" + mPhone.getPhoneId());
+ prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mEnableVideoCalling);
+ }
+ } catch (ImsException ex) {
+ log("Exception when trying to get ImsServiceStatus: " + ex);
+ prefSet.removePreference(wifiCallingSettings);
+ prefSet.removePreference(mEnableVideoCalling);
+ }
}
/**
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 3f44130..d084e92 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -44,10 +44,15 @@
import android.util.ArrayMap;
import android.util.Log;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import com.android.internal.telephony.SubscriptionController;
+
/**
* Phone app module that listens for phone state changes and various other
* events from the telephony layer, and triggers any resulting UI behavior
@@ -68,7 +73,8 @@
private Map<Integer, CallNotifierPhoneStateListener> mPhoneStateListeners =
new ArrayMap<Integer, CallNotifierPhoneStateListener>();
-
+ private Map<Integer, Boolean> mCFIStatus = new ArrayMap<Integer, Boolean>();
+ private Map<Integer, Boolean> mMWIStatus = new ArrayMap<Integer, Boolean>();
private PhoneGlobals mApplication;
private CallManager mCM;
private BluetoothHeadset mBluetoothHeadset;
@@ -140,7 +146,7 @@
new OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
- updatePhoneStateListeners();
+ updatePhoneStateListeners(true);
}
});
}
@@ -571,14 +577,26 @@
SHOW_MESSAGE_NOTIFICATION_TIME);
}
- public void updatePhoneStateListeners() {
+ public void updatePhoneStateListeners(boolean isRefresh) {
List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
- // Unregister phone listeners for inactive subscriptions.
- Iterator<Integer> itr = mPhoneStateListeners.keySet().iterator();
- while (itr.hasNext()) {
- int subId = itr.next();
+ // Sort sub id list based on slot id, so that CFI/MWI notifications will be updated for
+ // slot 0 first then slot 1. This is needed to ensure that when CFI or MWI is enabled for
+ // both slots, user always sees icon related to slot 0 on left side followed by that of
+ // slot 1.
+ List<Integer> subIdList = new ArrayList<Integer>(mPhoneStateListeners.keySet());
+ Collections.sort(subIdList, new Comparator<Integer>() {
+ public int compare(Integer sub1, Integer sub2) {
+ int slotId1 = SubscriptionController.getInstance().getSlotIndex(sub1);
+ int slotId2 = SubscriptionController.getInstance().getSlotIndex(sub2);
+ return slotId1 > slotId2 ? 0 : -1;
+ }
+ });
+
+ for (int subIdCounter = (subIdList.size() - 1); subIdCounter >= 0; subIdCounter--) {
+ int subId = subIdList.get(subIdCounter);
if (subInfos == null || !containsSubId(subInfos, subId)) {
+ Log.d(LOG_TAG, "updatePhoneStateListeners: Hide the outstanding notifications.");
// Hide the outstanding notifications.
mApplication.notificationMgr.updateMwi(subId, false);
mApplication.notificationMgr.updateCfi(subId, false);
@@ -586,7 +604,16 @@
// Listening to LISTEN_NONE removes the listener.
mTelephonyManager.listen(
mPhoneStateListeners.get(subId), PhoneStateListener.LISTEN_NONE);
- itr.remove();
+ mPhoneStateListeners.remove(subId);
+ } else {
+ Log.d(LOG_TAG, "updatePhoneStateListeners: update CF notifications.");
+
+ if (mCFIStatus.containsKey(subId)) {
+ mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId));
+ }
+ if (mMWIStatus.containsKey(subId)) {
+ mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId), isRefresh);
+ }
}
}
@@ -757,14 +784,16 @@
@Override
public void onMessageWaitingIndicatorChanged(boolean visible) {
if (VDBG) log("onMessageWaitingIndicatorChanged(): " + this.mSubId + " " + visible);
- mApplication.notificationMgr.updateMwi(this.mSubId, visible);
+ mMWIStatus.put(this.mSubId, visible);
+ updatePhoneStateListeners(false);
}
@Override
public void onCallForwardingIndicatorChanged(boolean visible) {
Log.i(LOG_TAG, "onCallForwardingIndicatorChanged(): subId=" + this.mSubId
+ ", visible=" + (visible ? "Y" : "N"));
- mApplication.notificationMgr.updateCfi(this.mSubId, visible);
+ mCFIStatus.put(this.mSubId, visible);
+ updatePhoneStateListeners(false);
}
};
diff --git a/src/com/android/phone/EditPhoneNumberPreference.java b/src/com/android/phone/EditPhoneNumberPreference.java
index 78e8439..39d35e7 100644
--- a/src/com/android/phone/EditPhoneNumberPreference.java
+++ b/src/com/android/phone/EditPhoneNumberPreference.java
@@ -123,8 +123,8 @@
setDialogLayoutResource(R.layout.pref_dialog_editphonenumber);
//create intent to bring up contact list
- mContactListIntent = new Intent(Intent.ACTION_GET_CONTENT);
- mContactListIntent.setType(Phone.CONTENT_ITEM_TYPE);
+ mContactListIntent = new Intent(Intent.ACTION_PICK);
+ mContactListIntent.setType(Phone.CONTENT_TYPE);
//get the edit phone number default settings
TypedArray a = context.obtainStyledAttributes(attrs,
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 2f307cc..ae842f1 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -49,6 +49,7 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
+import android.telephony.ims.feature.ImsFeature;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
@@ -64,6 +65,7 @@
import android.widget.TabHost;
import com.android.ims.ImsConfig;
+import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -223,6 +225,7 @@
private UserManager mUm;
private Phone mPhone;
+ private ImsManager mImsMgr;
private MyHandler mHandler;
private boolean mOkClicked;
@@ -545,6 +548,13 @@
mPhone = PhoneGlobals.getPhone();
}
Log.i(LOG_TAG, "updatePhone:- slotId=" + slotId + " sir=" + sir);
+
+ mImsMgr = ImsManager.getInstance(mPhone.getContext(), mPhone.getPhoneId());
+ if (mImsMgr == null) {
+ log("updatePhone :: Could not get ImsManager instance!");
+ } else if (DBG) {
+ log("updatePhone :: mImsMgr=" + mImsMgr);
+ }
}
private TabHost.TabContentFactory mEmptyTabContent = new TabHost.TabContentFactory() {
@@ -913,8 +923,16 @@
android.util.Log.d(LOG_TAG, "keep ltePref");
}
- if (hideEnhanced4gLteSettings(getActivity(), carrierConfig)) {
- Preference pref = prefSet.findPreference(BUTTON_4G_LTE_KEY);
+ Preference pref = prefSet.findPreference(BUTTON_4G_LTE_KEY);
+ try {
+ if ((mImsMgr.getImsServiceStatus() != ImsFeature.STATE_READY)
+ || hideEnhanced4gLteSettings(getActivity(), carrierConfig)) {
+ if (pref != null) {
+ prefSet.removePreference(pref);
+ }
+ }
+ } catch (ImsException ex) {
+ log("Exception when trying to get ImsServiceStatus: " + ex);
if (pref != null) {
prefSet.removePreference(pref);
}
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 38eb946..da97582 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -133,27 +133,6 @@
mSubscriptionManager = SubscriptionManager.from(mContext);
mTelecomManager = TelecomManager.from(mContext);
mTelephonyManager = (TelephonyManager) app.getSystemService(Context.TELEPHONY_SERVICE);
-
- mSubscriptionManager.addOnSubscriptionsChangedListener(
- new OnSubscriptionsChangedListener() {
- @Override
- public void onSubscriptionsChanged() {
- updateActivePhonesMwi();
- }
- });
- }
-
- public void updateActivePhonesMwi() {
- List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
-
- if (subInfos == null) {
- return;
- }
-
- for (int i = 0; i < subInfos.size(); i++) {
- int subId = subInfos.get(i).getSubscriptionId();
- refreshMwi(subId);
- }
}
/**
@@ -205,7 +184,7 @@
if (mMwiVisible.containsKey(subId)) {
boolean mwiVisible = mMwiVisible.get(subId);
if (mwiVisible) {
- updateMwi(subId, mwiVisible, true /* isRefresh */);
+ mApp.notifier.updatePhoneStateListeners(true);
}
}
}
@@ -273,6 +252,10 @@
}
int resId = android.R.drawable.stat_notify_voicemail;
+ if (mTelephonyManager.getPhoneCount() > 1) {
+ resId = (phone.getPhoneId() == 0) ? R.drawable.stat_notify_voicemail_sub1
+ : R.drawable.stat_notify_voicemail_sub2;
+ }
// This Notification can get a lot fancier once we have more
// information about the current voicemail messages.
@@ -493,14 +476,18 @@
}
String notificationTitle;
+ int resId = R.drawable.stat_sys_phone_call_forward;
if (mTelephonyManager.getPhoneCount() > 1) {
+ int slotId = SubscriptionManager.getSlotIndex(subId);
+ resId = (slotId == 0) ? R.drawable.stat_sys_phone_call_forward_sub1
+ : R.drawable.stat_sys_phone_call_forward_sub2;
notificationTitle = subInfo.getDisplayName().toString();
} else {
notificationTitle = mContext.getString(R.string.labelCF);
}
Notification.Builder builder = new Notification.Builder(mContext)
- .setSmallIcon(R.drawable.stat_sys_phone_call_forward)
+ .setSmallIcon(resId)
.setColor(subInfo.getIconTint())
.setContentTitle(notificationTitle)
.setContentText(mContext.getString(R.string.sum_cfu_enabled_indicator))
@@ -531,10 +518,17 @@
userHandle);
}
} else {
- mNotificationManager.cancelAsUser(
- Integer.toString(subId) /* tag */,
- CALL_FORWARD_NOTIFICATION,
- UserHandle.ALL);
+ List<UserInfo> users = mUserManager.getUsers(true);
+ for (UserInfo user : users) {
+ if (user.isManagedProfile()) {
+ continue;
+ }
+ UserHandle userHandle = user.getUserHandle();
+ mNotificationManager.cancelAsUser(
+ Integer.toString(subId) /* tag */,
+ CALL_FORWARD_NOTIFICATION,
+ userHandle);
+ }
}
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 7493858..d3dd93c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -156,8 +156,6 @@
private static final int EVENT_SET_PREFERRED_NETWORK_TYPE_DONE = 24;
private static final int CMD_SEND_ENVELOPE = 25;
private static final int EVENT_SEND_ENVELOPE_DONE = 26;
- private static final int CMD_INVOKE_OEM_RIL_REQUEST_RAW = 27;
- private static final int EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE = 28;
private static final int CMD_TRANSMIT_APDU_BASIC_CHANNEL = 29;
private static final int EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE = 30;
private static final int CMD_EXCHANGE_SIM_IO = 31;
@@ -723,21 +721,6 @@
handleNullReturnEvent(msg, "setPreferredNetworkType");
break;
- case CMD_INVOKE_OEM_RIL_REQUEST_RAW:
- request = (MainThreadRequest)msg.obj;
- onCompleted = obtainMessage(EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE, request);
- mPhone.invokeOemRilRequestRaw((byte[])request.argument, onCompleted);
- break;
-
- case EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE:
- ar = (AsyncResult)msg.obj;
- request = (MainThreadRequest)ar.userObj;
- request.result = ar;
- synchronized (request) {
- request.notifyAll();
- }
- break;
-
case CMD_SET_VOICEMAIL_NUMBER:
request = (MainThreadRequest) msg.obj;
onCompleted = obtainMessage(EVENT_SET_VOICEMAIL_NUMBER_DONE, request);
@@ -3152,39 +3135,6 @@
}
@Override
- @Deprecated
- public int invokeOemRilRequestRaw(byte[] oemReq, byte[] oemResp) {
- enforceModifyPermission();
-
- int returnValue = 0;
- try {
- AsyncResult result = (AsyncResult)sendRequest(CMD_INVOKE_OEM_RIL_REQUEST_RAW, oemReq);
- if(result.exception == null) {
- if (result.result != null) {
- byte[] responseData = (byte[])(result.result);
- if(responseData.length > oemResp.length) {
- Log.w(LOG_TAG, "Buffer to copy response too small: Response length is " +
- responseData.length + "bytes. Buffer Size is " +
- oemResp.length + "bytes.");
- }
- System.arraycopy(responseData, 0, oemResp, 0, responseData.length);
- returnValue = responseData.length;
- }
- } else {
- CommandException ex = (CommandException) result.exception;
- returnValue = ex.getCommandError().ordinal();
- if(returnValue > 0) returnValue *= -1;
- }
- } catch (RuntimeException e) {
- Log.w(LOG_TAG, "sendOemRilRequestRaw: Runtime Exception");
- returnValue = (CommandException.Error.GENERIC_FAILURE.ordinal());
- if(returnValue > 0) returnValue *= -1;
- }
-
- return returnValue;
- }
-
- @Override
public void setRadioCapability(RadioAccessFamily[] rafs) {
try {
ProxyController.getInstance().setRadioCapability(rafs);
diff --git a/src/com/android/phone/settings/VoicemailSettingsActivity.java b/src/com/android/phone/settings/VoicemailSettingsActivity.java
index 04e8bf5..4d55421 100644
--- a/src/com/android/phone/settings/VoicemailSettingsActivity.java
+++ b/src/com/android/phone/settings/VoicemailSettingsActivity.java
@@ -24,6 +24,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.PersistableBundle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@@ -31,6 +32,7 @@
import android.preference.SwitchPreference;
import android.provider.ContactsContract.CommonDataKinds;
import android.provider.Settings;
+import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
@@ -250,6 +252,10 @@
mSubMenuVoicemailSettings.setParentActivity(this, VOICEMAIL_PREF_ID, this);
mSubMenuVoicemailSettings.setDialogOnClosedListener(this);
mSubMenuVoicemailSettings.setDialogTitle(R.string.voicemail_settings_number_label);
+ if (!getBooleanCarrierConfig(
+ CarrierConfigManager.KEY_EDITABLE_VOICEMAIL_NUMBER_SETTING_BOOL)) {
+ mSubMenuVoicemailSettings.setEnabled(false);
+ }
}
mVoicemailProviders = (VoicemailProviderListPreference) findPreference(
@@ -545,6 +551,23 @@
}
}
+ /**
+ * Get the boolean config from carrier config manager.
+ *
+ * @param key config key defined in CarrierConfigManager
+ * @return boolean value of corresponding key.
+ */
+ private boolean getBooleanCarrierConfig(String key) {
+ PersistableBundle b = PhoneGlobals.getInstance()
+ .getCarrierConfigForSubId(mPhone.getSubId());
+ if (b != null) {
+ return b.getBoolean(key);
+ } else {
+ // Return static default defined in CarrierConfigManager.
+ return CarrierConfigManager.getDefaultConfig().getBoolean(key);
+ }
+ }
+
//*********************************************************************************************
// Activity Dialog Methods