summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/TetherSettings.java
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2011-02-23 13:08:09 -0800
committerJaikumar Ganesh <jaikumar@google.com>2011-02-23 13:30:08 -0800
commit9ad703cdb9a8d0972c123b041d18aa7bbeb391a4 (patch)
treed50b04bd8c0befdd4bb9ee9c7a2db17db7d1a87a /src/com/android/settings/TetherSettings.java
parent77bcd7e80718b3964cc91b1d941563b6023ccc3c (diff)
downloadpackages_apps_Settings-9ad703cdb9a8d0972c123b041d18aa7bbeb391a4.zip
packages_apps_Settings-9ad703cdb9a8d0972c123b041d18aa7bbeb391a4.tar.gz
packages_apps_Settings-9ad703cdb9a8d0972c123b041d18aa7bbeb391a4.tar.bz2
Make BluetoothPan implement BluetoothProfile.
This makes it consistent across all other profiles. Change-Id: I4c0694d042d7ed1b78c92ca3be38c8d543886769
Diffstat (limited to 'src/com/android/settings/TetherSettings.java')
-rw-r--r--src/com/android/settings/TetherSettings.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 4ccd598..2ff3254 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -23,6 +23,7 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothPan;
+import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -88,7 +89,12 @@ public class TetherSettings extends SettingsPreferenceFragment {
addPreferencesFromResource(R.xml.tether_prefs);
final Activity activity = getActivity();
- mBluetoothPan = new BluetoothPan(activity);
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if (adapter != null) {
+ adapter.getProfileProxy(activity.getApplicationContext(), mProfileServiceListener,
+ BluetoothProfile.PAN);
+ }
+
mEnableWifiAp = (CheckBoxPreference) findPreference(ENABLE_WIFI_AP);
mWifiApSettings = (PreferenceScreen) findPreference(WIFI_AP_SETTINGS);
@@ -119,7 +125,7 @@ public class TetherSettings extends SettingsPreferenceFragment {
if (!bluetoothAvailable) {
getPreferenceScreen().removePreference(mBluetoothTether);
} else {
- if (mBluetoothPan.isTetheringOn()) {
+ if (mBluetoothPan != null && mBluetoothPan.isTetheringOn()) {
mBluetoothTether.setChecked(true);
} else {
mBluetoothTether.setChecked(false);
@@ -130,6 +136,16 @@ public class TetherSettings extends SettingsPreferenceFragment {
mView = new WebView(activity);
}
+ private BluetoothProfile.ServiceListener mProfileServiceListener =
+ new BluetoothProfile.ServiceListener() {
+ public void onServiceConnected(int profile, BluetoothProfile proxy) {
+ mBluetoothPan = (BluetoothPan) proxy;
+ }
+ public void onServiceDisconnected(int profile) {
+ mBluetoothPan = null;
+ }
+ };
+
@Override
public Dialog onCreateDialog(int id) {
if (id == DIALOG_TETHER_HELP) {