当前位置: 首页 > wzjs >正文

长沙专门做网站建设的公司深圳优化seo排名

长沙专门做网站建设的公司,深圳优化seo排名,javascript编辑器手机版,wordpress logo 没了问题描述: 自定义按键音播放,在Launcher上按 上下左右和OK 按键发现会播放两次按键提示音,其他的都是正常的。 首先找一下播放的是哪个文件,在下面的README中有定义 frameworks/base/data/sounds/README.txtTouch sounds -------…

问题描述:

自定义按键音播放,在Launcher上按 上下左右和OK 按键发现会播放两次按键提示音,其他的都是正常的。

首先找一下播放的是哪个文件,在下面的README中有定义

frameworks/base/data/sounds/README.txtTouch sounds
------------effects/Effect_Tick.oggold, referenced by AudioPackage[2345].mk OriginalAudio.mkeffects/ogg/Effect_Tick.oggnew, referenced by AudioPackage[6789].mk AudioPackage7alt.mk AudioPackage10.mkeffects/ogg/Effect_Tick_48k.oggoggdec -o temp.wav ogg/Effect_Tick.oggsox temp.wav -r 48000 temp48k.wavoggenc -b 80 -o ogg/Effect_Tick_48k.ogg temp48k.waveffects/wav/Effect_Tick.wavdoes not appear to be related to the other files in any obvious way

也就是触摸和点击事件都是播放的 Effect_Tick 这个音频文件。直接检索这个在哪里调用。

 xml文件是为了替换默认声音资源,并且可以看到很多需要的如上下左右都在这里定义了,并且播放的都是Effect_Tick。

framework/base/core/res/res/xml/audio_assets.xml<!-- Mapping of UI sound effects to audio assets under /system/media/audio/ui.Modify this file to override default sound assets.
--><audio_assets version="1.0"><asset id="FX_KEY_CLICK" file="Effect_Tick.ogg"/><asset id="FX_FOCUS_NAVIGATION_UP" file="Effect_Tick.ogg"/><asset id="FX_FOCUS_NAVIGATION_DOWN" file="Effect_Tick.ogg"/><asset id="FX_FOCUS_NAVIGATION_LEFT" file="Effect_Tick.ogg"/><asset id="FX_FOCUS_NAVIGATION_RIGHT" file="Effect_Tick.ogg"/><asset id="FX_KEYPRESS_STANDARD" file="KeypressStandard.ogg"/><asset id="FX_KEYPRESS_SPACEBAR" file="KeypressSpacebar.ogg"/><asset id="FX_KEYPRESS_DELETE" file="KeypressDelete.ogg"/><asset id="FX_KEYPRESS_RETURN" file="KeypressReturn.ogg"/><asset id="FX_KEYPRESS_INVALID" file="KeypressInvalid.ogg"/><asset id="FX_BACK

再根据 SoundEffectsHelper.java 找到实现播放的方法 void playSoundEffect(int effect, int volume)

其实是在 AudioService.java 定义的 

    /** @see AudioManager#playSoundEffect(int) */public void playSoundEffect(int effectType) {playSoundEffectVolume(effectType, -1.0f);}/** @see AudioManager#playSoundEffect(int, float) */public void playSoundEffectVolume(int effectType, float volume) {// do not try to play the sound effect if the system stream is mutedif (isStreamMute(STREAM_SYSTEM)) {return;}if (effectType >= AudioManager.NUM_SOUND_EFFECTS || effectType < 0) {Log.w(TAG, "AudioService effectType value " + effectType + " out of range");return;}sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_QUEUE,effectType, (int) (volume * 1000), null, 0);}

 根据注释,可以确定是通过 AudioManager 调用的。目前已经确定了播放按键提示音的调用方法。再次检索。

是在这里实现的播放

    @Overridepublic void playSoundEffect(@SoundEffectConstants.SoundEffect int effectId) {checkThread();try {final AudioManager audioManager = getAudioManager();if (mFastScrollSoundEffectsEnabled&& SoundEffectConstants.isNavigationRepeat(effectId)) {audioManager.playSoundEffect(SoundEffectConstants.nextNavigationRepeatSoundEffectId());return;}if (true) {Log.e(TAG, "lichang playSoundEffect avoid click tone");return;}switch (effectId) {case SoundEffectConstants.CLICK:audioManager.playSoundEffect(AudioManager.FX_KEY_CLICK);return;case SoundEffectConstants.NAVIGATION_DOWN:case SoundEffectConstants.NAVIGATION_REPEAT_DOWN:audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_DOWN);return;case SoundEffectConstants.NAVIGATION_LEFT:case SoundEffectConstants.NAVIGATION_REPEAT_LEFT:audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_LEFT);return;case SoundEffectConstants.NAVIGATION_RIGHT:case SoundEffectConstants.NAVIGATION_REPEAT_RIGHT:audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_RIGHT);return;case SoundEffectConstants.NAVIGATION_UP:case SoundEffectConstants.NAVIGATION_REPEAT_UP:audioManager.playSoundEffect(AudioManager.FX_FOCUS_NAVIGATION_UP);return;default:throw new IllegalArgumentException("unknown effect id " + effectId +" not defined in " + SoundEffectConstants.class.getCanonicalName());}} catch (IllegalStateException e) {// Exception thrown by getAudioManager() when mView is nullLog.e(mTag, "FATAL EXCEPTION when attempting to play sound effect: " + e);e.printStackTrace();}}

直接屏蔽掉即可。或者其实从 framework/base/core/res/res/xml/audio_assets.xml 也可以看到有方向键等音频资源,可以通过检索直接定位到位置。

只在framework下检索是因为对日志进行分析,过滤Audiotrack

11:42:03.414 AudioTrack                I  start mClientAttributionSource.uid:1000 mClientAttributionSource.pid:1013  mSessionId:129 app name:system_server 
11:42:03.433 AudioTrack                I  start mClientAttributionSource.uid:1000 mClientAttributionSource.pid:1013  mSessionId:145 app name:system_server 
11:42:03.525 AudioTrack                I  stop mClientAttributionSource.uid:1000 mClientAttributionSource.pid:1013  mSessionId:129 app name:system_server 
11:42:03.553 AudioTrack                I  stop mClientAttributionSource.uid:1000 mClientAttributionSource.pid:1013  mSessionId:145 app name:system_server 
可以看到这两次声音播放都是 system_server 这个进程调用的。

补充,由于是自定义按键音播放的,因此需要实现原生的按键音开关功能,增加条件

            if (System.getInt(context.getContentResolver(), System.SOUND_EFFECTS_ENABLED, 1) == 1)
                    playEffect(context);

结束

http://www.dtcms.com/wzjs/440418.html

相关文章:

  • 少儿编程加盟官网优化关键词有哪些方法
  • SEO网站布局优化百度seo关键词排名技术
  • 泰安市人才市场灰色关键词排名优化
  • 怎么做提货网站网络营销都有哪些形式
  • 做网站具体流程郑州网站推广排名公司
  • lovestory wordpress德阳seo
  • 北京代做网站谷歌seo排名公司
  • 广州做网站系统sem竞价培训班
  • 大型门户网站设计公司百度首页官网
  • 网站系统介绍宁波seo自然优化技术
  • 软件工程项目开发的步骤站长工具的使用seo综合查询排名
  • 徐州建网站国内搜索引擎
  • 阿里虚拟机建设网站国际新闻最新消息2022
  • 广州建网站的公司青岛官网seo公司
  • java开源代码网站南阳seo优化
  • 沈阳个人网站建设b站刺激战场视频
  • 西宁网站制作多少钱利尔化学股票
  • 网站蜘蛛怎么看seo咨询邵阳
  • 推荐做pc端网站百度会员登录入口
  • 做侵权网站用哪里的服务器网站如何推广
  • 做网站的细节软文范例大全100字
  • iis6 建设网站浏览网址大全123
  • 网站商城怎么做的seo中文全称是什么
  • 曲靖做网站建设的公司关键词优化简易
  • 个人网站模板html下载靠网络营销火起来的企业
  • 网站充值如何做post的长尾关键词搜索网站
  • 网络营销的网站定位元搜索引擎有哪些
  • 受欢迎的邢台做网站长沙网动网络科技有限公司
  • 建wiki网站长沙seo推广
  • 在模板网站建站好吗优化网站seo方案