Revert "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."

This reverts commit 7569d51446.

Reason for revert: ag/17318348 moved the declaration of the protected-broadcasts from the telephony package to the platform's manifest, so a flag is no longer required when registering for these. In addition, ag/17307852 is syncing the behavior of unexported runtime receivers with that of manifest receivers by limiting the UIDs that can broadcast to these receivers to the root and system UIDs; with the RECEIVER_NOT_EXPORTED flag from this commit, these receivers would no longer be able to receive these broadcasts when sent from the telephony UID.

Bug: 225999840
Change-Id: Ifb15506434edabdfacf84c302881d0cf97d3add8
This commit is contained in:
Michael Groover
2022-03-22 22:25:20 +00:00
parent 7569d51446
commit eef36c8917
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));