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

Commit 16516f89 authored by Nate Myren's avatar Nate Myren Committed by Android (Google) Code Review
Browse files

Merge "Flush binders in Async LiveData" into rvc-dev

parents ec0c4eac ef2ba721
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.permissioncontroller.permission.data

import android.os.Binder
import com.android.permissioncontroller.permission.utils.IPC
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.GlobalScope
@@ -55,6 +56,8 @@ abstract class SmartAsyncMediatorLiveData<T> : SmartUpdateMediatorLiveData<T>()
        GlobalScope.launch(IPC) {
            currentJob = coroutineContext[Job]
            loadDataAndPostValue(currentJob!!)
            // TODO ntmyren: generalize this command to the IPC dispatcher
            Binder.flushPendingCommands()
            jobRunning = false
            if (jobQueued) {
                jobQueued = false
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ val Context.application: Application get() = when (this) {
 * The number of threads in the IPC thread pool. Set to the maximum number of binder threads allowed
 * to an app by the Android System.
 */
const val IPC_THREAD_POOL_COUNT = 16
const val IPC_THREAD_POOL_COUNT = 8

/**
 * A coroutine dispatcher with a fixed thread pool size, to be used for background tasks