微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > L版本上添加关机振动,定时开机振动会失效

L版本上添加关机振动,定时开机振动会失效

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]

L版本上添加关机振动,定时开机振动会失效

[SOLUTION]

先将定时开机的ret值赋给一个系统属性:
在build project 的时候,在system.prop 中设置一个 property,比如 sys.boot.ret=0
在vendor/mediatek/proprietary/external/boot_logo_updater/boot_logo_updater.c文件中作修

int update_boot_reason() {
int fd;
size_t s;
char boot_mode;


property_set(BOOT_REASON_SYS_PROPERTY, propVal);
property_set("sys.boot.ret", ret); //需要添加的地方
return ret;
}
在php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks/base/core/java/android/provider/Settings.java文件中定义SYS_BOOT_RET
public static final String SYS_BOOT_RET = "sys.boot.ret";
在frameworks/base/services/core/java/com/android/server/VibratorService.java文件中
通过获取系统属性值sys.boot.ret是否为2作为判断是否定时开机的条件:
mScheduleOn=Settings.System.getInt(getContext().getContentResolver(),Settings.System.SY
S_BOOT_RET);
在FAQ14178的基础上继续判断如果是定时开机则不将AppOpsManager对VibratorService的管控部分
注释掉:
private void startVibrationLocked(final Vibration vib) {
try {
if (mLowpowerMode
&& vib.mUsageHint != AudioAttributes.USAGE_NOTIFICATION_RINGTONE) {
return;
}
int mode = mAppOpsService.checkAudioOperation(AppOpsManager.OP_VIBRATE,
vib.mUsageHint, vib.mUid, vib.mOpPkg);
if (mode == AppOpsManager.MODE_ALLOWED) {
mode = mAppOpsService.startOperation(AppOpsManager.getToken(mAppOpsService),
AppOpsManager.OP_VIBRATE, vib.mUid, vib.mOpPkg);
}
if (mode != AppOpsManager.MODE_ALLOWED) {
if (mode == AppOpsManager.MODE_ERRORED) {
Slog.w(TAG, "Would be an error: vibrate fROM uid " + vib.mUid);
}
//mtk Modify, do nothing with App related control in MTK solution
//mH.post(mVibrationRunnable);
return;
}
修改为:
if(mScheduleOn==2) {
if (mode != AppOpsManager.MODE_ALLOWED) {
if (mode == AppOpsManager.MODE_ERRORED) {
Slog.w(TAG, "Would be an error: vibrate from uid " + vib.mUid);
}
//MTK Modify, do nothing with App related control in MTK solution
//mH.post(mVibrationRunnable);
return;
} else {
}
} catch (RemoteException e) {
}
if (vib.mTimeout != 0) {
doVibratorOn(vib.mTimeout, vib.mUid, vib.mUsageHint);
mH.postDelayed(mVibrationRunnable, vib.mTimeout);
} else {
// mThread better be null here. doCancelVibrate should always be
// called before startNextVibrationLocked or startVibrationLocked.
mThread = new VibrateThread(vib);
mThread.start();
}
}

感谢小编分享

谢谢支持

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top