Don't allow upstream if entitlement don't know any downstream

In case tethering donwstream is setup but don't ask EntitlementManager
to run provisioning. Cellular upstream should not be allowed if
EntilementManager don't have any donwstream record.

Bug: 134649258
Test: -build, flash, boot
      -manual test with carrier SIM
Change-Id: I609722c79f0a45a1c2164d39721ef5883e436feb
This commit is contained in:
markchien
2019-08-09 21:43:38 +08:00
committed by Mark Chien
parent 8aa2b1dffd
commit 426311bcb5
2 changed files with 13 additions and 0 deletions

View File

@@ -161,6 +161,12 @@ public class EntitlementManager {
* Check if cellular upstream is permitted.
*/
public boolean isCellularUpstreamPermitted() {
// If provisioning is required and EntitlementManager don't know any downstream,
// cellular upstream should not be allowed.
final TetheringConfiguration config = mFetcher.fetchTetheringConfiguration();
if (mCurrentTethers.size() == 0 && isTetherProvisioningRequired(config)) {
return false;
}
return mCellularUpstreamPermitted;
}

View File

@@ -405,6 +405,13 @@ public final class EntitlementManagerTest {
}
@Test
public void verifyPermissionWhenProvisioningNotStarted() {
assertTrue(mEnMgr.isCellularUpstreamPermitted());
setupForRequiredProvisioning();
assertFalse(mEnMgr.isCellularUpstreamPermitted());
}
@Test
public void testRunTetherProvisioning() {
setupForRequiredProvisioning();