From 35ec9146f0f44898f2249be3e505ff7bef171e11 Mon Sep 17 00:00:00 2001 From: erfanian Date: Tue, 24 Oct 2017 17:05:18 -0700 Subject: 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 --- .../dialer/assisteddialing/AssistedDialingMediatorImpl.java | 8 +++++--- 1 file 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; } /** -- cgit v1.2.3