From 7700db2520f995519996ab515658c87353b98804 Mon Sep 17 00:00:00 2001 From: twyen Date: Fri, 7 Jul 2017 17:14:39 -0700 Subject: Guard VoicemailClientReceiver when VVM module is disabled The dialer voicemail UI will send the broadcast even below O. Ideally all receiver for system and external broadcasts should be moved out of impl/ since they will not be disabled with the module, but at this point changes should be kept at minimal. Bug: 63437675 Test: VoicemailClientReceiverTest PiperOrigin-RevId: 161264508 Change-Id: I99476bb27ce3da9396f3b7205c98cb847bfff9b7 --- java/com/android/voicemail/impl/VoicemailClientReceiver.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'java/com/android/voicemail/impl') diff --git a/java/com/android/voicemail/impl/VoicemailClientReceiver.java b/java/com/android/voicemail/impl/VoicemailClientReceiver.java index 49a55a41b..688636e6c 100644 --- a/java/com/android/voicemail/impl/VoicemailClientReceiver.java +++ b/java/com/android/voicemail/impl/VoicemailClientReceiver.java @@ -23,6 +23,7 @@ import android.telecom.PhoneAccountHandle; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.voicemail.VoicemailClient; +import com.android.voicemail.VoicemailComponent; import com.android.voicemail.impl.sync.UploadTask; import com.android.voicemail.impl.sync.VvmAccountManager; @@ -31,6 +32,11 @@ public class VoicemailClientReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + if (!VoicemailComponent.get(context).getVoicemailClient().isVoicemailModuleEnabled()) { + LogUtil.i( + "VoicemailClientReceiver.onReceive", "module disabled, ignoring " + intent.getAction()); + return; + } switch (intent.getAction()) { case VoicemailClient.ACTION_UPLOAD: doUpload(context); -- cgit v1.2.3