Ignore the outdated entitlement check

Don't run entitlement if the request is base on outdated subId.

Bug: 129751453
Test: -build, flash, boot
      -atest TetherServiceTest
      -manual test with carrier SIM

Change-Id: Id3157df1a5758f8c72acbc45c9fefd2215c87395
Merged-In: Id3157df1a5758f8c72acbc45c9fefd2215c87395
This commit is contained in:
markchien
2019-04-09 19:51:33 +08:00
committed by Mark Chien
parent 3683a688f7
commit 8667e01cf5
3 changed files with 40 additions and 3 deletions

View File

@@ -266,11 +266,26 @@ public class TetherServiceTest extends ServiceTestCase<TetherService> {
assertEquals(TetherService.class.getName(), pi.getIntent().getComponent().getClassName());
}
public void testIgnoreOutdatedRequest() {
Intent intent = new Intent();
intent.putExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_WIFI);
intent.putExtra(EXTRA_RUN_PROVISION, true);
intent.putExtra(EXTRA_PROVISION_CALLBACK, mResultReceiver);
intent.putExtra(TetherService.EXTRA_SUBID, 1 /* Tested subId number */);
startService(intent);
SystemClock.sleep(PROVISION_TIMEOUT);
assertEquals(TETHERING_INVALID, mLastTetherRequestType);
assertTrue(mWrapper.isAppInactive(ENTITLEMENT_PACKAGE_NAME));
assertTrue(mWrapper.isAppInactive(FAKE_PACKAGE_NAME));
}
private void runProvisioningForType(int type) {
Intent intent = new Intent();
intent.putExtra(EXTRA_ADD_TETHER_TYPE, type);
intent.putExtra(EXTRA_RUN_PROVISION, true);
intent.putExtra(EXTRA_PROVISION_CALLBACK, mResultReceiver);
intent.putExtra(TetherService.EXTRA_SUBID, INVALID_SUBSCRIPTION_ID);
startService(intent);
}
@@ -291,7 +306,7 @@ public class TetherServiceTest extends ServiceTestCase<TetherService> {
long startTime = SystemClock.uptimeMillis();
while (true) {
if (mLastTetherRequestType == expectedType) {
mLastTetherRequestType = -1;
mLastTetherRequestType = TETHERING_INVALID;
return true;
}
if ((SystemClock.uptimeMillis() - startTime) > PROVISION_TIMEOUT) {