summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Asati <gasati@codeaurora.org>2014-10-10 12:13:12 +0530
committerGaurav Asati <gasati@codeaurora.org>2014-10-10 16:30:12 +0530
commit9f2f1fa5c09839cf2d49642c34ebd9a808830abb (patch)
tree984d3d8ef4db8e0fa8bee16080c877ce37ade5dd
parentdc387d32641ef49a3f7ff386358717e09c821e99 (diff)
downloadandroid_packages_apps_BluetoothExt-9f2f1fa5c09839cf2d49642c34ebd9a808830abb.tar.gz
android_packages_apps_BluetoothExt-9f2f1fa5c09839cf2d49642c34ebd9a808830abb.tar.bz2
android_packages_apps_BluetoothExt-9f2f1fa5c09839cf2d49642c34ebd9a808830abb.zip
Bluetooth: Update Call options on Screen Unlock.
- Update UI with proper call options when new calls are added in during locked screen. Change-Id: I6e1393b8a8e3308fd569918c0338ae96123a407a CRs-Fixed: 737180
-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();
}