/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.telecom; import android.annotation.NonNull; import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; import com.android.internal.telecom.IPhoneAccountSuggestionCallback; import com.android.internal.telecom.IPhoneAccountSuggestionService; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Base class for service that allows system apps to suggest phone accounts for outgoing calls. * * Phone account suggestions allow OEMs to intelligently select phone accounts based on knowledge * about the user's past behavior, carrier billing patterns, or other factors unknown to the AOSP * Telecom system. * OEMs who wish to provide a phone account suggestion service on their device should implement this * service in an app that resides in the /system/priv-app/ directory on their device. For security * reasons, the service's entry {@code AndroidManifest.xml} file must declare the * {@link android.Manifest.permission.BIND_PHONE_ACCOUNT_SUGGESTION_SERVICE} permission: *
* {@code ** Only one system app on each device may implement this service. If multiple system apps implement * this service, none of them will be queried for suggestions. * @hide */ @SystemApi public class PhoneAccountSuggestionService extends Service { /** * The {@link Intent} that must be declared in the {@code intent-filter} element of the * service's manifest entry. */ @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) public static final String SERVICE_INTERFACE = "android.telecom.PhoneAccountSuggestionService"; private IPhoneAccountSuggestionService mInterface = new IPhoneAccountSuggestionService.Stub() { @Override public void onAccountSuggestionRequest(IPhoneAccountSuggestionCallback callback, String number) { mCallbackMap.put(number, callback); PhoneAccountSuggestionService.this.onAccountSuggestionRequest(number); } }; private final Map* * } ** **