summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/TetherSettings.java17
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEventRedirector.java3
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java89
3 files changed, 18 insertions, 91 deletions
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index bc27dc025..81d23ab3e 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -51,7 +51,6 @@ public class TetherSettings extends SettingsPreferenceFragment {
private static final String ENABLE_WIFI_AP = "enable_wifi_ap";
private static final String WIFI_AP_SETTINGS = "wifi_ap_settings";
private static final String ENABLE_BLUETOOTH_TETHERING = "enable_bluetooth_tethering";
- private static final String BLUETOOTH_TETHER_SETTINGS = "bluetooth_tether_settings";
private static final String TETHERING_HELP = "tethering_help";
private static final String USB_HELP_MODIFIER = "usb_";
private static final String WIFI_HELP_MODIFIER = "wifi_";
@@ -68,7 +67,6 @@ public class TetherSettings extends SettingsPreferenceFragment {
private WifiApEnabler mWifiApEnabler;
private CheckBoxPreference mBluetoothTether;
- private PreferenceScreen mBluetoothSettings;
private PreferenceScreen mTetherHelp;
@@ -97,7 +95,6 @@ public class TetherSettings extends SettingsPreferenceFragment {
mWifiApSettings = (PreferenceScreen) findPreference(WIFI_AP_SETTINGS);
mUsbTether = (CheckBoxPreference) findPreference(USB_TETHER_SETTINGS);
mBluetoothTether = (CheckBoxPreference) findPreference(ENABLE_BLUETOOTH_TETHERING);
- mBluetoothSettings = (PreferenceScreen) findPreference(BLUETOOTH_TETHER_SETTINGS);
mTetherHelp = (PreferenceScreen) findPreference(TETHERING_HELP);
ConnectivityManager cm =
@@ -121,14 +118,11 @@ public class TetherSettings extends SettingsPreferenceFragment {
}
if (!bluetoothAvailable) {
getPreferenceScreen().removePreference(mBluetoothTether);
- getPreferenceScreen().removePreference(mBluetoothSettings);
} else {
if (mBluetoothPan.isTetheringOn()) {
mBluetoothTether.setChecked(true);
- mBluetoothSettings.setEnabled(true);
} else {
mBluetoothTether.setChecked(false);
- mBluetoothSettings.setEnabled(false);
}
}
/* Don't change the title for two-pane settings
@@ -360,17 +354,14 @@ public class TetherSettings extends SettingsPreferenceFragment {
int btState = adapter.getState();
if (btState == BluetoothAdapter.STATE_TURNING_OFF) {
mBluetoothTether.setEnabled(false);
- mBluetoothSettings.setEnabled(false);
mBluetoothTether.setSummary(R.string.wifi_stopping);
} else if (btState == BluetoothAdapter.STATE_TURNING_ON) {
mBluetoothTether.setEnabled(false);
- mBluetoothSettings.setEnabled(false);
mBluetoothTether.setSummary(R.string.bluetooth_turning_on);
} else if (mBluetoothPan.isTetheringOn()) {
mBluetoothTether.setChecked(true);
if (btState == BluetoothAdapter.STATE_ON) {
mBluetoothTether.setEnabled(true);
- mBluetoothSettings.setEnabled(true);
if (bluetoothTethered) {
mBluetoothTether.setSummary(R.string.bluetooth_tethering_connected_subtext);
} else if (bluetoothErrored) {
@@ -382,7 +373,6 @@ public class TetherSettings extends SettingsPreferenceFragment {
} else {
mBluetoothTether.setEnabled(true);
mBluetoothTether.setChecked(false);
- mBluetoothSettings.setEnabled(false);
mBluetoothTether.setSummary(R.string.bluetooth_tethering_off_subtext);
}
}
@@ -433,9 +423,6 @@ public class TetherSettings extends SettingsPreferenceFragment {
adapter.enable();
mBluetoothTether.setSummary(R.string.bluetooth_turning_on);
mBluetoothTether.setEnabled(false);
- mBluetoothSettings.setEnabled(false);
- } else {
- mBluetoothSettings.setEnabled(true);
}
mBluetoothPan.setBluetoothTethering(true);
@@ -453,16 +440,12 @@ public class TetherSettings extends SettingsPreferenceFragment {
}
mBluetoothPan.setBluetoothTethering(false);
- mBluetoothSettings.setEnabled(false);
if (errored) {
mBluetoothTether.setSummary(R.string.bluetooth_tethering_errored_subtext);
} else {
mBluetoothTether.setSummary(R.string.bluetooth_tethering_off_subtext);
}
}
- } else if (preference == mBluetoothSettings) {
- preference.getExtras().putString(BluetoothSettings.ACTION,
- BluetoothSettings.ACTION_LAUNCH_TETHER_PICKER);
} else if (preference == mTetherHelp) {
showDialog(DIALOG_TETHER_HELP);
return true;
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index 3042e3deb..57e359d10 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -142,6 +142,8 @@ public class BluetoothEventRedirector {
Profile.HID, newState);
} else if (action.equals(BluetoothPan.ACTION_PAN_STATE_CHANGED)) {
+ // TODO: uncomment and execute for reverse tethering only
+/*
final int newState = intent.getIntExtra(
BluetoothPan.EXTRA_PAN_STATE, 0);
final int oldState = intent.getIntExtra(
@@ -152,6 +154,7 @@ public class BluetoothEventRedirector {
}
mManager.getCachedDeviceManager().onProfileStateChanged(device,
Profile.PAN, newState);
+*/
} else if (action.equals(BluetoothDevice.ACTION_CLASS_CHANGED)) {
mManager.getCachedDeviceManager().onBtClassChanged(device);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index aae13115a..89efd72cb 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -42,6 +42,7 @@ import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
+import android.util.Log;
import android.view.View;
import java.util.List;
@@ -65,24 +66,21 @@ public class BluetoothSettings extends SettingsPreferenceFragment
private static final int SCREEN_TYPE_SETTINGS = 0;
private static final int SCREEN_TYPE_DEVICEPICKER = 1;
- private static final int SCREEN_TYPE_TETHERING = 2;
- private static final int SCREEN_TYPE_SCAN = 3;
+ private static final int SCREEN_TYPE_SCAN = 2;
public static final String ACTION = "bluetooth_action";
- public static final String ACTION_LAUNCH_TETHER_PICKER =
- "com.android.settings.bluetooth.action.LAUNCH_TETHER_PICKER";
public static final String ACTION_LAUNCH_SCAN_MODE =
"com.android.settings.bluetooth.action.LAUNCH_SCAN_MODE";
- private int mScreenType;
+ /*package*/ int mScreenType;
private int mFilterType;
private boolean mNeedAuth;
private String mLaunchPackage;
private String mLaunchClass;
- private BluetoothDevice mSelectedDevice= null;
+ /*package*/ BluetoothDevice mSelectedDevice= null;
- private LocalBluetoothManager mLocalManager;
+ /*package*/ LocalBluetoothManager mLocalManager;
private BluetoothEnabler mEnabler;
private BluetoothDiscoverableEnabler mDiscoverableEnabler;
@@ -111,8 +109,6 @@ public class BluetoothSettings extends SettingsPreferenceFragment
if (mScreenType == SCREEN_TYPE_DEVICEPICKER) {
sendDevicePickedIntent(device);
finish();
- } else if (mScreenType == SCREEN_TYPE_TETHERING) {
- onPanDevicePicked();
} else if (mScreenType == SCREEN_TYPE_SCAN) {
finish();
}
@@ -168,12 +164,6 @@ public class BluetoothSettings extends SettingsPreferenceFragment
activity.setTitle(activity.getString(R.string.device_picker));
addPreferencesFromResource(R.xml.device_picker);
- } else if (action.equals(ACTION_LAUNCH_TETHER_PICKER)) {
- mScreenType = SCREEN_TYPE_TETHERING;
- mFilterType = BluetoothDevicePicker.FILTER_TYPE_PANU;
-
- activity.setTitle(activity.getString(R.string.device_picker));
- addPreferencesFromResource(R.xml.device_picker);
} else if (action.equals(ACTION_LAUNCH_SCAN_MODE)) {
mScreenType = SCREEN_TYPE_SCAN;
@@ -293,15 +283,9 @@ public class BluetoothSettings extends SettingsPreferenceFragment
} else {
btPreference.getCachedDevice().onClicked();
}
- } else if (mScreenType == SCREEN_TYPE_TETHERING) {
- mLocalManager.stopScanning();
- mLocalManager.persistSelectedDeviceInPicker(mSelectedDevice.getAddress());
- if ((device.getBondState() == BluetoothDevice.BOND_BONDED)) {
- onPanDevicePicked();
- // don't call finish so that users can see it connecting
- } else {
- btPreference.getCachedDevice().onClicked();
- }
+ } else {
+ Log.e(TAG, "onPreferenceTreeClick has invalid mScreenType: "
+ + mScreenType);
}
return true;
}
@@ -391,14 +375,10 @@ public class BluetoothSettings extends SettingsPreferenceFragment
}
private void createDevicePreference(CachedBluetoothDevice cachedDevice) {
- BluetoothDevicePreference preference;
- if (mScreenType == SCREEN_TYPE_TETHERING) {
- preference = new BluetoothDevicePreference(
- getActivity(), cachedDevice, CachedBluetoothDevice.PAN_PROFILE);
- } else {
- preference = new BluetoothDevicePreference(
- getActivity(), cachedDevice, CachedBluetoothDevice.OTHER_PROFILES);
- }
+ BluetoothDevicePreference preference = new BluetoothDevicePreference(
+ getActivity(), cachedDevice,
+ CachedBluetoothDevice.OTHER_PROFILES);
+
if (mScreenType == SCREEN_TYPE_SETTINGS) {
preference.setOnSettingsClickListener(this);
}
@@ -422,7 +402,8 @@ public class BluetoothSettings extends SettingsPreferenceFragment
((ProgressCategory) mDeviceList).setProgress(start);
}
}
- private void onBluetoothStateChanged(int bluetoothState) {
+
+ /*package*/ void onBluetoothStateChanged(int bluetoothState) {
// When bluetooth is enabled (and we are in the activity, which we are),
// we should start a scan
if (bluetoothState == BluetoothAdapter.STATE_ON) {
@@ -434,47 +415,7 @@ public class BluetoothSettings extends SettingsPreferenceFragment
}
}
- private void onPanDevicePicked() {
- final Activity activity = getActivity();
- final LocalBluetoothProfileManager profileManager =
- LocalBluetoothProfileManager.getProfileManager(mLocalManager, Profile.PAN);
- int status = profileManager.getConnectionStatus(mSelectedDevice);
- if (SettingsBtStatus.isConnectionStatusConnected(status)) {
- String name = mSelectedDevice.getName();
- if (TextUtils.isEmpty(name)) {
- name = activity.getString(R.string.bluetooth_device);
- }
- String message = activity.getString(R.string.bluetooth_untether_blank, name);
- DialogInterface.OnClickListener disconnectListener =
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- profileManager.disconnect(mSelectedDevice);
- }
- };
- new AlertDialog.Builder(activity)
- .setTitle(name)
- .setMessage(message)
- .setPositiveButton(android.R.string.ok, disconnectListener)
- .setNegativeButton(android.R.string.cancel, null)
- .create()
- .show();
- } else if (status == SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED) {
- if (profileManager.getConnectedDevices().size() >= BluetoothPan.MAX_CONNECTIONS) {
- new AlertDialog.Builder(activity)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle(R.string.bluetooth_error_title)
- .setMessage(activity.getString(R.string.bluetooth_tethering_overflow_error,
- BluetoothPan.MAX_CONNECTIONS))
- .setNegativeButton(android.R.string.ok, null)
- .create()
- .show();
- return;
- }
- profileManager.connect(mSelectedDevice);
- }
- }
-
- private void sendDevicePickedIntent(BluetoothDevice device) {
+ /*package*/ void sendDevicePickedIntent(BluetoothDevice device) {
Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_SELECTED);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
if (mScreenType == SCREEN_TYPE_DEVICEPICKER &&