diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-24 22:41:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-24 22:41:00 +0000 |
commit | daa1c44c00f3c598223639c9b80a52cf41db51ba (patch) | |
tree | e4c88a1862b157dc858abe73e52b077bf7b96948 /java/com/android/voicemail/impl/OmtpService.java | |
parent | ef7338cf787301c573fde8129bf8880d7faba040 (diff) | |
parent | 938468da6f5c225ebb161a68bd949c9cf3261892 (diff) |
Merge "Rename the new bubble package name from "bubble" to "newbubble"."
Diffstat (limited to 'java/com/android/voicemail/impl/OmtpService.java')
-rw-r--r-- | java/com/android/voicemail/impl/OmtpService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/java/com/android/voicemail/impl/OmtpService.java b/java/com/android/voicemail/impl/OmtpService.java index 4db1aeb7e..4e8860c02 100644 --- a/java/com/android/voicemail/impl/OmtpService.java +++ b/java/com/android/voicemail/impl/OmtpService.java @@ -25,6 +25,7 @@ import android.preference.PreferenceManager; import android.support.annotation.MainThread; import android.support.annotation.NonNull; import android.telecom.PhoneAccountHandle; +import android.telephony.TelephonyManager; import android.telephony.VisualVoicemailService; import android.telephony.VisualVoicemailSms; import com.android.dialer.logging.DialerImpression; @@ -63,6 +64,7 @@ public class OmtpService extends VisualVoicemailService { } if (!isServiceEnabled(phoneAccountHandle)) { + disableFilter(phoneAccountHandle); task.finish(); return; } @@ -87,6 +89,8 @@ public class OmtpService extends VisualVoicemailService { } if (!isServiceEnabled(sms.getPhoneAccountHandle())) { + VvmLog.e(TAG, "onSmsReceived received when service is disabled"); + disableFilter(sms.getPhoneAccountHandle()); task.finish(); return; } @@ -178,6 +182,15 @@ public class OmtpService extends VisualVoicemailService { return true; } + private void disableFilter(PhoneAccountHandle phoneAccountHandle) { + TelephonyManager telephonyManager = + getSystemService(TelephonyManager.class).createForPhoneAccountHandle(phoneAccountHandle); + if (telephonyManager != null) { + VvmLog.i(TAG, "disabling SMS filter"); + telephonyManager.setVisualVoicemailSmsFilterSettings(null); + } + } + private static boolean isUserUnlocked(@NonNull Context context) { UserManager userManager = context.getSystemService(UserManager.class); return userManager.isUserUnlocked(); |