Loading core/java/com/android/internal/app/ShutdownThread.java +13 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -49,6 +50,9 @@ public final class ShutdownThread extends Thread { 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(); private static boolean sIsStarted = false; Loading Loading @@ -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 Loading Loading
core/java/com/android/internal/app/ShutdownThread.java +13 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -49,6 +50,9 @@ public final class ShutdownThread extends Thread { 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(); private static boolean sIsStarted = false; Loading Loading @@ -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 Loading