diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-10-03 18:45:37 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-03 18:45:37 -0700 |
commit | 6fb7fd3a0939413d8968fc0d404ed499d7f7dc52 (patch) | |
tree | 94d8ed2d8694bf66f8acb8a2bdbd662d0918f787 /core/java | |
parent | 33c36895a294c7b731fd59017a7ea0f06ac2a356 (diff) | |
parent | c428aae6429c3fd5e2037c3793af399d9f6e23bf (diff) | |
download | frameworks_base-6fb7fd3a0939413d8968fc0d404ed499d7f7dc52.zip frameworks_base-6fb7fd3a0939413d8968fc0d404ed499d7f7dc52.tar.gz frameworks_base-6fb7fd3a0939413d8968fc0d404ed499d7f7dc52.tar.bz2 |
Merge "Fix issue #7267494, issue #7212347" into jb-mr1-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 62 | ||||
-rw-r--r-- | core/java/android/os/IPowerManager.aidl | 3 | ||||
-rw-r--r-- | core/java/android/os/PowerManager.java | 2 |
3 files changed, 40 insertions, 27 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index ef9f6d4..5f65f08 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4530,6 +4530,14 @@ public final class ActivityThread { IContentProvider provider = pr.mProvider; IBinder jBinder = provider.asBinder(); + if (!jBinder.isBinderAlive()) { + // The hosting process of the provider has died; we can't + // use this one. + Log.i(TAG, "Acquiring provider " + auth + " for user " + userId + + ": existing object's process dead"); + handleUnstableProviderDiedLocked(jBinder, true); + return null; + } // Only increment the ref count if we have one. If we don't then the // provider is not reference counted and never needs to be released. @@ -4670,33 +4678,37 @@ public final class ActivityThread { } final void handleUnstableProviderDied(IBinder provider, boolean fromClient) { - synchronized(mProviderMap) { - ProviderRefCount prc = mProviderRefCountMap.get(provider); - if (prc != null) { - if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " - + provider + " " + prc.holder.info.name); - mProviderRefCountMap.remove(provider); - if (prc.client != null && prc.client.mNames != null) { - for (String name : prc.client.mNames) { - ProviderClientRecord pr = mProviderMap.get(name); - if (pr != null && pr.mProvider.asBinder() == provider) { - Slog.i(TAG, "Removing dead content provider: " + name); - mProviderMap.remove(name); - } + synchronized (mProviderMap) { + handleUnstableProviderDiedLocked(provider, fromClient); + } + } + + final void handleUnstableProviderDiedLocked(IBinder provider, boolean fromClient) { + ProviderRefCount prc = mProviderRefCountMap.get(provider); + if (prc != null) { + if (DEBUG_PROVIDER) Slog.v(TAG, "Cleaning up dead provider " + + provider + " " + prc.holder.info.name); + mProviderRefCountMap.remove(provider); + if (prc.client != null && prc.client.mNames != null) { + for (String name : prc.client.mNames) { + ProviderClientRecord pr = mProviderMap.get(name); + if (pr != null && pr.mProvider.asBinder() == provider) { + Slog.i(TAG, "Removing dead content provider: " + name); + mProviderMap.remove(name); } } - if (fromClient) { - // We found out about this due to execution in our client - // code. Tell the activity manager about it now, to ensure - // that the next time we go to do anything with the provider - // it knows it is dead (so we don't race with its death - // notification). - try { - ActivityManagerNative.getDefault().unstableProviderDied( - prc.holder.connection); - } catch (RemoteException e) { - //do nothing content provider object is dead any way - } + } + if (fromClient) { + // We found out about this due to execution in our client + // code. Tell the activity manager about it now, to ensure + // that the next time we go to do anything with the provider + // it knows it is dead (so we don't race with its death + // notification). + try { + ActivityManagerNative.getDefault().unstableProviderDied( + prc.holder.connection); + } catch (RemoteException e) { + //do nothing content provider object is dead any way } } } diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 557d3f3..6d6d147 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -37,7 +37,8 @@ interface IPowerManager void nap(long time); boolean isScreenOn(); - void reboot(String reason); + void reboot(boolean confirm, String reason, boolean wait); + void shutdown(boolean confirm, boolean wait); void crash(String message); void setStayOnSetting(int val); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index ae50ddb..fb02c0a 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -596,7 +596,7 @@ public final class PowerManager { */ public void reboot(String reason) { try { - mService.reboot(reason); + mService.reboot(false, reason, true); } catch (RemoteException e) { } } |