Enable reverse tethering in BT settings screen.
- Enable support for reverse tethering in BT settings. - Add string resource for "Auto connect" preference. - Remove unused imports and other minor cleanups. - Add isConnectable() and isAutoConnectable() methods to Profile enum type and remove isConnectableProfile() method. Change-Id: Ie606db04028a8278e98231f0671a388671f2f067
This commit is contained in:
@@ -20,9 +20,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.bluetooth.LocalBluetoothProfileManager.Profile;
|
||||
|
||||
import android.app.FragmentTransaction;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
@@ -59,7 +57,7 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
||||
private PreferenceGroup mProfileContainer;
|
||||
private CheckBoxPreference mAllowIncomingPref;
|
||||
private EditTextPreference mDeviceNamePref;
|
||||
private HashMap<String,CheckBoxPreference> mAutoConnectPrefs
|
||||
private final HashMap<String,CheckBoxPreference> mAutoConnectPrefs
|
||||
= new HashMap<String,CheckBoxPreference>();
|
||||
|
||||
@Override
|
||||
@@ -156,6 +154,14 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
||||
pref.setOrder(getProfilePreferenceIndex(profile));
|
||||
pref.setOnExpandClickListener(this);
|
||||
|
||||
LocalBluetoothProfileManager profileManager =
|
||||
LocalBluetoothProfileManager.getProfileManager(mManager, profile);
|
||||
int iconResource = profileManager.getDrawableResource();
|
||||
if (iconResource != 0) {
|
||||
pref.setProfileDrawable(mManager.getContext()
|
||||
.getResources().getDrawable(iconResource));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gray out profile while connecting and disconnecting
|
||||
*/
|
||||
@@ -302,6 +308,8 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
||||
return R.string.bluetooth_headset_profile_summary_use_for;
|
||||
case HID:
|
||||
return R.string.bluetooth_hid_profile_summary_use_for;
|
||||
case PAN:
|
||||
return R.string.bluetooth_pan_profile_summary_use_for;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -315,7 +323,7 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
||||
autoConnectPref = new CheckBoxPreference(getActivity());
|
||||
autoConnectPref.setLayoutResource(com.android.internal.R.layout.preference_child);
|
||||
autoConnectPref.setKey(prof.toString());
|
||||
autoConnectPref.setTitle(getCheckBoxTitle(prof));
|
||||
autoConnectPref.setTitle(R.string.bluetooth_auto_connect);
|
||||
autoConnectPref.setOrder(getProfilePreferenceIndex(prof) + 1);
|
||||
autoConnectPref.setChecked(getAutoConnect(prof));
|
||||
autoConnectPref.setOnPreferenceChangeListener(this);
|
||||
@@ -356,11 +364,6 @@ public class DeviceProfilesSettings extends SettingsPreferenceFragment
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getCheckBoxTitle(Profile prof) {
|
||||
// TODO: Use resources and base it on profile if necessary
|
||||
return "Auto connect";
|
||||
}
|
||||
|
||||
private boolean getAutoConnect(Profile prof) {
|
||||
return LocalBluetoothProfileManager.getProfileManager(mManager, prof)
|
||||
.isPreferred(mCachedDevice.getDevice());
|
||||
|
Reference in New Issue
Block a user