diff options
author | erfanian <erfanian@google.com> | 2017-10-24 17:05:18 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-25 07:22:24 -0700 |
commit | 35ec9146f0f44898f2249be3e505ff7bef171e11 (patch) | |
tree | 6be745c52fff43a474773931608c28a3096f41ac /java | |
parent | daa1c44c00f3c598223639c9b80a52cf41db51ba (diff) |
Refactor client platform checks to be DRY.
It didn't sit well with me that we would check for platform eligibility
in two places.
Test: existing unit tests;
PiperOrigin-RevId: 173334224
Change-Id: Ia7075bc40e935c2794646671b5cfea34b7a06afb
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java index 202760751..1cc9732bb 100644 --- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java +++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java @@ -17,9 +17,9 @@ package com.android.dialer.assisteddialing; import android.annotation.TargetApi; -import android.os.Build; import android.os.Build.VERSION_CODES; import android.support.annotation.NonNull; +import android.support.annotation.RequiresApi; import com.android.dialer.common.LogUtil; import java.util.Optional; @@ -30,6 +30,7 @@ import java.util.Optional; * call is eligible for assisted dialing, and performing the transformation of numbers eligible for * assisted dialing. */ +@RequiresApi(VERSION_CODES.N) final class AssistedDialingMediatorImpl implements AssistedDialingMediator { private final LocationDetector locationDetector; @@ -50,8 +51,9 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator { @Override public boolean isPlatformEligible() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N - && Build.VERSION.SDK_INT <= Build.VERSION_CODES.O; + // This impl is only instantiated if it passes platform checks in ConcreteCreator, + // so we return true here. + return true; } /** |