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

@@ -55,6 +55,8 @@ public class TetherService extends Service {
@VisibleForTesting
public static final String EXTRA_RESULT = "EntitlementResult";
@VisibleForTesting
public static final String EXTRA_SUBID = "subId";
// Activity results to match the activity provision protocol.
// Default to something not ok.
@@ -100,6 +102,18 @@ public class TetherService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent.hasExtra(EXTRA_SUBID)) {
final int tetherSubId = intent.getIntExtra(EXTRA_SUBID,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
final int subId = getTetherServiceWrapper().getDefaultDataSubscriptionId();
if (tetherSubId != subId) {
Log.e(TAG, "This Provisioning request is outdated, current subId: " + subId);
if (!mInProvisionCheck) {
stopSelf();
}
return START_NOT_STICKY;
}
}
if (intent.hasExtra(ConnectivityManager.EXTRA_ADD_TETHER_TYPE)) {
int type = intent.getIntExtra(ConnectivityManager.EXTRA_ADD_TETHER_TYPE,
ConnectivityManager.TETHERING_INVALID);