Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1edb5e42 authored by Wenyi Wang's avatar Wenyi Wang Committed by android-build-merger
Browse files

Get rid of CODENAME and use BuildCompat instead

am: edbbd6d891

* commit 'edbbd6d89137a3addf82d121cb3d785fe3074889':
  Get rid of CODENAME and use BuildCompat instead

Change-Id: If73e1085bfd040e6215a7cf345ad96145900744a
parents e2709752 3512e96b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.net.Uri;
import android.os.Build;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.support.annotation.IntDef;
import android.support.v4.os.BuildCompat;
import android.provider.ContactsContract.DisplayPhoto;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -52,9 +53,7 @@ public class ContactsUtils {

    private static int sThumbnailSize = -1;

    public static final boolean FLAG_N_FEATURE = SdkSelectionUtils.TARGET_N_SDK // build-time flag
            && (Build.VERSION.SDK_INT > Build.VERSION_CODES.M // runtime flag
            || Build.VERSION.CODENAME.startsWith("N")); // TODO: remove startsWith("N")
    public static final boolean FLAG_N_FEATURE = BuildCompat.isAtLeastN();

    // TODO find a proper place for the canonical version of these
    public interface ProviderNames {
+2 −8
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.contacts.common.compat;
import android.os.Build;
import android.os.Build.VERSION;
import android.support.annotation.Nullable;
import android.support.v4.os.BuildCompat;
import android.text.TextUtils;
import android.util.Log;

@@ -41,8 +42,6 @@ public final class CompatUtils {

    public final static int TYPE_ASSERT = 4;

    private final static Boolean CODENAME_STARTS_WITH_N = VERSION.CODENAME.startsWith("N");

    /**
     * Returns whether the operation in CPOWrapper is of TYPE_INSERT;
     */
@@ -173,12 +172,7 @@ public final class CompatUtils {
     * false} otherwise.
     */
    public static boolean isNCompatible() {
        // SdkVersionOverride doesn't work here because VERSION.SDK_INT remains 23 (same as M)
        // before N is release

        // TODO: remove build time check and use proper runtime check once N is released.
        return SdkSelectionUtils.TARGET_N_SDK // Build time flag
                && CODENAME_STARTS_WITH_N;  // Run time flag
        return BuildCompat.isAtLeastN();
    }

    /**