summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-10-14 08:50:24 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-10-14 08:50:24 -0700
commitccca61b9a71432ad5c9d0f5cf7bc08fa0451641a (patch)
tree4a47d2cac9b7caf45b6e96818888b702c767f24b
parent97b59be3c5b2e093ba1f942db2dbf16c3b2eda29 (diff)
parent9f2f1fa5c09839cf2d49642c34ebd9a808830abb (diff)
downloadandroid_packages_apps_BluetoothExt-ccca61b9a71432ad5c9d0f5cf7bc08fa0451641a.tar.gz
android_packages_apps_BluetoothExt-ccca61b9a71432ad5c9d0f5cf7bc08fa0451641a.tar.bz2
android_packages_apps_BluetoothExt-ccca61b9a71432ad5c9d0f5cf7bc08fa0451641a.zip
Merge "Bluetooth: Update Call options on Screen Unlock."
-rw-r--r--bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
index 2831522..aaf1369 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
@@ -58,6 +58,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Hashtable;
public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnectionObserver,
CallHistoryDialogListener {
@@ -74,6 +75,8 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
private ActionBar mActionBar = null;
+ private Hashtable<Integer, BluetoothHeadsetClientCall> mCalls;
+
// this should be visible for fragments
BluetoothHeadsetClient mBluetoothHeadsetClient;
ProfileService mProfileService = null;
@@ -317,6 +320,7 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
ActivityHelper.initialize(this, R.layout.activity_hfp_test);
BluetoothConnectionReceiver.registerObserver(this);
+ mCalls = new Hashtable<Integer, BluetoothHeadsetClientCall>();
// bind to app service
Intent intent = new Intent(this, ProfileService.class);
@@ -355,6 +359,25 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
filter.addAction(BluetoothHeadsetClient.ACTION_RESULT);
filter.addAction(BluetoothHeadsetClient.ACTION_LAST_VTAG);
registerReceiver(mHfpClientReceiver, filter);
+ if (mBluetoothHeadsetClient != null) {
+ for (BluetoothHeadsetClientCall call : mCalls.values()) {
+ call.setState(BluetoothHeadsetClientCall.CALL_STATE_TERMINATED);
+ mCallsListFragment.onCallChanged(call);
+ new MonkeyEvent("hfp-call-changed", true)
+ .addExtReply(callToJson(call))
+ .send();
+ }
+ for (BluetoothHeadsetClientCall call :
+ mBluetoothHeadsetClient.getCurrentCalls(mDevice)) {
+ Logger.v(TAG, "Updating call controls");
+ mCallsListFragment.onCallChanged(call);
+ new MonkeyEvent("hfp-call-changed", true)
+ .addExtReply(callToJson(call))
+ .send();
+ }
+ } else {
+ Logger.v(TAG,"mBluetoothHeadsetClient is null");
+ }
super.onResume();
}
@@ -363,6 +386,20 @@ public class HfpTestActivity extends MonkeyActivity implements IBluetoothConnect
Logger.v(TAG, "onPause");
unregisterReceiver(mHfpClientReceiver);
+ if (mBluetoothHeadsetClient != null) {
+ mCalls.clear();
+ Integer id = 1;
+ // save all calls status
+ if (!mBluetoothHeadsetClient.getCurrentCalls(mDevice).isEmpty()) {
+ for (BluetoothHeadsetClientCall call :
+ mBluetoothHeadsetClient.getCurrentCalls(mDevice)) {
+ mCalls.put(id, call);
+ id++;
+ }
+ }
+ } else {
+ Logger.v(TAG,"mBluetoothHeadsetClient is null");
+ }
super.onPause();
}