1 /* 2 * Copyright (C) 2020 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 17 package com.android.server.wifi; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.os.WorkSource; 22 23 import java.io.FileDescriptor; 24 import java.io.PrintWriter; 25 import java.util.BitSet; 26 27 /** 28 * This is used for creating a public {@link ClientModeManager} instance when wifi is off. 29 * 30 * Note: this class is currently a singleton as it has no state. 31 */ 32 public class DefaultClientModeManager implements ClientModeManager, ClientModeDefaults { 33 34 private static final long ID = -1; 35 36 @Override stop()37 public void stop() { 38 throw new IllegalStateException(); 39 } 40 41 @Override getRole()42 @Nullable public ClientRole getRole() { 43 return null; 44 } 45 46 @Override getPreviousRole()47 @Nullable public ClientRole getPreviousRole() { 48 return null; 49 } 50 51 @Override getLastRoleChangeSinceBootMs()52 public long getLastRoleChangeSinceBootMs() { 53 return 0; 54 } 55 56 @Override getInterfaceName()57 public String getInterfaceName() { 58 return null; 59 } 60 61 @Override getRequestorWs()62 public WorkSource getRequestorWs() { 63 return null; 64 } 65 66 @Override dump(FileDescriptor fd, PrintWriter pw, String[] args)67 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { } 68 69 @Override enableVerboseLogging(boolean verbose)70 public void enableVerboseLogging(boolean verbose) { } 71 72 @Override getId()73 public long getId() { 74 return ID; 75 } 76 77 @Override toString()78 public String toString() { 79 return "DefaultClientModeManager{id=" + getId() 80 + " iface=" + getInterfaceName() 81 + " role=" + getRole() 82 + "}"; 83 } 84 85 @Override getSupportedFeaturesBitSet()86 public @NonNull BitSet getSupportedFeaturesBitSet() { 87 return new BitSet(); 88 } 89 90 @Override isWifiStandardSupported(int standard)91 public boolean isWifiStandardSupported(int standard) { 92 return false; 93 } 94 } 95