Merge "Ignore the outdated entitlement check" am: d7885ca73a am: 7b30503dc4

am: f886be6999

Change-Id: Ic2cd5ed57ec675d0ad13521cc354a1eb4cc38d69
This commit is contained in:
Mark Chien
2019-04-19 23:45:35 -07:00
committed by android-build-merger
3 changed files with 40 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ public class TetherProvisioningActivity extends Activity {
private static final int PROVISION_REQUEST = 0;
private static final String TAG = "TetherProvisioningAct";
private static final String EXTRA_TETHER_TYPE = "TETHER_TYPE";
private static final String EXTRA_SUBID = "subId";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private ResultReceiver mResultReceiver;
@@ -49,14 +50,21 @@ public class TetherProvisioningActivity extends Activity {
mResultReceiver = (ResultReceiver)getIntent().getParcelableExtra(
ConnectivityManager.EXTRA_PROVISION_CALLBACK);
int tetherType = getIntent().getIntExtra(ConnectivityManager.EXTRA_ADD_TETHER_TYPE,
final int tetherType = getIntent().getIntExtra(ConnectivityManager.EXTRA_ADD_TETHER_TYPE,
ConnectivityManager.TETHERING_INVALID);
final int tetherSubId = getIntent().getIntExtra(EXTRA_SUBID,
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
final int subId = SubscriptionManager.getDefaultDataSubscriptionId();
if (tetherSubId != subId) {
Log.e(TAG, "This Provisioning request is outdated, current subId: " + subId);
return;
}
final Resources res = Utils.getResourcesForSubId(this, subId);
final String[] provisionApp = res.getStringArray(
com.android.internal.R.array.config_mobile_hotspot_provision_app);
Intent intent = new Intent(Intent.ACTION_MAIN);
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(provisionApp[0], provisionApp[1]);
intent.putExtra(EXTRA_TETHER_TYPE, tetherType);
if (DEBUG) {

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);