Promotion of fm.lnx.2.1-00029.
CRs Change ID Subject
--------------------------------------------------------------------------------------------------------------
2007816 Ic6811652a2356a80d3ba3517bf7ea11f73328ed3 FM Radio: Don't register AUDIO_BECOMING_NOISY intent
2009578 I23f271d6c1f32416aa10a9113273dde477b8a0d8 FM: Fix null pointer exception
2007818 Iba88994819fdf1b1489a654777111d7a0b769c7c FM Radio: Don't register A2DP service listener
Change-Id: Ib30a8c899097152cc539f9d95e57509b8525e82e
CRs-Fixed: 2007816, 2009578, 2007818
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index a178548..e5a7d83 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -223,6 +223,8 @@
private static Object mNotchFilterLock = new Object();
+ private boolean mFmA2dpDisabled;
+
public FMRadioService() {
}
@@ -230,6 +232,7 @@
public void onCreate() {
super.onCreate();
+ mFmA2dpDisabled = SystemProperties.getBoolean("fm.a2dp.conc.disabled",false);
mPrefs = new FmSharedPreferences(this);
mCallbacks = null;
TelephonyManager tmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
@@ -254,7 +257,6 @@
mSession.setFlags(MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY |
MediaSession.FLAG_HANDLES_MEDIA_BUTTONS);
mSession.setActive(true);
- registerAudioBecomeNoisy();
if ( false == SystemProperties.getBoolean("ro.fm.mulinst.recording.support",true)) {
mSingleRecordingInstanceSupported = true;
}
@@ -271,7 +273,8 @@
mA2dpDeviceSupportInHal = valueStr.contains("=true");
Log.d(LOGTAG, " is A2DP device Supported In HAL"+mA2dpDeviceSupportInHal);
- getA2dpStatusAtStart();
+ if (!mFmA2dpDisabled)
+ getA2dpStatusAtStart();
}
@Override
@@ -609,7 +612,6 @@
*/
public void registerHeadsetListener() {
if (mHeadsetReceiver == null) {
- boolean fm_a2dp_disabled = SystemProperties.getBoolean("fm.a2dp.conc.disabled",true);
mHeadsetReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -684,7 +686,7 @@
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
IntentFilter iFilter = new IntentFilter();
iFilter.addAction(Intent.ACTION_HEADSET_PLUG);
- if (!fm_a2dp_disabled) {
+ if (!mFmA2dpDisabled) {
iFilter.addAction(mA2dpDeviceState.getActionSinkStateChangedString());
}
iFilter.addAction("HDMI_CONNECTED");
@@ -1584,7 +1586,8 @@
switch (msg.arg1) {
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT");
- mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT);
+ if (mReceiver != null)
+ mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT);
if (true == isFmRecordingOn())
stopRecording();
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
@@ -1597,7 +1600,8 @@
case AudioManager.AUDIOFOCUS_LOSS:
Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS");
//intentional fall through.
- mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT);
+ if (mReceiver != null)
+ mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT);
if (mSpeakerPhoneOn) {
mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask);