kitkat添加耳机插拔图标

# On branch 1004zb 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# modified: core/res/res/values/config.xml 
# modified: packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java 
# 
# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
# packages/SystemUI/res/drawable-hdpi/headset.png 
# packages/SystemUI/res/drawable-mdpi/headset.png 
# packages/SystemUI/res/drawable-xhdpi/headset.png


xx@Android:/data/sdc1/puhui/lj/work/xmm6321/Limenstone/kitkat/frameworks/base$ 
xx@Android:/data/sdc1/puhui/lj/work/xmm6321/Limenstone/kitkat/frameworks/base$ git diff . 
diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml 
old mode 100755 
new mode 100644 
index b3b31ad..5e6bff3 
--- a/frameworks/base/core/res/res/values/config.xml 
+++ b/frameworks/base/core/res/res/values/config.xml 
@@ -38,6 +38,7 @@ 
<item><xliff:g id="id">data_connection</xliff:g></item> 
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item> 
<item><xliff:g id="id">phone_signal</xliff:g></item> 
+ <item><xliff:g id="id">headset</xliff:g></item> 
<item><xliff:g id="id">battery</xliff:g></item> 
<item><xliff:g id="id">alarm_clock</xliff:g></item> 
<item><xliff:g id="id">secure</xliff:g></item> 
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/st 
index 8957a77..dfe9207 100644 
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java 
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java 
@@ -26,6 +26,10 @@ import android.media.AudioManager; 
import android.os.Handler; 
import android.util.Log; 

+ 
+ 
+ 
+ 
import com.android.internal.telephony.IccCardConstants; 
import com.android.internal.telephony.TelephonyIntents; 
import com.android.internal.telephony.cdma.TtyIntent; 
@@ -99,6 +103,9 @@ public class PhoneStatusBarPolicy { 
else if (action.equals(TtyIntent.TTY_ENABLED_CHANGE_ACTION)) { 
updateTTY(intent); 
} 
+ else if (action.equals(Intent.ACTION_HEADSET_PLUG)) { 
+ updateHeadset(intent); 
+ } 
} 
}; 

@@ -115,6 +122,7 @@ public class PhoneStatusBarPolicy { 
filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED); 
filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); 
filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION); 
+ filter.addAction(Intent.ACTION_HEADSET_PLUG); 
mContext.registerReceiver(mIntentReceiver, filter, null, mHandler); 

// TTY status 
@@ -150,6 +158,9 @@ public class PhoneStatusBarPolicy { 
mService.setIcon("volume", R.drawable.stat_sys_ringer_silent, 0, null); 
mService.setIconVisibility("volume", false); 
updateVolume(); 
+ 
+ mService.setIcon("headset", R.drawable.headset, 0, null); 
+ mService.setIconVisibility("headset", false ); 
} 

private final void updateAlarm(Intent intent) { 
@@ -256,4 +267,11 @@ public class PhoneStatusBarPolicy { 
mService.setIconVisibility("tty", false); 
} 
} 
+ 
+ private final void updateHeadset(Intent intent) { 
+ Log.v(TAG, "updateHeadset: state=" + intent.getIntExtra("state" , 0)); 
+ mService.setIconVisibility("headset", (intent.getIntExtra("state" , 0 ) == 1 )?true :false ); 
+ } 
+ 
+ 
} 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值