Check for antenna connected on activity restart
On activity restart, check if antenna connected or not. On activity
restart we request for audio focus and update the UI with Radio text
etc. even if antenna not connected. This enables UI and disable it again
even if FM is turned off.
CRs-Fixed: 1081388
Change-Id: I0c27f4025322451447423e1f5c07da1f8db790e6
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index 43fd2ef..7d357f7 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -439,7 +439,7 @@
public void onRestart() {
Log.d(LOGTAG, "FMRadio: onRestart");
try {
- if (null != mService) {
+ if (null != mService && isAntennaAvailable()) {
mService.requestFocus();
}
} catch (Exception e) {
@@ -505,6 +505,9 @@
super.onResume();
+ if (!isAntennaAvailable()) {
+ return;
+ }
// TODO: We should return on exception or continue?
try {
if (mService != null)