Merge "Add AIDL for number verification request API"
This commit is contained in:
@@ -5516,19 +5516,40 @@ public class TelephonyManager {
|
||||
public void requestNumberVerification(@NonNull PhoneNumberRange range, long timeoutMillis,
|
||||
@NonNull @CallbackExecutor Executor executor,
|
||||
@NonNull NumberVerificationCallback callback) {
|
||||
if (executor == null) {
|
||||
throw new NullPointerException("Executor must be non-null");
|
||||
}
|
||||
if (callback == null) {
|
||||
throw new NullPointerException("Callback must be non-null");
|
||||
}
|
||||
|
||||
INumberVerificationCallback internalCallback = new INumberVerificationCallback.Stub() {
|
||||
@Override
|
||||
public void onCallReceived(String phoneNumber) throws RemoteException {
|
||||
Binder.withCleanCallingIdentity(() -> callback.onCallReceived(phoneNumber));
|
||||
public void onCallReceived(String phoneNumber) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() ->
|
||||
callback.onCallReceived(phoneNumber)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVerificationFailed(int reason) throws RemoteException {
|
||||
Binder.withCleanCallingIdentity(() -> callback.onVerificationFailed(reason));
|
||||
public void onVerificationFailed(int reason) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() ->
|
||||
callback.onVerificationFailed(reason)));
|
||||
}
|
||||
};
|
||||
|
||||
// TODO -- call the aidl method
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
telephony.requestNumberVerification(range, timeoutMillis, internalCallback,
|
||||
getOpPackageName());
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
Rlog.e(TAG, "requestNumberVerification RemoteException", ex);
|
||||
executor.execute(() ->
|
||||
callback.onVerificationFailed(NumberVerificationCallback.REASON_UNSPECIFIED));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.telephony.ICellInfoCallback;
|
||||
import android.telephony.ModemActivityInfo;
|
||||
import android.telephony.NeighboringCellInfo;
|
||||
import android.telephony.NetworkScanRequest;
|
||||
import android.telephony.PhoneNumberRange;
|
||||
import android.telephony.RadioAccessFamily;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
@@ -49,6 +50,7 @@ import android.telephony.ims.aidl.IImsRegistration;
|
||||
import android.telephony.ims.aidl.IImsRegistrationCallback;
|
||||
import com.android.ims.internal.IImsServiceFeatureCallback;
|
||||
import com.android.internal.telephony.CellNetworkScanResult;
|
||||
import com.android.internal.telephony.INumberVerificationCallback;
|
||||
import com.android.internal.telephony.OperatorInfo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -870,6 +872,17 @@ interface ITelephony {
|
||||
*/
|
||||
String getCdmaMin(int subId);
|
||||
|
||||
/**
|
||||
* Request that the next incoming call from a number matching {@code range} be intercepted.
|
||||
* @param range The range of phone numbers the caller expects a phone call from.
|
||||
* @param timeoutMillis The amount of time to wait for such a call, or
|
||||
* {@link #MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS}, whichever is lesser.
|
||||
* @param callback the callback aidl
|
||||
* @param callingPackage the calling package name.
|
||||
*/
|
||||
void requestNumberVerification(in PhoneNumberRange range, long timeoutMillis,
|
||||
in INumberVerificationCallback callback, String callingPackage);
|
||||
|
||||
/**
|
||||
* Has the calling application been granted special privileges by the carrier.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user