Renaming Ethernet Network Management Classes
Renaming InternalNetwork* files and classes related to ethernet network management to EthernetNetwork* as ethernet is the only trasnport these particular files are used with. Bug: 210485380 Test: atest EthernetServiceTests Change-Id: Ieb3915c032ef5fcd6b36eb09878119de7668bb4b
This commit is contained in:
parent
2ed5ef560c
commit
1ecadfa763
8 changed files with 67 additions and 42 deletions
|
|
@ -125,14 +125,14 @@ filegroup {
|
|||
name: "framework-connectivity-ethernet-sources",
|
||||
srcs: [
|
||||
"src/android/net/EthernetManager.java",
|
||||
"src/android/net/EthernetNetworkManagementException.java",
|
||||
"src/android/net/EthernetNetworkManagementException.aidl",
|
||||
"src/android/net/EthernetNetworkSpecifier.java",
|
||||
"src/android/net/EthernetNetworkUpdateRequest.java",
|
||||
"src/android/net/EthernetNetworkUpdateRequest.aidl",
|
||||
"src/android/net/IEthernetManager.aidl",
|
||||
"src/android/net/IEthernetNetworkManagementListener.aidl",
|
||||
"src/android/net/IEthernetServiceListener.aidl",
|
||||
"src/android/net/IInternalNetworkManagementListener.aidl",
|
||||
"src/android/net/InternalNetworkUpdateRequest.java",
|
||||
"src/android/net/InternalNetworkUpdateRequest.aidl",
|
||||
"src/android/net/InternalNetworkManagementException.java",
|
||||
"src/android/net/InternalNetworkManagementException.aidl",
|
||||
"src/android/net/ITetheredInterfaceCallback.aidl",
|
||||
],
|
||||
path: "src",
|
||||
|
|
|
|||
|
|
@ -320,15 +320,15 @@ public class EthernetManager {
|
|||
}
|
||||
|
||||
private static final class InternalNetworkManagementListener
|
||||
extends IInternalNetworkManagementListener.Stub {
|
||||
extends IEthernetNetworkManagementListener.Stub {
|
||||
@NonNull
|
||||
private final Executor mExecutor;
|
||||
@NonNull
|
||||
private final BiConsumer<Network, InternalNetworkManagementException> mListener;
|
||||
private final BiConsumer<Network, EthernetNetworkManagementException> mListener;
|
||||
|
||||
InternalNetworkManagementListener(
|
||||
@NonNull final Executor executor,
|
||||
@NonNull final BiConsumer<Network, InternalNetworkManagementException> listener) {
|
||||
@NonNull final BiConsumer<Network, EthernetNetworkManagementException> listener) {
|
||||
Objects.requireNonNull(executor, "Pass a non-null executor");
|
||||
Objects.requireNonNull(listener, "Pass a non-null listener");
|
||||
mExecutor = executor;
|
||||
|
|
@ -338,14 +338,14 @@ public class EthernetManager {
|
|||
@Override
|
||||
public void onComplete(
|
||||
@Nullable final Network network,
|
||||
@Nullable final InternalNetworkManagementException e) {
|
||||
@Nullable final EthernetNetworkManagementException e) {
|
||||
mExecutor.execute(() -> mListener.accept(network, e));
|
||||
}
|
||||
}
|
||||
|
||||
private InternalNetworkManagementListener getInternalNetworkManagementListener(
|
||||
@Nullable final Executor executor,
|
||||
@Nullable final BiConsumer<Network, InternalNetworkManagementException> listener) {
|
||||
@Nullable final BiConsumer<Network, EthernetNetworkManagementException> listener) {
|
||||
if (null != listener) {
|
||||
Objects.requireNonNull(executor, "Pass a non-null executor, or a null listener");
|
||||
}
|
||||
|
|
@ -360,9 +360,9 @@ public class EthernetManager {
|
|||
|
||||
private void updateConfiguration(
|
||||
@NonNull String iface,
|
||||
@NonNull InternalNetworkUpdateRequest request,
|
||||
@NonNull EthernetNetworkUpdateRequest request,
|
||||
@Nullable @CallbackExecutor Executor executor,
|
||||
@Nullable BiConsumer<Network, InternalNetworkManagementException> listener) {
|
||||
@Nullable BiConsumer<Network, EthernetNetworkManagementException> listener) {
|
||||
final InternalNetworkManagementListener proxy = getInternalNetworkManagementListener(
|
||||
executor, listener);
|
||||
try {
|
||||
|
|
@ -375,7 +375,7 @@ public class EthernetManager {
|
|||
private void connectNetwork(
|
||||
@NonNull String iface,
|
||||
@Nullable @CallbackExecutor Executor executor,
|
||||
@Nullable BiConsumer<Network, InternalNetworkManagementException> listener) {
|
||||
@Nullable BiConsumer<Network, EthernetNetworkManagementException> listener) {
|
||||
final InternalNetworkManagementListener proxy = getInternalNetworkManagementListener(
|
||||
executor, listener);
|
||||
try {
|
||||
|
|
@ -388,7 +388,7 @@ public class EthernetManager {
|
|||
private void disconnectNetwork(
|
||||
@NonNull String iface,
|
||||
@Nullable @CallbackExecutor Executor executor,
|
||||
@Nullable BiConsumer<Network, InternalNetworkManagementException> listener) {
|
||||
@Nullable BiConsumer<Network, EthernetNetworkManagementException> listener) {
|
||||
final InternalNetworkManagementListener proxy = getInternalNetworkManagementListener(
|
||||
executor, listener);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
parcelable EthernetNetworkManagementException;
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** @hide */
|
||||
public final class EthernetNetworkManagementException
|
||||
extends RuntimeException implements Parcelable {
|
||||
|
||||
/* @hide */
|
||||
public EthernetNetworkManagementException(@NonNull final String errorMessage) {
|
||||
super(errorMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
final EthernetNetworkManagementException that = (EthernetNetworkManagementException) obj;
|
||||
|
||||
return Objects.equals(getMessage(), that.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
dest.writeString(getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static final Parcelable.Creator<EthernetNetworkManagementException> CREATOR =
|
||||
new Parcelable.Creator<EthernetNetworkManagementException>() {
|
||||
@Override
|
||||
public EthernetNetworkManagementException[] newArray(int size) {
|
||||
return new EthernetNetworkManagementException[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EthernetNetworkManagementException createFromParcel(@NonNull Parcel source) {
|
||||
return new EthernetNetworkManagementException(source.readString());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
parcelable EthernetNetworkUpdateRequest;
|
||||
103
framework-t/src/android/net/EthernetNetworkUpdateRequest.java
Normal file
103
framework-t/src/android/net/EthernetNetworkUpdateRequest.java
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** @hide */
|
||||
public final class EthernetNetworkUpdateRequest implements Parcelable {
|
||||
@NonNull
|
||||
private final StaticIpConfiguration mIpConfig;
|
||||
@NonNull
|
||||
private final NetworkCapabilities mNetworkCapabilities;
|
||||
|
||||
@NonNull
|
||||
public StaticIpConfiguration getIpConfig() {
|
||||
return new StaticIpConfiguration(mIpConfig);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public NetworkCapabilities getNetworkCapabilities() {
|
||||
return new NetworkCapabilities(mNetworkCapabilities);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public EthernetNetworkUpdateRequest(@NonNull final StaticIpConfiguration ipConfig,
|
||||
@NonNull final NetworkCapabilities networkCapabilities) {
|
||||
Objects.requireNonNull(ipConfig);
|
||||
Objects.requireNonNull(networkCapabilities);
|
||||
mIpConfig = new StaticIpConfiguration(ipConfig);
|
||||
mNetworkCapabilities = new NetworkCapabilities(networkCapabilities);
|
||||
}
|
||||
|
||||
private EthernetNetworkUpdateRequest(@NonNull final Parcel source) {
|
||||
Objects.requireNonNull(source);
|
||||
mIpConfig = StaticIpConfiguration.CREATOR.createFromParcel(source);
|
||||
mNetworkCapabilities = NetworkCapabilities.CREATOR.createFromParcel(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EthernetNetworkUpdateRequest{"
|
||||
+ "mIpConfig=" + mIpConfig
|
||||
+ ", mNetworkCapabilities=" + mNetworkCapabilities + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
EthernetNetworkUpdateRequest that = (EthernetNetworkUpdateRequest) o;
|
||||
|
||||
return Objects.equals(that.getIpConfig(), mIpConfig)
|
||||
&& Objects.equals(that.getNetworkCapabilities(), mNetworkCapabilities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mIpConfig, mNetworkCapabilities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||
mIpConfig.writeToParcel(dest, flags);
|
||||
mNetworkCapabilities.writeToParcel(dest, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static final Parcelable.Creator<EthernetNetworkUpdateRequest> CREATOR =
|
||||
new Parcelable.Creator<EthernetNetworkUpdateRequest>() {
|
||||
@Override
|
||||
public EthernetNetworkUpdateRequest[] newArray(int size) {
|
||||
return new EthernetNetworkUpdateRequest[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EthernetNetworkUpdateRequest createFromParcel(@NonNull Parcel source) {
|
||||
return new EthernetNetworkUpdateRequest(source);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -18,8 +18,8 @@ package android.net;
|
|||
|
||||
import android.net.IpConfiguration;
|
||||
import android.net.IEthernetServiceListener;
|
||||
import android.net.IInternalNetworkManagementListener;
|
||||
import android.net.InternalNetworkUpdateRequest;
|
||||
import android.net.IEthernetNetworkManagementListener;
|
||||
import android.net.EthernetNetworkUpdateRequest;
|
||||
import android.net.ITetheredInterfaceCallback;
|
||||
|
||||
/**
|
||||
|
|
@ -38,8 +38,8 @@ interface IEthernetManager
|
|||
void setIncludeTestInterfaces(boolean include);
|
||||
void requestTetheredInterface(in ITetheredInterfaceCallback callback);
|
||||
void releaseTetheredInterface(in ITetheredInterfaceCallback callback);
|
||||
void updateConfiguration(String iface, in InternalNetworkUpdateRequest request,
|
||||
in IInternalNetworkManagementListener listener);
|
||||
void connectNetwork(String iface, in IInternalNetworkManagementListener listener);
|
||||
void disconnectNetwork(String iface, in IInternalNetworkManagementListener listener);
|
||||
void updateConfiguration(String iface, in EthernetNetworkUpdateRequest request,
|
||||
in IEthernetNetworkManagementListener listener);
|
||||
void connectNetwork(String iface, in IEthernetNetworkManagementListener listener);
|
||||
void disconnectNetwork(String iface, in IEthernetNetworkManagementListener listener);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2021, 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.EthernetNetworkManagementException;
|
||||
import android.net.Network;
|
||||
|
||||
/** @hide */
|
||||
oneway interface IEthernetNetworkManagementListener {
|
||||
void onComplete(in Network network, in EthernetNetworkManagementException exception);
|
||||
}
|
||||
Loading…
Reference in a new issue