Device could not use wifi hotspot when data card switch to sim2
STEPS TO REPRODUCE:
1. Test devide insert two sim card into the phone,Sim1 do not support DUN APN and sim2 support DUP APN
2. Switch data card to sim2
2. Enable wifi hotspot
3. Reference phone connect test device wifi hotspot and access website
OBSERVED RESULTS:
Reference phone could connect to test device wifi hotspot but could not access to Internet
Test: Whether wifi hotspot available when sim2 which support DUN APN is data card
Change-Id: Ic3d8e1ddfb508bb858ef664a5a00ab05858b5764
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 46f99e2..07db4c1 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4393,18 +4393,23 @@
}
/**
- * Check whether DUN APN is required for tethering.
+ * Check whether DUN APN is required for tethering with subId.
*
+ * @param subId the id of the subscription to require tethering.
* @return {@code true} if DUN APN is required for tethering.
* @hide
*/
@Override
- public boolean getTetherApnRequired() {
+ public boolean getTetherApnRequiredForSubscriber(int subId) {
enforceModifyPermission();
final long identity = Binder.clearCallingIdentity();
- final Phone defaultPhone = getDefaultPhone();
+ final Phone phone = getPhone(subId);
try {
- return defaultPhone.hasMatchedTetherApnSetting();
+ if (phone != null) {
+ return phone.hasMatchedTetherApnSetting();
+ } else {
+ return false;
+ }
} finally {
Binder.restoreCallingIdentity(identity);
}