Connectivity: Add TDLS test

Bug: 8539031

Change-Id: I68e9e2e93d49f29ed915a462570cb8e782e9a4f2
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt
2013-07-18 14:24:39 -07:00
parent b1fc86ddc3
commit 47a5a18431
3 changed files with 54 additions and 0 deletions

View File

@@ -206,6 +206,33 @@
android:layout_marginLeft="14.5sp" />
</LinearLayout>
<!-- divider line -->
<View android:background="#FFFFFFFF"
android:layout_width="match_parent"
android:layout_height="3dip" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/startTdls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/start_tdls" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mac_tdls" />
<EditText android:id="@+id/sc_ip_mac"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minEms="10" />
<Button android:id="@+id/stopTdls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stop_tdls" />
</LinearLayout>
<!-- divider line -->
<View android:background="#FFFFFFFF"
android:layout_width="match_parent"

View File

@@ -34,6 +34,10 @@
<string name="scan_cycles">Scan Cycles: </string>
<string name="disconnect">Disconnect</string>
<string name="start_tdls">Start TDLS</string>
<string name="stop_tdls">Stop TDLS</string>
<string name="mac_tdls"> MAC: </string>
<string name="start_mms">Start MMS</string>
<string name="stop_mms">Stop MMS</string>
<string name="start_hipri">Start HiPri</string>

View File

@@ -117,6 +117,8 @@ public class Connectivity extends Activity {
private long mTotalScanTime = 0;
private long mTotalScanCount = 0;
private String mTdlsAddr = null;
private WifiManager mWm;
private PowerManager mPm;
private ConnectivityManager mCm;
@@ -290,6 +292,9 @@ public class Connectivity extends Activity {
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
findViewById(R.id.startTdls).setOnClickListener(mClickListener);
findViewById(R.id.stopTdls).setOnClickListener(mClickListener);
findViewById(R.id.start_mms).setOnClickListener(mClickListener);
findViewById(R.id.stop_mms).setOnClickListener(mClickListener);
findViewById(R.id.start_hipri).setOnClickListener(mClickListener);
@@ -339,6 +344,12 @@ public class Connectivity extends Activity {
case R.id.startScan:
onStartScanCycle();
break;
case R.id.startTdls:
onStartTdls();
break;
case R.id.stopTdls:
onStopTdls();
break;
case R.id.start_mms:
mCm.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
Phone.FEATURE_ENABLE_MMS);
@@ -487,6 +498,18 @@ public class Connectivity extends Activity {
}
}
private void onStartTdls() {
mTdlsAddr = ((EditText)findViewById(R.id.sc_ip_mac)).getText().toString();
Log.d(TAG, "TDLS: START " + mTdlsAddr);
mWm.enableTdlsWithMacAddress(mTdlsAddr, true);
}
private void onStopTdls() {
if (mTdlsAddr == null) return;
Log.d(TAG, "TDLS: STOP " + mTdlsAddr);
mWm.enableTdlsWithMacAddress(mTdlsAddr, false);
}
private void onAddDefaultRoute() {
try {
mNetd.addRoute("eth0", new RouteInfo(null,