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

Commit d3c336a5 authored by songferngwang's avatar songferngwang Committed by SongFerng Wang
Browse files

To correct the DDS when the user turn on mobile data

If there is only one sim and the DDS is -1, when the user turns
on the mobile data, the settings should correct the dds and set the
mobile data on.

Bug: 339382631
Test: Verify UI
Change-Id: Ib0304dc1370a0d76310da2ce6ce0de12bfb275d8
parent 965da3df
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