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.telephony; 18 19 import android.annotation.FlaggedApi; 20 import android.annotation.NonNull; 21 import android.annotation.SystemApi; 22 import android.telephony.Annotation.DisconnectCauses; 23 24 import com.android.internal.telephony.flags.Flags; 25 26 import java.util.function.Consumer; 27 28 /** 29 * A callback class used by the domain selection module to notify the framework of the result of 30 * selecting a domain for a call. 31 * @hide 32 */ 33 @SystemApi 34 @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) 35 public interface TransportSelectorCallback { 36 /** 37 * Notify that {@link DomainSelector} instance has been created for the selection request. 38 * <p> 39 * DomainSelector callbacks run using the executor specified in 40 * {@link DomainSelectionService#onCreateExecutor}. 41 * 42 * @param selector the {@link DomainSelector} instance created. 43 */ onCreated(@onNull DomainSelector selector)44 void onCreated(@NonNull DomainSelector selector); 45 46 /** 47 * Notify that WLAN transport has been selected. 48 * 49 * @param useEmergencyPdn Indicates whether Wi-Fi emergency services use emergency PDN or not. 50 */ onWlanSelected(boolean useEmergencyPdn)51 void onWlanSelected(boolean useEmergencyPdn); 52 53 /** 54 * Notify that WWAN transport has been selected and the next phase of selecting 55 * the PS or CS domain is starting. 56 * 57 * @param consumer The callback used by the {@link DomainSelectionService} to optionally run 58 * emergency network scans and notify the framework of the WWAN transport result. 59 */ onWwanSelected(@onNull Consumer<WwanSelectorCallback> consumer)60 void onWwanSelected(@NonNull Consumer<WwanSelectorCallback> consumer); 61 62 /** 63 * Notify that selection has terminated because there is no decision that can be made 64 * or a timeout has occurred. The call should be terminated when this method is called. 65 * 66 * @param cause indicates the reason. 67 */ onSelectionTerminated(@isconnectCauses int cause)68 void onSelectionTerminated(@DisconnectCauses int cause); 69 } 70