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

Commit a9ba51db authored by Xiao Ma's avatar Xiao Ma Committed by Automerger Merge Worker
Browse files

Merge "Add new method to update Layer2 information when L2 roaming happens."...

Merge "Add new method to update Layer2 information when L2 roaming happens." am: b844596d am: b652d668 am: 3168e392 am: 5baf5da9 am: 91290e10

Change-Id: I672a8a17fff79edc519e852204b3b6cba4c8c118
parents af14253e 91290e10
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ filegroup {
        "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/IpConfigurationParcelableUtil.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",
        "src/android/net/shared/NetdUtils.java",
        "src/android/net/shared/NetdUtils.java",
+81 −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.net.Layer2InformationParcelable;
import android.net.MacAddress;

import java.util.Objects;

/** @hide */
public class Layer2Information {
    private final String mL2Key;
    private final String mGroupHint;
    private final MacAddress mBssid;

    /**
     * Create a Layer2Information with the specified configuration.
     */
    public Layer2Information(String l2Key, String groupHint, MacAddress bssid) {
        mL2Key = l2Key;
        mGroupHint = groupHint;
        mBssid = bssid;
    }

    @Override
    public String toString() {
        StringBuffer str = new StringBuffer();
        str.append("L2Key: ").append(mL2Key);
        str.append(", GroupHint: ").append(mGroupHint);
        str.append(", bssid: ").append(mBssid.toString());
        return str.toString();
    }

    /**
     * Convert Layer2 Information to a {@link Layer2InformationParcelable}.
     */
    public Layer2InformationParcelable toStableParcelable() {
        final Layer2InformationParcelable p = new Layer2InformationParcelable();
        p.l2Key = mL2Key;
        p.groupHint = mGroupHint;
        p.bssid = mBssid;
        return p;
    }

    /**
     * Create an instance of {@link Layer2Information} based on the contents of the specified
     * {@link Layer2InformationParcelable}.
     */
    public Layer2Information fromStableParcelable(Layer2InformationParcelable p) {
        if (p == null) return null;
        return new Layer2Information(p.l2Key, p.groupHint, p.bssid);
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Layer2Information)) return false;
        final Layer2Information other = (Layer2Information) obj;
        return Objects.equals(mL2Key, other.mL2Key)
                && Objects.equals(mGroupHint, other.mGroupHint)
                && Objects.equals(mBssid, other.mBssid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mL2Key, mGroupHint, mBssid);
    }
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ aidl_interface {
        "src/android/net/INetworkStackStatusCallback.aidl",
        "src/android/net/INetworkStackStatusCallback.aidl",
        "src/android/net/InitialConfigurationParcelable.aidl",
        "src/android/net/InitialConfigurationParcelable.aidl",
        "src/android/net/InformationElementParcelable.aidl",
        "src/android/net/InformationElementParcelable.aidl",
        "src/android/net/Layer2InformationParcelable.aidl",
        "src/android/net/Layer2PacketParcelable.aidl",
        "src/android/net/Layer2PacketParcelable.aidl",
        "src/android/net/NattKeepalivePacketDataParcelable.aidl",
        "src/android/net/NattKeepalivePacketDataParcelable.aidl",
        "src/android/net/PrivateDnsConfigParcel.aidl",
        "src/android/net/PrivateDnsConfigParcel.aidl",
+23 −0
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
//
// You must not make a backward incompatible changes to the AIDL files built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.net;
parcelable Layer2InformationParcelable {
  String l2Key;
  String groupHint;
  android.net.MacAddress bssid;
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -32,4 +32,5 @@ interface IIpClient {
  oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
  oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
  oneway void addNattKeepalivePacketFilter(int slot, in android.net.NattKeepalivePacketDataParcelable pkt);
  oneway void addNattKeepalivePacketFilter(int slot, in android.net.NattKeepalivePacketDataParcelable pkt);
  oneway void notifyPreconnectionComplete(boolean success);
  oneway void notifyPreconnectionComplete(boolean success);
  oneway void updateLayer2Information(in android.net.Layer2InformationParcelable info);
}
}
Loading