diff options
-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-- | libs/audioflinger/AudioDSP.cpp | 25 | ||||
-rw-r--r-- | libs/audioflinger/AudioDSP.h | 2 | ||||
-rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/status/StatusBarPolicy.java | 19 |
7 files changed, 28 insertions, 22 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/libs/audioflinger/AudioDSP.cpp b/libs/audioflinger/AudioDSP.cpp index b1c1719..d6b85ca 100644 --- a/libs/audioflinger/AudioDSP.cpp +++ b/libs/audioflinger/AudioDSP.cpp @@ -334,10 +334,6 @@ EffectTone::EffectTone() } EffectTone::~EffectTone() { - for (int32_t i = 0; i < 4; i ++) { - delete &mFilterL[i]; - delete &mFilterR[i]; - } } void EffectTone::configure(const float samplingFrequency) { @@ -402,10 +398,6 @@ EffectHeadphone::EffectHeadphone() EffectHeadphone::~EffectHeadphone() { - delete &mReverbDelayL; - delete &mReverbDelayR; - delete &mLowpassL; - delete &mLowpassR; } void EffectHeadphone::configure(const float samplingFrequency) { @@ -414,8 +406,7 @@ void EffectHeadphone::configure(const float samplingFrequency) { mReverbDelayL.setParameters(mSamplingFrequency, 0.030f); mReverbDelayR.setParameters(mSamplingFrequency, 0.030f); /* the -3 dB point is around 650 Hz, giving about 300 us to work with */ - mLowpassL.setHighShelf(800.0f, mSamplingFrequency, -12.0f, 0.72f); - mLowpassR.setHighShelf(800.0f, mSamplingFrequency, -12.0f, 0.72f); + mLowpass.setHighShelf(850.0f, mSamplingFrequency, -10.0f, 0.72f); /* Rockbox has a 0.3 ms delay line (13 samples at 44100 Hz), but * I think it makes the whole effect sound pretty bad so I skipped it! */ } @@ -469,14 +460,13 @@ void EffectHeadphone::process(int32_t* inout, int32_t frames) dataL += dryL; dataR += dryR; - /* Lowpass filter to estimate head shadow. */ - dataL = mLowpassL.process(dataL >> fixedPointDecimals); - dataR = mLowpassR.process(dataR >> fixedPointDecimals); + /* Lowpass filter difference to estimate head shadow. */ + int32_t diff = mLowpass.process((dataL - dataR) >> fixedPointDecimals); /* 28 bits */ - /* Mix right-to-left and vice versa. */ - inout[0] += dataR >> 1; - inout[1] += dataL >> 1; + /* Mix difference between channels. */ + inout[0] = dataL - (diff >> 1); + inout[1] = dataR + (diff >> 1); inout += 2; } } @@ -507,9 +497,6 @@ AudioDSP::AudioDSP() AudioDSP::~AudioDSP() { - delete &mCompression; - delete &mTone; - delete &mHeadphone; } void AudioDSP::configure(const float samplingRate) diff --git a/libs/audioflinger/AudioDSP.h b/libs/audioflinger/AudioDSP.h index e1b0933..a962ba7 100644 --- a/libs/audioflinger/AudioDSP.h +++ b/libs/audioflinger/AudioDSP.h @@ -120,7 +120,7 @@ class EffectHeadphone : public Effect { Delay mReverbDelayL, mReverbDelayR; int32_t mDelayDataL, mDelayDataR; - Biquad mLowpassL, mLowpassR; + Biquad mLowpass; public: EffectHeadphone(); diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index b6e0afc..de67416 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -879,8 +879,7 @@ class NotificationManagerService extends INotificationManager.Stub String[] mPackage = findPackage(pkg); boolean flashLight = true; if(((notification.flags & Notification.FLAG_ONGOING_EVENT) != 0) - || ((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) != 0) - || pkg.matches("android") ) { + || ((notification.flags & Notification.FLAG_FOREGROUND_SERVICE) != 0) ) { flashLight = false; } else if(mPackage != null) { if(mPackage[1].equals("none")) 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(); |