From fe354b7825b4ce48eaf1dff30fa9c17177316fb4 Mon Sep 17 00:00:00 2001 From: Hugo Benichi Date: Wed, 8 Aug 2018 09:42:59 +0900 Subject: [PATCH] WiFi: Define a base abstract class for IWifiManager This patch creates a base abstract class that implements IWifiManager.aidl with stub methods that throw runtime exceptions. Actual implementations of IWifiManager can extend this class instead of directly extending the autogenerated IWifiManager.Stub. This allows adding new methods or modifying existing methods in IWifiManager without requiring a synchronized change on all concrete implementations. Bug: 112338174 Test: Compiled, flashed marlin, booted. WiFi works. Change-Id: I316c999d6c076f4e6ea1354bd558512915d551ed --- .../server/wifi/AbstractWifiService.java | 415 ++++++++++++++++++ 1 file changed, 415 insertions(+) create mode 100644 wifi/java/com/android/server/wifi/AbstractWifiService.java diff --git a/wifi/java/com/android/server/wifi/AbstractWifiService.java b/wifi/java/com/android/server/wifi/AbstractWifiService.java new file mode 100644 index 0000000000000..eede23b223878 --- /dev/null +++ b/wifi/java/com/android/server/wifi/AbstractWifiService.java @@ -0,0 +1,415 @@ +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License") { + * throw new UnsupportedOperationException(); + } + * 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 com.android.server.wifi; + +import android.content.pm.ParceledListSlice; +import android.net.DhcpInfo; +import android.net.Network; +import android.net.wifi.INetworkRequestMatchCallback; +import android.net.wifi.ISoftApCallback; +import android.net.wifi.ITrafficStateCallback; +import android.net.wifi.IWifiManager; +import android.net.wifi.PasspointManagementObjectDefinition; +import android.net.wifi.ScanResult; +import android.net.wifi.WifiActivityEnergyInfo; +import android.net.wifi.WifiConfiguration; +import android.net.wifi.WifiInfo; +import android.net.wifi.hotspot2.IProvisioningCallback; +import android.net.wifi.hotspot2.OsuProvider; +import android.net.wifi.hotspot2.PasspointConfiguration; +import android.os.IBinder; +import android.os.Messenger; +import android.os.ResultReceiver; +import android.os.WorkSource; +import android.util.Slog; + +import java.util.List; + +/** + * Abstract class implementing IWifiManager with stub methods throwing runtime exceptions. + * + * This class is meant to be extended by real implementations of IWifiManager in order to facilitate + * cross-repo changes to WiFi internal APIs, including the introduction of new APIs, the removal of + * deprecated APIs, or the migration of existing API signatures. + * + * When an existing API is scheduled for removal, it can be removed from IWifiManager.aidl + * immediately and marked as @Deprecated first in this class. Children inheriting this class are + * then given a short grace period to update themselves before the @Deprecated stub is removed for + * good. If the API scheduled for removal has a replacement or an overload (signature change), + * these should be introduced before the stub is removed to allow children to migrate. + */ +public abstract class AbstractWifiService extends IWifiManager.Stub { + + private static final String TAG = AbstractWifiService.class.getSimpleName(); + + @Override + public int getSupportedFeatures() { + throw new UnsupportedOperationException(); + } + + @Override + public WifiActivityEnergyInfo reportActivityInfo() { + throw new UnsupportedOperationException(); + } + + @Override + public void requestActivityInfo(ResultReceiver result) { + throw new UnsupportedOperationException(); + } + + @Override + public ParceledListSlice getConfiguredNetworks() { + throw new UnsupportedOperationException(); + } + + @Override + public ParceledListSlice getPrivilegedConfiguredNetworks() { + throw new UnsupportedOperationException(); + } + + @Override + public WifiConfiguration getMatchingWifiConfig(ScanResult scanResult) { + throw new UnsupportedOperationException(); + } + + @Override + public List getAllMatchingWifiConfigs(ScanResult scanResult) { + throw new UnsupportedOperationException(); + } + + @Override + public List getMatchingOsuProviders(ScanResult scanResult) { + throw new UnsupportedOperationException(); + } + + @Override + public int addOrUpdateNetwork(WifiConfiguration config, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addOrUpdatePasspointConfiguration( + PasspointConfiguration config, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean removePasspointConfiguration(String fqdn, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public List getPasspointConfigurations() { + throw new UnsupportedOperationException(); + } + + @Override + public void queryPasspointIcon(long bssid, String fileName) { + throw new UnsupportedOperationException(); + } + + @Override + public int matchProviderWithCurrentNetwork(String fqdn) { + throw new UnsupportedOperationException(); + } + + @Override + public void deauthenticateNetwork(long holdoff, boolean ess) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean removeNetwork(int netId, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean enableNetwork(int netId, boolean disableOthers, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean disableNetwork(int netId, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean startScan(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public List getScanResults(String callingPackage) { + throw new UnsupportedOperationException(); + } + + @Override + public void disconnect(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void reconnect(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void reassociate(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public WifiInfo getConnectionInfo(String callingPackage) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean setWifiEnabled(String packageName, boolean enable) { + throw new UnsupportedOperationException(); + } + + @Override + public int getWifiEnabledState() { + throw new UnsupportedOperationException(); + } + + @Override + public void setCountryCode(String country) { + throw new UnsupportedOperationException(); + } + + @Override + public String getCountryCode() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isDualBandSupported() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean needs5GHzToAnyApBandConversion() { + throw new UnsupportedOperationException(); + } + + @Override + public DhcpInfo getDhcpInfo() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isScanAlwaysAvailable() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean acquireWifiLock(IBinder lock, int lockType, String tag, WorkSource ws) { + throw new UnsupportedOperationException(); + } + + @Override + public void updateWifiLockWorkSource(IBinder lock, WorkSource ws) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean releaseWifiLock(IBinder lock) { + throw new UnsupportedOperationException(); + } + + @Override + public void initializeMulticastFiltering() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isMulticastEnabled() { + throw new UnsupportedOperationException(); + } + + @Override + public void acquireMulticastLock(IBinder binder, String tag) { + throw new UnsupportedOperationException(); + } + + @Override + public void releaseMulticastLock(String tag) { + throw new UnsupportedOperationException(); + } + + @Override + public void updateInterfaceIpState(String ifaceName, int mode) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean startSoftAp(WifiConfiguration wifiConfig) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean stopSoftAp() { + throw new UnsupportedOperationException(); + } + + @Override + public int startLocalOnlyHotspot(Messenger messenger, IBinder binder, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void stopLocalOnlyHotspot() { + throw new UnsupportedOperationException(); + } + + @Override + public void startWatchLocalOnlyHotspot(Messenger messenger, IBinder binder) { + throw new UnsupportedOperationException(); + } + + @Override + public void stopWatchLocalOnlyHotspot() { + throw new UnsupportedOperationException(); + } + + @Override + public int getWifiApEnabledState() { + throw new UnsupportedOperationException(); + } + + @Override + public WifiConfiguration getWifiApConfiguration() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean setWifiApConfiguration(WifiConfiguration wifiConfig, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void notifyUserOfApBandConversion(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public Messenger getWifiServiceMessenger(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void enableTdls(String remoteIPAddress, boolean enable) { + throw new UnsupportedOperationException(); + } + + @Override + public void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable) { + throw new UnsupportedOperationException(); + } + + @Override + public String getCurrentNetworkWpsNfcConfigurationToken() { + throw new UnsupportedOperationException(); + } + + @Override + public void enableVerboseLogging(int verbose) { + throw new UnsupportedOperationException(); + } + + @Override + public int getVerboseLoggingLevel() { + throw new UnsupportedOperationException(); + } + + @Override + public void enableWifiConnectivityManager(boolean enabled) { + throw new UnsupportedOperationException(); + } + + @Override + public void disableEphemeralNetwork(String SSID, String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public void factoryReset(String packageName) { + throw new UnsupportedOperationException(); + } + + @Override + public Network getCurrentNetwork() { + throw new UnsupportedOperationException(); + } + + @Override + public byte[] retrieveBackupData() { + throw new UnsupportedOperationException(); + } + + @Override + public void restoreBackupData(byte[] data) { + throw new UnsupportedOperationException(); + } + + @Override + public void restoreSupplicantBackupData(byte[] supplicantData, byte[] ipConfigData) { + throw new UnsupportedOperationException(); + } + + @Override + public void startSubscriptionProvisioning( + OsuProvider provider, IProvisioningCallback callback) { + throw new UnsupportedOperationException(); + } + + @Override + public void registerSoftApCallback( + IBinder binder, ISoftApCallback callback, int callbackIdentifier) { + throw new UnsupportedOperationException(); + } + + @Override + public void unregisterSoftApCallback(int callbackIdentifier) { + throw new UnsupportedOperationException(); + } + + @Override + public void registerTrafficStateCallback( + IBinder binder, ITrafficStateCallback callback, int callbackIdentifier) { + throw new UnsupportedOperationException(); + } + + @Override + public void unregisterTrafficStateCallback(int callbackIdentifier) { + throw new UnsupportedOperationException(); + } + + @Override + public void registerNetworkRequestMatchCallback( + IBinder binder, INetworkRequestMatchCallback callback, int callbackIdentifier) { + throw new UnsupportedOperationException(); + } + + @Override + public void unregisterNetworkRequestMatchCallback(int callbackIdentifier) { + throw new UnsupportedOperationException(); + } +}