Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a26ba37 authored by Erik Kline's avatar Erik Kline
Browse files

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

Merged-In: Ifa121b057f9959ddb980edc940327929e48ea973
Merged-In: Iad6358dc2f1d10b322d22ec90543adc50882962d
Change-Id: Ia64faaadefb4a5d84a50da98bdebd544b6fda101
(cherry picked from commit 465ff3a0)
parent ea31cbea
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -910,7 +910,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);
+88 −78

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -60,4 +60,8 @@ public class TetheringDependencies {
    public INetd getNetdService() {
        return NetdService.getInstance();
    }

    public boolean isTetheringSupported() {
        return true;
    }
}
+40 −42

File changed.

Preview size limit exceeded, changes collapsed.