android studio导航栏 耳机拔出在通知栏显示通知

音视频方案(45)
& 扬声器、有线耳机、蓝牙耳机对手机通话或听音乐的影响
Android 耳机插拔流程源码跟踪浅析- http://www.jianshu.com/p/d82a8dabb3e7
对于有线耳机,监听Intent.ACTION_HEADSET_PLUG系统广播,对于蓝牙耳机,监听BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED系统广播
private BroadcastReceiver headsetPlugReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if(BluetoothProfile.STATE_DISCONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET)) {
//Bluetooth headset is now disconnected
handleHeadsetDisconnected();
} else if ("android.intent.action.HEADSET_PLUG".equals(action)) {
if (intent.hasExtra("state")) {
int state = intent.getIntExtra("state", 0);
if (state == 1) {
Toast.makeText(context, "插入耳机", Toast.LENGTH_SHORT).show();
} else if(state == 0){
Toast.makeText(context, "拔出耳机", Toast.LENGTH_SHORT).show();
监听Android的系统广播AudioManager.ACTION_AUDIO_BECOMING_NOISY, 但是这个广播只是针对有线耳机,或者无线耳机的手机断开连接的事件,监听不到有线耳机和蓝牙耳机的接入,但对于我的需求来说足够了,监听这个广播就没有延迟了,UI可以立即响应
private BroadcastReceiver headsetPlugReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(action)) {
handleHeadsetDisconnected();
------------------------------------------
Android应用--简、美音乐播放器添加电话监听- http://blog.csdn.net/wwj_748/article/details/9074007
android音乐播放器监听电话状态- http://blog.csdn.net/piaozhiye/article/details/6429402
一.短信拦截分为2种方式,其一是广播,其二是内容观察者
实现挂断电话的功能,就必须通过AIDL才行,然后利用反射来使用其方法。
Android开发——短信电话拦截/接听电话- http://blog.csdn.net/seu_calvin/article/details/
Android 短信拦截&来去电话拦截- https://my.oschina.net/ososchina/blog/501874
Android 电话和短信拦截- http://blog.csdn.net/jeden/article/details/
Android 来电(包括铃声),短信拦截的实现方法- http://blog.csdn.net/lyjit/article/details/
-------------------------------------
电话中的RIL机制 AT指令集及基带BaseBand,BP?经验5787 米
在线时间29 小时
版本8.1.18
机型小米手机6
签到次数200
MIUI版本8.1.18
本帖最后由 我是永恒啊 于
15:31 编辑
想必有些朋友也遇到过这个问题,正在听小说的时候(我用的是“喜马拉雅听”),插入耳机(我用的是1MORE话务耳机)通知栏里会自动跳出一个小米音乐的提示,接着我点耳机上的播放按钮时开始播放的并不是小说,而是小米音乐。试了好多方法都不能解决这个问题,也反馈了好多次,但是都没有明确的解决方法。后来偶然有一个网友在我的反馈贴里的回复,提醒了我,终于解决了问题,今天我就分享给大家吧。
--------------------------------------------------------------------
我的手机系统版本:miui7 6.4.21开发版
操作步骤:前提是小米音乐没有在后台运行,如果运行了,请先退出小米音乐应用。然后点设置-通知和状态栏-通知管理-音乐-将允许通知右面的滑块关掉,再打开“喜马拉雅听”点耳机的播放键,果然好用了!
下面是操作截图:
01.png (76.14 KB, 下载次数: 0)
02.png (76.74 KB, 下载次数: 0)
03.png (100.64 KB, 下载次数: 0)
04.png (36.48 KB, 下载次数: 0)
05.png (74.35 KB, 下载次数: 0)
我的系统版本是最新的开发版
分享到微信朋友圈
打开微信,点击底部的“发现”,使用 “扫一扫” 即可将网页分享到我的朋友圈。
经验1004 米
在线时间6 小时
版本7.11.9
积分 920, 距离下一级还需 1080 积分
积分 920, 距离下一级还需 1080 积分
机型小米手机3/4 WCDMA版
签到次数98
MIUI版本7.11.9
通过手机发布
这样做虽然解决了自动启动问题,但是怎样让线控可以控制第三方音乐软件?
经验5787 米
在线时间29 小时
版本8.1.18
机型小米手机6
签到次数200
MIUI版本8.1.18
本帖最后由 我是永恒啊 于
15:26 编辑
这样做虽然解决了自动启动问题,但是怎样让线控可以控制第三方音乐软件? ...
这样做小米音乐就不会弹出了,自然线控就可以控制第三方音乐应用了,我的懒人听书和喜马拉雅听都可以了,但是有时候可能会不灵,重插下耳机或重启一下第三方音乐应用又好用了,不知道为什么
经验528 米
在线时间1 小时
版本5.11.26
积分 530, 距离下一级还需 1470 积分
积分 530, 距离下一级还需 1470 积分
机型小米手机3 TD版
签到次数53
MIUI版本5.11.26
这个方法很好,大家可以尝试一下
2018新年勋章
参与回帖活动
MIUI 300周
MIUI 300周更新纪念勋章
已关注极客秀微信
已关注微信
关注腾讯微博
已关注腾讯微博
关注新浪微博
已关注新浪微博
Copyright (C) 2017 MIUI
京ICP备号 | 京公网安备34号 | 京ICP证110507号Android 耳机插拔流程源码跟踪浅析
作者:TioX2016
来源:鲜网读书
Android 开发过程中,使用耳机控制拍照,控制音乐播放,控制打电话等,线控再到蓝牙控...
耳机也在不断升级,耳机插拔的程序这一块也在不断完善。因此,在定制开发过程中,阅读这部分流程代码是必修的功课了,至少首先的要搞清楚程序走的线路流程。下面结合我在实际工作过程中遇到的bug,需求定制等做个简单的总结。
第一节,插拔耳机时,事件上报
抓取事件命令:
查看有哪些事件可以getPS C:Usersxxxx& adb shell getevent -l
add device 1: /dev/input/event11
add device 2: /dev/input/event10
add device 3: /dev/input/event9
add device 4: /dev/input/event0
"Power Button"
add device 5: /dev/input/event5
"Video Bus"
add device 6: /dev/input/event8
"baytrailaudio Intel MID Audio Jack"
add device 7: /dev/input/event6
"gpio-lesskey"
add device 8: /dev/input/event7
"dollar_cove_power_button"
add device 9: /dev/input/event3
"jsa1212_als"
add device 10: /dev/input/event2
"jsa1212_ps"
add device 11: /dev/input/event1
add device 12: /dev/input/event4
"goodix_ts"
event8正式我们想要查看的event。add device 6: /dev/input/event8
"baytrailaudio Intel MID Audio Jack"
下面我们开始get event8 详细信息,下面事件信息分别是拔出和进入耳机时事件信息。SW_MICROPHONE_INSERT带mic的耳机。PS C:Usersxxxx& adb shell getevent -l
/dev/input/event8
SW_HEADPHONE_INSERT
SW_MICROPHONE_INSERT
SYN_REPORT
SW_HEADPHONE_INSERT
SW_MICROPHONE_INSERT
SYN_REPORT
从上面的输出数据中我们可以看到,进入耳机上报1,拔出是0。另外,我们可以从get parameter命令看到当前信息(注:这个命令是特别方案才有,取决于芯片商)
PS C:Usersxxxx& adb shell parameter status
Last Applied [Pending] Configurations:
======================================
OutputDevice.Private.Selected: WiredSpeakers [&none&]
IHF.SDRC: Enabled [&none&]
InputDevice.Selected: HeadsetMic [&none&]
OutputDevice.Selected: Multimedia.IHF.Headset [&none&]
IHF.StereoEq: Enabled [&none&]
Headset.Selected: Digital [&none&]
Voip.Tuning: Default [&none&]
Calibration: Default [&none&]
LPE_Mixer: Default [&none&]
Audio.voice: Default [&none&]
InputDevice.Selected ,OutputDevice.Selected等我们可以看到是使用耳机状态。拔掉耳机,我们看一下具体的parameter信息:
Last Applied [Pending] Configurations:
======================================
OutputDevice.Private.Selected: WiredSpeakers [&none&]
IHF.SDRC: Enabled [&none&]
InputDevice.Selected: VoiceRecgnition.FrontMic [&none&]
OutputDevice.Selected: Multimedia.IHF [&none&]
IHF.StereoEq: Enabled [&none&]
Headset.Selected: Digital [&none&]
Voip.Tuning: Default [&none&]
Calibration: Default [&none&]
LPE_Mixer: Default [&none&]
此时相关参数发生了变化:InputDevice.Selected,OutputDevice.Selected 等已经发生了变化。
第二节,进入拔出framework部分相关源码流程分析
涉及到的类文件
InputManagerService.java./framework/base/services/core/java/com/android/server/input/InputManagerService.java*WiredAccessoryManager.java../framework/base/services/core/java/com/android/server/WiredAccessoryManager.java
config.xml./framework/base/core/res/res/values/config.xml
SystemServer.java./framework/base/services/java/com/android/server/SystemServer.java
AudioManager.java./base/media/java/android/media/AudioManager.java
AudioService.java./base/media/java/android/media/AudioService.java
UEvent和InputEvent的选择这两个的切换主要是通过设置属性来的。该属性开关位于config.xml中:
&!-- When true use the linux /dev/input/event subsystem to detect the switch changes
on the headphone/microphone jack. When false use the older uevent framework. --&
&bool name="config_useDevInputEventForAudioJack"&false&/bool&
从注释里面我们可以看到设置为true,选择/dev/input/event ,设置为false 选择uevent 来控制事件的上报。
在InputManagerService.java 构造方法中,config_useDevInputEventForAudioJack的值初始化mUseDevInputEventForAudioJack 决定采用哪种方式。
public InputManagerService(Context context) {
this.mContext =
this.mHandler = new InputManagerHandler(DisplayThread.get().getLooper());
//config_useDevInputEventForAudioJack
mUseDevInputEventForAudioJack =
context.getResources().getBoolean(R.bool.config_useDevInputEventForAudioJack);
Slog.i(TAG, "Initializing input manager, mUseDevInputEventForAudioJack="
+ mUseDevInputEventForAudioJack);
mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue());
LocalServices.addService(InputManagerInternal.class, new LocalService());
进入耳机底层kernal事件上报后(注:这段过程需要研究),转到InputManagerService.java中的notifySwitch方法中。接下来我们先看notifySwitch方法:
// Native callback.
private void notifySwitch(long whenNanos, int switchValues, int switchMask) {
... 因为当前我们只看耳机插拔的模式,因此,其他的先排除。
if (mUseDevInputEventForAudioJack
(switchMask
SW_JACK_BITS) != 0) {
mWiredAccessoryCallbacks.notifyWiredAccessoryChanged(whenNanos, switchValues,
switchMask);
接下来是走到mWiredAccessoryCallbacks 回调中。有个疑问:mWiredAccessoryCallbacks是什么呢?
先看看回调*接下来我们先顺藤摸瓜从这个callBack的声明初始化开始,找到目标。WiredAccessoryCallbacks接口的声明,它在WiredAccessoryManager.java类的内部,接口有两个方法,一个是notifyWiredAccessoryChanged另外一个是systemReady 。
* Callback interface implemented by WiredAccessoryObserver.
public interface WiredAccessoryCallbacks {
public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask);
public void systemReady();
再看何时将它初始化:
public void setWindowManagerCallbacks(WindowManagerCallbacks callbacks) {
mWindowManagerCallbacks =
setWindowManagerCallbacks的调用在SystemServer.java中,也就是InputManagerService被创建的时候。接下来转到SystemServer.java中:
inputManager = new InputManagerService(context);
wm = WindowManagerService.main(context, inputManager,
mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL/* always false*/,
!mFirstBoot/* always true*/,mOnlyCore/* always false*/);
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
//register the inputManagerService to ServiceManager
ServiceManager.addService(Context.INPUT_SERVICE, inputManager);
if (!disableMedia) {
Slog.i(TAG, "Wired Accessory Manager");
// Listen for wired headset changes
inputManager.setWiredAccessoryCallbacks(
new WiredAccessoryManager(context, inputManager));
} catch (Throwable e) {
reportWtf("starting WiredAccessoryManager", e);
从上面的代码可以看到WiredAccessoryManager对象直接被注册为callBack 因此,mWiredAccessoryCallbacks.notifyWiredAccessoryChanged直接将后面的任务交给了WiredAccessoryManager类。
WiredAccessoryManager.javanotifyWiredAccessoryChanged方法:
public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask) {
synchronized (mLock) {
mSwitchValues = (mSwitchValues
~switchMask) | switchV
switch (mSwitchValues
(SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT)) {
headset = 0;
case SW_HEADPHONE_INSERT_BIT:
headset = BIT_HEADSET_NO_MIC;
case SW_LINEOUT_INSERT_BIT:
headset = BIT_LINEOUT;
case SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT:
headset = BIT_HEADSET;
case SW_MICROPHONE_INSERT_BIT:
headset = BIT_HEADSET;
headset = 0;
//上面的switch 语句是看哪种耳机,带mic否?
updateLocked(NAME_H2W,
(mHeadsetState
~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT)) | headset);
接着转到updateLocked方法,该方法作用是check当前模式是否变化。也就是是否发生耳机拔出了或者进入了(0-&1;1-&0的变化)。state无变化则不会继续处理。疑问:这里的BIT_USB_HEADSET_ANLG和BIT_USB_HEADSET_DGTL是什么?
* Compare the existing headset state with the new state and pass along accordingly. Note
* that this only supports a single headset at a time. Inserting both a usb and jacked headset
* results in support for the last one plugged in. Similarly, unplugging either is seen as
* unplugging all.
* @param newName One of the NAME_xxx variables defined above.
* @param newState 0 or one of the BIT_xxx variables defined above.
private void updateLocked(String newName, int newState) {
// Retain only relevant bits
int headsetState = newState
SUPPORTED_HEADSETS;
int usb_headset_anlg = headsetState
BIT_USB_HEADSET_ANLG;
int usb_headset_dgtl = headsetState
BIT_USB_HEADSET_DGTL;
int h2w_headset = headsetState
(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT);
boolean h2wStateChange =
boolean usbStateChange =
//fulairy add: check the state changed or not mHeadsetState is old state and headsetState is new state
if (mHeadsetState == headsetState) {
Log.e(TAG, "No state change.");
// reject all suspect transitions: only accept state changes from:
// - a: 0 headset to 1 headset
// - b: 1 headset to 0 headset
if (h2w_headset == (BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT)) {
Log.e(TAG, "Invalid combination, unsetting h2w flag");
h2wStateChange =
// - c: 0 usb headset to 1 usb headset
// - d: 1 usb headset to 0 usb headset
if (usb_headset_anlg == BIT_USB_HEADSET_ANLG
usb_headset_dgtl == BIT_USB_HEADSET_DGTL) {
Log.e(TAG, "Invalid combination, unsetting usb flag");
usbStateChange =
//flairy add : h2wStateChange and usbStateChange all not changed .
if (!h2wStateChange
!usbStateChange) {
Log.e(TAG, "invalid transition, returning ...");
mWakeLock.acquire();
//flairy add : yeah ,you changed pls mHandler deal with it .
Message msg = mHandler.obtainMessage(MSG_NEW_DEVICE_STATE/*what*/, headsetState/*arg0*/, //headsetState 新状态
mHeadsetState/*arg1*/, newName/*obj*/);//mHeadsetState 旧的状态,newName name of the headset .
mHandler.sendMessage(msg);
mHeadsetState = headsetS// update the status .
接下来mHandler处理:
private final Handler mHandler = new Handler(Looper.myLooper(), null, true) {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_NEW_DEVICE_STATE:
setDevicesState(msg.arg1, msg.arg2, (String)msg.obj);
mWakeLock.release();
//这个方法挺有意思...就是没看明白 :(
private void setDevicesState(
int headsetState, int prevHeadsetState, String headsetName) {
synchronized (mLock) {
int allHeadsets = SUPPORTED_HEADSETS;
for (int curHeadset = 1; allHeadsets != 0; curHeadset &&= 1) {
if ((curHeadset
allHeadsets) != 0) {
setDeviceStateLocked(curHeadset, headsetState, prevHeadsetState, headsetName);
allHeadsets = ~curH
private void setDeviceStateLocked(int headset,
int headsetState, int prevHeadsetState, String headsetName) {
if ((headsetState
headset) != (prevHeadsetState
headset)) {
int outDevice = 0;
int inDevice = 0;
//important:
state set start
if ((headsetState
headset) != 0) {
state = 1;
state = 0;
// important : state set end
if (headset == BIT_HEADSET) {
outDevice = AudioManager.DEVICE_OUT_WIRED_HEADSET;
inDevice = AudioManager.DEVICE_IN_WIRED_HEADSET;
} else if (headset == BIT_HEADSET_NO_MIC){
outDevice = AudioManager.DEVICE_OUT_WIRED_HEADPHONE;
} else if (headset == BIT_LINEOUT){
outDevice = AudioManager.DEVICE_OUT_LINE;
} else if (headset == BIT_USB_HEADSET_ANLG) {
outDevice = AudioManager.DEVICE_OUT_ANLG_DOCK_HEADSET;
} else if (headset == BIT_USB_HEADSET_DGTL) {
outDevice = AudioManager.DEVICE_OUT_DGTL_DOCK_HEADSET;
} else if (headset == BIT_HDMI_AUDIO) {
outDevice = AudioManager.DEVICE_OUT_HDMI;
Slog.e(TAG, "setDeviceState() invalid headset type: "+headset);
//update the out device and in device .
if (outDevice != 0) {
mAudioManager.setWiredDeviceConnectionState(outDevice, state, headsetName);
//这里我们仅仅看in device.
if (inDevice != 0) {
mAudioManager.setWiredDeviceConnectionState(inDevice, state, headsetName);
接下来的流程就交给了AudioManager,从代码看实际上真正的处理这是AudioService
IAudioService service = getService();
service.setWiredDeviceConnectionState(device, state, name);
因此我们跳过AudioManager.java直接从AduioService.java看。
setWiredDeviceConnectionState--& queueMsgUnderWakeLock--&sendMsg--& ...
从源代码看到这里,你可以发现AudioService是个非常重要的角色,因此它里面的控制逻辑很多建议多多理解。
接下来我们直接从handler处理消息开始。因为我们只搞清楚headset处理的这条线。
case MSG_SET_WIRED_DEVICE_CONNECTION_STATE:
onSetWiredDeviceConnectionState(msg.arg1, msg.arg2, (String)msg.obj);
mAudioEventWakeLock.release();
private void onSetWiredDeviceConnectionState(int device, int state, String name)
synchronized (mConnectedDevices) {
//state==0 ===& the device is disconnected.
//ignore BluetoothA2dp Device.
handleDeviceConnection((state == 1)/*FULAIRY ADD :true if connected , false if disconnected */, device, (isUsb ? name : ""/* FuLaiRy add :that’s why we get empty string when we use common headset.*/));
... // other conditions we also ignore
// FuLAIRY ADD :Send broadcast ...
if (!isUsb
(device != AudioSystem.DEVICE_IN_WIRED_HEADSET)) {
sendDeviceConnectionIntent(device, state, name);
onSetWiredDeviceConnectionState方法中我们忽略其他一些情况的处理,看最主要的两个: 一个是handleDeviceConnection,另外一个是sendDeviceConnectionIntent。因此,下面我们主要看着两个方法。
handleDeviceConnection
private boolean handleDeviceConnection(boolean connected, int device, String params) {
synchronized (mConnectedDevices) {
//Fulairy: mConnectedDevices is a hashMap :
//private final HashMap &Integer, String& mConnectedDevices = new HashMap &Integer, String&();
// the if means that if key and values are all equal,indicate the same device has been connected .
boolean isConnected = (mConnectedDevices.containsKey(device)
(params.isEmpty() || mConnectedDevices.get(device).equals(params)));
if (isConnected
!connected) {
AudioSystem.setDeviceConnectionState(device,
AudioSystem.DEVICE_STATE_UNAVAILABLE,
mConnectedDevices.get(device));
mConnectedDevices.remove(device);
} else if (!isConnected
connected) {
//接下来的处理在JNI方法
AudioSystem.setDeviceConnectionState(device,
AudioSystem.DEVICE_STATE_AVAILABLE,
mConnectedDevices.put(new Integer(device), params);
JNI部分放到后面补充。
sendDeviceConnectionIntent从这个方法,可以看到intent耳机插拔的广播我们可以在app层通过监听ACTION_HEADSET_PLUG。 intent携带了,当前最新状态state ,name以及microphone(耳机是否带麦)。可以从自带音乐播放器看看。
private void sendDeviceConnectionIntent(int device, int state, String name)
Intent intent = new Intent();
intent.putExtra("state", state);
intent.putExtra("name", name);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
int connType = 0;
if (device == AudioSystem.DEVICE_OUT_WIRED_HEADSET) {
connType = AudioRoutesInfo.MAIN_HEADSET;
intent.setAction(Intent.ACTION_HEADSET_PLUG);
intent.putExtra("microphone", 1);
} else if (device == AudioSystem.DEVICE_OUT_WIRED_HEADPHONE ||
device == AudioSystem.DEVICE_OUT_LINE) {
/*do apps care about line-out vs headphones?*/
connType = AudioRoutesInfo.MAIN_HEADPHONES;
intent.setAction(Intent.ACTION_HEADSET_PLUG);
intent.putExtra("microphone", 0);
... 割舍了也很重要的一些其他逻辑处理。
ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.USER_ALL); // 后面的流程就不继续跟了,这个是通用,单独分出一条线比较好,check里面是如何运作的。
} finally ...
说到这里我们不得不提一下,进入与拔出耳机通知栏耳机图标的显示与消失。
第三节,插拔耳机,通知栏图标的显示与消失。
在原生应用中,搜索ACTION_HEADSET_PLUG我们是搜索不到的。因为没有做处理。下面我们自己添加。涉及到的文件
PhoneStatusBarPolicy.javaframeworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone
添加广播注册
//FuLairy add: HeadSet start
filter.addAction(Intent.ACTION_HEADSET_PLUG) ;
//FuLairy add: HeadSet start
mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
// FuLaiRy add Headset start
mService.setIcon(SLOT_HEADSET,
R.drawable.stat_sys_tty_mode, 0, null);
mService.setIconVisibility(SLOT_HEADSET, false);
// FuLaiRy add Headset end
新增update方法
//FuLairy add: HeadSet start
public final void updateHeadSet(intent){
final int state = intent.getIntExtra("state",0/*default*/) ;
final String name = intent.getStringExtra("name",""/*this always be empty string*/) ;
final int microPhone =intent.getIntExtra("microphone",0/*default*/) ;
switch(state){
//disconnected
String contentDescription = mContext.getString(R.string.headset_disconnected);
mService.setIcon(SLOT_HEADSET, R.drawable.head_set_disconnected_icon, 0, contentDescription);
mService.setIconVisibility(SLOT_HEADSET, false);
//connected
String contentDescription = mContext.getString(R.string.headset_connected);
if(microPhone==1){
mService.setIcon(SLOT_HEADSET, R.drawable.head_set_connected_icon_microphone, 0, contentDescription);
mService.setIconVisibility(SLOT_HEADSET, true);
}else if(microPhone==0){
mService.setIcon(SLOT_HEADSET, R.drawable.head_set_connected_icon_nomicrophone, 0, contentDescription);
mService.setIconVisibility(SLOT_HEADSET, true);
mService.setIconVisibility(SLOT_HEADSET, false);
}}//FuLairy add: HeadSet end
core/res/res/values/config.xml中添加:
&item&&xliff:g id="id"&headset&/xliff:g&&/item&
大概就这个思路,由于条件限制了,不然可以完整提供一下patch。流程清楚后,修改就快的多。
亲身实践才是王道... 文章只是个抛砖引玉。欢迎批评指正。Thank you all .Congratulations!!Happy new year!!!}

我要回帖

更多关于 android studio导航栏 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信