Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator.

Passing one of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED is
required for all code targeting T or above. The correct value
here is RECEIVER_NOT_EXPORTED because the receiver is being
registered in the system server and the broadcast comes from
the system server itself (same UID).

This does not need to be guarded by OS version because
CarrierPrivilegeAuthenticator is only used on T+.

Test: m
Fix: 217642082
Change-Id: I09840b17bd54352896607737b56c6a692ffbd2c2
This commit is contained in:
Lorenzo Colitti
2022-02-03 12:23:54 +09:00
committed by Chalard Jean
parent 1513c9991e
commit 7569d51446
2 changed files with 11 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ 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;
@@ -158,7 +160,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);
mContext.registerReceiver(this, filter, null, mHandler, RECEIVER_NOT_EXPORTED /* flags */);
registerCarrierPrivilegesListeners();
}