Loading core/java/android/os/Vibrator.java +20 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; package android.os; import android.util.Log; /** /** * Class that operates the vibrator on the device. * Class that operates the vibrator on the device. * <p> * <p> Loading @@ -23,6 +25,8 @@ package android.os; */ */ public class Vibrator public class Vibrator { { private static final String TAG = "Vibrator"; IVibratorService mService; IVibratorService mService; private final Binder mToken = new Binder(); private final Binder mToken = new Binder(); Loading @@ -40,9 +44,14 @@ public class Vibrator */ */ public void vibrate(long milliseconds) public void vibrate(long milliseconds) { { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); return; } try { try { mService.vibrate(milliseconds, mToken); mService.vibrate(milliseconds, mToken); } catch (RemoteException e) { } catch (Exception e) { Log.w(TAG, "Failed to vibrate.", e); } } } } Loading @@ -61,13 +70,18 @@ public class Vibrator */ */ public void vibrate(long[] pattern, int repeat) public void vibrate(long[] pattern, int repeat) { { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); return; } // catch this here because the server will do nothing. pattern may // catch this here because the server will do nothing. pattern may // not be null, let that be checked, because the server will drop it // not be null, let that be checked, because the server will drop it // anyway // anyway if (repeat < pattern.length) { if (repeat < pattern.length) { try { try { mService.vibratePattern(pattern, repeat, mToken); mService.vibratePattern(pattern, repeat, mToken); } catch (RemoteException e) { } catch (Exception e) { Log.w(TAG, "Failed to vibrate.", e); } } } else { } else { throw new ArrayIndexOutOfBoundsException(); throw new ArrayIndexOutOfBoundsException(); Loading @@ -79,9 +93,13 @@ public class Vibrator */ */ public void cancel() public void cancel() { { if (mService == null) { return; } try { try { mService.cancelVibrate(mToken); mService.cancelVibrate(mToken); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Failed to cancel vibration.", e); } } } } } } core/java/com/android/internal/app/ShutdownThread.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -364,7 +364,7 @@ public final class ShutdownThread extends Thread { // vibrator is asynchronous so we need to wait to avoid shutting down too soon. // vibrator is asynchronous so we need to wait to avoid shutting down too soon. try { try { Thread.sleep(SHUTDOWN_VIBRATE_MS); Thread.sleep(SHUTDOWN_VIBRATE_MS); } catch (InterruptedException e) { } catch (InterruptedException unused) { } } } } Loading Loading
core/java/android/os/Vibrator.java +20 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; package android.os; import android.util.Log; /** /** * Class that operates the vibrator on the device. * Class that operates the vibrator on the device. * <p> * <p> Loading @@ -23,6 +25,8 @@ package android.os; */ */ public class Vibrator public class Vibrator { { private static final String TAG = "Vibrator"; IVibratorService mService; IVibratorService mService; private final Binder mToken = new Binder(); private final Binder mToken = new Binder(); Loading @@ -40,9 +44,14 @@ public class Vibrator */ */ public void vibrate(long milliseconds) public void vibrate(long milliseconds) { { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); return; } try { try { mService.vibrate(milliseconds, mToken); mService.vibrate(milliseconds, mToken); } catch (RemoteException e) { } catch (Exception e) { Log.w(TAG, "Failed to vibrate.", e); } } } } Loading @@ -61,13 +70,18 @@ public class Vibrator */ */ public void vibrate(long[] pattern, int repeat) public void vibrate(long[] pattern, int repeat) { { if (mService == null) { Log.w(TAG, "Failed to vibrate; no vibrator service."); return; } // catch this here because the server will do nothing. pattern may // catch this here because the server will do nothing. pattern may // not be null, let that be checked, because the server will drop it // not be null, let that be checked, because the server will drop it // anyway // anyway if (repeat < pattern.length) { if (repeat < pattern.length) { try { try { mService.vibratePattern(pattern, repeat, mToken); mService.vibratePattern(pattern, repeat, mToken); } catch (RemoteException e) { } catch (Exception e) { Log.w(TAG, "Failed to vibrate.", e); } } } else { } else { throw new ArrayIndexOutOfBoundsException(); throw new ArrayIndexOutOfBoundsException(); Loading @@ -79,9 +93,13 @@ public class Vibrator */ */ public void cancel() public void cancel() { { if (mService == null) { return; } try { try { mService.cancelVibrate(mToken); mService.cancelVibrate(mToken); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Failed to cancel vibration.", e); } } } } } }
core/java/com/android/internal/app/ShutdownThread.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -364,7 +364,7 @@ public final class ShutdownThread extends Thread { // vibrator is asynchronous so we need to wait to avoid shutting down too soon. // vibrator is asynchronous so we need to wait to avoid shutting down too soon. try { try { Thread.sleep(SHUTDOWN_VIBRATE_MS); Thread.sleep(SHUTDOWN_VIBRATE_MS); } catch (InterruptedException e) { } catch (InterruptedException unused) { } } } } Loading