Merge "Add the ability to file a NetworkRequest for TRANSPORT_WIFI." into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
dafe3703da
@@ -283,6 +283,19 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/release_cell" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/request_wifi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/request_wifi" />
|
||||
<Button android:id="@+id/release_wifi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/release_wifi" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="4dip"
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
<string name="release_supl">Release SUPL</string>
|
||||
<string name="request_cell">Request cell</string>
|
||||
<string name="release_cell">Release cell</string>
|
||||
<string name="request_wifi">Request Wi-Fi</string>
|
||||
<string name="release_wifi">Release Wi-Fi</string>
|
||||
<string name="report_all_bad">Report all bad</string>
|
||||
|
||||
<string name="default_request">Make http request</string>
|
||||
|
||||
@@ -360,6 +360,10 @@ public class Connectivity extends Activity {
|
||||
private final RequestableNetwork mBoundTestNetwork;
|
||||
private boolean mRequestRunning;
|
||||
|
||||
private void addRequestableNetwork(RequestableNetwork network) {
|
||||
mRequestableNetworks.add(network);
|
||||
}
|
||||
|
||||
private void addRequestableNetwork(int capability, int requestButton, int releaseButton) {
|
||||
mRequestableNetworks.add(new RequestableNetwork(capability, requestButton, releaseButton));
|
||||
}
|
||||
@@ -369,7 +373,15 @@ public class Connectivity extends Activity {
|
||||
addRequestableNetwork(NET_CAPABILITY_MMS, R.id.request_mms, R.id.release_mms);
|
||||
addRequestableNetwork(NET_CAPABILITY_SUPL, R.id.request_supl, R.id.release_supl);
|
||||
addRequestableNetwork(NET_CAPABILITY_INTERNET, R.id.request_cell, R.id.release_cell);
|
||||
|
||||
// Make bound requests use cell data.
|
||||
mBoundTestNetwork = mRequestableNetworks.get(mRequestableNetworks.size() - 1);
|
||||
|
||||
NetworkRequest wifiRequest = new NetworkRequest.Builder()
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
|
||||
.build();
|
||||
addRequestableNetwork(new RequestableNetwork(wifiRequest,
|
||||
R.id.request_wifi, R.id.release_wifi, R.id.wifi_progress));
|
||||
}
|
||||
|
||||
final NetworkRequest mEmptyRequest = new NetworkRequest.Builder().clearCapabilities().build();
|
||||
|
||||
Reference in New Issue
Block a user