1 /*
2  * Copyright (C) 2024 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 android.car.wifi;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.RequiresPermission;
21 import android.annotation.SystemApi;
22 import android.car.Car;
23 import android.car.CarManagerBase;
24 import android.car.feature.Flags;
25 import android.os.IBinder;
26 import android.os.RemoteException;
27 
28 import com.android.car.internal.ICarBase;
29 
30 /**
31  * CarWifiManager provides API to allow for applications to perform Wi-Fi specific operations.
32  *
33  * @hide
34  */
35 @SystemApi
36 @FlaggedApi(Flags.FLAG_PERSIST_AP_SETTINGS)
37 public final class CarWifiManager extends CarManagerBase {
38     private final ICarWifi mService;
39 
40     /** @hide */
CarWifiManager(ICarBase car, IBinder service)41     public CarWifiManager(ICarBase car, IBinder service) {
42         super(car);
43         mService = ICarWifi.Stub.asInterface(service);
44     }
45 
46     /** @hide */
47     @Override
onCarDisconnected()48     public void onCarDisconnected() {}
49 
50     /**
51      * Returns {@code true} if the persist tethering settings are able to be changed.
52      *
53      * @hide
54      */
55     @SystemApi
56     @FlaggedApi(Flags.FLAG_PERSIST_AP_SETTINGS)
57     @RequiresPermission(Car.PERMISSION_READ_PERSIST_TETHERING_SETTINGS)
canControlPersistTetheringSettings()58     public boolean canControlPersistTetheringSettings() {
59         try {
60             return mService.canControlPersistTetheringSettings();
61         } catch (RemoteException e) {
62             return handleRemoteExceptionFromCarService(e, false);
63         }
64     }
65 }
66