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

Commit 67be1d71 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add an IpClientIntegrationTest"

parents 10c2cc18 53ed1aca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
/**
 * This class implements the DHCP-DISCOVER packet.
 */
class DhcpDiscoverPacket extends DhcpPacket {
public class DhcpDiscoverPacket extends DhcpPacket {
    /**
     * The IP address of the client which sent this packet.
     */
+14 −14
Original line number Diff line number Diff line
@@ -108,22 +108,22 @@ public abstract class DhcpPacket {
    /**
     * The client DHCP port.
     */
    static final short DHCP_CLIENT = (short) 68;
    public static final short DHCP_CLIENT = (short) 68;

    /**
     * The server DHCP port.
     */
    static final short DHCP_SERVER = (short) 67;
    public static final short DHCP_SERVER = (short) 67;

    /**
     * The message op code indicating a request from a client.
     */
    protected static final byte DHCP_BOOTREQUEST = (byte) 1;
    public static final byte DHCP_BOOTREQUEST = (byte) 1;

    /**
     * The message op code indicating a response from the server.
     */
    protected static final byte DHCP_BOOTREPLY = (byte) 2;
    public static final byte DHCP_BOOTREPLY = (byte) 2;

    /**
     * The code type used to identify an Ethernet MAC address in the
@@ -139,7 +139,7 @@ public abstract class DhcpPacket {
    /**
     * The magic cookie that identifies this as a DHCP packet instead of BOOTP.
     */
    private static final int DHCP_MAGIC_COOKIE = 0x63825363;
    public static final int DHCP_MAGIC_COOKIE = 0x63825363;

    /**
     * DHCP Optional Type: DHCP Subnet Mask
@@ -221,16 +221,16 @@ public abstract class DhcpPacket {
    /**
     * DHCP Optional Type: DHCP Message Type
     */
    protected static final byte DHCP_MESSAGE_TYPE = 53;
    public static final byte DHCP_MESSAGE_TYPE = 53;
    // the actual type values
    protected static final byte DHCP_MESSAGE_TYPE_DISCOVER = 1;
    protected static final byte DHCP_MESSAGE_TYPE_OFFER = 2;
    protected static final byte DHCP_MESSAGE_TYPE_REQUEST = 3;
    protected static final byte DHCP_MESSAGE_TYPE_DECLINE = 4;
    protected static final byte DHCP_MESSAGE_TYPE_ACK = 5;
    protected static final byte DHCP_MESSAGE_TYPE_NAK = 6;
    protected static final byte DHCP_MESSAGE_TYPE_RELEASE = 7;
    protected static final byte DHCP_MESSAGE_TYPE_INFORM = 8;
    public static final byte DHCP_MESSAGE_TYPE_DISCOVER = 1;
    public static final byte DHCP_MESSAGE_TYPE_OFFER = 2;
    public static final byte DHCP_MESSAGE_TYPE_REQUEST = 3;
    public static final byte DHCP_MESSAGE_TYPE_DECLINE = 4;
    public static final byte DHCP_MESSAGE_TYPE_ACK = 5;
    public static final byte DHCP_MESSAGE_TYPE_NAK = 6;
    public static final byte DHCP_MESSAGE_TYPE_RELEASE = 7;
    public static final byte DHCP_MESSAGE_TYPE_INFORM = 8;

    /**
     * DHCP Optional Type: DHCP Server Identifier
+3 −9
Original line number Diff line number Diff line
@@ -41,20 +41,14 @@ import java.util.concurrent.ConcurrentHashMap;
public class NetworkObserverRegistry extends INetdUnsolicitedEventListener.Stub {
    private static final String TAG = NetworkObserverRegistry.class.getSimpleName();

    /**
     * Constructs a new NetworkObserverRegistry.
     *
     * <p>Only one registry should be used per process since netd will silently ignore multiple
     * registrations from the same process.
     */
    NetworkObserverRegistry() {}

    /**
     * Start listening for Netd events.
     *
     * <p>This should be called before allowing any observer to be registered.
     * Note there is no unregister method. The only way to unregister is when the process
     * terminates.
     */
    void register(@NonNull INetd netd) throws RemoteException {
    public void register(@NonNull INetd netd) throws RemoteException {
        netd.registerUnsolicitedEventListener(this);
    }

+42 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_test {
    name: "NetworkStackIntegrationTests",
    certificate: "networkstack",
    srcs: ["src/**/*.java"],
    test_suites: ["device-tests"],
    static_libs: [
        "androidx.annotation_annotation",
        "androidx.test.rules",
        "mockito-target-extended-minus-junit4",
        "NetworkStackBase",
        "testables",
    ],
    libs: [
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
    ],
    defaults: ["libnetworkstackutilsjni_deps"],
    jni_libs: [
        // For mockito extended
        "libdexmakerjvmtiagent",
        "libstaticjvmtiagent",
        // For NetworkStackUtils included in NetworkStackBase
        "libnetworkstackutilsjni",
    ],
}
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.server.networkstack.integrationtests"
          android:sharedUserId="android.uid.networkstack">

    <!-- Note: do not add any privileged or signature permissions that are granted
         to the network stack app. Otherwise, the test APK will install, but when the device is
         rebooted, it will bootloop with something like:

         05-14 00:41:02.723 18330 18330 E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.android.server.networkstack.integrationtests: android.permission.CONNECTIVITY_INTERNAL}
    -->

    <application android:debuggable="true">
        <uses-library android:name="android.test.runner" />
    </application>
    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.server.networkstack.integrationtests"
        android:label="Networking stack integration tests">
    </instrumentation>
</manifest>
Loading