1 /* 2 * Copyright 2024 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 17 package androidx.camera.camera2.pipe.integration.compat.quirk 18 19 import android.os.Build 20 21 public object Device { isBluDevicenull22 public fun isBluDevice(): Boolean = isDeviceFrom("Blu") 23 24 public fun isHuaweiDevice(): Boolean = isDeviceFrom("Huawei") 25 26 public fun isInfinixDevice(): Boolean = isDeviceFrom("Infinix") 27 28 public fun isItelDevice(): Boolean = isDeviceFrom("Itel") 29 30 public fun isJioDevice(): Boolean = isDeviceFrom("Jio") 31 32 public fun isGoogleDevice(): Boolean = isDeviceFrom("Google") 33 34 public fun isMotorolaDevice(): Boolean = isDeviceFrom("Motorola") 35 36 public fun isOnePlusDevice(): Boolean = isDeviceFrom("OnePlus") 37 38 public fun isOppoDevice(): Boolean = isDeviceFrom("Oppo") 39 40 public fun isPositivoDevice(): Boolean = isDeviceFrom("Positivo") 41 42 public fun isRealmeDevice(): Boolean = isDeviceFrom("Realme") 43 44 public fun isRedmiDevice(): Boolean = isDeviceFrom("Redmi") 45 46 public fun isSamsungDevice(): Boolean = isDeviceFrom("Samsung") 47 48 public fun isTecnoDevice(): Boolean = isDeviceFrom("Tecno") || isDeviceFrom("Tecno-mobile") 49 50 public fun isXiaomiDevice(): Boolean = isDeviceFrom("Xiaomi") 51 52 public fun isVivoDevice(): Boolean = isDeviceFrom("Vivo") 53 54 private fun isDeviceFrom(vendor: String) = 55 Build.MANUFACTURER.equalsCaseInsensitive(vendor) || 56 Build.BRAND.equalsCaseInsensitive(vendor) 57 58 private fun String.equalsCaseInsensitive(other: String?) = equals(other, ignoreCase = true) 59 } 60