android 修改开关机铃声

1,boot铃声,在surfaceflinger.cpp中readyToRun():
/*
* We're now ready to accept clients...
*/

// start boot animation
property_set("ctl.start", "bootanim");
{
char value[PROPERTY_VALUE_MAX];
int ivalue = 0;

property_get("persist.sys.profile.silent", value, "0");
if (atoi(value)== 0){
LOGI("start:persist.sys.profile.silent is soundable");
property_set("ctl.start","startupsound");
}
else {
LOGI("start:persist.sys.profile.silent is silent");
}
}

2,shutdown 动画加在ShutdownThread.java中的beginShutdownSequence()方法的

synchronized (sIsStartedGuard) {
if (sIsStarted) {
Log.d(TAG, "Request to shutdown already running, returning.");
return;
}
sIsStarted = true;
}
后面
代码如下
android.os.SystemProperties.set("ctl.start","shutdownanim");
//chenxiang add to fix the shutdown sound
android.media.AudioManager mAudioManager = (android.media.AudioManager)context.getSystemService(context.AUDIO_SERVICE);
int ringerMode = mAudioManager.getRingerMode();
Log.i(TAG,"ringerMode:" + ringerMode);
if(ringerMode==android.media.AudioManager.RINGER_MODE_SILENT || ringerMode == android.media.AudioManager.RINGER_MODE_VIBRATE){

}else{
android.os.SystemProperties.set("ctl.start","shutdownsound");
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值