Merge "Revert "Pass entitlement configuration to Settings for entitlement check"" into rvc-dev am: f1b2407490 am: b4ac5bc5b4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11836348 Change-Id: I802dd4ee567f4210b2ad36287ff20ee706800c6d
This commit is contained in:
@@ -37,8 +37,8 @@ public final class TetheringConstants {
|
|||||||
private TetheringConstants() { }
|
private TetheringConstants() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra used for communicating with the TetherService and TetherProvisioningActivity.
|
* Extra used for communicating with the TetherService. Includes the type of tethering to
|
||||||
* Includes the type of tethering to enable if any.
|
* enable if any.
|
||||||
*/
|
*/
|
||||||
public static final String EXTRA_ADD_TETHER_TYPE = "extraAddTetherType";
|
public static final String EXTRA_ADD_TETHER_TYPE = "extraAddTetherType";
|
||||||
/**
|
/**
|
||||||
@@ -56,38 +56,8 @@ public final class TetheringConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String EXTRA_RUN_PROVISION = "extraRunProvision";
|
public static final String EXTRA_RUN_PROVISION = "extraRunProvision";
|
||||||
/**
|
/**
|
||||||
* Extra used for communicating with the TetherService and TetherProvisioningActivity.
|
* Extra used for communicating with the TetherService. Contains the {@link ResultReceiver}
|
||||||
* Contains the {@link ResultReceiver} which will receive provisioning results.
|
* which will receive provisioning results. Can be left empty.
|
||||||
* Can not be empty.
|
|
||||||
*/
|
*/
|
||||||
public static final String EXTRA_PROVISION_CALLBACK = "extraProvisionCallback";
|
public static final String EXTRA_PROVISION_CALLBACK = "extraProvisionCallback";
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra used for communicating with the TetherService and TetherProvisioningActivity.
|
|
||||||
* Contains the subId of current active cellular upstream.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_TETHER_SUBID = "android.net.extra.TETHER_SUBID";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra used for telling TetherProvisioningActivity the entitlement package name and class
|
|
||||||
* name to start UI entitlement check.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_TETHER_UI_PROVISIONING_APP_NAME =
|
|
||||||
"android.net.extra.TETHER_UI_PROVISIONING_APP_NAME";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra used for telling TetherService the intent action to start silent entitlement check.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_TETHER_SILENT_PROVISIONING_ACTION =
|
|
||||||
"android.net.extra.TETHER_SILENT_PROVISIONING_ACTION";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra used for TetherService to receive the response of provisioning check.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_TETHER_PROVISIONING_RESPONSE =
|
|
||||||
"android.net.extra.TETHER_PROVISIONING_RESPONSE";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ package com.android.networkstack.tethering;
|
|||||||
import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE;
|
import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE;
|
||||||
import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK;
|
import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK;
|
||||||
import static android.net.TetheringConstants.EXTRA_RUN_PROVISION;
|
import static android.net.TetheringConstants.EXTRA_RUN_PROVISION;
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_PROVISIONING_RESPONSE;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_SILENT_PROVISIONING_ACTION;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_SUBID;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_UI_PROVISIONING_APP_NAME;
|
|
||||||
import static android.net.TetheringManager.TETHERING_BLUETOOTH;
|
import static android.net.TetheringManager.TETHERING_BLUETOOTH;
|
||||||
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
||||||
import static android.net.TetheringManager.TETHERING_INVALID;
|
import static android.net.TetheringManager.TETHERING_INVALID;
|
||||||
@@ -73,6 +69,7 @@ public class EntitlementManager {
|
|||||||
protected static final String DISABLE_PROVISIONING_SYSPROP_KEY = "net.tethering.noprovisioning";
|
protected static final String DISABLE_PROVISIONING_SYSPROP_KEY = "net.tethering.noprovisioning";
|
||||||
private static final String ACTION_PROVISIONING_ALARM =
|
private static final String ACTION_PROVISIONING_ALARM =
|
||||||
"com.android.networkstack.tethering.PROVISIONING_RECHECK_ALARM";
|
"com.android.networkstack.tethering.PROVISIONING_RECHECK_ALARM";
|
||||||
|
private static final String EXTRA_SUBID = "subId";
|
||||||
|
|
||||||
private final ComponentName mSilentProvisioningService;
|
private final ComponentName mSilentProvisioningService;
|
||||||
private static final int MS_PER_HOUR = 60 * 60 * 1000;
|
private static final int MS_PER_HOUR = 60 * 60 * 1000;
|
||||||
@@ -200,9 +197,9 @@ public class EntitlementManager {
|
|||||||
// till upstream change to cellular.
|
// till upstream change to cellular.
|
||||||
if (mUsingCellularAsUpstream) {
|
if (mUsingCellularAsUpstream) {
|
||||||
if (showProvisioningUi) {
|
if (showProvisioningUi) {
|
||||||
runUiTetherProvisioning(downstreamType, config);
|
runUiTetherProvisioning(downstreamType, config.activeDataSubId);
|
||||||
} else {
|
} else {
|
||||||
runSilentTetherProvisioning(downstreamType, config);
|
runSilentTetherProvisioning(downstreamType, config.activeDataSubId);
|
||||||
}
|
}
|
||||||
mNeedReRunProvisioningUi = false;
|
mNeedReRunProvisioningUi = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -265,9 +262,9 @@ public class EntitlementManager {
|
|||||||
if (mCurrentEntitlementResults.indexOfKey(downstream) < 0) {
|
if (mCurrentEntitlementResults.indexOfKey(downstream) < 0) {
|
||||||
if (mNeedReRunProvisioningUi) {
|
if (mNeedReRunProvisioningUi) {
|
||||||
mNeedReRunProvisioningUi = false;
|
mNeedReRunProvisioningUi = false;
|
||||||
runUiTetherProvisioning(downstream, config);
|
runUiTetherProvisioning(downstream, config.activeDataSubId);
|
||||||
} else {
|
} else {
|
||||||
runSilentTetherProvisioning(downstream, config);
|
runSilentTetherProvisioning(downstream, config.activeDataSubId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,7 +361,7 @@ public class EntitlementManager {
|
|||||||
* @param subId default data subscription ID.
|
* @param subId default data subscription ID.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected Intent runSilentTetherProvisioning(int type, final TetheringConfiguration config) {
|
protected void runSilentTetherProvisioning(int type, int subId) {
|
||||||
if (DBG) mLog.i("runSilentTetherProvisioning: " + type);
|
if (DBG) mLog.i("runSilentTetherProvisioning: " + type);
|
||||||
// For silent provisioning, settings would stop tethering when entitlement fail.
|
// For silent provisioning, settings would stop tethering when entitlement fail.
|
||||||
ResultReceiver receiver = buildProxyReceiver(type, false/* notifyFail */, null);
|
ResultReceiver receiver = buildProxyReceiver(type, false/* notifyFail */, null);
|
||||||
@@ -372,20 +369,17 @@ public class EntitlementManager {
|
|||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(EXTRA_ADD_TETHER_TYPE, type);
|
intent.putExtra(EXTRA_ADD_TETHER_TYPE, type);
|
||||||
intent.putExtra(EXTRA_RUN_PROVISION, true);
|
intent.putExtra(EXTRA_RUN_PROVISION, true);
|
||||||
intent.putExtra(EXTRA_TETHER_SILENT_PROVISIONING_ACTION, config.provisioningAppNoUi);
|
|
||||||
intent.putExtra(EXTRA_TETHER_PROVISIONING_RESPONSE, config.provisioningResponse);
|
|
||||||
intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver);
|
intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver);
|
||||||
intent.putExtra(EXTRA_TETHER_SUBID, config.activeDataSubId);
|
intent.putExtra(EXTRA_SUBID, subId);
|
||||||
intent.setComponent(mSilentProvisioningService);
|
intent.setComponent(mSilentProvisioningService);
|
||||||
// Only admin user can change tethering and SilentTetherProvisioning don't need to
|
// Only admin user can change tethering and SilentTetherProvisioning don't need to
|
||||||
// show UI, it is fine to always start setting's background service as system user.
|
// show UI, it is fine to always start setting's background service as system user.
|
||||||
mContext.startService(intent);
|
mContext.startService(intent);
|
||||||
return intent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runUiTetherProvisioning(int type, final TetheringConfiguration config) {
|
private void runUiTetherProvisioning(int type, int subId) {
|
||||||
ResultReceiver receiver = buildProxyReceiver(type, true/* notifyFail */, null);
|
ResultReceiver receiver = buildProxyReceiver(type, true/* notifyFail */, null);
|
||||||
runUiTetherProvisioning(type, config, receiver);
|
runUiTetherProvisioning(type, subId, receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -395,20 +389,17 @@ public class EntitlementManager {
|
|||||||
* @param receiver to receive entitlement check result.
|
* @param receiver to receive entitlement check result.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected Intent runUiTetherProvisioning(int type, final TetheringConfiguration config,
|
protected void runUiTetherProvisioning(int type, int subId, ResultReceiver receiver) {
|
||||||
ResultReceiver receiver) {
|
|
||||||
if (DBG) mLog.i("runUiTetherProvisioning: " + type);
|
if (DBG) mLog.i("runUiTetherProvisioning: " + type);
|
||||||
|
|
||||||
Intent intent = new Intent(Settings.ACTION_TETHER_PROVISIONING_UI);
|
Intent intent = new Intent(Settings.ACTION_TETHER_PROVISIONING_UI);
|
||||||
intent.putExtra(EXTRA_ADD_TETHER_TYPE, type);
|
intent.putExtra(EXTRA_ADD_TETHER_TYPE, type);
|
||||||
intent.putExtra(EXTRA_TETHER_UI_PROVISIONING_APP_NAME, config.provisioningApp);
|
|
||||||
intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver);
|
intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver);
|
||||||
intent.putExtra(EXTRA_TETHER_SUBID, config.activeDataSubId);
|
intent.putExtra(EXTRA_SUBID, subId);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
// Only launch entitlement UI for system user. Entitlement UI should not appear for other
|
// Only launch entitlement UI for system user. Entitlement UI should not appear for other
|
||||||
// user because only admin user is allowed to change tethering.
|
// user because only admin user is allowed to change tethering.
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
return intent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not needed to check if this don't run on the handler thread because it's private.
|
// Not needed to check if this don't run on the handler thread because it's private.
|
||||||
@@ -640,7 +631,7 @@ public class EntitlementManager {
|
|||||||
receiver.send(cacheValue, null);
|
receiver.send(cacheValue, null);
|
||||||
} else {
|
} else {
|
||||||
ResultReceiver proxy = buildProxyReceiver(downstream, false/* notifyFail */, receiver);
|
ResultReceiver proxy = buildProxyReceiver(downstream, false/* notifyFail */, receiver);
|
||||||
runUiTetherProvisioning(downstream, config, proxy);
|
runUiTetherProvisioning(downstream, config.activeDataSubId, proxy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ public class TetheringConfiguration {
|
|||||||
public final String[] provisioningApp;
|
public final String[] provisioningApp;
|
||||||
public final String provisioningAppNoUi;
|
public final String provisioningAppNoUi;
|
||||||
public final int provisioningCheckPeriod;
|
public final int provisioningCheckPeriod;
|
||||||
public final String provisioningResponse;
|
|
||||||
|
|
||||||
public final int activeDataSubId;
|
public final int activeDataSubId;
|
||||||
|
|
||||||
@@ -142,13 +141,10 @@ public class TetheringConfiguration {
|
|||||||
enableLegacyDhcpServer = getEnableLegacyDhcpServer(res);
|
enableLegacyDhcpServer = getEnableLegacyDhcpServer(res);
|
||||||
|
|
||||||
provisioningApp = getResourceStringArray(res, R.array.config_mobile_hotspot_provision_app);
|
provisioningApp = getResourceStringArray(res, R.array.config_mobile_hotspot_provision_app);
|
||||||
provisioningAppNoUi = getResourceString(res,
|
provisioningAppNoUi = getProvisioningAppNoUi(res);
|
||||||
R.string.config_mobile_hotspot_provision_app_no_ui);
|
|
||||||
provisioningCheckPeriod = getResourceInteger(res,
|
provisioningCheckPeriod = getResourceInteger(res,
|
||||||
R.integer.config_mobile_hotspot_provision_check_period,
|
R.integer.config_mobile_hotspot_provision_check_period,
|
||||||
0 /* No periodic re-check */);
|
0 /* No periodic re-check */);
|
||||||
provisioningResponse = getResourceString(res,
|
|
||||||
R.string.config_mobile_hotspot_provision_response);
|
|
||||||
|
|
||||||
mOffloadPollInterval = getResourceInteger(res,
|
mOffloadPollInterval = getResourceInteger(res,
|
||||||
R.integer.config_tether_offload_poll_interval,
|
R.integer.config_tether_offload_poll_interval,
|
||||||
@@ -341,9 +337,9 @@ public class TetheringConfiguration {
|
|||||||
return copy(LEGACY_DHCP_DEFAULT_RANGE);
|
return copy(LEGACY_DHCP_DEFAULT_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getResourceString(Resources res, final int resId) {
|
private static String getProvisioningAppNoUi(Resources res) {
|
||||||
try {
|
try {
|
||||||
return res.getString(resId);
|
return res.getString(R.string.config_mobile_hotspot_provision_app_no_ui);
|
||||||
} catch (Resources.NotFoundException e) {
|
} catch (Resources.NotFoundException e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,8 @@
|
|||||||
|
|
||||||
package com.android.networkstack.tethering;
|
package com.android.networkstack.tethering;
|
||||||
|
|
||||||
import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_RUN_PROVISION;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_PROVISIONING_RESPONSE;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_SILENT_PROVISIONING_ACTION;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_SUBID;
|
|
||||||
import static android.net.TetheringConstants.EXTRA_TETHER_UI_PROVISIONING_APP_NAME;
|
|
||||||
import static android.net.TetheringManager.TETHERING_BLUETOOTH;
|
import static android.net.TetheringManager.TETHERING_BLUETOOTH;
|
||||||
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
import static android.net.TetheringManager.TETHERING_ETHERNET;
|
||||||
import static android.net.TetheringManager.TETHERING_INVALID;
|
|
||||||
import static android.net.TetheringManager.TETHERING_USB;
|
import static android.net.TetheringManager.TETHERING_USB;
|
||||||
import static android.net.TetheringManager.TETHERING_WIFI;
|
import static android.net.TetheringManager.TETHERING_WIFI;
|
||||||
import static android.net.TetheringManager.TETHERING_WIFI_P2P;
|
import static android.net.TetheringManager.TETHERING_WIFI_P2P;
|
||||||
@@ -52,7 +44,6 @@ import static org.mockito.Mockito.verify;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.util.SharedLog;
|
import android.net.util.SharedLog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -62,7 +53,6 @@ import android.os.ResultReceiver;
|
|||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.test.TestLooper;
|
import android.os.test.TestLooper;
|
||||||
import android.provider.DeviceConfig;
|
import android.provider.DeviceConfig;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -86,7 +76,6 @@ public final class EntitlementManagerTest {
|
|||||||
|
|
||||||
private static final String[] PROVISIONING_APP_NAME = {"some", "app"};
|
private static final String[] PROVISIONING_APP_NAME = {"some", "app"};
|
||||||
private static final String PROVISIONING_NO_UI_APP_NAME = "no_ui_app";
|
private static final String PROVISIONING_NO_UI_APP_NAME = "no_ui_app";
|
||||||
private static final String PROVISIONING_APP_RESPONSE = "app_response";
|
|
||||||
|
|
||||||
@Mock private CarrierConfigManager mCarrierConfigManager;
|
@Mock private CarrierConfigManager mCarrierConfigManager;
|
||||||
@Mock private Context mContext;
|
@Mock private Context mContext;
|
||||||
@@ -133,51 +122,15 @@ public final class EntitlementManagerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Intent runUiTetherProvisioning(int type,
|
protected void runUiTetherProvisioning(int type, int subId, ResultReceiver receiver) {
|
||||||
final TetheringConfiguration config, final ResultReceiver receiver) {
|
|
||||||
Intent intent = super.runUiTetherProvisioning(type, config, receiver);
|
|
||||||
assertUiTetherProvisioningIntent(type, config, receiver, intent);
|
|
||||||
uiProvisionCount++;
|
uiProvisionCount++;
|
||||||
receiver.send(fakeEntitlementResult, null);
|
receiver.send(fakeEntitlementResult, null);
|
||||||
return intent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertUiTetherProvisioningIntent(int type, final TetheringConfiguration config,
|
|
||||||
final ResultReceiver receiver, final Intent intent) {
|
|
||||||
assertEquals(Settings.ACTION_TETHER_PROVISIONING_UI, intent.getAction());
|
|
||||||
assertEquals(type, intent.getIntExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_INVALID));
|
|
||||||
final String[] appName = intent.getStringArrayExtra(
|
|
||||||
EXTRA_TETHER_UI_PROVISIONING_APP_NAME);
|
|
||||||
assertEquals(PROVISIONING_APP_NAME.length, appName.length);
|
|
||||||
for (int i = 0; i < PROVISIONING_APP_NAME.length; i++) {
|
|
||||||
assertEquals(PROVISIONING_APP_NAME[i], appName[i]);
|
|
||||||
}
|
|
||||||
assertEquals(receiver, intent.getParcelableExtra(EXTRA_PROVISION_CALLBACK));
|
|
||||||
assertEquals(config.activeDataSubId,
|
|
||||||
intent.getIntExtra(EXTRA_TETHER_SUBID, INVALID_SUBSCRIPTION_ID));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Intent runSilentTetherProvisioning(int type,
|
protected void runSilentTetherProvisioning(int type, int subId) {
|
||||||
final TetheringConfiguration config) {
|
|
||||||
Intent intent = super.runSilentTetherProvisioning(type, config);
|
|
||||||
assertSilentTetherProvisioning(type, config, intent);
|
|
||||||
silentProvisionCount++;
|
silentProvisionCount++;
|
||||||
addDownstreamMapping(type, fakeEntitlementResult);
|
addDownstreamMapping(type, fakeEntitlementResult);
|
||||||
return intent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertSilentTetherProvisioning(int type, final TetheringConfiguration config,
|
|
||||||
final Intent intent) {
|
|
||||||
assertEquals(type, intent.getIntExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_INVALID));
|
|
||||||
assertEquals(true, intent.getBooleanExtra(EXTRA_RUN_PROVISION, false));
|
|
||||||
assertEquals(PROVISIONING_NO_UI_APP_NAME,
|
|
||||||
intent.getStringExtra(EXTRA_TETHER_SILENT_PROVISIONING_ACTION));
|
|
||||||
assertEquals(PROVISIONING_APP_RESPONSE,
|
|
||||||
intent.getStringExtra(EXTRA_TETHER_PROVISIONING_RESPONSE));
|
|
||||||
assertTrue(intent.hasExtra(EXTRA_PROVISION_CALLBACK));
|
|
||||||
assertEquals(config.activeDataSubId,
|
|
||||||
intent.getIntExtra(EXTRA_TETHER_SUBID, INVALID_SUBSCRIPTION_ID));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,8 +187,6 @@ public final class EntitlementManagerTest {
|
|||||||
.thenReturn(PROVISIONING_APP_NAME);
|
.thenReturn(PROVISIONING_APP_NAME);
|
||||||
when(mResources.getString(R.string.config_mobile_hotspot_provision_app_no_ui))
|
when(mResources.getString(R.string.config_mobile_hotspot_provision_app_no_ui))
|
||||||
.thenReturn(PROVISIONING_NO_UI_APP_NAME);
|
.thenReturn(PROVISIONING_NO_UI_APP_NAME);
|
||||||
when(mResources.getString(R.string.config_mobile_hotspot_provision_response)).thenReturn(
|
|
||||||
PROVISIONING_APP_RESPONSE);
|
|
||||||
// Act like the CarrierConfigManager is present and ready unless told otherwise.
|
// Act like the CarrierConfigManager is present and ready unless told otherwise.
|
||||||
when(mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE))
|
when(mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE))
|
||||||
.thenReturn(mCarrierConfigManager);
|
.thenReturn(mCarrierConfigManager);
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ public class TetheringConfigurationTest {
|
|||||||
private final SharedLog mLog = new SharedLog("TetheringConfigurationTest");
|
private final SharedLog mLog = new SharedLog("TetheringConfigurationTest");
|
||||||
|
|
||||||
private static final String[] PROVISIONING_APP_NAME = {"some", "app"};
|
private static final String[] PROVISIONING_APP_NAME = {"some", "app"};
|
||||||
private static final String PROVISIONING_NO_UI_APP_NAME = "no_ui_app";
|
|
||||||
private static final String PROVISIONING_APP_RESPONSE = "app_response";
|
|
||||||
@Mock private Context mContext;
|
@Mock private Context mContext;
|
||||||
@Mock private TelephonyManager mTelephonyManager;
|
@Mock private TelephonyManager mTelephonyManager;
|
||||||
@Mock private Resources mResources;
|
@Mock private Resources mResources;
|
||||||
@@ -390,8 +388,6 @@ public class TetheringConfigurationTest {
|
|||||||
new MockTetheringConfiguration(mMockContext, mLog, anyValidSubId);
|
new MockTetheringConfiguration(mMockContext, mLog, anyValidSubId);
|
||||||
assertEquals(mockCfg.provisioningApp[0], PROVISIONING_APP_NAME[0]);
|
assertEquals(mockCfg.provisioningApp[0], PROVISIONING_APP_NAME[0]);
|
||||||
assertEquals(mockCfg.provisioningApp[1], PROVISIONING_APP_NAME[1]);
|
assertEquals(mockCfg.provisioningApp[1], PROVISIONING_APP_NAME[1]);
|
||||||
assertEquals(mockCfg.provisioningAppNoUi, PROVISIONING_NO_UI_APP_NAME);
|
|
||||||
assertEquals(mockCfg.provisioningResponse, PROVISIONING_APP_RESPONSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpResourceForSubId() {
|
private void setUpResourceForSubId() {
|
||||||
@@ -407,10 +403,6 @@ public class TetheringConfigurationTest {
|
|||||||
new int[0]);
|
new int[0]);
|
||||||
when(mResourcesForSubId.getStringArray(
|
when(mResourcesForSubId.getStringArray(
|
||||||
R.array.config_mobile_hotspot_provision_app)).thenReturn(PROVISIONING_APP_NAME);
|
R.array.config_mobile_hotspot_provision_app)).thenReturn(PROVISIONING_APP_NAME);
|
||||||
when(mResourcesForSubId.getString(R.string.config_mobile_hotspot_provision_app_no_ui))
|
|
||||||
.thenReturn(PROVISIONING_NO_UI_APP_NAME);
|
|
||||||
when(mResourcesForSubId.getString(
|
|
||||||
R.string.config_mobile_hotspot_provision_response)).thenReturn(
|
|
||||||
PROVISIONING_APP_RESPONSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user