b/2154978 Show only connectable profiles (Headset and& A2DP but not OPP) in Bluetooth Device Advance Options aka "Connect to..."
Change-Id: I34249a4828707bde491da4a82dca94ecf37cf490
This commit is contained in:
@@ -32,15 +32,15 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
private static final String TAG = "BluetoothDevicePreference";
|
||||
|
||||
private static int sDimAlpha = Integer.MIN_VALUE;
|
||||
|
||||
|
||||
private CachedBluetoothDevice mCachedDevice;
|
||||
|
||||
|
||||
/**
|
||||
* Cached local copy of whether the device is busy. This is only updated
|
||||
* from {@link #onDeviceAttributesChanged(CachedBluetoothDevice)}.
|
||||
*/
|
||||
*/
|
||||
private boolean mIsBusy;
|
||||
|
||||
|
||||
public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) {
|
||||
super(context);
|
||||
|
||||
@@ -49,16 +49,16 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true);
|
||||
sDimAlpha = (int) (outValue.getFloat() * 255);
|
||||
}
|
||||
|
||||
|
||||
mCachedDevice = cachedDevice;
|
||||
|
||||
|
||||
setLayoutResource(R.layout.preference_bluetooth);
|
||||
|
||||
|
||||
cachedDevice.registerCallback(this);
|
||||
|
||||
|
||||
onDeviceAttributesChanged(cachedDevice);
|
||||
}
|
||||
|
||||
|
||||
public CachedBluetoothDevice getCachedDevice() {
|
||||
return mCachedDevice;
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
* The preference framework takes care of making sure the value has
|
||||
* changed before proceeding.
|
||||
*/
|
||||
|
||||
|
||||
setTitle(mCachedDevice.getName());
|
||||
|
||||
|
||||
/*
|
||||
* TODO: Showed "Paired" even though it was "Connected". This may be
|
||||
* related to BluetoothHeadset not bound to the actual
|
||||
@@ -87,10 +87,10 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
|
||||
// Used to gray out the item
|
||||
mIsBusy = mCachedDevice.isBusy();
|
||||
|
||||
|
||||
// Data has changed
|
||||
notifyChanged();
|
||||
|
||||
|
||||
// This could affect ordering, so notify that also
|
||||
notifyHierarchyChanged();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
|
||||
ImageView btClass = (ImageView) view.findViewById(R.id.btClass);
|
||||
btClass.setImageResource(mCachedDevice.getBtClassDrawable());
|
||||
btClass.setAlpha(isEnabled() ? 255 : sDimAlpha);
|
||||
btClass.setAlpha(isEnabled() ? 255 : sDimAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,8 +122,8 @@ public class BluetoothDevicePreference extends Preference implements CachedBluet
|
||||
// Put other preference types above us
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return mCachedDevice.compareTo(((BluetoothDevicePreference) another).mCachedDevice);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -34,14 +34,14 @@ import android.util.Config;
|
||||
* preference reflects the current state.
|
||||
*/
|
||||
public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
|
||||
|
||||
private static final boolean LOCAL_LOGD = Config.LOGD || false;
|
||||
private static final String TAG = "BluetoothEnabler";
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private final Context mContext;
|
||||
private final CheckBoxPreference mCheckBoxPreference;
|
||||
private final CharSequence mOriginalSummary;
|
||||
|
||||
|
||||
private final LocalBluetoothManager mLocalManager;
|
||||
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@@ -55,10 +55,10 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
public BluetoothEnabler(Context context, CheckBoxPreference checkBoxPreference) {
|
||||
mContext = context;
|
||||
mCheckBoxPreference = checkBoxPreference;
|
||||
|
||||
|
||||
mOriginalSummary = checkBoxPreference.getSummary();
|
||||
checkBoxPreference.setPersistent(false);
|
||||
|
||||
|
||||
mLocalManager = LocalBluetoothManager.getInstance(context);
|
||||
if (mLocalManager == null) {
|
||||
// Bluetooth not supported
|
||||
@@ -70,32 +70,32 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
if (mLocalManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int state = mLocalManager.getBluetoothState();
|
||||
// This is the widget enabled state, not the preference toggled state
|
||||
mCheckBoxPreference.setEnabled(state == BluetoothAdapter.STATE_ON ||
|
||||
state == BluetoothAdapter.STATE_OFF);
|
||||
// BT state is not a sticky broadcast, so set it manually
|
||||
handleStateChanged(state);
|
||||
|
||||
mContext.registerReceiver(mReceiver,
|
||||
|
||||
mContext.registerReceiver(mReceiver,
|
||||
new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
|
||||
mCheckBoxPreference.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void pause() {
|
||||
if (mLocalManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mContext.unregisterReceiver(mReceiver);
|
||||
mCheckBoxPreference.setOnPreferenceChangeListener(null);
|
||||
}
|
||||
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
// Turn on/off BT
|
||||
setEnabled((Boolean) value);
|
||||
|
||||
|
||||
// Don't update UI to opposite state until we're sure
|
||||
return false;
|
||||
}
|
||||
@@ -103,10 +103,10 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
private void setEnabled(final boolean enable) {
|
||||
// Disable preference
|
||||
mCheckBoxPreference.setEnabled(false);
|
||||
|
||||
|
||||
mLocalManager.setBluetoothEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
private void handleStateChanged(int state) {
|
||||
|
||||
if (state == BluetoothAdapter.STATE_OFF ||
|
||||
@@ -125,13 +125,13 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
if (isEnabledByDependency()) {
|
||||
mCheckBoxPreference.setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
} else if (state == BluetoothAdapter.STATE_TURNING_ON ||
|
||||
state == BluetoothAdapter.STATE_TURNING_OFF) {
|
||||
mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_TURNING_ON
|
||||
? R.string.wifi_starting
|
||||
: R.string.wifi_stopping);
|
||||
|
||||
|
||||
} else {
|
||||
mCheckBoxPreference.setChecked(false);
|
||||
mCheckBoxPreference.setSummary(R.string.wifi_error);
|
||||
@@ -144,17 +144,17 @@ public class BluetoothEnabler implements Preference.OnPreferenceChangeListener {
|
||||
if (dep == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return !dep.shouldDisableDependents();
|
||||
}
|
||||
|
||||
|
||||
private Preference getDependencyPreference() {
|
||||
String depKey = mCheckBoxPreference.getDependency();
|
||||
if (TextUtils.isEmpty(depKey)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return mCheckBoxPreference.getPreferenceManager().findPreference(depKey);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@ import android.app.AlertDialog;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothClass;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.os.ParcelUuid;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.ParcelUuid;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -794,8 +794,18 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
||||
}
|
||||
}
|
||||
|
||||
public List<Profile> getProfiles() {
|
||||
return new ArrayList<Profile>(mProfiles);
|
||||
public List<Profile> getConnectableProfiles() {
|
||||
ArrayList<Profile> connectableProfiles = new ArrayList<Profile>();
|
||||
for (Profile profile : mProfiles) {
|
||||
if (isConnectableProfile(profile)) {
|
||||
connectableProfiles.add(profile);
|
||||
}
|
||||
}
|
||||
return connectableProfiles;
|
||||
}
|
||||
|
||||
private boolean isConnectableProfile(Profile profile) {
|
||||
return profile.equals(Profile.HEADSET) || profile.equals(Profile.A2DP);
|
||||
}
|
||||
|
||||
public void onCreateContextMenu(ContextMenu menu) {
|
||||
@@ -806,7 +816,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
||||
|
||||
int bondState = getBondState();
|
||||
boolean isConnected = isConnected();
|
||||
boolean hasProfiles = mProfiles.size() > 0;
|
||||
boolean hasConnectableProfiles = false;
|
||||
|
||||
for (Profile profile : mProfiles) {
|
||||
if (isConnectableProfile(profile)) {
|
||||
hasConnectableProfiles = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
menu.setHeaderTitle(getName());
|
||||
|
||||
@@ -819,14 +836,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
||||
menu.add(0, CONTEXT_ITEM_UNPAIR, 0,
|
||||
R.string.bluetooth_device_context_disconnect_unpair);
|
||||
} else { // Paired but not connected
|
||||
if (hasProfiles) {
|
||||
if (hasConnectableProfiles) {
|
||||
menu.add(0, CONTEXT_ITEM_CONNECT, 0, R.string.bluetooth_device_context_connect);
|
||||
}
|
||||
menu.add(0, CONTEXT_ITEM_UNPAIR, 0, R.string.bluetooth_device_context_unpair);
|
||||
}
|
||||
|
||||
// Show the connection options item
|
||||
if (hasProfiles) {
|
||||
if (hasConnectableProfiles) {
|
||||
menu.add(0, CONTEXT_ITEM_CONNECT_ADVANCED, 0,
|
||||
R.string.bluetooth_device_context_connect_advanced);
|
||||
}
|
||||
|
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.LocalBluetoothProfileManager.Profile;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -29,7 +26,8 @@ import android.preference.PreferenceGroup;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.LocalBluetoothProfileManager.Profile;
|
||||
|
||||
/**
|
||||
* ConnectSpecificProfilesActivity presents the user with all of the profiles
|
||||
@@ -46,12 +44,9 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
|
||||
public static final String EXTRA_DEVICE = "device";
|
||||
|
||||
public static final String CLASS_NAME_OPP_PROFILE_MANAGER =
|
||||
"com.android.settings.bluetooth.LocalBluetoothProfileManager$OppProfileManager";
|
||||
|
||||
private LocalBluetoothManager mManager;
|
||||
private CachedBluetoothDevice mCachedDevice;
|
||||
|
||||
|
||||
private PreferenceGroup mProfileContainer;
|
||||
private CheckBoxPreference mOnlineModePreference;
|
||||
|
||||
@@ -63,11 +58,11 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
* profile.
|
||||
*/
|
||||
private boolean mOnlineMode;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
BluetoothDevice device;
|
||||
if (savedInstanceState != null) {
|
||||
device = savedInstanceState.getParcelable(EXTRA_DEVICE);
|
||||
@@ -80,7 +75,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
Log.w(TAG, "Activity started without a remote blueototh device");
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
mManager = LocalBluetoothManager.getInstance(this);
|
||||
mCachedDevice = mManager.getCachedDeviceManager().findDevice(device);
|
||||
if (mCachedDevice == null) {
|
||||
@@ -90,7 +85,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
|
||||
addPreferencesFromResource(R.xml.bluetooth_device_advanced);
|
||||
mProfileContainer = (PreferenceGroup) findPreference(KEY_PROFILE_CONTAINER);
|
||||
|
||||
|
||||
// Set the title of the screen
|
||||
findPreference(KEY_TITLE).setTitle(
|
||||
getString(R.string.bluetooth_device_advanced_title, mCachedDevice.getName()));
|
||||
@@ -98,7 +93,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
// Listen for check/uncheck of the online mode checkbox
|
||||
mOnlineModePreference = (CheckBoxPreference) findPreference(KEY_ONLINE_MODE);
|
||||
mOnlineModePreference.setOnPreferenceChangeListener(this);
|
||||
|
||||
|
||||
// Add a preference for each profile
|
||||
addPreferencesForProfiles();
|
||||
}
|
||||
@@ -106,14 +101,14 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
|
||||
outState.putParcelable(EXTRA_DEVICE, mCachedDevice.getDevice());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
mManager.setForegroundActivity(this);
|
||||
mCachedDevice.registerCallback(this);
|
||||
|
||||
@@ -123,13 +118,13 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
|
||||
mCachedDevice.unregisterCallback(this);
|
||||
mManager.setForegroundActivity(null);
|
||||
}
|
||||
|
||||
private void addPreferencesForProfiles() {
|
||||
for (Profile profile : mCachedDevice.getProfiles()) {
|
||||
for (Profile profile : mCachedDevice.getConnectableProfiles()) {
|
||||
Preference pref = createProfilePreference(profile);
|
||||
mProfileContainer.addPreference(pref);
|
||||
}
|
||||
@@ -138,7 +133,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
/**
|
||||
* Creates a checkbox preference for the particular profile. The key will be
|
||||
* the profile's name.
|
||||
*
|
||||
*
|
||||
* @param profile The profile for which the preference controls.
|
||||
* @return A preference that allows the user to choose whether this profile
|
||||
* will be connected to.
|
||||
@@ -154,27 +149,22 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
.getProfileManager(mManager, profile);
|
||||
|
||||
/**
|
||||
* Gray out checkbox while connecting and disconnecting or this is OPP
|
||||
* profile
|
||||
* Gray out checkbox while connecting and disconnecting
|
||||
*/
|
||||
if (profileManager.getClass().getName().equals(CLASS_NAME_OPP_PROFILE_MANAGER)) {
|
||||
pref.setEnabled(false);
|
||||
} else {
|
||||
pref.setEnabled(!mCachedDevice.isBusy());
|
||||
}
|
||||
pref.setEnabled(!mCachedDevice.isBusy());
|
||||
|
||||
refreshProfilePreference(pref, profile);
|
||||
|
||||
|
||||
return pref;
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String key = preference.getKey();
|
||||
if (TextUtils.isEmpty(key) || newValue == null) return true;
|
||||
|
||||
|
||||
if (key.equals(KEY_ONLINE_MODE)) {
|
||||
onOnlineModeCheckedStateChanged((Boolean) newValue);
|
||||
|
||||
|
||||
} else {
|
||||
Profile profile = getProfileOf(preference);
|
||||
if (profile == null) return false;
|
||||
@@ -187,7 +177,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
private void onOnlineModeCheckedStateChanged(boolean checked) {
|
||||
setOnlineMode(checked, true);
|
||||
}
|
||||
|
||||
|
||||
private void onProfileCheckedStateChanged(Profile profile, boolean checked) {
|
||||
if (mOnlineMode) {
|
||||
if (checked) {
|
||||
@@ -196,12 +186,12 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
mCachedDevice.disconnect(profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
|
||||
.getProfileManager(mManager, profile);
|
||||
profileManager.setPreferred(mCachedDevice.getDevice(), checked);
|
||||
}
|
||||
|
||||
|
||||
public void onDeviceAttributesChanged(CachedBluetoothDevice cachedDevice) {
|
||||
refresh();
|
||||
}
|
||||
@@ -214,14 +204,14 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
|
||||
/**
|
||||
* Switches between online/offline mode.
|
||||
*
|
||||
*
|
||||
* @param onlineMode Whether to be in online mode, or offline mode.
|
||||
* @param takeAction Whether to take action (i.e., connect or disconnect)
|
||||
* based on the new online mode.
|
||||
*/
|
||||
private void setOnlineMode(boolean onlineMode, boolean takeAction) {
|
||||
mOnlineMode = onlineMode;
|
||||
|
||||
|
||||
if (takeAction) {
|
||||
if (onlineMode) {
|
||||
mCachedDevice.connect();
|
||||
@@ -229,22 +219,16 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
mCachedDevice.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
refreshOnlineModePreference();
|
||||
}
|
||||
|
||||
|
||||
private void refreshOnlineModePreference() {
|
||||
mOnlineModePreference.setChecked(mOnlineMode);
|
||||
|
||||
/* Gray out checkbox while connecting and disconnecting */
|
||||
mOnlineModePreference.setEnabled(!mCachedDevice.isBusy());
|
||||
|
||||
List<Profile> profiles = mCachedDevice.getProfiles();
|
||||
if ((profiles.size() == 1) && (profiles.get(0).name().equals("OPP"))) {
|
||||
Log.w(TAG, "there is only one profile: Opp, disable the connect button.");
|
||||
mOnlineModePreference.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the device is online, show status. Otherwise, show a summary that
|
||||
* describes what the checkbox does.
|
||||
@@ -252,9 +236,9 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
mOnlineModePreference.setSummary(mOnlineMode ? mCachedDevice.getSummary()
|
||||
: R.string.bluetooth_device_advanced_online_mode_summary);
|
||||
}
|
||||
|
||||
|
||||
private void refreshProfiles() {
|
||||
for (Profile profile : mCachedDevice.getProfiles()) {
|
||||
for (Profile profile : mCachedDevice.getConnectableProfiles()) {
|
||||
CheckBoxPreference profilePref =
|
||||
(CheckBoxPreference) findPreference(profile.toString());
|
||||
if (profilePref == null) {
|
||||
@@ -265,27 +249,21 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void refreshProfilePreference(CheckBoxPreference profilePref, Profile profile) {
|
||||
BluetoothDevice device = mCachedDevice.getDevice();
|
||||
LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
|
||||
.getProfileManager(mManager, profile);
|
||||
|
||||
|
||||
int connectionStatus = profileManager.getConnectionStatus(device);
|
||||
|
||||
/*
|
||||
* Gray out checkbox while connecting and disconnecting or this is OPP
|
||||
* profile
|
||||
* Gray out checkbox while connecting and disconnecting
|
||||
*/
|
||||
if (profileManager.getClass().getName().equals(CLASS_NAME_OPP_PROFILE_MANAGER)) {
|
||||
Log.w(TAG, "this is Opp profile");
|
||||
profilePref.setEnabled(false);
|
||||
} else {
|
||||
profilePref.setEnabled(!mCachedDevice.isBusy());
|
||||
}
|
||||
profilePref.setEnabled(!mCachedDevice.isBusy());
|
||||
profilePref.setSummary(getProfileSummary(profileManager, profile, device,
|
||||
connectionStatus, mOnlineMode));
|
||||
|
||||
|
||||
profilePref.setChecked(profileManager.isPreferred(device));
|
||||
}
|
||||
|
||||
@@ -293,7 +271,7 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
if (!(pref instanceof CheckBoxPreference)) return null;
|
||||
String key = pref.getKey();
|
||||
if (TextUtils.isEmpty(key)) return null;
|
||||
|
||||
|
||||
try {
|
||||
return Profile.valueOf(pref.getKey());
|
||||
} catch (IllegalArgumentException e) {
|
||||
@@ -309,10 +287,10 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
return profileManager.getSummary(device);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the summary that describes when checked, it will become a preferred profile.
|
||||
*
|
||||
*
|
||||
* @param profile The profile to get the summary for.
|
||||
* @return The summary.
|
||||
*/
|
||||
@@ -322,11 +300,9 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
|
||||
return R.string.bluetooth_a2dp_profile_summary_use_for;
|
||||
case HEADSET:
|
||||
return R.string.bluetooth_headset_profile_summary_use_for;
|
||||
case OPP:
|
||||
return R.string.bluetooth_opp_profile_summary_use_for;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -26,9 +26,9 @@ import com.android.settings.R;
|
||||
*/
|
||||
public class SettingsBtStatus {
|
||||
private static final String TAG = "SettingsBtStatus";
|
||||
|
||||
|
||||
// Connection status
|
||||
|
||||
|
||||
public static final int CONNECTION_STATUS_UNKNOWN = 0;
|
||||
public static final int CONNECTION_STATUS_ACTIVE = 1;
|
||||
/** Use {@link #isConnected} to check for the connected state */
|
||||
@@ -55,17 +55,17 @@ public class SettingsBtStatus {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final boolean isConnectionStatusConnected(int connectionStatus) {
|
||||
return connectionStatus == CONNECTION_STATUS_ACTIVE
|
||||
|| connectionStatus == CONNECTION_STATUS_CONNECTED;
|
||||
}
|
||||
|
||||
|
||||
public static final boolean isConnectionStatusBusy(int connectionStatus) {
|
||||
return connectionStatus == CONNECTION_STATUS_CONNECTING
|
||||
|| connectionStatus == CONNECTION_STATUS_DISCONNECTING;
|
||||
}
|
||||
|
||||
|
||||
public static final int getPairingStatusSummary(int bondState) {
|
||||
switch (bondState) {
|
||||
case BluetoothDevice.BOND_BONDED:
|
||||
|
Reference in New Issue
Block a user