diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-09-18 07:41:43 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-09-18 07:41:43 -0700 |
commit | d0729211b0180e9ce6377dd0e70684ee79403c02 (patch) | |
tree | a78aeb2030baf801d8d795b65e99bde893e2fdf0 | |
parent | 7c670313e1b295d85dcb5c953ffb7afdbe50ed55 (diff) | |
parent | 9c555961c3e9eaf997c6ade0c10bdd2974eb1e1c (diff) | |
download | android_hardware_qcom_fm-d0729211b0180e9ce6377dd0e70684ee79403c02.tar.gz android_hardware_qcom_fm-d0729211b0180e9ce6377dd0e70684ee79403c02.tar.bz2 android_hardware_qcom_fm-d0729211b0180e9ce6377dd0e70684ee79403c02.zip |
Merge "FM: Disable speaker option when A2DP connected"
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadio.java | 31 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadioService.java | 14 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMStats.java | 3 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/IFMRadioService.aidl | 1 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl | 1 |
5 files changed, 50 insertions, 0 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 12693cf..20270e3 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -1858,6 +1858,19 @@ public class FMRadio extends Activity return(mRtPlusSupported); } + private boolean isA2DPConnected() { + boolean A2DPConnected = false; + if (mService != null) { + try { + A2DPConnected = mService.isA2DPConnected(); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + Log.d(LOGTAG, "A2DPConnected: " + A2DPConnected); + return(A2DPConnected); + } + private boolean isSpeakerEnabled() { boolean speakerEnabled = false; if (mService != null) { @@ -2047,6 +2060,10 @@ public class FMRadio extends Activity }else{ mSpeakerButton.setImageResource(R.drawable.btn_earphone); } + if (isA2DPConnected()) + mSpeakerButton.setClickable(false); + else + mSpeakerButton.setClickable(true); } } @@ -2225,6 +2242,16 @@ public class FMRadio extends Activity updateSearchProgress(); } + private void A2DPConnectionState(boolean state) { + Log.d(LOGTAG, "A2DPConnectionState with:" +state); + if (state) { + Log.d(LOGTAG, "make speaker button disable"); + mSpeakerButton.setClickable(false); + } else { + Log.d(LOGTAG, "make speaker button enable"); + mSpeakerButton.setClickable(true); + } + } /** Scan related */ private void initiateSearch(int pty) { synchronized (this) { @@ -3144,6 +3171,10 @@ public class FMRadio extends Activity Log.d(LOGTAG, "mServiceCallbacks.onSeekNextStation:"); SeekNextStation(); } + public void onA2DPConnectionstateChanged(boolean state){ + Log.d(LOGTAG, "mServiceCallbacks.onA2DPConnectionstateChanged :"); + A2DPConnectionState(state); + } }; private void registerFMSettingListner() { diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index c8a5970..02dd4ad 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -555,6 +555,12 @@ public class FMRadioService extends Service boolean bA2dpConnected = mA2dpDeviceState.isConnected(intent); Log.d(LOGTAG, "bA2dpConnected:" +bA2dpConnected); + try { + if ((mServiceInUse) && (mCallbacks != null)) + mCallbacks.onA2DPConnectionstateChanged(bA2dpConnected); + } catch (RemoteException e) { + e.printStackTrace(); + } if (!bA2dpConnected) { Log.d(LOGTAG, "A2DP device is dis-connected!"); mA2dpDisconnected = true; @@ -1964,6 +1970,11 @@ public class FMRadioService extends Service { return(mService.get().isSSRInProgress()); } + + public boolean isA2DPConnected() + { + return(mService.get().isA2DPConnected()); + } } private final IBinder mBinder = new ServiceStub(this); @@ -2202,6 +2213,9 @@ public class FMRadioService extends Service return mIsSSRInProgress; } + public boolean isA2DPConnected() { + return (mA2dpConnected); + } /* Returns whether FM hardware is ON. * * @return true if FM was tuned, searching. (at the end of diff --git a/fmapp2/src/com/caf/fmradio/FMStats.java b/fmapp2/src/com/caf/fmradio/FMStats.java index ddefd89..961f04b 100644 --- a/fmapp2/src/com/caf/fmradio/FMStats.java +++ b/fmapp2/src/com/caf/fmradio/FMStats.java @@ -2716,6 +2716,9 @@ public class FMStats extends Activity { public void onSeekNextStation() { Log.d(LOGTAG, "mServiceCallbacks.onSeekNextStation:"); } + public void onA2DPConnectionstateChanged(boolean state){ + Log.d(LOGTAG, "mServiceCallbacks.onA2DPConnectionstateChanged :"); + } }; /* Radio Vars */ private Handler mHandler = new Handler(); diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl index 6140f0d..a02c593 100644 --- a/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl +++ b/fmapp2/src/com/caf/fmradio/IFMRadioService.aidl @@ -74,5 +74,6 @@ interface IFMRadioService boolean isSleepTimerActive(); boolean isSSRInProgress(); boolean isRtPlusSupported(); + boolean isA2DPConnected(); } diff --git a/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl b/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl index 6a8deb5..e6fded7 100644 --- a/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl +++ b/fmapp2/src/com/caf/fmradio/IFMRadioServiceCallbacks.aidl @@ -47,4 +47,5 @@ interface IFMRadioServiceCallbacks void onExtenRadioTextChanged(); void onRecordingStarted(); void onSeekNextStation(); + void onA2DPConnectionstateChanged(boolean state); } |