From 14f7faf78e048b7209551cc32ac50b2673e15409 Mon Sep 17 00:00:00 2001 From: Erik Kline Date: Tue, 14 Feb 2017 19:03:09 +0900 Subject: [PATCH] Split chooseUpstreamType() into two separate functions Test: as follows - built (bullhead) - flashed - booted - runtest frameworks-net passes Bug: 32163131 Change-Id: If892864ff59a6f38340791597c2d9e5b4022bbfa --- .../com/android/server/connectivity/Tethering.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index b0e45097aff69..c1ec1ac1e9864 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -1058,9 +1058,13 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering } protected void chooseUpstreamType(boolean tryCell) { + final int upstreamType = findPreferredUpstreamType(tryCell); + setUpstreamByType(upstreamType); + } + + protected int findPreferredUpstreamType(boolean tryCell) { final ConnectivityManager cm = getConnectivityManager(); int upType = ConnectivityManager.TYPE_NONE; - String iface = null; updateConfiguration(); // TODO - remove? @@ -1117,7 +1121,13 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering break; } + return upType; + } + + protected void setUpstreamByType(int upType) { + final ConnectivityManager cm = getConnectivityManager(); Network network = null; + String iface = null; if (upType != ConnectivityManager.TYPE_NONE) { LinkProperties linkProperties = cm.getLinkProperties(upType); if (linkProperties != null) {