Merge "To correct the DDS when the user turn on mobile data" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
539aee4211
@@ -410,11 +410,22 @@ suspend fun setMobileData(
|
|||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
): Unit =
|
): Unit =
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
Log.d(NetworkCellularGroupProvider.fileName, "setMobileData: $enabled")
|
Log.d(NetworkCellularGroupProvider.fileName, "setMobileData[$subId]: $enabled")
|
||||||
|
|
||||||
|
var targetSubId = subId
|
||||||
|
val activeSubIdList = subscriptionManager?.activeSubscriptionIdList
|
||||||
|
if (activeSubIdList?.size == 1) {
|
||||||
|
targetSubId = activeSubIdList[0]
|
||||||
|
Log.d(
|
||||||
|
NetworkCellularGroupProvider.fileName,
|
||||||
|
"There is only one sim in the device, correct dds as $targetSubId"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
Log.d(NetworkCellularGroupProvider.fileName, "setDefaultData: [$subId]")
|
Log.d(NetworkCellularGroupProvider.fileName, "setDefaultData: [$targetSubId]")
|
||||||
subscriptionManager?.setDefaultDataSubId(subId)
|
subscriptionManager?.setDefaultDataSubId(targetSubId)
|
||||||
}
|
}
|
||||||
TelephonyRepository(context)
|
TelephonyRepository(context)
|
||||||
.setMobileData(subId, enabled, wifiPickerTrackerHelper)
|
.setMobileData(targetSubId, enabled, wifiPickerTrackerHelper)
|
||||||
}
|
}
|
Reference in New Issue
Block a user