Merge "Remove usage of hidden API PhoneConstants.SUBSCRIPTION_KEY"

am: 52b8e3e448

Change-Id: I55b96c74990b3b649ab052372a87892c2cf9e5d9
This commit is contained in:
Meng Wang
2019-12-09 13:28:44 -08:00
committed by android-build-merger
2 changed files with 10 additions and 12 deletions

View File

@@ -223,7 +223,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.os.RoSystemProperties;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ConcurrentUtils;
import com.android.internal.util.DumpUtils;
@@ -1650,10 +1649,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
// No need to do a permission check, because the ACTION_CARRIER_CONFIG_CHANGED
// broadcast is protected and can't be spoofed. Runs on a background handler thread.
if (!intent.hasExtra(PhoneConstants.SUBSCRIPTION_KEY)) {
if (!intent.hasExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX)) {
return;
}
final int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, -1);
final int subId = intent.getIntExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, -1);
// Get all of our cross-process communication with telephony out of
// the way before we acquire internal locks.

View File

@@ -137,7 +137,6 @@ import android.util.RecurrenceRule;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.util.test.BroadcastInterceptingContext;
import com.android.internal.util.test.BroadcastInterceptingContext.FutureIntent;
import com.android.server.DeviceIdleController;
@@ -1408,7 +1407,7 @@ public class NetworkPolicyManagerServiceTest {
// smoke test to make sure no errors are raised
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(DEFAULT_CYCLE_DAY, mDefaultWarningBytes, mDefaultLimitBytes,
true);
@@ -1423,7 +1422,7 @@ public class NetworkPolicyManagerServiceTest {
bundle.putLong(CarrierConfigManager.KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG, -100);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(DEFAULT_CYCLE_DAY, mDefaultWarningBytes, mDefaultLimitBytes,
@@ -1442,7 +1441,7 @@ public class NetworkPolicyManagerServiceTest {
DATA_CYCLE_USE_PLATFORM_DEFAULT);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(DEFAULT_CYCLE_DAY, mDefaultWarningBytes, mDefaultLimitBytes,
@@ -1464,7 +1463,7 @@ public class NetworkPolicyManagerServiceTest {
DATA_CYCLE_THRESHOLD_DISABLED);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
// The policy still shouldn't change, because we don't want to overwrite user settings.
@@ -1481,7 +1480,7 @@ public class NetworkPolicyManagerServiceTest {
bundle.putLong(CarrierConfigManager.KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG, 9999);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(31, 9999, 9999, true);
@@ -1498,7 +1497,7 @@ public class NetworkPolicyManagerServiceTest {
DATA_CYCLE_THRESHOLD_DISABLED);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(31, WARNING_DISABLED, LIMIT_DISABLED, true);
@@ -1515,7 +1514,7 @@ public class NetworkPolicyManagerServiceTest {
DATA_CYCLE_THRESHOLD_DISABLED);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(31, WARNING_DISABLED, LIMIT_DISABLED, true);
@@ -1530,7 +1529,7 @@ public class NetworkPolicyManagerServiceTest {
DATA_CYCLE_USE_PLATFORM_DEFAULT);
mServiceContext.sendBroadcast(
new Intent(ACTION_CARRIER_CONFIG_CHANGED)
.putExtra(PhoneConstants.SUBSCRIPTION_KEY, FAKE_SUB_ID)
.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, FAKE_SUB_ID)
);
assertNetworkPolicyEquals(31, mDefaultWarningBytes, mDefaultLimitBytes,