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

Commit eb729f28 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix flicker of "App data usage"" into 24D1-dev

parents a48f19c1 9e5b389d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.settings.datausage.DataUsageUtils
import com.android.settings.datausage.lib.DataUsageLib
import com.android.settings.datausage.lib.NetworkCycleDataRepository
import com.android.settings.datausage.lib.NetworkStatsRepository.Companion.AllTimeRange
import com.android.settingslib.spaprivileged.framework.compose.getPlaceholder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -63,6 +64,7 @@ class DataUsagePreferenceController(context: Context, key: String) :
    }

    override fun onViewCreated(viewLifecycleOwner: LifecycleOwner) {
        preference.summary = mContext.getPlaceholder()
        viewLifecycleOwner.lifecycleScope.launch {
            viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
                update()
@@ -113,7 +115,6 @@ class DataUsagePreferenceController(context: Context, key: String) :
        }

        val allTimeUsage = repository.queryUsage(AllTimeRange)
        if (allTimeUsage.usage > 0) return allTimeUsage.getDataUsedString(mContext) to true
        return null to false
        return allTimeUsage.getDataUsedString(mContext) to (allTimeUsage.usage > 0)
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class DataUsagePreferenceControllerTest {
            on { loadFirstCycle() } doReturn usageData
        }
        controller.onViewCreated(TestLifecycleOwner())
        waitUntil { preference.summary != null }
        waitUntil { !preference.summary.isNullOrBlank() }

        controller.handlePreferenceTreeClick(preference)