Merge "Create TM for each subId to register phonestatelistner"
This commit is contained in:
@@ -174,7 +174,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId())
|
||||||
|
.listen(mPhoneStateListener,
|
||||||
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
|
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
|
||||||
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
|
||||||
| PhoneStateListener.LISTEN_SERVICE_STATE);
|
| PhoneStateListener.LISTEN_SERVICE_STATE);
|
||||||
@@ -197,8 +198,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId())
|
||||||
PhoneStateListener.LISTEN_NONE);
|
.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||||
|
|
||||||
if (mShowLatestAreaInfo) {
|
if (mShowLatestAreaInfo) {
|
||||||
mContext.unregisterReceiver(mAreaInfoReceiver);
|
mContext.unregisterReceiver(mAreaInfoReceiver);
|
||||||
@@ -432,8 +433,7 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
PhoneStateListener getPhoneStateListener() {
|
PhoneStateListener getPhoneStateListener() {
|
||||||
return new PhoneStateListener(
|
return new PhoneStateListener() {
|
||||||
mSubscriptionInfo.getSubscriptionId()) {
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataConnectionStateChanged(int state) {
|
public void onDataConnectionStateChanged(int state) {
|
||||||
updateDataState(state);
|
updateDataState(state);
|
||||||
|
@@ -220,7 +220,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
Log.d(TAG, "Register for call state change");
|
Log.d(TAG, "Register for call state change");
|
||||||
for (int i = 0; i < mPhoneCount; i++) {
|
for (int i = 0; i < mPhoneCount; i++) {
|
||||||
int subId = mSelectableSubInfos.get(i).getSubscriptionId();
|
int subId = mSelectableSubInfos.get(i).getSubscriptionId();
|
||||||
tm.listen(getPhoneStateListener(i, subId),
|
tm.createForSubscriptionId(subId).listen(getPhoneStateListener(i),
|
||||||
PhoneStateListener.LISTEN_CALL_STATE);
|
PhoneStateListener.LISTEN_CALL_STATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,13 +239,13 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhoneStateListener getPhoneStateListener(int phoneId, int subId) {
|
private PhoneStateListener getPhoneStateListener(int phoneId) {
|
||||||
// Disable Sim selection for Data when voice call is going on as changing the default data
|
// Disable Sim selection for Data when voice call is going on as changing the default data
|
||||||
// sim causes a modem reset currently and call gets disconnected
|
// sim causes a modem reset currently and call gets disconnected
|
||||||
// ToDo : Add subtext on disabled preference to let user know that default data sim cannot
|
// ToDo : Add subtext on disabled preference to let user know that default data sim cannot
|
||||||
// be changed while call is going on
|
// be changed while call is going on
|
||||||
final int i = phoneId;
|
final int i = phoneId;
|
||||||
mPhoneStateListener[phoneId] = new PhoneStateListener(subId) {
|
mPhoneStateListener[phoneId] = new PhoneStateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCallStateChanged(int state, String incomingNumber) {
|
public void onCallStateChanged(int state, String incomingNumber) {
|
||||||
if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
|
if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
|
||||||
|
Reference in New Issue
Block a user