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

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

Remove DhcpResults from NetworkStack shared lib

Remove the dependency on DhcpResults in moduleutils by moving
toStableParcelable to NetworkStack main code, and fromStableParcelable
to the test only.

Only NetworkStack should be generating DhcpResultsParcelables, and only
the NetworkStack should be using DhcpResults at this point (eventually
the class would move from frameworks/base/core to NetworkStack).

Test: built, flashed, WiFi working
Bug: 149403767
Change-Id: I093fa48967a48f594b242b1e05e7d481fa9ee529
parent 4520b4e9
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ filegroup {
    srcs: [
    srcs: [
        "src/android/net/util/SharedLog.java",
        "src/android/net/util/SharedLog.java",
        "src/android/net/shared/InitialConfiguration.java",
        "src/android/net/shared/InitialConfiguration.java",
        "src/android/net/shared/IpConfigurationParcelableUtil.java",
        "src/android/net/shared/Layer2Information.java",
        "src/android/net/shared/Layer2Information.java",
        "src/android/net/shared/LinkPropertiesParcelableUtil.java",
        "src/android/net/shared/LinkPropertiesParcelableUtil.java",
        "src/android/net/shared/ParcelableUtil.java",
        "src/android/net/shared/ParcelableUtil.java",
+1 −0
Original line number Original line Diff line number Diff line
@@ -122,6 +122,7 @@ java_library {
        "src/android/net/IpMemoryStoreClient.java",
        "src/android/net/IpMemoryStoreClient.java",
        "src/android/net/ipmemorystore/**/*.java",
        "src/android/net/ipmemorystore/**/*.java",
        "src/android/net/networkstack/**/*.java",
        "src/android/net/networkstack/**/*.java",
        "src/android/net/shared/**/*.java",
    ],
    ],
    static_libs: [
    static_libs: [
        "ipmemorystore-aidl-interfaces-java",
        "ipmemorystore-aidl-interfaces-java",
+48 −0
Original line number Original line Diff line number Diff line
/*
 * 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.
 * 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.shared;

import android.annotation.Nullable;
import android.net.InetAddresses;

import java.net.InetAddress;

/**
 * Collection of utility methods to convert to and from stable AIDL parcelables for IpClient
 * configuration classes.
 * @hide
 */
public final class IpConfigurationParcelableUtil {

    /**
     * Convert InetAddress to String.
     * TODO: have an InetAddressParcelable
     */
    public static String parcelAddress(@Nullable InetAddress addr) {
        if (addr == null) return null;
        return addr.getHostAddress();
    }

    /**
     * Convert String to InetAddress.
     * TODO: have an InetAddressParcelable
     */
    public static InetAddress unparcelAddress(@Nullable String addr) {
        if (addr == null) return null;
        return InetAddresses.parseNumericAddress(addr);
    }
}
+9 −27
Original line number Original line 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");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -14,22 +14,22 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package android.net.shared;
package android.net.dhcp;

import static android.net.shared.IpConfigurationParcelableUtil.parcelAddress;
import static android.net.shared.IpConfigurationParcelableUtil.unparcelAddress;


import android.annotation.Nullable;
import android.net.DhcpResults;
import android.net.DhcpResults;
import android.net.DhcpResultsParcelable;
import android.net.DhcpResultsParcelable;
import android.net.InetAddresses;

import androidx.annotation.Nullable;


import java.net.Inet4Address;
import java.net.Inet4Address;
import java.net.InetAddress;


/**
/**
 * Collection of utility methods to convert to and from stable AIDL parcelables for IpClient
 * A utility class to convert DhcpResults to DhcpResultsParcelable.
 * configuration classes.
 * @hide
 */
 */
public final class IpConfigurationParcelableUtil {
public final class DhcpResultsParcelableUtil {
    /**
    /**
     * Convert DhcpResults to a DhcpResultsParcelable.
     * Convert DhcpResults to a DhcpResultsParcelable.
     */
     */
@@ -60,22 +60,4 @@ public final class IpConfigurationParcelableUtil {
        results.captivePortalApiUrl = p.captivePortalApiUrl;
        results.captivePortalApiUrl = p.captivePortalApiUrl;
        return results;
        return results;
    }
    }

    /**
     * Convert InetAddress to String.
     * TODO: have an InetAddressParcelable
     */
    public static String parcelAddress(@Nullable InetAddress addr) {
        if (addr == null) return null;
        return addr.getHostAddress();
    }

    /**
     * Convert String to InetAddress.
     * TODO: have an InetAddressParcelable
     */
    public static InetAddress unparcelAddress(@Nullable String addr) {
        if (addr == null) return null;
        return InetAddresses.parseNumericAddress(addr);
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -17,7 +17,7 @@
package android.net.ip;
package android.net.ip;


import static android.net.RouteInfo.RTN_UNICAST;
import static android.net.RouteInfo.RTN_UNICAST;
import static android.net.shared.IpConfigurationParcelableUtil.toStableParcelable;
import static android.net.dhcp.DhcpResultsParcelableUtil.toStableParcelable;
import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY;
import static android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY;


import static com.android.server.util.NetworkStackConstants.VENDOR_SPECIFIC_IE_ID;
import static com.android.server.util.NetworkStackConstants.VENDOR_SPECIFIC_IE_ID;
Loading