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

Commit 31ac7552 authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android (Google) Code Review
Browse files

Merge "Add new APIs iccExchangeSimIO and iccTransmitApduBasicChannel to...

Merge "Add new APIs iccExchangeSimIO and iccTransmitApduBasicChannel to TelephonyManager." into lmp-dev
parents 11d2e53d a122e8df
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -29237,6 +29237,20 @@ package android.telephony {
    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
  }
  }
  public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
    method public int describeContents();
    method public int getChannel();
    method public byte[] getSelectResponse();
    method public int getStatus();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static int INVALID_CHANNEL;
    field public static int MISSING_RESOURCE;
    field public static int NO_ERROR;
    field public static int NO_SUCH_ELEMENT;
    field public static int UNKNOWN_ERROR;
  }
  public class MessagingConfigurationManager {
  public class MessagingConfigurationManager {
    method public boolean getCarrierConfigBoolean(java.lang.String, boolean);
    method public boolean getCarrierConfigBoolean(java.lang.String, boolean);
    method public int getCarrierConfigInt(java.lang.String, int);
    method public int getCarrierConfigInt(java.lang.String, int);
@@ -29559,7 +29573,8 @@ package android.telephony {
    method public int hasCarrierPrivileges();
    method public int hasCarrierPrivileges();
    method public boolean hasIccCard();
    method public boolean hasIccCard();
    method public boolean iccCloseLogicalChannel(int);
    method public boolean iccCloseLogicalChannel(int);
    method public int iccOpenLogicalChannel(java.lang.String);
    method public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannel(java.lang.String);
    method public java.lang.String iccTransmitApduBasicChannel(int, int, int, int, int, java.lang.String);
    method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
    method public java.lang.String iccTransmitApduLogicalChannel(int, int, int, int, int, int, java.lang.String);
    method public boolean isNetworkRoaming();
    method public boolean isNetworkRoaming();
    method public boolean isSmsCapable();
    method public boolean isSmsCapable();
+20 −0
Original line number Original line Diff line number Diff line
/*
**
** Copyright 2014, 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.telephony;

parcelable IccOpenLogicalChannelResponse;
+121 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2014 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.telephony;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * Response to the {@link TelephonyManager#iccOpenLogicalChannel} command.
 */
public class IccOpenLogicalChannelResponse implements Parcelable {
    // Indicates an invalid channel.
    public static int INVALID_CHANNEL = -1;

    // Possible status values.
    public static int NO_ERROR = 1;
    public static int MISSING_RESOURCE = 2;
    public static int NO_SUCH_ELEMENT = 3;
    public static int UNKNOWN_ERROR = 4;

    private final int mChannel;
    private final int mStatus;
    private final byte[] mSelectResponse;

    /**
     * Constructor.
     *
     * @hide
     */
    public IccOpenLogicalChannelResponse(int channel, int status, byte[] selectResponse) {
        mChannel = channel;
        mStatus = status;
        mSelectResponse = selectResponse;
    }

    /**
     * Construct a IccOpenLogicalChannelResponse from a given parcel.
     */
    private IccOpenLogicalChannelResponse(Parcel in) {
        mChannel = in.readInt();
        mStatus = in.readInt();
        int arrayLength = in.readInt();
        if (arrayLength > 0) {
            mSelectResponse = new byte[arrayLength];
            in.readByteArray(mSelectResponse);
        } else {
            mSelectResponse = null;
        }
    }

    /**
     * @return the channel id.
     */
    public int getChannel() {
        return mChannel;
    }

    /**
     * @return the status of the command.
     */
    public int getStatus() {
        return mStatus;
    }

    /**
     * @return the select response.
     */
    public byte[] getSelectResponse() {
        return mSelectResponse;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(mChannel);
        out.writeInt(mStatus);
        if (mSelectResponse != null & mSelectResponse.length > 0) {
            out.writeInt(mSelectResponse.length);
            out.writeByteArray(mSelectResponse);
        } else {
            out.writeInt(0);
        }
    }

    public static final Parcelable.Creator<IccOpenLogicalChannelResponse> CREATOR
             = new Parcelable.Creator<IccOpenLogicalChannelResponse>() {

        @Override
        public IccOpenLogicalChannelResponse createFromParcel(Parcel in) {
             return new IccOpenLogicalChannelResponse(in);
         }

         public IccOpenLogicalChannelResponse[] newArray(int size) {
             return new IccOpenLogicalChannelResponse[size];
         }
     };

    @Override
    public String toString() {
        return "Channel: " + mChannel + " Status: " + mStatus;
    }
}
+60 −3
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.util.Log;
import android.util.Log;
import android.util.Pair;


import com.android.internal.telecomm.ITelecommService;
import com.android.internal.telecomm.ITelecommService;
import com.android.internal.telephony.IPhoneSubInfo;
import com.android.internal.telephony.IPhoneSubInfo;
@@ -2348,15 +2349,15 @@ public class TelephonyManager {
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     *
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @return The logical channel id which is negative on error.
     * @return an IccOpenLogicalChannelResponse object.
     */
     */
    public int iccOpenLogicalChannel(String AID) {
    public IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID) {
        try {
        try {
            return getITelephony().iccOpenLogicalChannel(AID);
            return getITelephony().iccOpenLogicalChannel(AID);
        } catch (RemoteException ex) {
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
        } catch (NullPointerException ex) {
        }
        }
        return -1;
        return null;
    }
    }


    /**
    /**
@@ -2413,6 +2414,62 @@ public class TelephonyManager {
        return "";
        return "";
    }
    }


    /**
     * Transmit an APDU to the ICC card over the basic channel.
     *
     * Input parameters equivalent to TS 27.007 AT+CSIM command.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * @param cla Class of the APDU command.
     * @param instruction Instruction of the APDU command.
     * @param p1 P1 value of the APDU command.
     * @param p2 P2 value of the APDU command.
     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
     *            is sent to the SIM.
     * @param data Data to be sent with the APDU.
     * @return The APDU response from the ICC card with the status appended at
     *            the end. If an error occurs, an empty string is returned.
     */
    public String iccTransmitApduBasicChannel(int cla,
            int instruction, int p1, int p2, int p3, String data) {
        try {
            return getITelephony().iccTransmitApduBasicChannel(cla,
                    instruction, p1, p2, p3, data);
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
        }
        return "";
    }

    /**
     * Returns the response APDU for a command APDU sent through SIM_IO.
     *
     * <p>Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * @param fileID
     * @param command
     * @param p1 P1 value of the APDU command.
     * @param p2 P2 value of the APDU command.
     * @param p3 P3 value of the APDU command.
     * @param filePath
     * @return The APDU response.
     */
    byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
            String filePath) {
        try {
            return getITelephony().iccExchangeSimIO(fileID, command, p1, p2,
                p3, filePath);
        } catch (RemoteException ex) {
        } catch (NullPointerException ex) {
        }
        return null;
    }

    /**
    /**
     * Send ENVELOPE to the SIM and return the response.
     * Send ENVELOPE to the SIM and return the response.
     *
     *
+37 −4
Original line number Original line Diff line number Diff line
@@ -18,9 +18,10 @@ package com.android.internal.telephony;


import android.content.Intent;
import android.content.Intent;
import android.os.Bundle;
import android.os.Bundle;
import java.util.List;
import android.telephony.NeighboringCellInfo;
import android.telephony.CellInfo;
import android.telephony.CellInfo;
import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.NeighboringCellInfo;
import java.util.List;




/**
/**
@@ -499,9 +500,9 @@ interface ITelephony {
     * Input parameters equivalent to TS 27.007 AT+CCHO command.
     * Input parameters equivalent to TS 27.007 AT+CCHO command.
     *
     *
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @param AID Application id. See ETSI 102.221 and 101.220.
     * @return The logical channel id which is set to -1 on error.
     * @return an IccOpenLogicalChannelResponse object.
     */
     */
    int iccOpenLogicalChannel(String AID);
    IccOpenLogicalChannelResponse iccOpenLogicalChannel(String AID);


    /**
    /**
     * Closes a previously opened logical channel to the ICC card.
     * Closes a previously opened logical channel to the ICC card.
@@ -534,6 +535,38 @@ interface ITelephony {
    String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
    String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
            int p1, int p2, int p3, String data);
            int p1, int p2, int p3, String data);


    /**
     * Transmit an APDU to the ICC card over the basic channel.
     *
     * Input parameters equivalent to TS 27.007 AT+CSIM command.
     *
     * @param cla Class of the APDU command.
     * @param instruction Instruction of the APDU command.
     * @param p1 P1 value of the APDU command.
     * @param p2 P2 value of the APDU command.
     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
     *            is sent to the SIM.
     * @param data Data to be sent with the APDU.
     * @return The APDU response from the ICC card with the status appended at
     *            the end. If an error occurs, an empty string is returned.
     */
    String iccTransmitApduBasicChannel(int cla, int instruction,
            int p1, int p2, int p3, String data);

    /**
     * Returns the response APDU for a command APDU sent through SIM_IO.
     *
     * @param fileID
     * @param command
     * @param p1 P1 value of the APDU command.
     * @param p2 P2 value of the APDU command.
     * @param p3 P3 value of the APDU command.
     * @param filePath
     * @return The APDU response.
     */
    byte[] iccExchangeSimIO(int fileID, int command, int p1, int p2, int p3,
            String filePath);

    /**
    /**
     * Send ENVELOPE to the SIM and returns the response.
     * Send ENVELOPE to the SIM and returns the response.
     *
     *