Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 539aee42 authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "To correct the DDS when the user turn on mobile data" into main

parents e05e11c2 d3c336a5
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -410,11 +410,22 @@ suspend fun setMobileData(
    enabled: Boolean,
): Unit =
    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) {
            Log.d(NetworkCellularGroupProvider.fileName, "setDefaultData: [$subId]")
            subscriptionManager?.setDefaultDataSubId(subId)
            Log.d(NetworkCellularGroupProvider.fileName, "setDefaultData: [$targetSubId]")
            subscriptionManager?.setDefaultDataSubId(targetSubId)
        }
        TelephonyRepository(context)
            .setMobileData(subId, enabled, wifiPickerTrackerHelper)
            .setMobileData(targetSubId, enabled, wifiPickerTrackerHelper)
    }
 No newline at end of file