The provider model slice carrier toggle is broke.

The slice doesn't upload subId for TelephonyManager and
the listeners.

Bug: 177385874
Test: (PASS)atest NetworkProviderWorkerTest
(PASS)atest ProviderModelSliceTest
(PASS)atest ProviderModelSliceHelperTest

Change-Id: Icc8a7793204de2e2eadd0454edf50e466821b8f9
This commit is contained in:
SongFerngWang
2021-01-13 22:11:49 +08:00
parent 88ffca9af9
commit f3b25cc7cb
5 changed files with 57 additions and 52 deletions

View File

@@ -63,7 +63,7 @@ import java.util.stream.Collectors;
public class ProviderModelSliceHelper {
private static final String TAG = "ProviderModelSlice";
private final SubscriptionManager mSubscriptionManager;
private final TelephonyManager mTelephonyManager;
private TelephonyManager mTelephonyManager;
protected final Context mContext;
private CustomSliceable mSliceable;
@@ -277,4 +277,16 @@ public class ProviderModelSliceHelper {
.map(String::trim)
.collect(Collectors.toSet());
}
/**
* To update the telephony with subid.
*/
public void updateTelephony() {
if (mSubscriptionManager == null || mSubscriptionManager.getDefaultDataSubscriptionId()
== mSubscriptionManager.INVALID_SUBSCRIPTION_ID) {
return;
}
mTelephonyManager = mTelephonyManager.createForSubscriptionId(
mSubscriptionManager.getDefaultDataSubscriptionId());
}
}