Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b948370 authored by Rambo Wang's avatar Rambo Wang
Browse files

CarrierServiceBindHelper: incorrect user unlocked event received in HSUM

This CL fixes the issue that CarrierServiceBindHelper always register to
receive ACTION_USER_UNLOCKED from system user by registering the
receiver for current user instead.

It keeps the same behavior for non-HSUM devices but let secondary users
(e.g. Main user) in HSUM receive the event for current user.

Bug: 345523452
Test: atest FrameworksTelephonyTests
Test: CarrierService regressoin test on both Phone andd Tablet
Flag: com.android.internal.telephony.flags.support_carrier_services_for_hsum
Change-Id: Ice803050271f720dee6bfb2177fe5197bf67c7ed
parent 6f3615bd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.util.Log;
import android.util.SparseArray;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.util.TelephonyUtils;

import java.io.FileDescriptor;
@@ -171,7 +172,7 @@ public class CarrierServiceBindHelper {
                context, mHandler.getLooper(), UserHandle.ALL);
        try {
            Context contextAsUser = mContext.createPackageContextAsUser(mContext.getPackageName(),
                0, UserHandle.SYSTEM);
                0, Flags.supportCarrierServicesForHsum() ? UserHandle.CURRENT : UserHandle.SYSTEM);
            contextAsUser.registerReceiver(mUserUnlockedReceiver,
                new IntentFilter(Intent.ACTION_USER_UNLOCKED), null /* broadcastPermission */,
                mHandler);