Wenyi Wang | 6fa570f | 2015-11-24 15:44:11 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package com.android.contacts.common.compat; |
| 17 | |
| 18 | import android.os.Build; |
| 19 | |
| 20 | import com.android.contacts.common.compat.SdkVersionOverride; |
| 21 | |
| 22 | public final class CompatUtils { |
| 23 | /** |
| 24 | * PrioritizedMimeType is added in API level 23. |
| 25 | */ |
| 26 | public static boolean hasPrioritizedMimeType() { |
| 27 | return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) |
| 28 | >= Build.VERSION_CODES.M; |
| 29 | } |
Nancy Chen | eab0b82 | 2015-11-25 15:44:48 -0800 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Determines if this version is compatible with multi-SIM and the phone account APIs. |
| 33 | * Can also force the version to be lower through SdkVersionOverride. |
| 34 | * |
| 35 | * @return {@code true} if multi-SIM capability is available, {@code false} otherwise. |
| 36 | */ |
| 37 | public static boolean isMSIMCompatible() { |
| 38 | return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) |
| 39 | >= Build.VERSION_CODES.LOLLIPOP_MR1; |
| 40 | } |
Nancy Chen | 5fe647d | 2015-12-08 16:57:48 -0800 | [diff] [blame^] | 41 | |
| 42 | /** |
| 43 | * Determines if this version is compatible with video calling. Can also force the version to be |
| 44 | * lower through SdkVersionOverride. |
| 45 | * |
| 46 | * @return {@code true} if video calling is allowed, {@code false} otherwise. |
| 47 | */ |
| 48 | public static boolean isVideoCompatible() { |
| 49 | return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) |
| 50 | >= Build.VERSION_CODES.M; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Determines if this version is compatible with call subject. Can also force the version to |
| 55 | * be lower through SdkVersionOverride. |
| 56 | * |
| 57 | * @return {@code true} if call subject is a feature on this device, {@code false} otherwise. |
| 58 | */ |
| 59 | public static boolean isCallSubjectCompatible() { |
| 60 | return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) |
| 61 | >= Build.VERSION_CODES.M; |
| 62 | } |
Wenyi Wang | 6fa570f | 2015-11-24 15:44:11 -0800 | [diff] [blame] | 63 | } |