summaryrefslogtreecommitdiffstats
path: root/core/java/android/server
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:23 -0800
commitb798689749c64baba81f02e10cf2157c747d6b46 (patch)
treeda394a395ddb1a6cf69193314846b03fe47a397e /core/java/android/server
parentf013e1afd1e68af5e3b868c26a653bbfb39538f8 (diff)
downloadframeworks_base-b798689749c64baba81f02e10cf2157c747d6b46.zip
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.gz
frameworks_base-b798689749c64baba81f02e10cf2157c747d6b46.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'core/java/android/server')
-rw-r--r--core/java/android/server/BluetoothA2dpService.java31
-rw-r--r--core/java/android/server/search/SearchableInfo.java18
2 files changed, 45 insertions, 4 deletions
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 3cbb855..ded50e4 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -45,7 +45,7 @@ import java.util.HashMap;
import java.util.Iterator;
public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
- private static final String TAG = "BluetoothDeviceService";
+ private static final String TAG = "BluetoothA2dpService";
private static final boolean DBG = true;
public static final String BLUETOOTH_A2DP_SERVICE = "bluetooth_a2dp";
@@ -143,12 +143,27 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
if (path == null) {
return BluetoothError.ERROR;
}
- if (!connectSinkNative(path)) {
+
+ SinkState sink = mAudioDevices.get(path);
+ int state = BluetoothA2dp.STATE_DISCONNECTED;
+ if (sink != null) {
+ state = sink.state;
+ }
+ switch (state) {
+ case BluetoothA2dp.STATE_CONNECTED:
+ case BluetoothA2dp.STATE_PLAYING:
+ case BluetoothA2dp.STATE_DISCONNECTING:
return BluetoothError.ERROR;
- } else {
- updateState(path, BluetoothA2dp.STATE_CONNECTING);
+ case BluetoothA2dp.STATE_CONNECTING:
return BluetoothError.SUCCESS;
}
+
+ // State is DISCONNECTED
+ if (!connectSinkNative(path)) {
+ return BluetoothError.ERROR;
+ }
+ updateState(path, BluetoothA2dp.STATE_CONNECTING);
+ return BluetoothError.SUCCESS;
}
public synchronized int disconnectSink(String address) {
@@ -165,6 +180,14 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
if (path == null) {
return BluetoothError.ERROR;
}
+ switch (mAudioDevices.get(path).state) {
+ case BluetoothA2dp.STATE_DISCONNECTED:
+ return BluetoothError.ERROR;
+ case BluetoothA2dp.STATE_DISCONNECTING:
+ return BluetoothError.SUCCESS;
+ }
+
+ // State is CONNECTING or CONNECTED or PLAYING
if (!disconnectSinkNative(path)) {
return BluetoothError.ERROR;
} else {
diff --git a/core/java/android/server/search/SearchableInfo.java b/core/java/android/server/search/SearchableInfo.java
index 6c8f554..ac4cdb9 100644
--- a/core/java/android/server/search/SearchableInfo.java
+++ b/core/java/android/server/search/SearchableInfo.java
@@ -31,6 +31,7 @@ import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import android.text.InputType;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
@@ -75,6 +76,7 @@ public final class SearchableInfo implements Parcelable {
public boolean mQueryRewriteFromText = false;
private int mIconId = 0;
private int mSearchButtonText = 0;
+ private int mSearchInputType = 0;
private String mSuggestAuthority = null;
private String mSuggestPath = null;
private String mSuggestSelection = null;
@@ -415,6 +417,10 @@ public final class SearchableInfo implements Parcelable {
mIconId = a.getResourceId(com.android.internal.R.styleable.Searchable_icon, 0);
mSearchButtonText = a.getResourceId(
com.android.internal.R.styleable.Searchable_searchButtonText, 0);
+ mSearchInputType = a.getInt(com.android.internal.R.styleable.Searchable_inputType,
+ InputType.TYPE_CLASS_TEXT |
+ InputType.TYPE_TEXT_FLAG_SEARCH |
+ InputType.TYPE_TEXT_VARIATION_SEARCH_STRING);
setSearchModeFlags();
if (DBG_INHIBIT_SUGGESTIONS == 0) {
@@ -657,6 +663,16 @@ public final class SearchableInfo implements Parcelable {
}
/**
+ * Return the input type as specified in the searchable attributes. This will default to
+ * InputType.TYPE_CLASS_TEXT if not specified (which is appropriate for free text input).
+ *
+ * @return the input type
+ */
+ public int getInputType() {
+ return mSearchInputType;
+ }
+
+ /**
* Return the list of searchable activities, for use in the drop-down.
*/
public static ArrayList<SearchableInfo> getSearchablesList() {
@@ -694,6 +710,7 @@ public final class SearchableInfo implements Parcelable {
mSearchMode = in.readInt();
mIconId = in.readInt();
mSearchButtonText = in.readInt();
+ mSearchInputType = in.readInt();
setSearchModeFlags();
mSuggestAuthority = in.readString();
@@ -722,6 +739,7 @@ public final class SearchableInfo implements Parcelable {
dest.writeInt(mSearchMode);
dest.writeInt(mIconId);
dest.writeInt(mSearchButtonText);
+ dest.writeInt(mSearchInputType);
dest.writeString(mSuggestAuthority);
dest.writeString(mSuggestPath);