Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a931da2 authored by Nikolas Havrikov's avatar Nikolas Havrikov Committed by Automerger Merge Worker
Browse files

Merge "Only wait for successful vibration" into udc-dev am: 844c5aec

parents c21e9655 844c5aec
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -703,17 +703,20 @@ public final class ShutdownThread extends Thread {
            // vibrate before shutting down
            Vibrator vibrator = new SystemVibrator(context);
            try {
                if (vibrator.hasVibrator()) {
                    vibrator.vibrate(SHUTDOWN_VIBRATE_MS, VIBRATION_ATTRIBUTES);
            } 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) {
                        // this is not critical and does not require logging
                    }
                }
            } catch (Exception e) {
                // Failure to vibrate shouldn't interrupt shutdown.  Just log it.
                Log.w(TAG, "Failed to vibrate during shutdown.", e);
            }

        }
        // Shutdown power
        Log.i(TAG, "Performing low-level shutdown...");