From 2b9b9b44be104a4f3614d96fd6179b9451cb55ad Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 2 Oct 2018 10:14:27 +0900 Subject: [PATCH 1/2] Add OWNERS for the connectivity page in the Dev Tools app. Test: ../../../build/make/tools/checkowners.py src/com/android/development/OWNERS Change-Id: I44da96fa7daaa6fcd0033797a7ca3f633509364b --- apps/Development/src/com/android/development/OWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/Development/src/com/android/development/OWNERS diff --git a/apps/Development/src/com/android/development/OWNERS b/apps/Development/src/com/android/development/OWNERS new file mode 100644 index 000000000..171a26e12 --- /dev/null +++ b/apps/Development/src/com/android/development/OWNERS @@ -0,0 +1 @@ +per-file Connectivity.java = codewiz@google.com, jchalard@google.com, lorenzo@google.com, reminv@google.com, satk@google.com From 223fc59aca93d77818b0fc563ccbdcbe26e29682 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 19 Jun 2018 15:27:39 +0900 Subject: [PATCH 2/2] Log broadcasts in DevToolsConnectivity. Test: manual Change-Id: I1b9dc4d56b56dae5da779aec1d99cd7190e94a4e --- .../com/android/development/Connectivity.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java index e0b763e43..2b62acb2c 100644 --- a/apps/Development/src/com/android/development/Connectivity.java +++ b/apps/Development/src/com/android/development/Connectivity.java @@ -85,6 +85,8 @@ import java.util.Enumeration; import java.util.List; import java.util.Random; +import static android.net.ConnectivityManager.CONNECTIVITY_ACTION; +import static android.net.ConnectivityManager.INET_CONDITION_ACTION; import static android.net.NetworkCapabilities.*; public class Connectivity extends Activity { @@ -153,8 +155,23 @@ public class Connectivity extends Activity { private static final String TEST_ALARM_CYCLE_EXTRA = "CONNECTIVITY_TEST_CYCLE_EXTRA"; private static final String SCREEN_ON = "SCREEN_ON"; private static final String SCREEN_OFF = "SCREEN_OFF"; + + private static final String NETWORK_CONDITIONS_MEASURED = + "android.net.conn.NETWORK_CONDITIONS_MEASURED"; + + private void logBroadcast(Intent intent) { + StringBuilder sb = new StringBuilder(); + Bundle b = intent.getExtras(); + for (String key : b.keySet()) { + sb.append(String.format(" %s=%s", key, b.get(key))); + } + Log.d(TAG, "Got broadcast " + intent.getAction() + " extras:" + sb.toString()); + } + public BroadcastReceiver mReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { + logBroadcast(intent); + if (intent.getAction().equals(CONNECTIVITY_TEST_ALARM)) { String extra = (String)intent.getExtra(TEST_ALARM_EXTRA); PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); @@ -465,7 +482,13 @@ public class Connectivity extends Activity { } onHttpRequestResults(null); - registerReceiver(mReceiver, new IntentFilter(CONNECTIVITY_TEST_ALARM)); + IntentFilter broadcastFilter = new IntentFilter(); + broadcastFilter.addAction(CONNECTIVITY_ACTION); + broadcastFilter.addAction(CONNECTIVITY_TEST_ALARM); + broadcastFilter.addAction(INET_CONDITION_ACTION); + broadcastFilter.addAction(NETWORK_CONDITIONS_MEASURED); + + registerReceiver(mReceiver, broadcastFilter); mLinkStatsResults = (TextView)findViewById(R.id.stats); mLinkStatsResults.setVisibility(View.VISIBLE);