diff options
author | Mike Lockwood <lockwood@android.com> | 2010-07-26 07:18:21 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-07-26 07:27:23 -0400 |
commit | d67b236497d87223e8373d96c274c97cfbcab0cb (patch) | |
tree | 7d45bd9501cc21904ec874994148e30c5efcdad6 | |
parent | 14bfa398a4e8697ce5822861a684b7d1245e4a85 (diff) | |
download | frameworks_base-d67b236497d87223e8373d96c274c97cfbcab0cb.zip frameworks_base-d67b236497d87223e8373d96c274c97cfbcab0cb.tar.gz frameworks_base-d67b236497d87223e8373d96c274c97cfbcab0cb.tar.bz2 |
Avoid starting multiple threads in ShutdownThread
The previous code allowed this to happen if a second call to shutdown
happened while the dialog was being displayed.
BUG: 2563243
Change-Id: I93adc4ef316917a79002d580b17eda0dc354704c
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | core/java/com/android/internal/app/ShutdownThread.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java index a96253b..d1aff2a 100644 --- a/core/java/com/android/internal/app/ShutdownThread.java +++ b/core/java/com/android/internal/app/ShutdownThread.java @@ -84,7 +84,7 @@ public final class ShutdownThread extends Thread { public static void shutdown(final Context context, boolean confirm) { // ensure that only one thread is trying to power down. // any additional calls are just returned - synchronized (sIsStartedGuard){ + synchronized (sIsStartedGuard) { if (sIsStarted) { Log.d(TAG, "Request to shutdown already running, returning."); return; @@ -133,6 +133,10 @@ public final class ShutdownThread extends Thread { private static void beginShutdownSequence(Context context) { synchronized (sIsStartedGuard) { + if (sIsStarted) { + Log.d(TAG, "Request to shutdown already running, returning."); + return; + } sIsStarted = true; } |