summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-02-04 10:01:52 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-02-04 10:01:52 -0800
commit154a784aa2595aa02ba9516e3bbc50b91f4c52d9 (patch)
treefe7eb15c0828703c3de8bc762889725f2ee9a85d
parent29cf1efcc23f180201c8b33d0c69538076cc7a7e (diff)
parentf40fecc359bd855e9dd7c4499743fdf69cefadda (diff)
downloadandroid_packages_apps_BluetoothExt-154a784aa2595aa02ba9516e3bbc50b91f4c52d9.tar.gz
android_packages_apps_BluetoothExt-154a784aa2595aa02ba9516e3bbc50b91f4c52d9.tar.bz2
android_packages_apps_BluetoothExt-154a784aa2595aa02ba9516e3bbc50b91f4c52d9.zip
Merge "Bluetooth: Check for null value."
-rw-r--r--bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java7
-rw-r--r--bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java10
2 files changed, 15 insertions, 2 deletions
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
index 05e722b..867cafd 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
@@ -359,6 +359,13 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
filter.addAction(BluetoothHeadsetClient.ACTION_RESULT);
filter.addAction(BluetoothHeadsetClient.ACTION_LAST_VTAG);
registerReceiver(mHfpClientReceiver, filter);
+ if (mBluetoothHeadsetClient != null &&
+ mBluetoothHeadsetClient.getConnectionState(mDevice) !=
+ BluetoothProfile.STATE_CONNECTED) {
+ Logger.v(TAG, "No device is connected");
+ super.onResume();
+ return;
+ }
if (mBluetoothHeadsetClient != null) {
for (BluetoothHeadsetClientCall call : mCalls.values()) {
call.setState(BluetoothHeadsetClientCall.CALL_STATE_TERMINATED);
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
index f73e435..0fb64e0 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
@@ -451,10 +451,16 @@ public class ServicesFragment extends ListFragment {
switch (srv.mType) {
case HFP:
if (isChecked) {
- mActivity.mProfileService.getHfpClient().connect(mActivity.mDevice);
+ if (mActivity.mProfileService.getHfpClient() != null) {
+ mActivity.mProfileService.getHfpClient()
+ .connect(mActivity.mDevice);
+ }
buttonView.setEnabled(false);
} else {
- mActivity.mProfileService.getHfpClient().disconnect(mActivity.mDevice);
+ if (mActivity.mProfileService.getHfpClient() != null) {
+ mActivity.mProfileService.getHfpClient()
+ .disconnect(mActivity.mDevice);
+ }
buttonView.setEnabled(false);
}
break;