Messaging: Prevent broadcast spoofing

Change-Id: Ib0df346233cd4fcbf242aef580f72414bf1e359b
This commit is contained in:
Michael W
2024-12-26 14:55:12 +01:00
parent 101b31e873
commit 37d6d70835
2 changed files with 11 additions and 2 deletions
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -15,6 +16,8 @@
*/ */
package com.android.messaging.receiver; package com.android.messaging.receiver;
import static android.telephony.SubscriptionManager.ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -27,6 +30,8 @@ import com.android.messaging.datamodel.ParticipantRefresh;
public class DefaultSmsSubscriptionChangeReceiver extends BroadcastReceiver { public class DefaultSmsSubscriptionChangeReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
ParticipantRefresh.refreshSelfParticipants(); if (ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED.equals(intent.getAction())) {
ParticipantRefresh.refreshSelfParticipants();
}
} }
} }
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -19,6 +20,7 @@ package com.android.messaging.receiver;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.provider.Telephony.Sms;
/** /**
* Class that receives incoming SMS messages on KLP+ Devices. * Class that receives incoming SMS messages on KLP+ Devices.
@@ -26,6 +28,8 @@ import android.content.Intent;
public final class SmsDeliverReceiver extends BroadcastReceiver { public final class SmsDeliverReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(final Context context, final Intent intent) { public void onReceive(final Context context, final Intent intent) {
SmsReceiver.deliverSmsIntent(context, intent); if (Sms.Intents.SMS_DELIVER_ACTION.equals(intent.getAction())) {
SmsReceiver.deliverSmsIntent(context, intent);
}
} }
} }