Code example for Vibrator

Methods: sleep, vibrate

0
            } 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 SystemVibrator();
            try { 
                vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
            } catch (Exception e) {
                // Failure to vibrate shouldn't interrupt shutdown.  Just log it. 
                Log.w(TAG, "Failed to vibrate during shutdown.", e);
            } 
 
            // vibrator is asynchronous so we need to wait to avoid shutting down too soon. 
            try { 
                Thread.sleep(SHUTDOWN_VIBRATE_MS);
            } catch (InterruptedException unused) {
            } 
        } 
 
        // Shutdown power