Merge "Revert "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator.""

This commit is contained in:
Michael Groover
2022-03-31 01:39:28 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 11 deletions

View File

@@ -19,8 +19,6 @@ package com.android.server.connectivity;
import static android.net.NetworkCapabilities.NET_CAPABILITY_CBS;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static com.android.networkstack.apishim.ConstantsShim.RECEIVER_NOT_EXPORTED;
import android.annotation.NonNull;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -160,7 +158,7 @@ public class CarrierPrivilegeAuthenticator extends BroadcastReceiver {
private void registerForCarrierChanges() {
final IntentFilter filter = new IntentFilter();
filter.addAction(TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED);
mContext.registerReceiver(this, filter, null, mHandler, RECEIVER_NOT_EXPORTED /* flags */);
mContext.registerReceiver(this, filter, null, mHandler);
registerCarrierPrivilegesListeners();
}

View File

@@ -69,8 +69,6 @@ import java.util.List;
@RunWith(DevSdkIgnoreRunner.class)
@IgnoreUpTo(SC_V2) // TODO: Use to Build.VERSION_CODES.SC_V2 when available
public class CarrierPrivilegeAuthenticatorTest {
// TODO : use ConstantsShim.RECEIVER_NOT_EXPORTED when it's available in tests.
private static final int RECEIVER_NOT_EXPORTED = 4;
private static final int SUBSCRIPTION_COUNT = 2;
private static final int TEST_SUBSCRIPTION_ID = 1;
@@ -117,7 +115,7 @@ public class CarrierPrivilegeAuthenticatorTest {
private IntentFilter getIntentFilter() {
final ArgumentCaptor<IntentFilter> captor = ArgumentCaptor.forClass(IntentFilter.class);
verify(mContext).registerReceiver(any(), captor.capture(), any(), any(), anyInt());
verify(mContext).registerReceiver(any(), captor.capture(), any(), any());
return captor.getValue();
}
@@ -143,8 +141,7 @@ public class CarrierPrivilegeAuthenticatorTest {
eq(mCarrierPrivilegeAuthenticator),
any(IntentFilter.class),
any(),
any(),
eq(RECEIVER_NOT_EXPORTED));
any());
final IntentFilter filter = getIntentFilter();
assertEquals(1, filter.countActions());
assertTrue(filter.hasAction(ACTION_MULTI_SIM_CONFIG_CHANGED));