Loading src/java/com/android/internal/telephony/test/SimulatedCommands.java +37 −85 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class SimulatedCommands extends BaseCommands public final static String FAKE_ESN = "1234"; public final static String FAKE_MEID = "1234"; public final static int DEFAULT_PIN1_ATTEMPT = 5; public final static int DEFAULT_PIN2_ATTEMPT = 5; private String mImei; private String mImeiSv; Loading Loading @@ -166,8 +167,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -177,10 +177,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState = SimLockState.NONE; mIccStatusChangedRegistrants.notifyRegistrants(); if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -190,15 +187,14 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: failed! attempt=" + mPinUnlockAttempts); if (mPinUnlockAttempts >= 3) { if (mPinUnlockAttempts >= DEFAULT_PIN1_ATTEMPT) { Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: set state to REQUIRE_PUK"); mSimLockedState = SimLockState.REQUIRE_PUK; } CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -209,8 +205,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -220,11 +215,7 @@ public class SimulatedCommands extends BaseCommands mPukUnlockAttempts = 0; mIccStatusChangedRegistrants.notifyRegistrants(); if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -240,8 +231,7 @@ public class SimulatedCommands extends BaseCommands CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -252,8 +242,7 @@ public class SimulatedCommands extends BaseCommands mSimFdnEnabledState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -262,11 +251,7 @@ public class SimulatedCommands extends BaseCommands mPin2UnlockAttempts = 0; mSimFdnEnabledState = SimFdnState.NONE; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -275,15 +260,14 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: failed! attempt=" + mPin2UnlockAttempts); if (mPin2UnlockAttempts >= 3) { if (mPin2UnlockAttempts >= DEFAULT_PIN2_ATTEMPT) { Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: set state to REQUIRE_PUK2"); mSimFdnEnabledState = SimFdnState.REQUIRE_PUK2; } CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -294,8 +278,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -304,11 +287,7 @@ public class SimulatedCommands extends BaseCommands mSimFdnEnabledState = SimFdnState.NONE; mPuk2UnlockAttempts = 0; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -324,8 +303,7 @@ public class SimulatedCommands extends BaseCommands CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -333,44 +311,32 @@ public class SimulatedCommands extends BaseCommands public void changeIccPin(String oldPin, String newPin, Message result) { if (oldPin != null && oldPin.equals(mPinCode)) { mPinCode = newPin; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] changeIccPin: pin failed!"); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); } @Override public void changeIccPin2(String oldPin2, String newPin2, Message result) { if (oldPin2 != null && oldPin2.equals(mPin2Code)) { mPin2Code = newPin2; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] changeIccPin2: pin2 failed!"); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); } @Override Loading Loading @@ -406,8 +372,7 @@ public class SimulatedCommands extends BaseCommands r[0] = (mSimLockEnabled ? 1 : 0); Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: SIM is " + (r[0] == 0 ? "unlocked" : "locked")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); resultSuccess(result, r); } return; } else if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) { Loading @@ -416,8 +381,7 @@ public class SimulatedCommands extends BaseCommands r[0] = (mSimFdnEnabled ? 1 : 0); Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: FDN is " + (r[0] == 0 ? "disabled" : "enabled")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); resultSuccess(result, r); } return; } Loading @@ -441,22 +405,16 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin is valid"); mSimLockEnabled = lockEnabled; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin failed!"); CommandException ex = new CommandException( CommandException.Error.GENERIC_FAILURE); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); return; } else if (facility != null && Loading @@ -465,22 +423,16 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 is valid"); mSimFdnEnabled = lockEnabled; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 failed!"); CommandException ex = new CommandException( CommandException.Error.GENERIC_FAILURE); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); return; } Loading tests/telephonytests/src/com/android/internal/telephony/IccCardStatusTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/IccCardStatusTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading tests/telephonytests/src/com/android/internal/telephony/IccPhoneBookInterfaceManagerTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/IccPhoneBookInterfaceManagerTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.HandlerThread; import android.os.Message; import android.os.AsyncResult; import com.android.internal.telephony.uicc.AdnRecord; import com.android.internal.telephony.uicc.AdnRecordCache; import com.android.internal.telephony.uicc.IccConstants; import com.android.internal.telephony.IccPhoneBookInterfaceManager; import com.android.internal.telephony.TelephonyTest; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.doAnswer; Loading tests/telephonytests/src/com/android/internal/telephony/UiccCardApplicationTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardApplicationTest.java +3 −5 Original line number Diff line number Diff line Loading @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.AsyncResult; import android.os.HandlerThread; import com.android.internal.telephony.CommandException; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.test.SimulatedCommands; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.UiccCard; import com.android.internal.telephony.uicc.UiccCardApplication; import com.android.internal.telephony.uicc.IccCardStatus; import org.junit.After; import org.junit.Before; Loading tests/telephonytests/src/com/android/internal/telephony/UiccCardTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardTest.java +2 −7 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.Handler; import android.os.HandlerThread; Loading @@ -24,11 +24,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.cat.CatService; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.uicc.UiccCard; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import static org.mockito.Mockito.*; Loading @@ -39,8 +36,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static com.android.internal.telephony.TelephonyTestUtils.waitForMs; import com.android.internal.telephony.uicc.IccIoResult; public class UiccCardTest extends TelephonyTest { private UiccCard mUicccard; Loading Loading
src/java/com/android/internal/telephony/test/SimulatedCommands.java +37 −85 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class SimulatedCommands extends BaseCommands public final static String FAKE_ESN = "1234"; public final static String FAKE_MEID = "1234"; public final static int DEFAULT_PIN1_ATTEMPT = 5; public final static int DEFAULT_PIN2_ATTEMPT = 5; private String mImei; private String mImeiSv; Loading Loading @@ -166,8 +167,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -177,10 +177,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState = SimLockState.NONE; mIccStatusChangedRegistrants.notifyRegistrants(); if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -190,15 +187,14 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: failed! attempt=" + mPinUnlockAttempts); if (mPinUnlockAttempts >= 3) { if (mPinUnlockAttempts >= DEFAULT_PIN1_ATTEMPT) { Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: set state to REQUIRE_PUK"); mSimLockedState = SimLockState.REQUIRE_PUK; } CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -209,8 +205,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -220,11 +215,7 @@ public class SimulatedCommands extends BaseCommands mPukUnlockAttempts = 0; mIccStatusChangedRegistrants.notifyRegistrants(); if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -240,8 +231,7 @@ public class SimulatedCommands extends BaseCommands CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -252,8 +242,7 @@ public class SimulatedCommands extends BaseCommands mSimFdnEnabledState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -262,11 +251,7 @@ public class SimulatedCommands extends BaseCommands mPin2UnlockAttempts = 0; mSimFdnEnabledState = SimFdnState.NONE; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -275,15 +260,14 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: failed! attempt=" + mPin2UnlockAttempts); if (mPin2UnlockAttempts >= 3) { if (mPin2UnlockAttempts >= DEFAULT_PIN2_ATTEMPT) { Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: set state to REQUIRE_PUK2"); mSimFdnEnabledState = SimFdnState.REQUIRE_PUK2; } CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -294,8 +278,7 @@ public class SimulatedCommands extends BaseCommands mSimLockedState); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); return; } Loading @@ -304,11 +287,7 @@ public class SimulatedCommands extends BaseCommands mSimFdnEnabledState = SimFdnState.NONE; mPuk2UnlockAttempts = 0; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } Loading @@ -324,8 +303,7 @@ public class SimulatedCommands extends BaseCommands CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); resultFail(result, null, ex); } } Loading @@ -333,44 +311,32 @@ public class SimulatedCommands extends BaseCommands public void changeIccPin(String oldPin, String newPin, Message result) { if (oldPin != null && oldPin.equals(mPinCode)) { mPinCode = newPin; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] changeIccPin: pin failed!"); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); } @Override public void changeIccPin2(String oldPin2, String newPin2, Message result) { if (oldPin2 != null && oldPin2.equals(mPin2Code)) { mPin2Code = newPin2; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] changeIccPin2: pin2 failed!"); CommandException ex = new CommandException( CommandException.Error.PASSWORD_INCORRECT); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); } @Override Loading Loading @@ -406,8 +372,7 @@ public class SimulatedCommands extends BaseCommands r[0] = (mSimLockEnabled ? 1 : 0); Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: SIM is " + (r[0] == 0 ? "unlocked" : "locked")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); resultSuccess(result, r); } return; } else if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) { Loading @@ -416,8 +381,7 @@ public class SimulatedCommands extends BaseCommands r[0] = (mSimFdnEnabled ? 1 : 0); Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: FDN is " + (r[0] == 0 ? "disabled" : "enabled")); AsyncResult.forMessage(result, r, null); result.sendToTarget(); resultSuccess(result, r); } return; } Loading @@ -441,22 +405,16 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin is valid"); mSimLockEnabled = lockEnabled; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin failed!"); CommandException ex = new CommandException( CommandException.Error.GENERIC_FAILURE); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); return; } else if (facility != null && Loading @@ -465,22 +423,16 @@ public class SimulatedCommands extends BaseCommands Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 is valid"); mSimFdnEnabled = lockEnabled; if (result != null) { AsyncResult.forMessage(result, null, null); result.sendToTarget(); } resultSuccess(result, null); return; } if (result != null) { Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 failed!"); CommandException ex = new CommandException( CommandException.Error.GENERIC_FAILURE); AsyncResult.forMessage(result, null, ex); result.sendToTarget(); } resultFail(result, null, ex); return; } Loading
tests/telephonytests/src/com/android/internal/telephony/IccCardStatusTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/IccCardStatusTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import org.junit.After; import org.junit.Before; import org.junit.Test; Loading
tests/telephonytests/src/com/android/internal/telephony/IccPhoneBookInterfaceManagerTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/IccPhoneBookInterfaceManagerTest.java +3 −4 Original line number Diff line number Diff line Loading @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.HandlerThread; import android.os.Message; import android.os.AsyncResult; import com.android.internal.telephony.uicc.AdnRecord; import com.android.internal.telephony.uicc.AdnRecordCache; import com.android.internal.telephony.uicc.IccConstants; import com.android.internal.telephony.IccPhoneBookInterfaceManager; import com.android.internal.telephony.TelephonyTest; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.doAnswer; Loading
tests/telephonytests/src/com/android/internal/telephony/UiccCardApplicationTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardApplicationTest.java +3 −5 Original line number Diff line number Diff line Loading @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.AsyncResult; import android.os.HandlerThread; import com.android.internal.telephony.CommandException; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.test.SimulatedCommands; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.UiccCard; import com.android.internal.telephony.uicc.UiccCardApplication; import com.android.internal.telephony.uicc.IccCardStatus; import org.junit.After; import org.junit.Before; Loading
tests/telephonytests/src/com/android/internal/telephony/UiccCardTest.java→tests/telephonytests/src/com/android/internal/telephony/uicc/UiccCardTest.java +2 −7 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; package com.android.internal.telephony.uicc; import android.os.Handler; import android.os.HandlerThread; Loading @@ -24,11 +24,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.cat.CatService; import com.android.internal.telephony.uicc.IccCardApplicationStatus; import com.android.internal.telephony.uicc.IccCardStatus; import com.android.internal.telephony.uicc.IccUtils; import com.android.internal.telephony.uicc.UiccCard; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import static org.mockito.Mockito.*; Loading @@ -39,8 +36,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static com.android.internal.telephony.TelephonyTestUtils.waitForMs; import com.android.internal.telephony.uicc.IccIoResult; public class UiccCardTest extends TelephonyTest { private UiccCard mUicccard; Loading