From d8840e4fd3c577cf3990b1ae938b2eb5d03782fd Mon Sep 17 00:00:00 2001 From: Erik Kline Date: Fri, 9 Mar 2018 14:18:02 +0900 Subject: [PATCH] Refactor isTetheringSupported() calls Tethering currently wants access to complex isTetheringSupported logic that is only available in ConnectivityService. Instead of trying to access that via ConnectivityManager, pass this capability in to Tethering directly, in the TetheringDependencies object. Also: - ConnectivityManager is only a source of static constants now, so "import static" all the constants that are actually used. Test: as follows - built - flashed - booted - runtest frameworks-net works - manual USB towards WiFi tethering works Bug: 68951715 Change-Id: Ia64faaadefb4a5d84a50da98bdebd544b6fda101 --- .../core/java/com/android/server/ConnectivityService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index ae7ac8f041..995f926479 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -878,7 +878,12 @@ public class ConnectivityService extends IConnectivityManager.Stub private Tethering makeTethering() { // TODO: Move other elements into @Overridden getters. - final TetheringDependencies deps = new TetheringDependencies(); + final TetheringDependencies deps = new TetheringDependencies() { + @Override + public boolean isTetheringSupported() { + return ConnectivityService.this.isTetheringSupported(); + } + }; return new Tethering(mContext, mNetd, mStatsService, mPolicyManager, IoThread.get().getLooper(), new MockableSystemProperties(), deps);