• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.net.connectivity;
18 
19 import android.content.Context;
20 import android.net.ConnectivityManager;
21 import android.os.Build;
22 import android.os.IBinder;
23 
24 import androidx.annotation.RequiresApi;
25 
26 /**
27  * Utility providing limited access to module-internal APIs which are only available on Android T+,
28  * as this class is only in the bootclasspath on T+ as part of framework-connectivity.
29  *
30  * R+ module components like Tethering cannot depend on all hidden symbols from
31  * framework-connectivity. They only have access to stable API stubs where newer APIs can be
32  * accessed after an API level check (enforced by the linter), or to limited hidden symbols in this
33  * class which is also annotated with @RequiresApi (so API level checks are also enforced by the
34  * linter).
35  * @hide
36  */
37 @RequiresApi(Build.VERSION_CODES.TIRAMISU)
38 public class TiramisuConnectivityInternalApiUtil {
39 
40     /**
41      * Get a service binder token for
42      * {@link com.android.server.connectivity.wear.CompanionDeviceManagerProxyService}.
43      */
getCompanionDeviceManagerProxyService(Context ctx)44     public static IBinder getCompanionDeviceManagerProxyService(Context ctx) {
45         final ConnectivityManager cm = ctx.getSystemService(ConnectivityManager.class);
46         return cm.getCompanionDeviceManagerProxyService();
47     }
48 }
49