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 SatelliteGatewayService implementation, which binds via the Telephony SatelliteController. 28 * Services that extend SatelliteGatewayService must register the service in their AndroidManifest 29 * to be detected by the framework. The application must declare that they require the 30 * "android.permission.BIND_SATELLITE_GATEWAY_SERVICE" permission to ensure that nothing else can 31 * bind to their service except the Telephony framework. The SatelliteGatewayService definition in 32 * the manifest must follow the following format: 33 * 34 * ... 35 * <service android:name=".EgSatelliteGatewayService" 36 * android:permission="android.permission.BIND_SATELLITE_GATEWAY_SERVICE" > 37 * ... 38 * <intent-filter> 39 * <action android:name="android.telephony.satellite.SatelliteGatewayService" /> 40 * </intent-filter> 41 * </service> 42 * ... 43 * 44 * The telephony framework will then bind to the SatelliteGatewayService defined in the manifest if 45 * it is the default SatelliteGatewayService defined in the device overlay 46 * "config_satellite_gateway_service_package". 47 * @hide 48 */ 49 public abstract class SatelliteGatewayService extends Service { 50 private static final String TAG = "SatelliteGatewayService"; 51 52 @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) 53 public static final String SERVICE_INTERFACE = 54 "android.telephony.satellite.SatelliteGatewayService"; 55 56 private final IBinder mBinder = new ISatelliteGateway.Stub() {}; 57 58 /** 59 * @hide 60 */ 61 @Override onBind(Intent intent)62 public final IBinder onBind(Intent intent) { 63 if (SERVICE_INTERFACE.equals(intent.getAction())) { 64 Rlog.d(TAG, "SatelliteGatewayService bound"); 65 return mBinder; 66 } 67 return null; 68 } 69 70 /** 71 * @return The binder for the ISatelliteGateway. 72 * @hide 73 */ getBinder()74 public final IBinder getBinder() { 75 return mBinder; 76 } 77 } 78