ITeye博客

android 修改开关机铃声

ericchan2012 · 2012-10-18 16:52 · android系统 · 移动开发 · Markdown

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

// start boot animation
property_set("ctl.start", "bootanim");
{
    char value;
    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");
  }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。