Home | History | Annotate | Download | only in compat
      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.dialer.compat;
     17 
     18 import android.os.Build;
     19 
     20 public final class CompatUtils {
     21 
     22   /** PrioritizedMimeType is added in API level 23. */
     23   public static boolean hasPrioritizedMimeType() {
     24     return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M;
     25   }
     26 
     27   /**
     28    * Determines if this version is compatible with multi-SIM and the phone account APIs. Can also
     29    * force the version to be lower through SdkVersionOverride.
     30    *
     31    * @return {@code true} if multi-SIM capability is available, {@code false} otherwise.
     32    */
     33   public static boolean isMSIMCompatible() {
     34     return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP)
     35         >= Build.VERSION_CODES.LOLLIPOP_MR1;
     36   }
     37 
     38   /**
     39    * Determines if this version is compatible with video calling. Can also force the version to be
     40    * lower through SdkVersionOverride.
     41    *
     42    * @return {@code true} if video calling is allowed, {@code false} otherwise.
     43    */
     44   public static boolean isVideoCompatible() {
     45     return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) >= Build.VERSION_CODES.M;
     46   }
     47 
     48   /**
     49    * Determines if this version is capable of using presence checking for video calling. Support for
     50    * video call presence indication is added in SDK 24.
     51    *
     52    * @return {@code true} if video presence checking is allowed, {@code false} otherwise.
     53    */
     54   public static boolean isVideoPresenceCompatible() {
     55     return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) > Build.VERSION_CODES.M;
     56   }
     57 
     58   /**
     59    * Determines if this version is compatible with call subject. Can also force the version to be
     60    * lower through SdkVersionOverride.
     61    *
     62    * @return {@code true} if call subject is a feature on this device, {@code false} otherwise.
     63    */
     64   public static boolean isCallSubjectCompatible() {
     65     return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) >= Build.VERSION_CODES.M;
     66   }
     67 }
     68