在NotificationManagerService
构造函数中添加
filter.addAction(Intent.ACTION_POWER_CONNECTED);
在广播接收器中添加处理函数
else if (action.equals(Intent.ACTION_POWER_CONNECTED)) { updateACNotification(); }
private void updateACNotification() { if (SystemProperties.getBoolean("hyst.t18.sp026",false)) { mVibrator.vibrate(200); } }
有的时候插入USB不震动,需要在
StorageNotification中的updateUsbMassStorageNotification方法中添加
mVibrator.vibrate(200);
在start中初始化mVibrator = (Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE); |