1 /*
2  * Copyright (C) 2023 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.telephony.satellite.stub;
18 
19 import android.annotation.SdkConstant;
20 import android.app.Service;
21 import android.content.Intent;
22 import android.os.IBinder;
23 
24 import com.android.telephony.Rlog;
25 
26 /**
27  * Main SatelliteService implementation, which binds via the Telephony SatelliteServiceController.
28  * Services that extend SatelliteService must register the service in their AndroidManifest to be
29  * detected by the framework. First, the application must declare that they use the
30  * "android.permission.BIND_SATELLITE_SERVICE" permission. Then, the SatelliteService definition in
31  * the manifest must follow the following format:
32  *
33  * ...
34  * <service android:name=".EgSatelliteService"
35  *     android:permission="android.permission.BIND_SATELLITE_SERVICE" >
36  *     ...
37  *     <intent-filter>
38  *         <action android:name="android.telephony.satellite.SatelliteService" />
39  *     </intent-filter>
40  * </service>
41  * ...
42  *
43  * The telephony framework will then bind to the SatelliteService defined in the manifest if it is
44  * the default SatelliteService defined in the device overlay "config_satellite_service_package".
45  * @hide
46  */
47 public class SatelliteService extends Service {
48     private static final String TAG = "SatelliteService";
49 
50     @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
51     public static final String SERVICE_INTERFACE = "android.telephony.satellite.SatelliteService";
52 
53     /**
54      * @hide
55      */
56     @Override
onBind(Intent intent)57     public IBinder onBind(Intent intent) {
58         if (SERVICE_INTERFACE.equals(intent.getAction())) {
59             Rlog.d(TAG, "SatelliteService bound");
60             return new SatelliteImplBase(Runnable::run).getBinder();
61         }
62         return null;
63     }
64 }
65