1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package android.net.util;
17 
18 import android.net.INetdUnsolicitedEventListener;
19 
20 import androidx.annotation.NonNull;
21 
22 /**
23  * Base {@link INetdUnsolicitedEventListener} that provides no-op implementations which can be
24  * overridden.
25  */
26 public class BaseNetdUnsolicitedEventListener extends INetdUnsolicitedEventListener.Stub {
27 
28     @Override
onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs, int uid)29     public void onInterfaceClassActivityChanged(boolean isActive, int timerLabel, long timestampNs,
30             int uid) { }
31 
32     @Override
onQuotaLimitReached(@onNull String alertName, @NonNull String ifName)33     public void onQuotaLimitReached(@NonNull String alertName, @NonNull String ifName) { }
34 
35     @Override
onInterfaceDnsServerInfo(@onNull String ifName, long lifetimeS, @NonNull String[] servers)36     public void onInterfaceDnsServerInfo(@NonNull String ifName, long lifetimeS,
37             @NonNull String[] servers) { }
38 
39     @Override
onInterfaceAddressUpdated(@onNull String addr, String ifName, int flags, int scope)40     public void onInterfaceAddressUpdated(@NonNull String addr, String ifName, int flags,
41             int scope) { }
42 
43     @Override
onInterfaceAddressRemoved(@onNull String addr, @NonNull String ifName, int flags, int scope)44     public void onInterfaceAddressRemoved(@NonNull String addr, @NonNull String ifName, int flags,
45             int scope) { }
46 
47     @Override
onInterfaceAdded(@onNull String ifName)48     public void onInterfaceAdded(@NonNull String ifName) { }
49 
50     @Override
onInterfaceRemoved(@onNull String ifName)51     public void onInterfaceRemoved(@NonNull String ifName) { }
52 
53     @Override
onInterfaceChanged(@onNull String ifName, boolean up)54     public void onInterfaceChanged(@NonNull String ifName, boolean up) { }
55 
56     @Override
onInterfaceLinkStateChanged(@onNull String ifName, boolean up)57     public void onInterfaceLinkStateChanged(@NonNull String ifName, boolean up) { }
58 
59     @Override
onRouteChanged(boolean updated, @NonNull String route, @NonNull String gateway, @NonNull String ifName)60     public void onRouteChanged(boolean updated, @NonNull String route, @NonNull String gateway,
61             @NonNull String ifName) { }
62 
63     @Override
onStrictCleartextDetected(int uid, @NonNull String hex)64     public void onStrictCleartextDetected(int uid, @NonNull String hex) { }
65 
66     @Override
getInterfaceVersion()67     public int getInterfaceVersion() {
68         return INetdUnsolicitedEventListener.VERSION;
69     }
70 
71     @Override
getInterfaceHash()72     public String getInterfaceHash() {
73         return INetdUnsolicitedEventListener.HASH;
74     }
75 }
76