diff options
author | Mike Lockwood <lockwood@android.com> | 2010-04-01 21:08:53 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-04-01 21:08:53 -0700 |
commit | 87e72cd3b327fefc39030a628e9e9b7141791d39 (patch) | |
tree | de6a5f48d2bcaf3f4af2529d336eb3af4b41b186 | |
parent | bf1259b8a6a44d7a4eab5131cd33dac0fbcb50b6 (diff) | |
parent | a717f64ddcdce44379b24616333a58a6df2fcca5 (diff) | |
download | frameworks_base-87e72cd3b327fefc39030a628e9e9b7141791d39.zip frameworks_base-87e72cd3b327fefc39030a628e9e9b7141791d39.tar.gz frameworks_base-87e72cd3b327fefc39030a628e9e9b7141791d39.tar.bz2 |
Merge "Vibrate before shutting down." into froyo
-rw-r--r-- | core/java/com/android/internal/app/ShutdownThread.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java index 51cd0f8..83614a8 100644 --- a/core/java/com/android/internal/app/ShutdownThread.java +++ b/core/java/com/android/internal/app/ShutdownThread.java @@ -33,6 +33,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.Vibrator; import android.os.storage.IMountService; import android.os.storage.IMountShutdownObserver; @@ -48,6 +49,9 @@ public final class ShutdownThread extends Thread { // maximum time we wait for the shutdown broadcast before going on. private static final int MAX_BROADCAST_TIME = 10*1000; private static final int MAX_SHUTDOWN_WAIT_TIME = 20*1000; + + // length of vibration before shutting down + private static final int SHUTDOWN_VIBRATE_MS = 500; // state tracking private static Object sIsStartedGuard = new Object(); @@ -324,6 +328,15 @@ public final class ShutdownThread extends Thread { } catch (Exception e) { Log.e(TAG, "Reboot failed, will attempt shutdown instead", e); } + } else if (SHUTDOWN_VIBRATE_MS > 0) { + // vibrate before shutting down + Vibrator vibrator = new Vibrator(); + vibrator.vibrate(SHUTDOWN_VIBRATE_MS); + // vibrator is asynchronous so we need to wait to avoid shutting down too soon. + try { + Thread.sleep(SHUTDOWN_VIBRATE_MS); + } catch (InterruptedException e) { + } } // Shutdown power |