Merge "Configuration param to indicate if sd card is behind the battery."
diff --git a/common/java/com/android/common/speech/Recognition.java b/common/java/com/android/common/speech/Recognition.java
index 6f164a9..bf60c9a 100644
--- a/common/java/com/android/common/speech/Recognition.java
+++ b/common/java/com/android/common/speech/Recognition.java
@@ -19,7 +19,8 @@
/**
* Utilities for voice recognition implementations.
*
- * @see android.app.RecognitionService
+ * @see android.speech.RecognitionService
+ * @see android.speech.RecognizerIntent
*/
public class Recognition {
@@ -30,7 +31,39 @@
* is set by anyone but the system process, it should be overridden by the voice search
* implementation.
*/
- public final static String EXTRA_CALLING_PACKAGE = "calling_package";
+ public static final String EXTRA_CALLING_PACKAGE = "calling_package";
+
+ /**
+ * The key to the extra in the Bundle returned by
+ * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS
+ * which is an ArrayList of CharSequences which are hints that can be shown to
+ * the user for voice actions currently supported by voice search for the user's current
+ * language preference for voice search (i.e., the one defined in the extra
+ * android.speech.RecognizerIntent#EXTRA_LANGUAGE_PREFERENCE).
+ *
+ * If this is paired with EXTRA_HINT_CONTEXT, should return a set of hints that are
+ * appropriate for the provided context.
+ *
+ * The CharSequences are SpannedStrings and will contain segments wrapped in
+ * <annotation action="true"></annotation>. This is to indicate the section of the text
+ * which represents the voice action, to be highlighted in the UI if so desired.
+ */
+ public static final String EXTRA_HINT_STRINGS = "android.speech.extra.HINT_STRINGS";
+
+ /**
+ * The key to an extra to be included in the request intent for
+ * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS.
+ * Should be an int of one of the values defined below. If an
+ * unknown int value is provided, it should be ignored.
+ */
+ public static final String EXTRA_HINT_CONTEXT = "android.speech.extra.HINT_CONTEXT";
+
+ /**
+ * A set of values for EXTRA_HINT_CONTEXT.
+ */
+ public static final int HINT_CONTEXT_UNKNOWN = 0;
+ public static final int HINT_CONTEXT_VOICE_SEARCH_HELP = 1;
+ public static final int HINT_CONTEXT_CAR_HOME = 2;
private Recognition() { } // don't instantiate
}
diff --git a/libs/audioflinger/AudioPolicyManagerBase.cpp b/libs/audioflinger/AudioPolicyManagerBase.cpp
index 42b6508..7b866c7 100644
--- a/libs/audioflinger/AudioPolicyManagerBase.cpp
+++ b/libs/audioflinger/AudioPolicyManagerBase.cpp
@@ -82,8 +82,8 @@
// keep track of SCO device address
mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
#ifdef WITH_A2DP
- if ((mA2dpDeviceAddress == mScoDeviceAddress) &&
- (mPhoneState != AudioSystem::MODE_NORMAL)) {
+ if (mA2dpOutput != 0 &&
+ mPhoneState != AudioSystem::MODE_NORMAL) {
mpClientInterface->suspendOutput(mA2dpOutput);
}
#endif
@@ -116,8 +116,8 @@
if (AudioSystem::isBluetoothScoDevice(device)) {
mScoDeviceAddress = "";
#ifdef WITH_A2DP
- if ((mA2dpDeviceAddress == mScoDeviceAddress) &&
- (mPhoneState != AudioSystem::MODE_NORMAL)) {
+ if (mA2dpOutput != 0 &&
+ mPhoneState != AudioSystem::MODE_NORMAL) {
mpClientInterface->restoreOutput(mA2dpOutput);
}
#endif
@@ -275,10 +275,8 @@
newDevice = getNewDevice(mHardwareOutput, false);
#ifdef WITH_A2DP
checkOutputForAllStrategies(newDevice);
- // suspend A2DP output if SCO device address is the same as A2DP device address.
- // no need to check that a SCO device is actually connected as mScoDeviceAddress == ""
- // if none is connected and the test below will fail.
- if (mA2dpDeviceAddress == mScoDeviceAddress) {
+ // suspend A2DP output if a SCO device is present.
+ if (mA2dpOutput != 0 && mScoDeviceAddress != "") {
if (oldState == AudioSystem::MODE_NORMAL) {
mpClientInterface->suspendOutput(mA2dpOutput);
} else if (state == AudioSystem::MODE_NORMAL) {
@@ -1191,7 +1189,7 @@
}
AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
- if (mA2dpDeviceAddress == mScoDeviceAddress) {
+ if (mScoDeviceAddress != "") {
// It is normal to suspend twice if we are both in call,
// and have the hardware audio output routed to BT SCO
if (mPhoneState != AudioSystem::MODE_NORMAL) {
@@ -1556,9 +1554,9 @@
usleep(outputDesc->mLatency*2*1000);
}
#ifdef WITH_A2DP
- // suspend A2D output if SCO device is selected
+ // suspend A2DP output if SCO device is selected
if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) {
- if (mA2dpOutput && mScoDeviceAddress == mA2dpDeviceAddress) {
+ if (mA2dpOutput != 0) {
mpClientInterface->suspendOutput(mA2dpOutput);
}
}
@@ -1573,7 +1571,7 @@
#ifdef WITH_A2DP
// if disconnecting SCO device, restore A2DP output
if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)prevDevice)) {
- if (mA2dpOutput && mScoDeviceAddress == mA2dpDeviceAddress) {
+ if (mA2dpOutput != 0) {
LOGV("restore A2DP output");
mpClientInterface->restoreOutput(mA2dpOutput);
}