From eed5afa45b9da6c1532feb95bd8ffdb5ae48d219 Mon Sep 17 00:00:00 2001 From: twyen Date: Fri, 18 Aug 2017 11:04:37 -0700 Subject: Allow legacy mode voicemail notification to show in FBE Legacy mode is when the carrier notifies the device of incoming voicemails with visual voicemail SMS, but the device shows a legacy voicemail notification and will not access the voicemail server. This is used by certain carriers to pretend VVM is deactivated, or under FBE because the server access credentials is encrypted. Previously the VVM activation state is made available in FBE, so all legacy voicemail notifications will be blocked, including legacy mode. In this CL, legacy mode will send an additional flag so it will not be blocked by the VVM activated state. Bug: 64768579 Test: LegacyVoicemailNotificationReceiverTest PiperOrigin-RevId: 165726692 Change-Id: I9a6dbb0ba3ad07bd31c6daf3d9beac0797e22cb4 --- .../dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java | 8 +++++--- java/com/android/voicemail/VoicemailClient.java | 6 ++++++ java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'java/com') diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index a81d8665a..d681df205 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -32,6 +32,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.PerAccountSharedPreferences; import com.android.dialer.util.DialerUtils; +import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; /** @@ -105,9 +106,10 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { return; } - if (VoicemailComponent.get(context) - .getVoicemailClient() - .isActivated(context, phoneAccountHandle)) { + if (!intent.getBooleanExtra(VoicemailClient.EXTRA_IS_LEGACY_MODE, false) + && VoicemailComponent.get(context) + .getVoicemailClient() + .isActivated(context, phoneAccountHandle)) { LogUtil.i( "LegacyVoicemailNotificationReceiver.onReceive", "visual voicemail is activated, ignoring notification"); diff --git a/java/com/android/voicemail/VoicemailClient.java b/java/com/android/voicemail/VoicemailClient.java index 21846a480..d52a67a8e 100644 --- a/java/com/android/voicemail/VoicemailClient.java +++ b/java/com/android/voicemail/VoicemailClient.java @@ -54,6 +54,12 @@ public interface VoicemailClient { String ACTION_SHOW_LEGACY_VOICEMAIL = "com.android.voicemail.VoicemailClient.ACTION_SHOW_LEGACY_VOICEMAIL"; + /** + * Boolean extra send with {@link #ACTION_SHOW_LEGACY_VOICEMAIL}, indicating that the notification + * is sent by legacy mode and should not be suppressed even when VVM is activated + */ + String EXTRA_IS_LEGACY_MODE = "is_legacy_mode"; + /** * Secret code to launch the voicemail config activity intended for OEMs and Carriers. {@code * *#*#VVMCONFIG#*#*} diff --git a/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java b/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java index 5decf6376..e902825c0 100644 --- a/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java +++ b/java/com/android/voicemail/impl/sms/LegacyModeSmsHandler.java @@ -79,6 +79,7 @@ public class LegacyModeSmsHandler { VvmLog.i(TAG, "sending voicemail notification"); Intent intent = new Intent(VoicemailClient.ACTION_SHOW_LEGACY_VOICEMAIL); intent.setPackage(context.getPackageName()); + intent.putExtra(VoicemailClient.EXTRA_IS_LEGACY_MODE, true); intent.putExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); // Setting voicemail message count to non-zero will show the telephony voicemail // notification, and zero will clear it. -- cgit v1.2.3