Annotate framework vibrate calls with stream hints.

Migrate existing framework usages of Vibrator.vibrate to use
the new overload with an explicit stream hint.  This prevents
them from being blocked by rules targeting the unspecified stream.

For calls that pass the existing appops check in VibrateService,
pass streamHint down to the input device vibrator so we don't lose
the signal, but leave it up to InputManager to decide what to do
with it - currently unused.

Change-Id: I65c944e4010edea29a412bf57d8d7d3b8098b746
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 52f9aa9..aa756a1 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -362,7 +362,7 @@
         } catch (RemoteException e) {
         }
         if (vib.mTimeout != 0) {
-            doVibratorOn(vib.mTimeout, vib.mUid);
+            doVibratorOn(vib.mTimeout, vib.mUid, vib.mStreamHint);
             mH.postDelayed(mVibrationRunnable, vib.mTimeout);
         } else {
             // mThread better be null here. doCancelVibrate should always be
@@ -481,7 +481,7 @@
         return vibratorExists();
     }
 
-    private void doVibratorOn(long millis, int uid) {
+    private void doVibratorOn(long millis, int uid, int streamHint) {
         synchronized (mInputDeviceVibrators) {
             try {
                 mBatteryStatsService.noteVibratorOn(uid, millis);
@@ -491,7 +491,7 @@
             final int vibratorCount = mInputDeviceVibrators.size();
             if (vibratorCount != 0) {
                 for (int i = 0; i < vibratorCount; i++) {
-                    mInputDeviceVibrators.get(i).vibrate(millis);
+                    mInputDeviceVibrators.get(i).vibrate(millis, streamHint);
                 }
             } else {
                 vibratorOn(millis);
@@ -554,6 +554,7 @@
                 final int len = pattern.length;
                 final int repeat = mVibration.mRepeat;
                 final int uid = mVibration.mUid;
+                final int streamHint = mVibration.mStreamHint;
                 int index = 0;
                 long duration = 0;
 
@@ -574,7 +575,7 @@
                         // duration is saved for delay() at top of loop
                         duration = pattern[index++];
                         if (duration > 0) {
-                            VibratorService.this.doVibratorOn(duration, uid);
+                            VibratorService.this.doVibratorOn(duration, uid, streamHint);
                         }
                     } else {
                         if (repeat < 0) {