diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/os/IVibratorManagerService.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/os/IVibratorService.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/os/SystemVibrator.java | 11 |
3 files changed, 10 insertions, 5 deletions
diff --git a/core/java/android/os/IVibratorManagerService.aidl b/core/java/android/os/IVibratorManagerService.aidl index 08d201977c49..b591f6016d14 100644 --- a/core/java/android/os/IVibratorManagerService.aidl +++ b/core/java/android/os/IVibratorManagerService.aidl @@ -22,6 +22,8 @@ import android.os.VibrationAttributes; /** {@hide} */ interface IVibratorManagerService { int[] getVibratorIds(); + boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, + in CombinedVibrationEffect effect, in VibrationAttributes attributes); void vibrate(int uid, String opPkg, in CombinedVibrationEffect effect, in VibrationAttributes attributes, String reason, IBinder token); void cancelVibrate(IBinder token); diff --git a/core/java/android/os/IVibratorService.aidl b/core/java/android/os/IVibratorService.aidl index 615ae6593330..562ac16099dd 100644 --- a/core/java/android/os/IVibratorService.aidl +++ b/core/java/android/os/IVibratorService.aidl @@ -30,8 +30,6 @@ interface IVibratorService boolean hasAmplitudeControl(); int[] areEffectsSupported(in int[] effectIds); boolean[] arePrimitivesSupported(in int[] primitiveIds); - boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, in VibrationEffect effect, - in VibrationAttributes attributes); void vibrate(int uid, String opPkg, in VibrationEffect effect, in VibrationAttributes attributes, String reason, IBinder token); void cancelVibrate(IBinder token); diff --git a/core/java/android/os/SystemVibrator.java b/core/java/android/os/SystemVibrator.java index 5c9067ac3c3e..b742ee2be43b 100644 --- a/core/java/android/os/SystemVibrator.java +++ b/core/java/android/os/SystemVibrator.java @@ -38,6 +38,7 @@ public class SystemVibrator extends Vibrator { private static final String TAG = "Vibrator"; private final IVibratorService mService; + private final IVibratorManagerService mManagerService; private final Binder mToken = new Binder(); private final Context mContext; @@ -49,6 +50,8 @@ public class SystemVibrator extends Vibrator { public SystemVibrator() { mContext = null; mService = IVibratorService.Stub.asInterface(ServiceManager.getService("vibrator")); + mManagerService = IVibratorManagerService.Stub.asInterface( + ServiceManager.getService("vibrator_manager")); } @UnsupportedAppUsage @@ -56,6 +59,8 @@ public class SystemVibrator extends Vibrator { super(context); mContext = context; mService = IVibratorService.Stub.asInterface(ServiceManager.getService("vibrator")); + mManagerService = IVibratorManagerService.Stub.asInterface( + ServiceManager.getService("vibrator_manager")); } @Override @@ -207,13 +212,14 @@ public class SystemVibrator extends Vibrator { @Override public boolean setAlwaysOnEffect(int uid, String opPkg, int alwaysOnId, VibrationEffect effect, AudioAttributes attributes) { - if (mService == null) { + if (mManagerService == null) { Log.w(TAG, "Failed to set always-on effect; no vibrator service."); return false; } try { VibrationAttributes atr = new VibrationAttributes.Builder(attributes, effect).build(); - return mService.setAlwaysOnEffect(uid, opPkg, alwaysOnId, effect, atr); + CombinedVibrationEffect combinedEffect = CombinedVibrationEffect.createSynced(effect); + return mManagerService.setAlwaysOnEffect(uid, opPkg, alwaysOnId, combinedEffect, atr); } catch (RemoteException e) { Log.w(TAG, "Failed to set always-on effect.", e); } @@ -255,7 +261,6 @@ public class SystemVibrator extends Vibrator { } } - @Override public void cancel() { if (mService == null) { |
