From e7f966d5594b658c8801f6412bc8e5fb756ef811 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 17 Jun 2021 16:24:21 -0700 Subject: [PATCH] Mark all published authorities for a provider as ready There could be more than one authority in a published provider. Make sure the waiting acquireProvider() calls are notified for each of the published authorities. Fixes: 186333995 Test: atest MultiAuthorityTest Manual: Start a work profile app while work profile is stopped Verify that the app starts faster than the 20 second timeout for acquireProvider() Change-Id: Iaad58949debeead6ea477aa440b13ba4ddc1198e --- core/java/android/app/ActivityThread.java | 15 +++++++++------ core/java/android/app/IApplicationThread.aidl | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 02ab3143eed90..034ad8e83fd38 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -447,7 +447,7 @@ public final class ActivityThread extends ClientTransactionHandler @GuardedBy("mLock") ContentProviderHolder mHolder; // Temp holder to be used between notifier and waiter - Object mLock; // The lock to be used to get notified when the provider is ready + final Object mLock; // The lock to be used to get notified when the provider is ready public ProviderKey(String authority, int userId) { this.authority = authority; @@ -1827,11 +1827,14 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void notifyContentProviderPublishStatus(@NonNull ContentProviderHolder holder, - @NonNull String auth, int userId, boolean published) { - final ProviderKey key = getGetProviderKey(auth, userId); - synchronized (key.mLock) { - key.mHolder = holder; - key.mLock.notifyAll(); + @NonNull String authorities, int userId, boolean published) { + final String auths[] = authorities.split(";"); + for (String auth: auths) { + final ProviderKey key = getGetProviderKey(auth, userId); + synchronized (key.mLock) { + key.mHolder = holder; + key.mLock.notifyAll(); + } } } diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl index 4555c1725a569..d6ff6d3dfc3a5 100644 --- a/core/java/android/app/IApplicationThread.aidl +++ b/core/java/android/app/IApplicationThread.aidl @@ -153,7 +153,7 @@ oneway interface IApplicationThread { void performDirectAction(IBinder activityToken, String actionId, in Bundle arguments, in RemoteCallback cancellationCallback, in RemoteCallback resultCallback); - void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String auth, + void notifyContentProviderPublishStatus(in ContentProviderHolder holder, String authorities, int userId, boolean published); void instrumentWithoutRestart(in ComponentName instrumentationName, in Bundle instrumentationArgs,