diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 21e9e44ddee13..ad21a18adc5b1 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -1177,6 +1177,21 @@ public interface CommandsInterface { void queryFacilityLock (String facility, String password, int serviceClass, Message response); + /** + * (AsyncResult)response.obj).result will be an Integer representing + * the sum of enabled service classes (sum of SERVICE_CLASS_*) for the + * application with appId. + * + * @param facility one of CB_FACILTY_* + * @param password password or "" if not required + * @param serviceClass is a sum of SERVICE_CLASS_* + * @param appId is application Id or null if none + * @param response is callback message + */ + + void queryFacilityLockForApp(String facility, String password, int serviceClass, String appId, + Message response); + /** * @param facility one of CB_FACILTY_* * @param lockState true means lock, false means unlock @@ -1187,6 +1202,18 @@ public interface CommandsInterface { void setFacilityLock (String facility, boolean lockState, String password, int serviceClass, Message response); + /** + * Set the facility lock for the app with this AID on the ICC card. + * + * @param facility one of CB_FACILTY_* + * @param lockState true means lock, false means unlock + * @param password password or "" if not required + * @param serviceClass is a sum of SERVICE_CLASS_* + * @param appId is application Id or null if none + * @param response is callback message + */ + void setFacilityLockForApp(String facility, boolean lockState, String password, + int serviceClass, String appId, Message response); void sendUSSD (String ussdString, Message response); diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 76c6229b017dc..bccb2194e318a 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -1643,41 +1643,59 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } + @Override public void - queryFacilityLock (String facility, String password, int serviceClass, + queryFacilityLock(String facility, String password, int serviceClass, Message response) { - RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_FACILITY_LOCK, response); - - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - - // count strings - rr.mp.writeInt(3); - - rr.mp.writeString(facility); - rr.mp.writeString(password); - - rr.mp.writeString(Integer.toString(serviceClass)); - - send(rr); + queryFacilityLockForApp(facility, password, serviceClass, null, response); } + @Override public void - setFacilityLock (String facility, boolean lockState, String password, - int serviceClass, Message response) { - String lockString; - RILRequest rr - = RILRequest.obtain(RIL_REQUEST_SET_FACILITY_LOCK, response); + queryFacilityLockForApp(String facility, String password, int serviceClass, String appId, + Message response) { + RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_FACILITY_LOCK, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); // count strings rr.mp.writeInt(4); + rr.mp.writeString(facility); + rr.mp.writeString(password); + + rr.mp.writeString(Integer.toString(serviceClass)); + rr.mp.writeString(appId); + + send(rr); + } + + @Override + public void + setFacilityLock (String facility, boolean lockState, String password, + int serviceClass, Message response) { + setFacilityLockForApp(facility, lockState, password, serviceClass, null, response); + } + + @Override + public void + setFacilityLockForApp(String facility, boolean lockState, String password, + int serviceClass, String appId, Message response) { + String lockString; + RILRequest rr + = RILRequest.obtain(RIL_REQUEST_SET_FACILITY_LOCK, response); + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + // count strings + rr.mp.writeInt(5); + rr.mp.writeString(facility); lockString = (lockState)?"1":"0"; rr.mp.writeString(lockString); rr.mp.writeString(password); rr.mp.writeString(Integer.toString(serviceClass)); + rr.mp.writeString(appId); send(rr); diff --git a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java index b6c3b67a134c7..f2ece7fc6234d 100644 --- a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java +++ b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java @@ -251,14 +251,26 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface { public void getBasebandVersion (Message response) { } - public void queryFacilityLock (String facility, String password, + @Override + public void queryFacilityLock(String facility, String password, int serviceClass, Message response) { } - public void setFacilityLock (String facility, boolean lockState, + @Override + public void queryFacilityLockForApp(String facility, String password, + int serviceClass, String appId, Message response) { + } + + @Override + public void setFacilityLock(String facility, boolean lockState, String password, int serviceClass, Message response) { } + @Override + public void setFacilityLockForApp(String facility, boolean lockState, + String password, int serviceClass, String appId, Message response) { + } + public void sendUSSD (String ussdString, Message response) { } diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java index 242d44fc6aa38..d9bd7e8761892 100644 --- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java +++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java @@ -331,35 +331,31 @@ public final class SimulatedCommands extends BaseCommands mSsnNotifyOn = enable; } - /** - * (AsyncResult)response.obj).result will be an Integer representing - * the sum of enabled service classes (sum of SERVICE_CLASS_*) - * - * @param facility one of CB_FACILTY_* - * @param pin password or "" if not required - * @param serviceClass is a sum of SERVICE_CLASS_* - */ - - public void queryFacilityLock (String facility, String pin, + @Override + public void queryFacilityLock(String facility, String pin, int serviceClass, Message result) { - if (facility != null && - facility.equals(CommandsInterface.CB_FACILITY_BA_SIM)) { + queryFacilityLockForApp(facility, pin, serviceClass, null, result); + } + + @Override + public void queryFacilityLockForApp(String facility, String pin, int serviceClass, + String appId, Message result) { + if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_SIM)) { if (result != null) { int[] r = new int[1]; r[0] = (mSimLockEnabled ? 1 : 0); - Log.i(LOG_TAG, "[SimCmd] queryFacilityLock: SIM is " + - (r[0] == 0 ? "unlocked" : "locked")); + Log.i(LOG_TAG, "[SimCmd] queryFacilityLock: SIM is " + + (r[0] == 0 ? "unlocked" : "locked")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); } return; - } else if (facility != null && - facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) { + } else if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) { if (result != null) { int[] r = new int[1]; r[0] = (mSimFdnEnabled ? 1 : 0); - Log.i(LOG_TAG, "[SimCmd] queryFacilityLock: FDN is " + - (r[0] == 0 ? "disabled" : "enabled")); + Log.i(LOG_TAG, "[SimCmd] queryFacilityLock: FDN is " + + (r[0] == 0 ? "disabled" : "enabled")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); } @@ -369,14 +365,15 @@ public final class SimulatedCommands extends BaseCommands unimplemented(result); } - /** - * @param facility one of CB_FACILTY_* - * @param lockEnabled true if SIM lock is enabled - * @param pin the SIM pin or "" if not required - * @param serviceClass is a sum of SERVICE_CLASS_* - */ - public void setFacilityLock (String facility, boolean lockEnabled, - String pin, int serviceClass, + @Override + public void setFacilityLock(String facility, boolean lockEnabled, String pin, int serviceClass, + Message result) { + setFacilityLockForApp(facility, lockEnabled, pin, serviceClass, null, result); + } + + @Override + public void setFacilityLockForApp(String facility, boolean lockEnabled, + String pin, int serviceClass, String appId, Message result) { if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_SIM)) {