improve audio startup performace
Create the needed audio patches as soon as possible, executing the visual
transition only after they are created.
Change-Id: Ic4ac4bb146836cb17ff144652b8f2d0f8dd612a9
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java
index c53ebb0..b3d7715 100644
--- a/src/com/android/fmradio/FmService.java
+++ b/src/com/android/fmradio/FmService.java
@@ -271,12 +271,12 @@
} else if (Intent.ACTION_HEADSET_PLUG.equals(action)) {
// switch antenna should not impact audio focus status
mValueHeadSetPlug = (intent.getIntExtra("state", -1) == HEADSET_PLUG_IN) ? 0 : 1;
- switchAntennaAsync(mValueHeadSetPlug);
// Avoid Service is killed,and receive headset plug in
// broadcast again
if (!mIsServiceInited) {
Log.d(TAG, "onReceive, mIsServiceInited is false");
+ switchAntennaAsync(mValueHeadSetPlug);
return;
}
/*
@@ -306,6 +306,8 @@
bundle.putBoolean(FmListener.KEY_IS_SPEAKER_MODE, false);
notifyActivityStateChanged(bundle);
}
+
+ switchAntennaAsync(mValueHeadSetPlug);
}
}
}