Skip the notification when the userId is not main

Fix: 381585049
Test: atest SimSelectNotificationTest
Flag: EXEMPT bugfix

Change-Id: I9a08a1c28948051cbf5a316b8cc5c676f25ff8cc
This commit is contained in:
songferngwang
2024-12-03 10:12:02 +00:00
committed by SongFerng Wang
parent 0496fc2de5
commit 178befee5e
2 changed files with 24 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.UserManager;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -91,6 +92,11 @@ public class SimSelectNotification extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
UserManager userManager = context.getSystemService(UserManager.class);
if (userManager != null && !userManager.isMainUser()) {
Log.d(TAG, "The userId is not the main user");
return;
}
if (!SubscriptionUtil.isSimHardwareVisible(context)) {
Log.w(TAG, "Received unexpected intent with null action.");
return;