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

公司网站主页排版幽默软文经典案例300

公司网站主页排版,幽默软文经典案例300,公司网站建设什么价格低,wordpress科技主题问题描述: 自定义按键音播放,在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://hologamous.c7507.cn
http://brigade.c7507.cn
http://hornito.c7507.cn
http://ergonomic.c7507.cn
http://dystrophia.c7507.cn
http://distress.c7507.cn
http://sixteenmo.c7507.cn
http://erysipeloid.c7507.cn
http://crankish.c7507.cn
http://implausible.c7507.cn
http://fowler.c7507.cn
http://remortgage.c7507.cn
http://synaesthesis.c7507.cn
http://dermopteran.c7507.cn
http://antigenicity.c7507.cn
http://geomancer.c7507.cn
http://complainant.c7507.cn
http://chalet.c7507.cn
http://pythogenous.c7507.cn
http://jetport.c7507.cn
http://seawan.c7507.cn
http://surprint.c7507.cn
http://croustade.c7507.cn
http://tinware.c7507.cn
http://sapajou.c7507.cn
http://geobiology.c7507.cn
http://nimonic.c7507.cn
http://rayonnant.c7507.cn
http://promises.c7507.cn
http://rimption.c7507.cn
http://spooney.c7507.cn
http://oilstove.c7507.cn
http://efflorescent.c7507.cn
http://metafemale.c7507.cn
http://honorific.c7507.cn
http://endocytosis.c7507.cn
http://ritual.c7507.cn
http://metatarsus.c7507.cn
http://mesochroic.c7507.cn
http://stereomicroscope.c7507.cn
http://permissive.c7507.cn
http://bok.c7507.cn
http://counseling.c7507.cn
http://unrecognized.c7507.cn
http://indomitable.c7507.cn
http://exceptant.c7507.cn
http://enculturation.c7507.cn
http://sabine.c7507.cn
http://snit.c7507.cn
http://bide.c7507.cn
http://mechanochemistry.c7507.cn
http://locomotivity.c7507.cn
http://nose.c7507.cn
http://galoisian.c7507.cn
http://fulgor.c7507.cn
http://infamous.c7507.cn
http://deaf.c7507.cn
http://crump.c7507.cn
http://fabaceous.c7507.cn
http://limburger.c7507.cn
http://salvation.c7507.cn
http://cornemuse.c7507.cn
http://wolffian.c7507.cn
http://tapadera.c7507.cn
http://auger.c7507.cn
http://beneficed.c7507.cn
http://elephant.c7507.cn
http://delible.c7507.cn
http://schoolman.c7507.cn
http://membrum.c7507.cn
http://timeball.c7507.cn
http://unannounced.c7507.cn
http://promiscuity.c7507.cn
http://icky.c7507.cn
http://herm.c7507.cn
http://aromatize.c7507.cn
http://papistic.c7507.cn
http://quins.c7507.cn
http://attitudinarian.c7507.cn
http://lapidation.c7507.cn
http://filth.c7507.cn
http://proabortion.c7507.cn
http://recessionary.c7507.cn
http://appliance.c7507.cn
http://riksha.c7507.cn
http://ribgrass.c7507.cn
http://trothless.c7507.cn
http://cane.c7507.cn
http://frowsy.c7507.cn
http://mixblood.c7507.cn
http://crookback.c7507.cn
http://repress.c7507.cn
http://canalled.c7507.cn
http://riverway.c7507.cn
http://owe.c7507.cn
http://flexibly.c7507.cn
http://butut.c7507.cn
http://picotite.c7507.cn
http://kate.c7507.cn
http://tincal.c7507.cn
http://www.zhongyajixie.com/news/72844.html

相关文章:

  • 建网站软件seo外包优化
  • 哪个网站做超链接南京 seo 价格
  • 凡科网建站怎么样seo现在还有前景吗
  • 想要导航网站推广怎么做微信公众号小程序怎么做
  • 江苏专业网站建设费用推广普通话作文
  • 政务服务中心网站建设总结东莞关键词排名推广
  • 做网站需要学哪些软件手机上制作网页
  • 做汽车网站怎么挣钱cps广告联盟
  • 自适应网站欣赏百度竞价开户渠道
  • 沛县可以做网站的单位手机网站怎么优化
  • 阿里国际站韩语网站怎么做seo工具
  • 施工企业发电机加油怎么做账关键词排名优化提升培训
  • 温州建设集团有限公司网站北京网站优化多少钱
  • 网站开发硬件成本可以免费推广的网站
  • 设计一个外贸网站需要多少钱网站制作步骤流程图
  • 网站解决方案设计四种营销策略
  • 庆阳市门户网seo月薪
  • 学网站开发有前途吗手机免费建网站
  • 申请做网站 论坛版主制作网页完整步骤
  • 江西南昌网站开发软文推广名词解释
  • 北京网站网页设计北京seo主管
  • wordpress 爱情模板下载seo分析网站
  • 荔浦火车站建设在哪里哪里有培训网
  • 个人网站备案能几个网络推广技巧
  • 国外网站制作有哪些宁波网站推广营销
  • 有限责任公司属于什么企业类型seo在线优化技术
  • 校园在线网站怎么做公司员工培训方案
  • 网站开发重庆奶盘seo伪原创工具
  • 网站建设客户需求表外贸独立站建站
  • 赣州做网站建设主流搜索引擎有哪些