diff options
author | Steve Kondik <shade@chemlab.org> | 2010-09-02 12:05:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit2@cyanogenmod.teamdouche.net> | 2010-09-02 12:05:28 +0000 |
commit | fe53de5fbd11d370da7f7db85234db3da7eb1a64 (patch) | |
tree | 9517e6100ab3e3e71f8191d6975686dbe51f8125 | |
parent | a2284ac53742d74a27f041339f6528afe5f87e50 (diff) | |
parent | 4c1efe09d573ad9b086cc0f82ebff20d5587eb20 (diff) | |
download | frameworks_base-fe53de5fbd11d370da7f7db85234db3da7eb1a64.zip frameworks_base-fe53de5fbd11d370da7f7db85234db3da7eb1a64.tar.gz frameworks_base-fe53de5fbd11d370da7f7db85234db3da7eb1a64.tar.bz2 |
Merge "Display headset icon in notification bar" into froyo
-rw-r--r-- | core/res/res/drawable-hdpi/stat_sys_headset.png | bin | 664 -> 1189 bytes | |||
-rw-r--r-- | core/res/res/drawable-mdpi/stat_sys_headset.png | bin | 408 -> 613 bytes | |||
-rw-r--r-- | core/res/res/values/arrays.xml | 1 | ||||
-rw-r--r-- | services/java/com/android/server/status/StatusBarPolicy.java | 19 |
4 files changed, 20 insertions, 0 deletions
diff --git a/core/res/res/drawable-hdpi/stat_sys_headset.png b/core/res/res/drawable-hdpi/stat_sys_headset.png Binary files differindex 7a70aea..7eea8f0 100644 --- a/core/res/res/drawable-hdpi/stat_sys_headset.png +++ b/core/res/res/drawable-hdpi/stat_sys_headset.png diff --git a/core/res/res/drawable-mdpi/stat_sys_headset.png b/core/res/res/drawable-mdpi/stat_sys_headset.png Binary files differindex 45fbea2..7e537ae 100644 --- a/core/res/res/drawable-mdpi/stat_sys_headset.png +++ b/core/res/res/drawable-mdpi/stat_sys_headset.png diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml index 3c6ba20..4c75175 100644 --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -133,6 +133,7 @@ <item><xliff:g id="id">bluetooth</xliff:g></item> <item><xliff:g id="id">tty</xliff:g></item> <item><xliff:g id="id">volume</xliff:g></item> + <item><xliff:g id="id">headset</xliff:g></item> <item><xliff:g id="id">mute</xliff:g></item> <item><xliff:g id="id">speakerphone</xliff:g></item> <item><xliff:g id="id">tty</xliff:g></item> diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java index 90958bf..45dfea5 100644 --- a/services/java/com/android/server/status/StatusBarPolicy.java +++ b/services/java/com/android/server/status/StatusBarPolicy.java @@ -298,6 +298,10 @@ public class StatusBarPolicy { private IconData mVolumeData; private boolean mVolumeVisible; + // headset + private IBinder mHeadsetIcon; + private IconData mHeadsetData; + // bluetooth device status private IBinder mBluetoothIcon; private IconData mBluetoothData; @@ -405,6 +409,9 @@ public class StatusBarPolicy { action.equals(AudioManager.VIBRATE_SETTING_CHANGED_ACTION)) { updateVolume(); } + else if (action.equals(Intent.ACTION_HEADSET_PLUG)) { + updateHeadset(intent); + } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) { updateSimState(intent); } @@ -531,6 +538,12 @@ public class StatusBarPolicy { service.setIconVisibility(mVolumeIcon, false); updateVolume(); + // headset + mHeadsetData = IconData.makeIcon("headset", + null, com.android.internal.R.drawable.stat_sys_headset, 0, 0); + mHeadsetIcon = service.addIcon(mHeadsetData, null); + service.setIconVisibility(mHeadsetIcon, false); + IntentFilter filter = new IntentFilter(); // Register for Intent broadcasts for... @@ -544,6 +557,7 @@ public class StatusBarPolicy { filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); filter.addAction(Intent.ACTION_ALARM_CHANGED); filter.addAction(Intent.ACTION_SYNC_STATE_CHANGED); + filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(AudioManager.VIBRATE_SETTING_CHANGED_ACTION); filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); @@ -1238,6 +1252,11 @@ public class StatusBarPolicy { } } + private final void updateHeadset(Intent intent) { + int state = intent.getIntExtra("state", 0); + mService.setIconVisibility(mHeadsetIcon, (state == 1)); + } + private final void updateBluetooth(Intent intent) { int iconId = com.android.internal.R.drawable.stat_sys_data_bluetooth; String action = intent.getAction(); |