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

Commit 2d9f02a7 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Catch binder transaction failure in ScreenshotProxyService

Avoid crashing if the binder transaction passed in fails.

Bug: 297299481
Fix: 297299481
Test: manual -- just adds an exception catch
Flag: NONE

Change-Id: I39453d5c68b2eecf49ba874c1f6565f02079e219
parent a9d2c1f1
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -17,15 +17,16 @@ package com.android.systemui.screenshot

import android.content.Intent
import android.os.IBinder
import android.os.RemoteException
import android.util.Log
import androidx.lifecycle.LifecycleService
import androidx.lifecycle.lifecycleScope
import com.android.app.tracing.coroutines.launch
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.shade.ShadeExpansionStateManager
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import com.android.app.tracing.coroutines.launch
import kotlinx.coroutines.withContext

/** Provides state from the main SystemUI process on behalf of the Screenshot process. */
@@ -56,7 +57,13 @@ constructor(
    private suspend fun executeAfterDismissing(callback: IOnDoneCallback) =
        withContext(mMainDispatcher) {
            activityStarter.executeRunnableDismissingKeyguard(
                Runnable { callback.onDone(true) },
                {
                    try {
                        callback.onDone(true)
                    } catch (e: RemoteException) {
                        Log.w(TAG, "Failed to complete callback transaction", e)
                    }
                },
                null,
                true /* dismissShade */,
                true /* afterKeyguardGone */,