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

Commit 7256d34a authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Fix helper methods in contacts utils

Bug 28954561

Change-Id: I4af27b4f6c05eaad7a10a10a3f007d3792fc4803
parent cd923992
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.contacts.common.model.dataitem.ImDataItem;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.compat.ContactsCompat;
import com.android.contacts.common.compat.DirectoryCompat;
import com.android.contacts.common.compat.SdkSelectionUtils;
import com.android.contacts.common.model.AccountTypeManager;

import java.lang.annotation.Retention;
@@ -51,7 +52,9 @@ public class ContactsUtils {

    private static int sThumbnailSize = -1;

    public static final boolean FLAG_N_FEATURE = Build.VERSION.SDK_INT > Build.VERSION_CODES.M;
    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")

    // TODO find a proper place for the canonical version of these
    public interface ProviderNames {
+3 −1
Original line number Diff line number Diff line
@@ -176,7 +176,9 @@ public final class CompatUtils {
        // SdkVersionOverride doesn't work here because VERSION.SDK_INT remains 23 (same as M)
        // before N is release

        return Build.VERSION.SDK_INT > Build.VERSION_CODES.M;  // Run time flag
        // 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
    }

    /**