Merge "Telephony: Fix sim_refresh as per ril v6"
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 + "}";
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.android.internal.telephony.AdnRecord;
|
||||
import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.AdnRecordLoader;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.IccRefreshResponse;
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
import com.android.internal.telephony.cdma.RuimCard;
|
||||
import com.android.internal.telephony.MccTable;
|
||||
@@ -300,7 +301,7 @@ public final class RuimRecords extends IccRecords {
|
||||
isRecordLoadResponse = false;
|
||||
ar = (AsyncResult)msg.obj;
|
||||
if (ar.exception == null) {
|
||||
handleRuimRefresh((int[])(ar.result));
|
||||
handleRuimRefresh((IccRefreshResponse)ar.result);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -409,24 +410,30 @@ public final class RuimRecords extends IccRecords {
|
||||
((CDMAPhone) phone).notifyMessageWaitingIndicator();
|
||||
}
|
||||
|
||||
private void handleRuimRefresh(int[] result) {
|
||||
if (result == null || result.length == 0) {
|
||||
if (DBG) log("handleRuimRefresh without input");
|
||||
private void handleRuimRefresh(IccRefreshResponse refreshResponse) {
|
||||
if (refreshResponse == null) {
|
||||
if (DBG) log("handleRuimRefresh received without input");
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((result[0])) {
|
||||
case CommandsInterface.SIM_REFRESH_FILE_UPDATED:
|
||||
if (refreshResponse.aid != null &&
|
||||
!refreshResponse.aid.equals(phone.getIccCard().getAid())) {
|
||||
// This is for different app. Ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
switch (refreshResponse.refreshResult) {
|
||||
case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE:
|
||||
if (DBG) log("handleRuimRefresh with SIM_REFRESH_FILE_UPDATED");
|
||||
adnCache.reset();
|
||||
fetchRuimRecords();
|
||||
break;
|
||||
case CommandsInterface.SIM_REFRESH_INIT:
|
||||
case IccRefreshResponse.REFRESH_RESULT_INIT:
|
||||
if (DBG) log("handleRuimRefresh with SIM_REFRESH_INIT");
|
||||
// need to reload all files (that we care about)
|
||||
fetchRuimRecords();
|
||||
break;
|
||||
case CommandsInterface.SIM_REFRESH_RESET:
|
||||
case IccRefreshResponse.REFRESH_RESULT_RESET:
|
||||
if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET");
|
||||
phone.mCM.setRadioPower(false, null);
|
||||
/* Note: no need to call setRadioPower(true). Assuming the desired
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.android.internal.telephony.MccTable;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.PhoneBase;
|
||||
import com.android.internal.telephony.SmsMessageBase;
|
||||
import com.android.internal.telephony.IccRefreshResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1049,7 +1050,7 @@ public class SIMRecords extends IccRecords {
|
||||
ar = (AsyncResult)msg.obj;
|
||||
if (DBG) log("Sim REFRESH with exception: " + ar.exception);
|
||||
if (ar.exception == null) {
|
||||
handleSimRefresh((int[])(ar.result));
|
||||
handleSimRefresh((IccRefreshResponse)ar.result);
|
||||
}
|
||||
break;
|
||||
case EVENT_GET_CFIS_DONE:
|
||||
@@ -1130,27 +1131,31 @@ public class SIMRecords extends IccRecords {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSimRefresh(int[] result) {
|
||||
if (result == null || result.length == 0) {
|
||||
if (DBG) log("handleSimRefresh without input");
|
||||
private void handleSimRefresh(IccRefreshResponse refreshResponse){
|
||||
if (refreshResponse == null) {
|
||||
if (DBG) log("handleSimRefresh received without input");
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((result[0])) {
|
||||
case CommandsInterface.SIM_REFRESH_FILE_UPDATED:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_FILE_UPDATED");
|
||||
// result[1] contains the EFID of the updated file.
|
||||
int efid = result[1];
|
||||
handleFileUpdate(efid);
|
||||
if (refreshResponse.aid != null &&
|
||||
!refreshResponse.aid.equals(phone.getIccCard().getAid())) {
|
||||
// This is for different app. Ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
switch (refreshResponse.refreshResult) {
|
||||
case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE:
|
||||
if (DBG) log("handleSimRefresh with SIM_FILE_UPDATED");
|
||||
handleFileUpdate(refreshResponse.efId);
|
||||
break;
|
||||
case CommandsInterface.SIM_REFRESH_INIT:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
|
||||
case IccRefreshResponse.REFRESH_RESULT_INIT:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
|
||||
// need to reload all files (that we care about)
|
||||
adnCache.reset();
|
||||
fetchSimRecords();
|
||||
break;
|
||||
case CommandsInterface.SIM_REFRESH_RESET:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
|
||||
case IccRefreshResponse.REFRESH_RESULT_RESET:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
|
||||
phone.mCM.setRadioPower(false, null);
|
||||
/* Note: no need to call setRadioPower(true). Assuming the desired
|
||||
* radio power state is still ON (as tracked by ServiceStateTracker),
|
||||
@@ -1162,7 +1167,7 @@ public class SIMRecords extends IccRecords {
|
||||
break;
|
||||
default:
|
||||
// unknown refresh operation
|
||||
if (DBG) log("handleSimRefresh with unknown operation");
|
||||
if (DBG) log("handleSimRefresh with unknown operation");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,11 @@ public final class SimCard extends IccCard {
|
||||
return mPhone.mIccRecords.getServiceProviderName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getCurrentApplicationIndex() {
|
||||
if (mIccCardStatus == null) {
|
||||
return -1;
|
||||
}
|
||||
return mIccCardStatus.getGsmUmtsSubscriptionAppIndex();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user