diff options
author | twyen <twyen@google.com> | 2017-10-12 13:58:08 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-12 14:32:20 -0700 |
commit | a8371d31fb26cdc689ea03cfc4843d69702dc9dc (patch) | |
tree | 6c774b8a9de50b4c4595769fafbbd6adc72a9f5c /java | |
parent | ac7ab398262a92c33735fe0d93b029bf8aba548f (diff) |
Use TelephonyManagerCompat for IS_REFRESH
Bug: 66633426
Test: LegacyVoicemailNotificationReceiverTest
PiperOrigin-RevId: 172007744
Change-Id: Ic67566c22659b51d605c92d2673f9baddaee531f
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java | 12 | ||||
-rw-r--r-- | java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java index efa34a071..0a6f2c156 100644 --- a/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java +++ b/java/com/android/dialer/app/voicemail/LegacyVoicemailNotificationReceiver.java @@ -22,7 +22,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Build; -import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.support.annotation.VisibleForTesting; import android.support.v4.os.BuildCompat; @@ -33,6 +32,7 @@ import com.android.dialer.app.calllog.LegacyVoicemailNotifier; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.PerAccountSharedPreferences; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.util.DialerUtils; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; @@ -47,9 +47,6 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { @VisibleForTesting static final String LEGACY_VOICEMAIL_DISMISSED = "legacy_voicemail_dismissed"; - /** Hidden version of {@link TelephonyManager#EXTRA_IS_REFRESH} in OC */ - @VisibleForTesting static final String EXTRA_IS_REFRESH_LEGACY = "is_refresh"; - @Override public void onReceive(Context context, Intent intent) { @@ -76,12 +73,7 @@ public class LegacyVoicemailNotificationReceiver extends BroadcastReceiver { Assert.isNotNull(intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE)); int count = intent.getIntExtra(TelephonyManager.EXTRA_NOTIFICATION_COUNT, -1); - boolean isRefresh = - intent.getBooleanExtra( - VERSION.SDK_INT >= VERSION_CODES.O_MR1 - ? TelephonyManager.EXTRA_IS_REFRESH - : EXTRA_IS_REFRESH_LEGACY, - false); + boolean isRefresh = intent.getBooleanExtra(TelephonyManagerCompat.EXTRA_IS_REFRESH, false); LogUtil.i("LegacyVoicemailNotificationReceiver.onReceive", "isRefresh: " + isRefresh); PerAccountSharedPreferences preferences = getSharedPreferences(context, phoneAccountHandle); if (isRefresh) { diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 61c44b9f4..fbc789900 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -73,6 +73,9 @@ public class TelephonyManagerCompat { public static final String ASSISTED_DIALING_EXTRAS = "android.telecom.extra.ASSISTED_DIALING_EXTRAS"; + public static final String EXTRA_IS_REFRESH = + BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh"; + /** * Returns the number of phones available. Returns 1 for Single standby mode (Single SIM * functionality) Returns 2 for Dual standby mode.(Dual SIM functionality) |