Bluetooth: Enable HFP client role.
Enable HFP Client role relevant test features
in BTTestApp.apk.
Change-Id: I6c28538922731a57e9939b024f174f36f90533f5
diff --git a/bttestapp/AndroidManifest.xml b/bttestapp/AndroidManifest.xml
index f96e4a5..46c21ea 100644
--- a/bttestapp/AndroidManifest.xml
+++ b/bttestapp/AndroidManifest.xml
@@ -29,9 +29,9 @@
</activity>
<activity android:name=".VcardFilterActivity" />
- <!--activity
+ <activity
android:name=".HfpTestActivity"
- android:launchMode="singleTop" /-->
+ android:launchMode="singleTop" />
<activity
android:name=".PbapTestActivity"
android:launchMode="singleTop" />
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/BluetoothConnectionReceiver.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/BluetoothConnectionReceiver.java
index 0f276c8..e06382b 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/BluetoothConnectionReceiver.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/BluetoothConnectionReceiver.java
@@ -43,9 +43,9 @@
private final static String TAG = "BluetoothConnectionReceiver";
- public static final String ACTION_NEW_BLUETOOTH_DEVICE = "com.qualcomm.bluetooth.action.NEW_BLUETOOTH_DEVICE";
+ public static final String ACTION_NEW_BLUETOOTH_DEVICE = "org.codeaurora.bluetooth.action.NEW_BLUETOOTH_DEVICE";
- public static final String EXTRA_DEVICE_ADDRESS = "com.qualcomm.bluetooth.extra.DEVICE_ADDRESS";
+ public static final String EXTRA_DEVICE_ADDRESS = "org.codeaurora.bluetooth.extra.DEVICE_ADDRESS";
private static ArrayList<IBluetoothConnectionObserver> observers = new ArrayList<IBluetoothConnectionObserver>();
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/CallsListFragment.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/CallsListFragment.java
index 9c87abd..3a78fb2 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/CallsListFragment.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/CallsListFragment.java
@@ -26,7 +26,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*package org.codeaurora.bttestapp;
+package org.codeaurora.bluetooth.bttestapp;
import android.app.Activity;
import android.app.Fragment;
@@ -50,7 +50,7 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.qualcomm.bttestapp.R;
+import org.codeaurora.bluetooth.bttestapp.R;
public class CallsListFragment extends Fragment implements OnClickListener, OnItemClickListener {
@@ -464,4 +464,4 @@
mActionExplicitTransfer.setEnabled(mActivity.mFeatMergeDetach && (adapter.getCount() > 1));
}
-}*/
+}
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/DialpadFragment.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/DialpadFragment.java
index 3e5aa15..f67da53 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/DialpadFragment.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/DialpadFragment.java
@@ -27,7 +27,7 @@
*/
-/*package org.codeaurora.bttestapp;
+package org.codeaurora.bluetooth.bttestapp;
import android.app.Activity;
import android.app.Fragment;
@@ -52,7 +52,7 @@
import android.widget.Toast;
import android.widget.ToggleButton;
-import com.qualcomm.bttestapp.R;
+import org.codeaurora.bluetooth.bttestapp.R;
public class DialpadFragment extends Fragment implements OnClickListener, OnLongClickListener {
@@ -282,4 +282,4 @@
public void setNumber(String number) {
mNumberEdit.setText(number);
}
-}*/
+}
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
index d62d5c4..4fd0935 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/HfpTestActivity.java
@@ -27,7 +27,7 @@
*/
-/*package org.codeaurora.bttestapp;
+package org.codeaurora.bluetooth.bttestapp;
import android.app.ActionBar;
import android.app.DialogFragment;
@@ -48,10 +48,10 @@
import android.view.MenuItem;
import android.widget.Toast;
-import com.qualcomm.bttestapp.CallHistoryDialogFragment.CallHistoryDialogListener;
-import com.qualcomm.bttestapp.R;
-import com.qualcomm.bttestapp.util.Logger;
-import com.qualcomm.bttestapp.util.MonkeyEvent;
+import org.codeaurora.bluetooth.bttestapp.CallHistoryDialogFragment.CallHistoryDialogListener;
+import org.codeaurora.bluetooth.bttestapp.R;
+import org.codeaurora.bluetooth.bttestapp.util.Logger;
+import org.codeaurora.bluetooth.bttestapp.util.MonkeyEvent;
import org.json.JSONException;
import org.json.JSONObject;
@@ -73,12 +73,12 @@
private ActionBar mActionBar = null;
- // /* this should be visible for fragments ///
+ // this should be visible for fragments
BluetoothHandsfreeClient mBluetoothHandsfreeClient;
ProfileService mProfileService = null;
BluetoothDevice mDevice;
- ///* this should be done in a more elegant way //
+ // this should be done in a more elegant way //
public boolean mFeatVtag;
public boolean mFeatVoiceRecognition;
public boolean mFeatThreeWayCalling;
@@ -173,7 +173,7 @@
return;
}
- /// we add any "new" call to list and put in at the beginning
+ // we add any "new" call to list and put in at the beginning
if (state == BluetoothHandsfreeClientCall.CALL_STATE_ALERTING ||
state == BluetoothHandsfreeClientCall.CALL_STATE_DIALING ||
state == BluetoothHandsfreeClientCall.CALL_STATE_INCOMING ||
@@ -233,9 +233,7 @@
}
};
- ///*
- * HFP Service Connection.
- ///
+ // HFP Service Connection.
private final ServiceConnection mHfpServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
@@ -513,4 +511,4 @@
mFeatAcceptHeldOrWaiting = b.containsKey(BluetoothHandsfreeClient.EXTRA_AG_FEATURE_ACCEPT_HELD_OR_WAITING_CALL);
mFeatReleaseHeldOrWaiting = b.containsKey(BluetoothHandsfreeClient.EXTRA_AG_FEATURE_RELEASE_HELD_OR_WAITING_CALL);
}
-}*/
+}
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/IndicatorsFragment.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/IndicatorsFragment.java
index af451b0..e3ca195 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/IndicatorsFragment.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/IndicatorsFragment.java
@@ -26,7 +26,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*package org.codeaurora.bttestapp;
+package org.codeaurora.bluetooth.bttestapp;
import android.app.Activity;
import android.app.Fragment;
@@ -43,9 +43,9 @@
import android.widget.TextView;
import android.widget.ToggleButton;
-import com.qualcomm.bttestapp.R;
-*/
-/*public class IndicatorsFragment extends Fragment implements OnClickListener {
+import org.codeaurora.bluetooth.bttestapp.R;
+
+public class IndicatorsFragment extends Fragment implements OnClickListener {
private HfpTestActivity mActivity;
@@ -351,4 +351,4 @@
}
mIndVrState.setEnabled(false);
}
-}*/
+}
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MainActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MainActivity.java
index 1a8c85f..a4dc0b3 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MainActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MainActivity.java
@@ -110,9 +110,9 @@
for (Parcelable uuid : uuids) {
if (BluetoothUuid.PBAP_PSE.equals(uuid)) {
mServicesFragment.addService(ServicesFragment.Service.Type.PBAP, null);
- } /*else if (BluetoothUuid.Handsfree_AG.equals(uuid)) {
+ } else if (BluetoothUuid.Handsfree_AG.equals(uuid)) {
mServicesFragment.addService(ServicesFragment.Service.Type.HFP, null);
- }*/
+ }
}
}
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MonkeyActivity.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MonkeyActivity.java
index e8839c1..449f1bf 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MonkeyActivity.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/MonkeyActivity.java
@@ -54,9 +54,9 @@
private static final String TAG = "MonkeyActivity";
- public static final String ACTION_MONKEY = "com.qualcomm.bluetooth.action.MONKEY";
+ public static final String ACTION_MONKEY = "org.codeaurora.bluetooth.action.MONKEY";
- public static final String ACTION_MONKEY_QUERY = "com.qualcomm.bluetooth.action.MONKEY_QUERY";
+ public static final String ACTION_MONKEY_QUERY = "org.codeaurora.bluetooth.action.MONKEY_QUERY";
public static final String EXTRA_OP = "extra.op";
public static final String EXTRA_DIALOG_TAG = "extra.dialogTag";
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ProfileService.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ProfileService.java
index 79d6d23..ec855c9 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ProfileService.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ProfileService.java
@@ -34,7 +34,7 @@
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
-//import android.bluetooth.BluetoothHandsfreeClient;
+import android.bluetooth.BluetoothHandsfreeClient;
import android.bluetooth.BluetoothMasInstance;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProfile.ServiceListener;
@@ -101,7 +101,7 @@
private final BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter();
- //private BluetoothHandsfreeClient mHfpClient = null;
+ private BluetoothHandsfreeClient mHfpClient = null;
private BluetoothPbapClient mPbapClient = null;
@@ -534,7 +534,7 @@
String action = intent.getAction();
Log.d(TAG, "received " + action);
- /*if (BluetoothHandsfreeClient.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
+ if (BluetoothHandsfreeClient.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1);
Intent new_intent = new Intent(ACTION_HFP_CONNECTION_STATE);
@@ -547,7 +547,7 @@
}
ProfileService.this.sendBroadcast(new_intent);
- } else */if (PBAP_AUTH_ACTION_RESPONSE.equals(action)) {
+ } else if (PBAP_AUTH_ACTION_RESPONSE.equals(action)) {
String key = intent.getStringExtra(PBAP_AUTH_EXTRA_KEY);
mPbapClient.setAuthResponse(key);
} else if (PBAP_AUTH_ACTION_CANCEL.equals(action)) {
@@ -570,7 +570,7 @@
}
};
-/* private final ServiceListener mHfpServiceListener = new ServiceListener() {
+ private final ServiceListener mHfpServiceListener = new ServiceListener() {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (profile == BluetoothProfile.HANDSFREE_CLIENT) {
@@ -585,7 +585,7 @@
}
}
};
-*/
+
private void createPbapAuthNotification() {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@@ -627,10 +627,10 @@
Log.v(TAG, "checkAndStop(): unbind=" + unbind + " disconnect=" + disconnect);
if (unbind) {
- /*if (mHfpClient != null &&
+ if (mHfpClient != null &&
mHfpClient.getConnectionState(mDevice) != BluetoothProfile.STATE_DISCONNECTED) {
canStop = false;
- }*/
+ }
if (mPbapClient != null
&& mPbapClient.getState() != BluetoothPbapClient.ConnectionState.DISCONNECTED) {
@@ -687,11 +687,11 @@
filter.addAction(PBAP_AUTH_ACTION_RESPONSE);
filter.addAction(PBAP_AUTH_ACTION_CANCEL);
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
- //filter.addAction(BluetoothHandsfreeClient.ACTION_CONNECTION_STATE_CHANGED);
+ filter.addAction(BluetoothHandsfreeClient.ACTION_CONNECTION_STATE_CHANGED);
registerReceiver(mReceiver, filter);
-// mAdapter.getProfileProxy(getApplicationContext(), mHfpServiceListener,
- // BluetoothProfile.HANDSFREE_CLIENT);
+ mAdapter.getProfileProxy(getApplicationContext(), mHfpServiceListener,
+ BluetoothProfile.HANDSFREE_CLIENT);
}
@Override
@@ -705,8 +705,8 @@
public void onDestroy() {
Log.v(TAG, "onDestroy");
- //mAdapter.closeProfileProxy(BluetoothProfile.HANDSFREE_CLIENT,
- // mHfpClient);
+ mAdapter.closeProfileProxy(BluetoothProfile.HANDSFREE_CLIENT,
+ mHfpClient);
unregisterReceiver(mReceiver);
@@ -724,9 +724,9 @@
return;
}
- /*if (mHfpClient != null) {
+ if (mHfpClient != null) {
mHfpClient.disconnect(mDevice);
- }*/
+ }
if (mPbapClient != null) {
mPbapClient.disconnect();
@@ -751,9 +751,9 @@
mMapSessionData = new HashMap<Integer, MapSessionData>();
}
- /*public BluetoothHandsfreeClient getHfpClient() {
+ public BluetoothHandsfreeClient getHfpClient() {
return mHfpClient;
- }*/
+ }
public BluetoothPbapClient getPbapClient() {
if (mDevice == null) {
diff --git a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
index df72d43..2776ebd 100644
--- a/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
+++ b/bttestapp/src/org/codeaurora/bluetooth/bttestapp/ServicesFragment.java
@@ -32,7 +32,7 @@
import android.app.ListFragment;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
-//import android.bluetooth.BluetoothHandsfreeClient;
+import android.bluetooth.BluetoothHandsfreeClient;
import android.bluetooth.BluetoothMasInstance;
import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
@@ -86,7 +86,7 @@
Log.v(TAG, "mReceiver got " + action);
- /* if (ProfileService.ACTION_HFP_CONNECTION_STATE.equals(action)) {
+ if (ProfileService.ACTION_HFP_CONNECTION_STATE.equals(action)) {
connState = intent.getBooleanExtra(ProfileService.EXTRA_CONNECTED, false);
Service srv = new Service(Service.Type.HFP, null);
@@ -98,7 +98,7 @@
connEvent = true;
- } else */if (ProfileService.ACTION_PBAP_CONNECTION_STATE.equals(action)) {
+ } else if (ProfileService.ACTION_PBAP_CONNECTION_STATE.equals(action)) {
connState = intent.getBooleanExtra(ProfileService.EXTRA_CONNECTED, false);
Service srv = new Service(Service.Type.PBAP, null);
@@ -170,7 +170,7 @@
final BluetoothMasInstance mMasInstance;
enum Type {
- // HFP("Hands-Free Profile (AG)"),
+ HFP("Hands-Free Profile (AG)"),
PBAP("Phone Book Access Profile (PSE)"),
MAP("Message Access Profile (MSE)");
@@ -265,7 +265,7 @@
// need to update switch state on new view
if (mActivity.mProfileService != null) {
switch (srv.mType) {
- /* case HFP: {
+ case HFP: {
BluetoothHandsfreeClient cli = mActivity.mProfileService.getHfpClient();
if (cli == null || bluetoothOn == false) {
@@ -295,7 +295,7 @@
break;
}
-*/
+
case PBAP: {
BluetoothPbapClient cli = mActivity.mProfileService.getPbapClient();
@@ -406,7 +406,7 @@
Service srv = mServices.get((Integer) buttonView.getTag());
switch (srv.mType) {
-/* case HFP:
+ case HFP:
if (isChecked) {
mActivity.mProfileService.getHfpClient().connect(mActivity.mDevice);
buttonView.setEnabled(false);
@@ -415,7 +415,7 @@
buttonView.setEnabled(false);
}
break;
-*/
+
case PBAP:
if (isChecked) {
mActivity.mProfileService.getPbapClient().connect();
@@ -502,10 +502,10 @@
intent = new Intent(getActivity(), PbapTestActivity.class);
break;
-/* case HFP:
+ case HFP:
intent = new Intent(getActivity(), HfpTestActivity.class);
break;
-*/
+
case MAP:
intent = new Intent(getActivity(), MapTestActivity.class);
intent.putExtra(ProfileService.EXTRA_MAP_INSTANCE_ID, srv.mMasInstance.getId());