jasmine1

开机动画结束时增加振动提示

0
阅读(56) 评论(0)

[DESCRIPTION]

进入MTK手机待机界面的时候,增加一个500ms振动提示


[SOLUTION]

在进入launcher前增加振动功能solution:

振动500ms。

/php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java

//-------------add--------------------

// length of vibration before boot up

private static final int BOOTUP_VIBRATE_MS = 500;

private static final AudioAttributes VIBRATION_ATTRIBUTES = new

AudioAttributes.Builder()

.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)

.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)

.build();

//-------------add--------------------

6424 public void performEnableScreen() {

...

6483 mDisplayEnabled = true;

6484 if (DEBUG_SCREEN_ON || DEBUG_BOOT) Slog.i(TAG, "******************** ENABLING

SCREEN!");

//-------------add--------------------

1076 // vibrate before boot up

1077 Vibrator vibrator = new SystemVibrator();

1078 try {

1079 vibrator.vibrate(BOOTUP_VIBRATE_MS, VIBRATION_ATTRIBUTES);

1080 } catch (Exception e) {

1081 // Failure to vibrate shouldn't interrupt boot up. Just log it.

1082 Log.w(TAG, "Failed to vibrate during boot up.", e);

1083 }

//-------------add--------------------

6486 // Enable input dispatch.

6487 mInputMonitor.setEventDispatchingLw(mEventDispatchingEnabled);

/frameworks/base/services/core/java/com/android/server/VibratorService.java

391 private void startVibrationLocked(final Vibration vib) {

//将该部分注释掉

404 if (mode != AppOpsManager.MODE_ALLOWED) {

405 if (mode == AppOpsManager.MODE_ERRORED) {

406 Slog.w(TAG, "Would be an error: vibrate fROM uid " + vib.mUid);

407 }

408 //mtk Modify, do nothing with App related control in MTK solution

409 //mH.post(mVibrationRunnable);

410 return;

411 }

//将该部分注释掉