summaryrefslogtreecommitdiffstats
path: root/core/java/android/app
diff options
context:
space:
mode:
authorWale Ogunwale <ogunwale@google.com>2015-04-24 22:14:56 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-24 22:14:56 +0000
commite2047da6f3f21fc702d35b7d1c4e9bb62c963dac (patch)
tree0ac4c01e34fea0db6d3b997ede3458cf9a428c99 /core/java/android/app
parent8652bce13765fb29329df2a4ccca4591bae28de5 (diff)
parentd9bf26522b930a8d5d25f6e28c390e39fee6d0b2 (diff)
downloadframeworks_base-e2047da6f3f21fc702d35b7d1c4e9bb62c963dac.zip
frameworks_base-e2047da6f3f21fc702d35b7d1c4e9bb62c963dac.tar.gz
frameworks_base-e2047da6f3f21fc702d35b7d1c4e9bb62c963dac.tar.bz2
am d9bf2652: Merge "Revert "Clean-up state if we have an exception when acquiring provider""
* commit 'd9bf26522b930a8d5d25f6e28c390e39fee6d0b2': Revert "Clean-up state if we have an exception when acquiring provider"
Diffstat (limited to 'core/java/android/app')
-rw-r--r--core/java/android/app/ActivityThread.java66
1 files changed, 24 insertions, 42 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 6cbfee7..c05d0d4 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -261,8 +261,6 @@ public final class ActivityThread {
IActivityManager.ContentProviderHolder holder;
boolean acquiring = true;
int requests = 1;
- // Set if there was a runtime exception when trying to acquire the provider.
- RuntimeException runtimeException = null;
}
// The lock of mProviderMap protects the following variables.
@@ -4669,55 +4667,39 @@ public final class ActivityThread {
}
IActivityManager.ContentProviderHolder holder = null;
- try {
- if (first) {
- // Multiple threads may try to acquire the same provider at the same time.
- // When this happens, we only let the first one really gets provider.
- // Other threads just wait for its result.
- // Note that we cannot hold the lock while acquiring and installing the
- // provider since it might take a long time to run and it could also potentially
- // be re-entrant in the case where the provider is in the same process.
+ if (first) {
+ // Multiple threads may try to acquire the same provider at the same time.
+ // When this happens, we only let the first one really gets provider.
+ // Other threads just wait for its result.
+ // Note that we cannot hold the lock while acquiring and installing the
+ // provider since it might take a long time to run and it could also potentially
+ // be re-entrant in the case where the provider is in the same process.
+ try {
holder = ActivityManagerNative.getDefault().getContentProvider(
getApplicationThread(), auth, userId, stable);
- } else {
- synchronized (r) {
- while (r.acquiring) {
- try {
- r.wait();
- } catch (InterruptedException e) {
- }
- }
- holder = r.holder;
- }
+ } catch (RemoteException ex) {
}
- } catch (RemoteException ex) {
- } catch (RuntimeException e) {
synchronized (r) {
- r.runtimeException = e;
+ r.holder = holder;
+ r.acquiring = false;
+ r.notifyAll();
}
- } finally {
- if (first) {
- synchronized (r) {
- r.holder = holder;
- r.acquiring = false;
- r.notifyAll();
- }
- }
-
- synchronized (mAcquiringProviderMap) {
- if (--r.requests == 0) {
- mAcquiringProviderMap.remove(key);
+ } else {
+ synchronized (r) {
+ while (r.acquiring) {
+ try {
+ r.wait();
+ } catch (InterruptedException e) {
+ }
}
+ holder = r.holder;
}
-
- if (r.runtimeException != null) {
- // Was set when the first thread tried to acquire the provider,
- // but we should make sure it is thrown for all threads trying to
- // acquire the provider.
- throw r.runtimeException;
+ }
+ synchronized (mAcquiringProviderMap) {
+ if (--r.requests == 0) {
+ mAcquiringProviderMap.remove(key);
}
}
-
if (holder == null) {
Slog.e(TAG, "Failed to find provider info for " + auth);
return null;