diff options
author | Etan Cohen <etancohen@google.com> | 2015-03-30 16:54:20 -0700 |
---|---|---|
committer | Etan Cohen <etancohen@google.com> | 2015-03-30 16:54:20 -0700 |
commit | 0650f6cdd47582d532583fb75253e5d700c6fc71 (patch) | |
tree | a5cdedfc6736ef7bc546f43838f28c4b39454525 /apps | |
parent | b0735703abb2a0b9a5809b9041cf4a0ce7a3b5b9 (diff) | |
parent | c84e7b11e598d5a6c07c754755382279e194efcb (diff) | |
download | android_development-0650f6cdd47582d532583fb75253e5d700c6fc71.tar.gz android_development-0650f6cdd47582d532583fb75253e5d700c6fc71.tar.bz2 android_development-0650f6cdd47582d532583fb75253e5d700c6fc71.zip |
Merge commit 'c84e7b11e598d5a6c07c754755382279e194efcb' into merge
Diffstat (limited to 'apps')
-rw-r--r-- | apps/Development/res/layout/connectivity.xml | 27 | ||||
-rw-r--r-- | apps/Development/res/values/strings.xml | 2 | ||||
-rw-r--r-- | apps/Development/src/com/android/development/Connectivity.java | 26 |
3 files changed, 55 insertions, 0 deletions
diff --git a/apps/Development/res/layout/connectivity.xml b/apps/Development/res/layout/connectivity.xml index d23a6b1b9..00ba508bb 100644 --- a/apps/Development/res/layout/connectivity.xml +++ b/apps/Development/res/layout/connectivity.xml @@ -350,6 +350,33 @@ android:layout_height="wrap_content" android:text="@string/routed_socket_request" /> </LinearLayout> + + <!-- divider line --> + <View android:background="#FFFFFFFF" + android:layout_width="match_parent" + android:layout_height="3dip" /> + <LinearLayout + android:orientation="horizontal" + android:paddingTop="4dip" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <Button android:id="@+id/link_stats" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/link_stats" /> + </LinearLayout> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <TextView + android:id="@+id/stats" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/stats_results" /> + </LinearLayout> + </LinearLayout> </ScrollView> diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml index d670cf4c4..3ef88458e 100644 --- a/apps/Development/res/values/strings.xml +++ b/apps/Development/res/values/strings.xml @@ -33,6 +33,8 @@ <string name="start_scan">Start Scan</string> <string name="scan_cycles">Scan Cycles: </string> <string name="disconnect">Disconnect</string> + <string name="link_stats">Link Stats</string> + <string name="stats_results"> results </string> <string name="start_tdls">Start TDLS</string> <string name="stop_tdls">Stop TDLS</string> diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java index a576eb397..5ff72add9 100644 --- a/apps/Development/src/com/android/development/Connectivity.java +++ b/apps/Development/src/com/android/development/Connectivity.java @@ -33,6 +33,7 @@ import android.net.Network; import android.net.NetworkUtils; import android.net.RouteInfo; import android.net.wifi.ScanResult; +import android.net.wifi.WifiActivityEnergyInfo; import android.net.wifi.WifiManager; import android.os.RemoteException; import android.os.Handler; @@ -119,6 +120,8 @@ public class Connectivity extends Activity { private long mTotalScanTime = 0; private long mTotalScanCount = 0; + private TextView mLinkStatsResults; + private String mTdlsAddr = null; private WifiManager mWm; @@ -316,8 +319,12 @@ public class Connectivity extends Activity { findViewById(R.id.routed_socket_request).setOnClickListener(mClickListener); findViewById(R.id.default_request).setOnClickListener(mClickListener); findViewById(R.id.default_socket).setOnClickListener(mClickListener); + findViewById(R.id.link_stats).setOnClickListener(mClickListener); registerReceiver(mReceiver, new IntentFilter(CONNECTIVITY_TEST_ALARM)); + + mLinkStatsResults = (TextView)findViewById(R.id.stats); + mLinkStatsResults.setVisibility(View.VISIBLE); } @Override @@ -408,6 +415,9 @@ public class Connectivity extends Activity { mCm.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_HIPRI); break; + case R.id.link_stats: + onLinkStats(); + break; } } }; @@ -544,6 +554,22 @@ public class Connectivity extends Activity { } } + private void onLinkStats() { + Log.e(TAG, "LINK STATS: "); + try { + WifiActivityEnergyInfo info = + mWm.getControllerActivityEnergyInfo(0); + if (info != null) { + mLinkStatsResults.setText(" power " + info.toString()); + } else { + mLinkStatsResults.setText(" null! "); + } + } catch (Exception e) { + mLinkStatsResults.setText(" failed! " + e.toString()); + } + } + + private void onAddDefaultRoute() { try { int netId = Integer.valueOf(((TextView) findViewById(R.id.netid)).getText().toString()); |