Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7cc5e88 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Change ILongConsumer to Consumer<Long> for onSatelliteDatagramReceived api."

parents e1ce22a9 1a757e02
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@ package android.telephony.satellite;


import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteDatagram;


import com.android.internal.telephony.ILongConsumer;
import com.android.internal.telephony.IVoidConsumer;


/**
/**
 * Interface for satellite datagrams callback.
 * Interface for satellite datagrams callback.
@@ -31,10 +31,10 @@ oneway interface ISatelliteDatagramCallback {
     * @param datagramId An id that uniquely identifies incoming datagram.
     * @param datagramId An id that uniquely identifies incoming datagram.
     * @param datagram Datagram received from satellite.
     * @param datagram Datagram received from satellite.
     * @param pendingCount Number of datagrams yet to be 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
     * @param callback This callback will be used by datagram receiver app to to inform
     *                 datagramId to Telephony. If the callback is not received within five minutes,
     *                 Telephony that datagram is received. If the callback is not received
     *                 Telephony will resend the datagram.
     *                 within five minutes, Telephony will resend the datagram.
     */
     */
    void onSatelliteDatagramReceived(long datagramId, in SatelliteDatagram datagram,
    void onSatelliteDatagramReceived(long datagramId, in SatelliteDatagram datagram,
            int pendingCount, ILongConsumer callback);
            int pendingCount, IVoidConsumer callback);
}
}
+5 −5
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@ package android.telephony.satellite;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;


import com.android.internal.telephony.ILongConsumer;
import java.util.function.Consumer;


/**
/**
 * A callback class for listening to satellite datagrams.
 * 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 datagramId An id that uniquely identifies incoming datagram.
     * @param datagram Datagram to be received over satellite.
     * @param datagram Datagram to be received over satellite.
     * @param pendingCount Number of datagrams yet to be received by the app.
     * @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
     * @param callback This callback will be used by datagram receiver app to inform Telephony
     *                 datagramId to Telephony. If the callback is not received within five minutes,
     *                 that they received the datagram. If the callback is not received within
     *                 Telephony will resend the datagram.
     *                 five minutes, Telephony will resend the datagram.
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void onSatelliteDatagramReceived(long datagramId, @NonNull SatelliteDatagram datagram,
    void onSatelliteDatagramReceived(long datagramId, @NonNull SatelliteDatagram datagram,
            int pendingCount, @NonNull ILongConsumer callback);
            int pendingCount, @NonNull Consumer<Void> callback);
}
}
+16 −4
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyFrameworkInitializer;


import com.android.internal.telephony.IIntegerConsumer;
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.internal.telephony.ITelephony;
import com.android.telephony.Rlog;
import com.android.telephony.Rlog;


@@ -1186,10 +1186,22 @@ public class SatelliteManager {
                            @Override
                            @Override
                            public void onSatelliteDatagramReceived(long datagramId,
                            public void onSatelliteDatagramReceived(long datagramId,
                                    @NonNull SatelliteDatagram datagram, int pendingCount,
                                    @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(
                                executor.execute(() -> Binder.withCleanCallingIdentity(
                                        () -> callback.onSatelliteDatagramReceived(
                                        () -> callback.onSatelliteDatagramReceived(
                                                datagramId, datagram, pendingCount, ack)));
                                                datagramId, datagram, pendingCount, externalAck)));
                            }
                            }
                        };
                        };
                sSatelliteDatagramCallbackMap.put(callback, internalCallback);
                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
     * 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
     * satellite. If there are any incoming datagrams, they will be received via
     * {@link SatelliteDatagramCallback#onSatelliteDatagramReceived(long, SatelliteDatagram, int,
     * {@link SatelliteDatagramCallback#onSatelliteDatagramReceived(long, SatelliteDatagram, int,
     *        ILongConsumer)}
     * Consumer)} )}
     *
     *
     * @param executor The executor on which the result listener will be called.
     * @param executor The executor on which the result listener will be called.
     * @param resultListener Listener for the {@link SatelliteError} result of the operation.
     * @param resultListener Listener for the {@link SatelliteError} result of the operation.
+25 −0
Original line number Original line Diff line number Diff line
/*
 * 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();
 }
 No newline at end of file