# 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 );
+ }
+
+
}
kitkat添加耳机插拔图标
最新推荐文章于 2022-02-04 18:54:19 发布