Merge "Change ILongConsumer to Consumer<Long> for onSatelliteDatagramReceived api."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d7cc5e88ee
@@ -18,7 +18,7 @@ package android.telephony.satellite;
|
||||
|
||||
import android.telephony.satellite.SatelliteDatagram;
|
||||
|
||||
import com.android.internal.telephony.ILongConsumer;
|
||||
import com.android.internal.telephony.IVoidConsumer;
|
||||
|
||||
/**
|
||||
* Interface for satellite datagrams callback.
|
||||
@@ -31,10 +31,10 @@ oneway interface ISatelliteDatagramCallback {
|
||||
* @param datagramId An id that uniquely identifies incoming datagram.
|
||||
* @param datagram Datagram received from satellite.
|
||||
* @param pendingCount Number of datagrams yet to be received from satellite.
|
||||
* @param callback This callback will be used by datagram receiver app to send received
|
||||
* datagramId to Telephony. If the callback is not received within five minutes,
|
||||
* Telephony will resend the datagram.
|
||||
* @param callback This callback will be used by datagram receiver app to to inform
|
||||
* Telephony that datagram is received. If the callback is not received
|
||||
* within five minutes, Telephony will resend the datagram.
|
||||
*/
|
||||
void onSatelliteDatagramReceived(long datagramId, in SatelliteDatagram datagram,
|
||||
int pendingCount, ILongConsumer callback);
|
||||
int pendingCount, IVoidConsumer callback);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package android.telephony.satellite;
|
||||
import android.annotation.NonNull;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
|
||||
import com.android.internal.telephony.ILongConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* A callback class for listening to satellite datagrams.
|
||||
@@ -33,11 +33,11 @@ public interface SatelliteDatagramCallback {
|
||||
* @param datagramId An id that uniquely identifies incoming datagram.
|
||||
* @param datagram Datagram to be received over satellite.
|
||||
* @param pendingCount Number of datagrams yet to be received by the app.
|
||||
* @param callback This callback will be used by datagram receiver app to send received
|
||||
* datagramId to Telephony. If the callback is not received within five minutes,
|
||||
* Telephony will resend the datagram.
|
||||
* @param callback This callback will be used by datagram receiver app to inform Telephony
|
||||
* that they received the datagram. If the callback is not received within
|
||||
* five minutes, Telephony will resend the datagram.
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
void onSatelliteDatagramReceived(long datagramId, @NonNull SatelliteDatagram datagram,
|
||||
int pendingCount, @NonNull ILongConsumer callback);
|
||||
int pendingCount, @NonNull Consumer<Void> callback);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyFrameworkInitializer;
|
||||
|
||||
import com.android.internal.telephony.IIntegerConsumer;
|
||||
import com.android.internal.telephony.ILongConsumer;
|
||||
import com.android.internal.telephony.IVoidConsumer;
|
||||
import com.android.internal.telephony.ITelephony;
|
||||
import com.android.telephony.Rlog;
|
||||
|
||||
@@ -1186,10 +1186,22 @@ public class SatelliteManager {
|
||||
@Override
|
||||
public void onSatelliteDatagramReceived(long datagramId,
|
||||
@NonNull SatelliteDatagram datagram, int pendingCount,
|
||||
@NonNull ILongConsumer ack) {
|
||||
@NonNull IVoidConsumer internalAck) {
|
||||
Consumer<Void> externalAck = new Consumer<Void>() {
|
||||
@Override
|
||||
public void accept(Void result) {
|
||||
try {
|
||||
internalAck.accept();
|
||||
} catch (RemoteException e) {
|
||||
logd("onSatelliteDatagramReceived "
|
||||
+ "RemoteException: " + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
executor.execute(() -> Binder.withCleanCallingIdentity(
|
||||
() -> callback.onSatelliteDatagramReceived(
|
||||
datagramId, datagram, pendingCount, ack)));
|
||||
datagramId, datagram, pendingCount, externalAck)));
|
||||
}
|
||||
};
|
||||
sSatelliteDatagramCallbackMap.put(callback, internalCallback);
|
||||
@@ -1244,7 +1256,7 @@ public class SatelliteManager {
|
||||
* This method requests modem to check if there are any pending datagrams to be received over
|
||||
* satellite. If there are any incoming datagrams, they will be received via
|
||||
* {@link SatelliteDatagramCallback#onSatelliteDatagramReceived(long, SatelliteDatagram, int,
|
||||
* ILongConsumer)}
|
||||
* Consumer)} )}
|
||||
*
|
||||
* @param executor The executor on which the result listener will be called.
|
||||
* @param resultListener Listener for the {@link SatelliteError} result of the operation.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2023 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 com.android.internal.telephony;
|
||||
|
||||
/**
|
||||
* Copies consumer pattern for an operation that requires void result from another process to
|
||||
* finish.
|
||||
*/
|
||||
oneway interface IVoidConsumer {
|
||||
void accept();
|
||||
}
|
||||
Reference in New Issue
Block a user