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

Commit ab90741d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Introduce mutable parcelable request to open/close logical channel"

parents d1618ce4 2ebfca0f
Loading
Loading
Loading
Loading
+27 −8
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ import com.android.internal.telephony.ISms;
import com.android.internal.telephony.ISub;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.IUpdateAvailableNetworksCallback;
import com.android.internal.telephony.IccLogicalChannelRequest;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RILConstants;
@@ -6774,8 +6775,13 @@ public class TelephonyManager {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.iccOpenLogicalChannelByPort(slotIndex, DEFAULT_PORT_INDEX,
                         getOpPackageName(), aid, p2);
                IccLogicalChannelRequest request = new IccLogicalChannelRequest();
                request.slotIndex = slotIndex;
                request.aid = aid;
                request.p2 = p2;
                request.callingPackage = getOpPackageName();
                request.binder = new Binder();
                return telephony.iccOpenLogicalChannel(request);
            }
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
@@ -6842,8 +6848,15 @@ public class TelephonyManager {
    public IccOpenLogicalChannelResponse iccOpenLogicalChannel(int subId, String AID, int p2) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null)
                return telephony.iccOpenLogicalChannel(subId, getOpPackageName(), AID, p2);
            if (telephony != null) {
                IccLogicalChannelRequest request = new IccLogicalChannelRequest();
                request.subId = subId;
                request.callingPackage = getOpPackageName();
                request.aid = AID;
                request.p2 = p2;
                request.binder = new Binder();
                return telephony.iccOpenLogicalChannel(request);
            }
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
        }
@@ -6873,8 +6886,10 @@ public class TelephonyManager {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.iccCloseLogicalChannelByPort(slotIndex, DEFAULT_PORT_INDEX,
                         channel);
                IccLogicalChannelRequest request = new IccLogicalChannelRequest();
                request.slotIndex = slotIndex;
                request.channel = channel;
                return telephony.iccCloseLogicalChannel(request);
            }
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
@@ -6917,8 +6932,12 @@ public class TelephonyManager {
    public boolean iccCloseLogicalChannel(int subId, int channel) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null)
                return telephony.iccCloseLogicalChannel(subId, channel);
            if (telephony != null) {
                IccLogicalChannelRequest request = new IccLogicalChannelRequest();
                request.subId = subId;
                request.channel = channel;
                return telephony.iccCloseLogicalChannel(request);
            }
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
        }
+5 −39
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.telephony.CellNetworkScanResult;
import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.ICallForwardingInfoCallback;
import com.android.internal.telephony.IccLogicalChannelRequest;
import com.android.internal.telephony.IImsStateCallback;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.INumberVerificationCallback;
@@ -583,60 +584,25 @@ interface ITelephony {
     */
    void setCellInfoListRate(int rateInMillis);

    /**
     * Opens a logical channel to the ICC card using the physical slot index and port index.
     *
     * Input parameters equivalent to TS 27.007 AT+CCHO command.
     *
     * @param slotIndex The physical slot index of the target ICC card
     * @param portIndex The unique index referring to a port belonging to the SIM slot
     * @param callingPackage the name of the package making the call.
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @param p2 P2 parameter (described in ISO 7816-4).
     * @return an IccOpenLogicalChannelResponse object.
     */
    IccOpenLogicalChannelResponse iccOpenLogicalChannelByPort(
            int slotIndex, int portIndex, String callingPackage, String AID, int p2);

    /**
     * Opens a logical channel to the ICC card.
     *
     * Input parameters equivalent to TS 27.007 AT+CCHO command.
     *
     * @param subId The subscription to use.
     * @param callingPackage the name of the package making the call.
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @param p2 P2 parameter (described in ISO 7816-4).
     * @param request the parcelable used to indicate how to open the logical channel.
     * @return an IccOpenLogicalChannelResponse object.
     */
    IccOpenLogicalChannelResponse iccOpenLogicalChannel(
            int subId, String callingPackage, String AID, int p2);

    /**
     * Closes a previously opened logical channel to the ICC card using the physical slot index and port index.
     *
     * Input parameters equivalent to TS 27.007 AT+CCHC command.
     *
     * @param slotIndex The physical slot index of the target ICC card
     * @param portIndex The unique index referring to a port belonging to the SIM slot
     * @param channel is the channel id to be closed as returned by a
     *            successful iccOpenLogicalChannel.
     * @return true if the channel was closed successfully.
     */
    boolean iccCloseLogicalChannelByPort(int slotIndex, int portIndex, int channel);
    IccOpenLogicalChannelResponse iccOpenLogicalChannel(in IccLogicalChannelRequest request);

    /**
     * Closes a previously opened logical channel to the ICC card.
     *
     * Input parameters equivalent to TS 27.007 AT+CCHC command.
     *
     * @param subId The subscription to use.
     * @param channel is the channel id to be closed as returned by a
     *            successful iccOpenLogicalChannel.
     * @param request the parcelable used to indicate how to close the logical channel.
     * @return true if the channel was closed successfully.
     */
    @UnsupportedAppUsage(trackingBug = 171933273)
    boolean iccCloseLogicalChannel(int subId, int channel);
    boolean iccCloseLogicalChannel(in IccLogicalChannelRequest request);

    /**
     * Transmit an APDU to the ICC card over a logical channel using the physical slot index and port index.
+52 −0
Original line number Diff line number Diff line
/*
** Copyright 2007, 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;

import android.os.IBinder;

/**
 * A request to open or close a logical channel to the ICC card.
 *
 * @hide
 */
@JavaDerive(toString=true, equals=true)
parcelable IccLogicalChannelRequest {

    /** Subscription id. */
    int subId = -1;

    /** Physical slot index of the ICC card. */
    int slotIndex = -1;

    /** The unique index referring to a port belonging to the ICC card slot. */
    int portIndex = 0;

    /** Package name for the calling app, used only when open channel. */
    @nullable String callingPackage;

    /** Application id, used only when open channel. */
    @nullable String aid;

    /** The P2 parameter described in ISO 7816-4, used only when open channel. */
    int p2 = 0;

    /** Channel number */
    int channel = -1;

    /** A IBinder object for server side to check if the request client is still living. */
    @nullable IBinder binder;
}