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

Commit 064d2d65 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Telephony: Fix sim_refresh as per ril v6"

parents f46723b4 8f241458
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -93,11 +93,6 @@ public interface CommandsInterface {
    static final int USSD_MODE_NOTIFY       = 0;
    static final int USSD_MODE_REQUEST      = 1;

    // SIM Refresh results, passed up from RIL.
    static final int SIM_REFRESH_FILE_UPDATED   = 0;  // Single file updated
    static final int SIM_REFRESH_INIT           = 1;  // SIM initialized; reload all
    static final int SIM_REFRESH_RESET          = 2;  // SIM reset; may be locked

    // GSM SMS fail cause for acknowledgeLastIncomingSMS. From TS 23.040, 9.2.3.22.
    static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED    = 0xD3;
    static final int GSM_SMS_FAIL_CAUSE_USIM_APP_TOOLKIT_BUSY       = 0xD4;
+21 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public abstract class IccCard {
    protected String mLogTag;
    protected boolean mDbg;

    private IccCardStatus mIccCardStatus = null;
    protected IccCardStatus mIccCardStatus = null;
    protected State mState = null;
    private final Object mStateMonitor = new Object();

@@ -911,4 +911,24 @@ public abstract class IccCard {
    private void log(String msg) {
        Log.d(mLogTag, "[IccCard] " + msg);
    }

    protected abstract int getCurrentApplicationIndex();

    public String getAid() {
        String aid = "";
        int appIndex = getCurrentApplicationIndex();

        if (appIndex >= 0 && appIndex < IccCardStatus.CARD_MAX_APPS) {
            IccCardApplication app = mIccCardStatus.getApplication(appIndex);
            if (app != null) {
                aid = app.aid;
            } else {
                Log.e(mLogTag, "[IccCard] getAid: no current application index=" + appIndex);
            }
        } else {
            Log.e(mLogTag, "[IccCard] getAid: Invalid Subscription Application index=" + appIndex);
        }

        return aid;
    }
}
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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;

/**
 * See also RIL_SimRefresh in include/telephony/ril.h
 *
 * {@hide}
 */

public class IccRefreshResponse {

    public static final int REFRESH_RESULT_FILE_UPDATE = 0; /* Single file was updated */
    public static final int REFRESH_RESULT_INIT = 1;        /* The Icc has been initialized */
    public static final int REFRESH_RESULT_RESET = 2;       /* The Icc was reset */

    public int             refreshResult;      /* Sim Refresh result */
    public int             efId;               /* EFID */
    public String          aid;                /* null terminated string, e.g.,
                                                  from 0xA0, 0x00 -> 0x41,
                                                  0x30, 0x30, 0x30 */
                                               /* Example: a0000000871002f310ffff89080000ff */

    @Override
    public String toString() {
        return "{" + refreshResult + ", " + aid +", " + efId + "}";
    }
}
+12 −1
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
import com.android.internal.telephony.cdma.CdmaInformationRecords;
import com.android.internal.telephony.IccRefreshResponse;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -2419,7 +2420,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            case RIL_UNSOL_STK_EVENT_NOTIFY: ret = responseString(p); break;
            case RIL_UNSOL_STK_CALL_SETUP: ret = responseInts(p); break;
            case RIL_UNSOL_SIM_SMS_STORAGE_FULL: ret =  responseVoid(p); break;
            case RIL_UNSOL_SIM_REFRESH: ret =  responseInts(p); break;
            case RIL_UNSOL_SIM_REFRESH: ret =  responseSimRefresh(p); break;
            case RIL_UNSOL_CALL_RING: ret =  responseCallRing(p); break;
            case RIL_UNSOL_RESTRICTED_STATE_CHANGED: ret = responseInts(p); break;
            case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:  ret =  responseVoid(p); break;
@@ -2975,6 +2976,16 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        return status;
    }

    private Object
    responseSimRefresh(Parcel p) {
        IccRefreshResponse response = new IccRefreshResponse();

        response.refreshResult = p.readInt();
        response.efId   = p.readInt();
        response.aid = p.readString();
        return response;
    }

    private Object
    responseCallList(Parcel p) {
        int num;
+8 −0
Original line number Diff line number Diff line
@@ -44,5 +44,13 @@ public final class RuimCard extends IccCard {
    public String getServiceProviderName () {
        return mPhone.mIccRecords.getServiceProviderName();
    }

    @Override
    protected int getCurrentApplicationIndex() {
        if (mIccCardStatus == null) {
            return -1;
        }
        return mIccCardStatus.getCdmaSubscriptionAppIndex();
    }
 }
Loading