Media3ActionFactory: Drop usages of runBlocking
- This CL refactors Media3ActionFactory to remove blocking runBlocking calls, leveraging asynchronous coroutines for Media3 operations. - Previous use of runBlocking in getMedia3Actions for Media3 controller interactions could block the calling thread, potentially causing UI jank or ANRs. - getMedia3Actions is now a suspend fun, allowing its callers to suspend instead of blocking. Custom actions are fetched and mapped asynchronously - The suspendCancellableCoroutine block for createMediaAction now directly launches a coroutine on bgScope, removing reliance on Handler.post for dispatching controller calls, for structured concurrency and cancellation. Bug: 423462317 Flag: com.android.systemui.do_not_use_run_blocking Test: atest Media3ActionFactoryTest Change-Id: Ie9adcb5cd8caaaf0a42c7400e890f5bfcd26dc4c
Loading
Please register or sign in to comment