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