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

Commit e67b0c3a authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Move NetworkMonitor to NetworkStack

Bug: b/112869080
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1b8b6a3f4390adbabf92fb9e48da61c47b08b2ec
parent dcfef162
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -824,8 +824,11 @@ aidl_interface {
    name: "networkstack-aidl-interfaces",
    local_include_dir: "core/java",
    srcs: [
        "core/java/android/net/INetworkMonitor.aidl",
        "core/java/android/net/INetworkMonitorCallbacks.aidl",
        "core/java/android/net/INetworkStackConnector.aidl",
        "core/java/android/net/INetworkStackStatusCallback.aidl",
        "core/java/android/net/PrivateDnsConfigParcel.aidl",
        "core/java/android/net/dhcp/DhcpServingParamsParcel.aidl",
        "core/java/android/net/dhcp/IDhcpServer.aidl",
        "core/java/android/net/dhcp/IDhcpServerCallbacks.aidl",
+10 −0
Original line number Diff line number Diff line
@@ -2051,6 +2051,16 @@ public class ConnectivityManager {
        return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    /** @hide */
    public NetworkRequest getDefaultRequest() {
        try {
            // This is not racy as the default request is final in ConnectivityService.
            return mService.getDefaultRequest();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /* TODO: These permissions checks don't belong in client-side code. Move them to
     * services.jar, possibly in com.android.server.net. */

+2 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ interface IConnectivityManager

    int getMultipathPreference(in Network Network);

    NetworkRequest getDefaultRequest();

    int getRestoreDefaultNetworkDelay(int networkType);

    boolean addVpnAddress(String address, int prefixLength);
+45 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2018, 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.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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
 * limitations under the License.
 */
package android.net;

import android.net.PrivateDnsConfigParcel;

/** @hide */
oneway interface INetworkMonitor {
    // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
    // The network should be used as a default internet connection.  It was found to be:
    // 1. a functioning network providing internet access, or
    // 2. a captive portal and the user decided to use it as is.
    const int NETWORK_TEST_RESULT_VALID = 0;

    // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
    // The network should not be used as a default internet connection.  It was found to be:
    // 1. a captive portal and the user is prompted to sign-in, or
    // 2. a captive portal and the user did not want to use it, or
    // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed).
    const int NETWORK_TEST_RESULT_INVALID = 1;

    void start();
    void launchCaptivePortalApp();
    void forceReevaluation(int uid);
    void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
    void notifyDnsResponse(int returnCode);
    void notifySystemReady();
    void notifyNetworkConnected();
    void notifyNetworkDisconnected();
    void notifyLinkPropertiesChanged();
    void notifyNetworkCapabilitiesChanged();
}
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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 permissions and
 * limitations under the License.
 */

package android.net;

import android.net.INetworkMonitor;
import android.net.PrivateDnsConfigParcel;

/** @hide */
oneway interface INetworkMonitorCallbacks {
    void onNetworkMonitorCreated(in INetworkMonitor networkMonitor);
    void notifyNetworkTested(int testResult, @nullable String redirectUrl);
    void notifyPrivateDnsConfigResolved(in PrivateDnsConfigParcel config);
    void showProvisioningNotification(String action);
    void hideProvisioningNotification();
}
 No newline at end of file
Loading