From 0d106018db4418dd12e6ec0aa4c81eac0cd6ef39 Mon Sep 17 00:00:00 2001 From: Jon Spivack Date: Mon, 6 Apr 2020 19:17:21 -0700 Subject: [PATCH] ApexManager: Allow blocking Binder calls When ApexManager switched from using ServiceManager.getService to using Binder.waitForService to retrieve apexservice, it lost the call to Binder.allowBlocking that was inside getService. Since ApexManager currently makes several synchronous binder calls, this call is needed to avoid Log.wtf()s. Bug: 153360345 Test: atest ApexManagerTest Change-Id: I6016477b20754a6dc0f31588bae4e679f08a1ba2 --- services/core/java/com/android/server/pm/ApexManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java index 1e4dc7bfe7781..daf4bf271ca23 100644 --- a/services/core/java/com/android/server/pm/ApexManager.java +++ b/services/core/java/com/android/server/pm/ApexManager.java @@ -399,7 +399,9 @@ public abstract class ApexManager { @VisibleForTesting protected IApexService waitForApexService() { try { - return IApexService.Stub.asInterface(Binder.waitForService("apexservice")); + // Since apexd is a trusted platform component, synchronized calls are allowable + return IApexService.Stub.asInterface( + Binder.allowBlocking(Binder.waitForService("apexservice"))); } catch (RemoteException e) { throw new IllegalStateException("Required service apexservice not available"); }