Merge "Fixing a condition that can cause deadlock" into sc-dev am: 7447381921

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15558584

Change-Id: If5bff0fa00bf8053fc7223f45f9bba60a4dafe8d
This commit is contained in:
Max Bires
2021-08-13 22:45:18 +00:00
committed by Automerger Merge Worker

View File

@@ -25,6 +25,8 @@ import android.os.RemoteException;
import android.util.Log;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
@@ -88,7 +90,8 @@ public class GenerateRkpKey {
}
intent.setComponent(comp);
mCountDownLatch = new CountDownLatch(1);
if (!mContext.bindService(intent, mConnection, Context.BIND_AUTO_CREATE)) {
Executor executor = Executors.newCachedThreadPool();
if (!mContext.bindService(intent, Context.BIND_AUTO_CREATE, executor, mConnection)) {
throw new RemoteException("Failed to bind to GenerateRkpKeyService");
}
try {