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

Commit db5594d7 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by markchien
Browse files

Add tethering client callbacks

The callbacks are fired when the list of connected clients or their IP
addresses / hostname change.

Test: flashed, connected 2 devices, verified callbacks
Test: atest TetheringTests
Bug: 135411507
Change-Id: I96291038cf7b39a67547a5f74fcd7cbedc1ca002
Merged-In: I96291038cf7b39a67547a5f74fcd7cbedc1ca002
parent 2d14a4b3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
java_defaults {
    name: "TetheringAndroidLibraryDefaults",
    // TODO (b/146757305): change to module API once available
    // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
    sdk_version: "core_platform",
    srcs: [
        "src/**/*.java",
@@ -34,7 +35,12 @@ java_defaults {
        "net-utils-framework-common",
    ],
    libs: [
        // Order matters: framework-tethering needs to be before the system stubs, otherwise
        // hidden fields in the framework-tethering classes (which are also used to generate stubs)
        // will not be found.
        "framework-tethering",
        "android_system_stubs_current",
        "framework-res",
        "unsupportedappusage",
        "android_system_stubs_current",
        "framework-res",
@@ -86,6 +92,7 @@ cc_library {
java_defaults {
    name: "TetheringAppDefaults",
    // TODO (b/146757305): change to module API once available
    // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
    sdk_version: "core_platform",
    privileged: true,
    // Build system doesn't track transitive dependeicies for jni_libs, list all the dependencies
@@ -99,6 +106,9 @@ java_defaults {
        "res",
    ],
    libs: [
        // Order matters: framework-tethering needs to be before the system stubs, otherwise
        // hidden fields in the framework-tethering classes (which are also used to generate stubs)
        // will not be found.
        "framework-tethering",
        "android_system_stubs_current",
        "framework-res",
+4 −4
Original line number Diff line number Diff line
/**
 * Copyright (c) 2019, The Android Open Source Project
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -10,7 +10,7 @@
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing perNmissions and
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.net;
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net;

import android.net.Network;
import android.net.TetheredClient;
import android.net.TetheringConfigurationParcel;
import android.net.TetheringCallbackStartedParcel;
import android.net.TetherStatesParcel;
@@ -33,4 +34,5 @@ oneway interface ITetheringEventCallback
    void onUpstreamChanged(in Network network);
    void onConfigurationChanged(in TetheringConfigurationParcel config);
    void onTetherStatesChanged(in TetherStatesParcel states);
    void onTetherClientsChanged(in List<TetheredClient> clients);
}
+18 −0
Original line number Diff line number Diff line
@@ -191,6 +191,15 @@ public final class TetheredClient implements Parcelable {
                return new AddressInfo[size];
            }
        };

        @NonNull
        @Override
        public String toString() {
            return "AddressInfo {"
                    + mAddress
                    + (mHostname != null ? ", hostname " + mHostname : "")
                    + "}";
        }
    }

    @Override
@@ -212,4 +221,13 @@ public final class TetheredClient implements Parcelable {
            return new TetheredClient[size];
        }
    };

    @NonNull
    @Override
    public String toString() {
        return "TetheredClient {hwAddr " + mMacAddress
                + ", addresses " + mAddresses
                + ", tetheringType " + mTetheringType
                + "}";
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net;

import android.net.Network;
import android.net.TetheredClient;
import android.net.TetheringConfigurationParcel;
import android.net.TetherStatesParcel;

@@ -29,4 +30,5 @@ parcelable TetheringCallbackStartedParcel {
    Network upstreamNetwork;
    TetheringConfigurationParcel config;
    TetherStatesParcel states;
    List<TetheredClient> tetheredClients;
}
 No newline at end of file
Loading