├── .clang-format ├── Android.bp ├── DSPVolumeSynchronizer ├── Android.bp ├── AndroidManifest.xml ├── config-dspvolume.xml ├── preinstalled-packages-platform-dspvolume.xml ├── privapp-permissions-dspvolume.xml ├── res │ └── values │ │ └── strings.xml └── src │ └── org │ └── lineageos │ └── dspvolume │ └── xiaomi │ ├── BootReceiver.java │ ├── VolumeListenerReceiver.java │ └── VolumeListenerService.java ├── Euicc ├── Android.bp ├── AndroidManifest.xml ├── co.aospa.euicc.xml ├── default-permissions-euicc.xml ├── hidden-api-whitelist-co.aospa.euicc.xml ├── privapp-permissions-euiccgoogle.xml ├── proguard.flags ├── proprietary │ └── product │ │ └── priv-app │ │ └── EuiccGoogle │ │ └── EuiccGoogle.apk ├── res │ ├── raw │ │ ├── esim_intro_illustration_lottie.json │ │ └── sim_illustration_lottie_bottom.json │ └── values │ │ └── strings.xml └── src │ └── co │ └── aospa │ └── euicc │ ├── BootCompletedReceiver.kt │ ├── EuiccDisabler.kt │ └── EuiccReceiver.kt ├── IFAAService ├── Android.bp ├── AndroidManifest.xml ├── res │ └── values │ │ └── strings.xml └── src │ └── org │ └── ifaa │ └── aidl │ └── manager │ ├── IfaaManagerService.aidl │ └── IfaaService.kt ├── aidl ├── fingerprint │ ├── Android.bp │ ├── CancellationSignal.cpp │ ├── CancellationSignal.h │ ├── Fingerprint.cpp │ ├── Fingerprint.h │ ├── FingerprintConfig.cpp │ ├── FingerprintConfig.h │ ├── LockoutTracker.cpp │ ├── LockoutTracker.h │ ├── Session.cpp │ ├── Session.h │ ├── android.hardware.biometrics.fingerprint-service.xiaomi.rc │ ├── android.hardware.biometrics.fingerprint-service.xiaomi.xml │ ├── fingerprint.sysprop │ ├── include │ │ └── Legacy2Aidl.h │ └── service.cpp ├── ir │ ├── Android.bp │ ├── ConsumerIr.cpp │ ├── ConsumerIr.h │ ├── android.hardware.ir-service.xiaomi.rc │ ├── android.hardware.ir-service.xiaomi.xml │ └── service.cpp └── sensors │ ├── Android.bp │ ├── HalProxy.cpp │ ├── HalProxyCallback.cpp │ ├── android.hardware.sensors-service.xiaomi-multihal.rc │ ├── android.hardware.sensors.xiaomi-multihal.xml │ └── service.cpp ├── dolby ├── Android.bp ├── AndroidManifest.xml ├── preinstalled-packages-platform-dolby.xml ├── res │ ├── drawable │ │ ├── ic_dolby.xml │ │ ├── ic_dolby_qs.xml │ │ ├── ic_ieq_balanced.xml │ │ ├── ic_ieq_detailed.xml │ │ ├── ic_ieq_off.xml │ │ ├── ic_ieq_warm.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_launcher_background__0.xml │ │ ├── ic_launcher_background__1.xml │ │ ├── ic_launcher_foreground.xml │ │ ├── ic_launcher_mono.xml │ │ ├── ic_profile_custom.xml │ │ ├── ic_profile_dynamic.xml │ │ ├── ic_profile_movie.xml │ │ ├── ic_profile_music.xml │ │ ├── reset_settings_24px.xml │ │ └── save_as_24px.xml │ ├── layout-v34 │ │ └── settingslib_main_switch_bar.xml │ ├── layout │ │ ├── ieq_icon_layout.xml │ │ └── preference_widget_switch_compat.xml │ ├── mipmap-anydpi │ │ └── ic_launcher.xml │ ├── values-pl │ │ └── strings.xml │ ├── values-ru │ │ └── strings.xml │ ├── values │ │ ├── arrays.xml │ │ └── strings.xml │ └── xml │ │ └── dolby_settings.xml └── src │ └── co │ └── aospa │ └── dolby │ └── xiaomi │ ├── BootCompletedReceiver.kt │ ├── DolbyActivity.kt │ ├── DolbyAudioEffect.kt │ ├── DolbyConstants.kt │ ├── DolbyController.kt │ ├── DolbyTileService.kt │ ├── SummaryProvider.kt │ ├── geq │ ├── EqualizerActivity.kt │ ├── data │ │ ├── BandGain.kt │ │ ├── EqualizerRepository.kt │ │ └── Preset.kt │ └── ui │ │ ├── BandGainSlider.kt │ │ ├── BandGainSliderLabels.kt │ │ ├── ConfirmationDialog.kt │ │ ├── EqualizerBands.kt │ │ ├── EqualizerScreen.kt │ │ ├── EqualizerViewModel.kt │ │ ├── PresetNameDialog.kt │ │ ├── PresetNameValidationError.kt │ │ ├── PresetSelector.kt │ │ └── TooltipIconButton.kt │ └── preference │ ├── DolbyIeqPreference.kt │ ├── DolbyPreferenceStore.kt │ └── DolbySettingsFragment.kt ├── fingerprint ├── Android.bp ├── UdfpsExtension.cpp ├── UdfpsHandler.cpp └── include │ ├── UdfpsHandler.h │ └── fingerprint.h ├── hidl ├── biometrics │ └── fingerprint │ │ ├── Android.bp │ │ ├── BiometricsFingerprint.cpp │ │ ├── BiometricsFingerprint.h │ │ ├── android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc │ │ ├── android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml │ │ └── service.cpp ├── sensors │ └── 1.0 │ │ ├── Android.bp │ │ ├── Sensors.cpp │ │ ├── Sensors.h │ │ ├── convert.cpp │ │ └── include │ │ └── sensors │ │ └── convert.h └── touch │ ├── Android.bp │ ├── HighTouchPollingRate.cpp │ ├── HighTouchPollingRate.h │ ├── service.cpp │ ├── vendor.lineage.touch@1.0-service.xiaomi.rc │ └── vendor.lineage.touch@1.0-service.xiaomi.xml ├── interfaces ├── Android.bp ├── fingerprints │ └── extension │ │ ├── 1.0 │ │ ├── Android.bp │ │ ├── IAuthenticatorCallback.hal │ │ ├── ICalibrationCallback.hal │ │ ├── ICryptCallback.hal │ │ ├── IFingerprintAuthenticator.hal │ │ ├── IFingerprintCalibration.hal │ │ ├── IFingerprintEngineering.hal │ │ ├── IFingerprintNavigation.hal │ │ ├── IFingerprintOptical.hal │ │ ├── IFingerprintOpticalCallback.hal │ │ ├── IFingerprintRecalibration.hal │ │ ├── IFingerprintSenseTouch.hal │ │ ├── IFingerprintSensorTest.hal │ │ ├── IFpcFingerprintAuthenticator.hal │ │ ├── IIlluminationTuningCallback.hal │ │ ├── IImageCaptureCallback.hal │ │ ├── IImageInjectionCallback.hal │ │ ├── IRecalibrationCallback.hal │ │ ├── ISensorTestCallback.hal │ │ ├── ISensorTestCaptureCallback.hal │ │ ├── IVerifyUserCallback.hal │ │ └── types.hal │ │ └── 2.0 │ │ ├── Android.bp │ │ ├── ICalibrationCallback.hal │ │ ├── IFingerprintAuthenticator.hal │ │ ├── IFingerprintCalibration.hal │ │ ├── IFingerprintEngineering.hal │ │ ├── IFingerprintNavigation.hal │ │ ├── IFingerprintRecalibration.hal │ │ ├── IFingerprintSenseTouch.hal │ │ ├── IFingerprintSensorTest.hal │ │ └── ISensorTestCallback.hal ├── goodix │ └── hardware │ │ ├── biometrics │ │ └── fingerprint │ │ │ └── 2.1 │ │ │ ├── Android.bp │ │ │ ├── IGoodixFingerprintDaemon.hal │ │ │ ├── IGoodixFingerprintDaemonCallback.hal │ │ │ ├── IGoodixFingerprintDaemonExt.hal │ │ │ ├── IGoodixFingerprintDaemonExtCallback.hal │ │ │ ├── IGoodixFingerprintDaemonFido.hal │ │ │ ├── IGoodixFingerprintDaemonFidoCallback.hal │ │ │ ├── IGoodixFingerprintDaemonHbd.hal │ │ │ └── IGoodixFingerprintDaemonHbdCallback.hal │ │ ├── fingerprint │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ ├── IGoodixBiometricsFingerprint.hal │ │ │ └── IGoodixBiometricsFingerprintClientCallback.hal │ │ └── fingerprintextension │ │ └── 1.0 │ │ ├── Android.bp │ │ ├── IGoodixBiometricsFingerprint.hal │ │ └── IGoodixBiometricsFingerprintClientCallback.hal ├── updates-makefiles.sh └── xiaomi │ ├── hardware │ ├── displayfeature │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ ├── IDisplayFeature.hal │ │ │ ├── IDisplayFeatureCallback.hal │ │ │ └── types.hal │ ├── fingerprintextension │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ └── IXiaomiFingerprint.hal │ ├── fx │ │ └── tunnel │ │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ ├── IMiFxTunnel.hal │ │ │ └── IMiFxTunnelCallback.hal │ ├── mfidoca │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ └── IFidoService.hal │ ├── mlipay │ │ ├── 1.0 │ │ │ ├── Android.bp │ │ │ └── IMlipayService.hal │ │ └── 1.1 │ │ │ ├── Android.bp │ │ │ └── IMlipayService.hal │ ├── motor │ │ └── 1.0 │ │ │ ├── Android.bp │ │ │ ├── IMotor.hal │ │ │ ├── IMotorCallback.hal │ │ │ └── types.hal │ ├── mtdservice │ │ ├── 1.0 │ │ │ ├── Android.bp │ │ │ └── IMTService.hal │ │ ├── 1.1 │ │ │ ├── Android.bp │ │ │ └── IMTService.hal │ │ ├── 1.2 │ │ │ ├── Android.bp │ │ │ └── IMTService.hal │ │ └── 1.3 │ │ │ ├── Android.bp │ │ │ └── IMTService.hal │ └── touchfeature │ │ └── 1.0 │ │ ├── Android.bp │ │ └── ITouchFeature.hal │ └── hw │ └── touchfeature │ └── 1.0 │ ├── Android.bp │ └── ITouchFeature.hal ├── megvii ├── Android.bp └── megvii.c ├── sensors ├── v1 │ ├── Android.bp │ └── udfps_hal.cpp └── v2 │ ├── Android.bp │ ├── Sensor.cpp │ ├── Sensor.h │ ├── SensorsSubHal.cpp │ └── SensorsSubHal.h ├── telephony ├── Android.bp └── src │ └── android │ └── telephony │ └── TelephonyBaseUtilsStub.java ├── vibrator └── effect │ ├── Android.bp │ ├── effect.cpp │ └── effect.h └── vintf └── xiaomi_framework_compatibility_matrix.xml /.clang-format: -------------------------------------------------------------------------------- 1 | ../../build/soong/scripts/system-clang-format -------------------------------------------------------------------------------- /Android.bp: -------------------------------------------------------------------------------- 1 | soong_namespace { 2 | } 3 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2024-2025 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | android_app { 8 | name: "DSPVolumeSynchronizer", 9 | certificate: "platform", 10 | srcs: ["src/**/*.java"], 11 | platform_apis: true, 12 | privileged: true, 13 | system_ext_specific: true, 14 | static_libs: [ 15 | "androidx.core_core", 16 | "SettingsLib", 17 | ], 18 | 19 | required: [ 20 | "privapp-permissions-dspvolume", 21 | "config-dspvolume", 22 | "preinstalled-packages-platform-dspvolume", 23 | ], 24 | } 25 | 26 | prebuilt_etc { 27 | name: "privapp-permissions-dspvolume", 28 | relative_install_path: "permissions", 29 | src: "privapp-permissions-dspvolume.xml", 30 | system_ext_specific: true, 31 | filename_from_src: true, 32 | } 33 | 34 | prebuilt_etc { 35 | name: "config-dspvolume", 36 | relative_install_path: "sysconfig", 37 | src: "config-dspvolume.xml", 38 | system_ext_specific: true, 39 | filename_from_src: true, 40 | } 41 | 42 | prebuilt_etc { 43 | name: "preinstalled-packages-platform-dspvolume", 44 | relative_install_path: "sysconfig", 45 | src: "preinstalled-packages-platform-dspvolume.xml", 46 | system_ext_specific: true, 47 | filename_from_src: true, 48 | } 49 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/config-dspvolume.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/preinstalled-packages-platform-dspvolume.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/privapp-permissions-dspvolume.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DSP Volume Synchronizer 5 | 6 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/src/org/lineageos/dspvolume/xiaomi/BootReceiver.java: -------------------------------------------------------------------------------- 1 | package org.lineageos.dspvolume.xiaomi; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | 8 | public class BootReceiver extends BroadcastReceiver { 9 | @Override 10 | public void onReceive(final Context context, Intent intent) { 11 | if (context == null) { 12 | return; 13 | } 14 | context.startService(new Intent(context, VolumeListenerService.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/src/org/lineageos/dspvolume/xiaomi/VolumeListenerReceiver.java: -------------------------------------------------------------------------------- 1 | package org.lineageos.dspvolume.xiaomi; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.media.AudioManager; 7 | import android.util.Log; 8 | 9 | import android.os.Bundle; 10 | 11 | public class VolumeListenerReceiver extends BroadcastReceiver { 12 | 13 | @Override 14 | public void onReceive(Context context, Intent intent) { 15 | if (context == null) { 16 | return; 17 | } 18 | 19 | if(intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_TYPE", 0) == AudioManager.STREAM_MUSIC) { 20 | AudioManager audioManager = context.getSystemService(AudioManager.class); 21 | int current = intent.getIntExtra( 22 | "android.media.EXTRA_VOLUME_STREAM_VALUE", 23 | 0 24 | ); 25 | audioManager.setParameters("volume_change=" + current + ";flags=8"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /DSPVolumeSynchronizer/src/org/lineageos/dspvolume/xiaomi/VolumeListenerService.java: -------------------------------------------------------------------------------- 1 | package org.lineageos.dspvolume.xiaomi; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.content.IntentFilter; 6 | import android.media.AudioManager; 7 | import android.os.IBinder; 8 | 9 | import androidx.annotation.Nullable; 10 | 11 | public class VolumeListenerService extends Service { 12 | @Nullable 13 | @Override 14 | public IBinder onBind(Intent intent) { 15 | return null; 16 | } 17 | 18 | @Override 19 | public int onStartCommand(Intent intent, int flags, int startId) { 20 | IntentFilter intentFilter = new IntentFilter(); 21 | intentFilter.addAction("android.media.VOLUME_CHANGED_ACTION"); 22 | registerReceiver(new VolumeListenerReceiver(), intentFilter); 23 | 24 | AudioManager audioManager = getSystemService(AudioManager.class); 25 | int current = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); 26 | audioManager.setParameters("volume_change=" + current + ";flags=8"); 27 | 28 | return super.onStartCommand(intent, flags, startId); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Euicc/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2023 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | android_app { 8 | name: "XiaomiEuicc", 9 | 10 | srcs: ["src/**/*.kt"], 11 | resource_dirs: ["res"], 12 | 13 | sdk_version: "current", 14 | product_specific: true, 15 | certificate: "platform", 16 | privileged: true, 17 | 18 | optimize: { 19 | proguard_flags_files: ["proguard.flags"], 20 | }, 21 | required: [ 22 | "co.aospa.euicc.xml", 23 | "hidden-api-whitelist-co.aospa.euicc.xml", 24 | "EuiccGoogle", 25 | ], 26 | } 27 | 28 | android_app_import { 29 | name: "EuiccGoogle", 30 | owner: "xiaomi", 31 | apk: "proprietary/product/priv-app/EuiccGoogle/EuiccGoogle.apk", 32 | preprocessed: true, 33 | presigned: true, 34 | dex_preopt: { 35 | enabled: false, 36 | }, 37 | privileged: true, 38 | product_specific: true, 39 | required: [ 40 | "default-permissions-euicc.xml", 41 | "privapp-permissions-euiccgoogle.xml", 42 | ], 43 | } 44 | 45 | prebuilt_etc { 46 | sub_dir: "default-permissions", 47 | name: "default-permissions-euicc.xml", 48 | filename: "default-permissions-euicc.xml", 49 | src: "default-permissions-euicc.xml", 50 | product_specific: true, 51 | } 52 | 53 | prebuilt_etc { 54 | sub_dir: "permissions", 55 | name: "privapp-permissions-euiccgoogle.xml", 56 | filename: "privapp-permissions-euiccgoogle.xml", 57 | src: "privapp-permissions-euiccgoogle.xml", 58 | product_specific: true, 59 | } 60 | 61 | prebuilt_etc { 62 | sub_dir: "permissions", 63 | name: "co.aospa.euicc.xml", 64 | filename: "co.aospa.euicc.xml", 65 | src: "co.aospa.euicc.xml", 66 | product_specific: true, 67 | } 68 | 69 | prebuilt_etc { 70 | sub_dir: "sysconfig", 71 | name: "hidden-api-whitelist-co.aospa.euicc.xml", 72 | filename: "hidden-api-whitelist-co.aospa.euicc.xml", 73 | src: "hidden-api-whitelist-co.aospa.euicc.xml", 74 | product_specific: true, 75 | } 76 | -------------------------------------------------------------------------------- /Euicc/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Euicc/co.aospa.euicc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Euicc/default-permissions-euicc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Euicc/hidden-api-whitelist-co.aospa.euicc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Euicc/privapp-permissions-euiccgoogle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Euicc/proguard.flags: -------------------------------------------------------------------------------- 1 | -keep class co.aospa.euicc.* { 2 | *; 3 | } 4 | -------------------------------------------------------------------------------- /Euicc/proprietary/product/priv-app/EuiccGoogle/EuiccGoogle.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crdroidandroid/android_hardware_xiaomi/9d8d55bd221c87765cd17d824db63a01f225471e/Euicc/proprietary/product/priv-app/EuiccGoogle/EuiccGoogle.apk -------------------------------------------------------------------------------- /Euicc/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | {\"sim_illustration_lottie_mappings\":[{\"devices\":[\"diting\",\"ziyi\",\"nuwa\",\"fuxi\"],\"illustration_lottie\":\"sim_illustration_lottie_bottom\"}]} 8 | {\"sim-slot-mappings\":[{\"devices\":[\"diting\",\"ziyi\",\"nuwa\",\"fuxi\"],\"esim-slot-ids\":[1],\"psim-slot-ids\":[0]}]} 9 | 10 | -------------------------------------------------------------------------------- /Euicc/src/co/aospa/euicc/BootCompletedReceiver.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package co.aospa.euicc 7 | 8 | import android.content.BroadcastReceiver 9 | import android.content.Context 10 | import android.content.Intent 11 | import android.util.Log 12 | 13 | class BootCompletedReceiver : BroadcastReceiver() { 14 | override fun onReceive(context: Context, intent: Intent) { 15 | Log.d(TAG, "Received boot completed intent") 16 | EuiccDisabler.enableOrDisableEuicc(context) 17 | } 18 | 19 | companion object { 20 | private const val TAG = "XiaomiEuiccBootReceiver" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Euicc/src/co/aospa/euicc/EuiccDisabler.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021-2024 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package co.aospa.euicc 7 | 8 | import android.content.Context 9 | import android.content.pm.ApplicationInfo 10 | import android.content.pm.PackageManager 11 | import android.content.pm.PackageManager.ApplicationInfoFlags 12 | import android.util.Log 13 | 14 | object EuiccDisabler { 15 | private const val TAG = "XiaomiEuiccDisabler" 16 | 17 | private val EUICC_DEPENDENCIES = listOf( 18 | "com.google.android.gms", 19 | "com.google.android.gsf", 20 | ) 21 | 22 | private val EUICC_PACKAGES = listOf( 23 | "com.google.android.euicc", 24 | "com.google.android.ims", 25 | ) 26 | 27 | private fun isInstalled(pm: PackageManager, pkgName: String) = runCatching { 28 | val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0)) 29 | info.flags and ApplicationInfo.FLAG_INSTALLED != 0 30 | }.getOrDefault(false) 31 | 32 | private fun isInstalledAndEnabled(pm: PackageManager, pkgName: String) = runCatching { 33 | val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0)) 34 | Log.d(TAG, "package $pkgName installed, enabled = ${info.enabled}") 35 | info.enabled 36 | }.getOrDefault(false) 37 | 38 | fun enableOrDisableEuicc(context: Context) { 39 | val pm = context.packageManager 40 | val disable = EUICC_DEPENDENCIES.any { !isInstalledAndEnabled(pm, it) } 41 | val flag = if (disable) { 42 | PackageManager.COMPONENT_ENABLED_STATE_DISABLED 43 | } else { 44 | PackageManager.COMPONENT_ENABLED_STATE_ENABLED 45 | } 46 | 47 | for (pkg in EUICC_PACKAGES) { 48 | if (isInstalled(pm, pkg)) { 49 | pm.setApplicationEnabledSetting(pkg, flag, 0) 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Euicc/src/co/aospa/euicc/EuiccReceiver.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package co.aospa.euicc 7 | 8 | import android.content.BroadcastReceiver 9 | import android.content.Context 10 | import android.content.Intent 11 | import android.util.Log 12 | 13 | class EuiccReceiver : BroadcastReceiver() { 14 | override fun onReceive(context: Context, intent: Intent) { 15 | Log.d(TAG, "Received PARTNER_CUSTOMIZATION intent") 16 | } 17 | 18 | companion object { 19 | private const val TAG = "XiaomiEuiccReceiver" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /IFAAService/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022-2024 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | android_app { 8 | name: "IFAAService", 9 | srcs: [ 10 | "src/**/*.kt", 11 | "src/**/*.aidl", 12 | ], 13 | aidl: { 14 | local_include_dirs: ["src"], 15 | }, 16 | 17 | static_libs: [ 18 | "android.hidl.base-V1.0-java", 19 | "vendor.xiaomi.hardware.mlipay-V1.1-java", 20 | ], 21 | 22 | certificate: "platform", 23 | platform_apis: true, 24 | system_ext_specific: true, 25 | } 26 | -------------------------------------------------------------------------------- /IFAAService/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /IFAAService/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | IFAAService 8 | 9 | -------------------------------------------------------------------------------- /IFAAService/src/org/ifaa/aidl/manager/IfaaManagerService.aidl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | package org.ifaa.aidl.manager; 8 | 9 | interface IfaaManagerService { 10 | int getSupportBIOTypes(); 11 | int startBIOManager(int authType); 12 | String getDeviceModel(); 13 | byte[] processCmd(inout byte[] param); 14 | int getVersion(); 15 | String getExtInfo(int authType, String keyExtInfo); 16 | void setExtInfo(int authType, String keyExtInfo, String valExtInfo); 17 | int getEnabled(int bioType); 18 | int[] getIDList(int bioType); 19 | } 20 | -------------------------------------------------------------------------------- /aidl/fingerprint/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2024 The LineageOS Project 3 | // 2024 Paranoid Android 4 | // 5 | // SPDX-License-Identifier: Apache-2.0 6 | // 7 | 8 | soong_config_module_type { 9 | name: "xiaomi_hardware_biometrics_config_default", 10 | module_type: "cc_defaults", 11 | config_namespace: "xiaomi_hardware_biometrics", 12 | bool_variables: [ 13 | "run_32bit", 14 | ], 15 | properties: ["compile_multilib"], 16 | } 17 | 18 | xiaomi_hardware_biometrics_config_default { 19 | name: "xiaomi_hardware_biometrics_config_default", 20 | 21 | soong_config_variables: { 22 | run_32bit: { 23 | conditions_default: { 24 | compile_multilib: "64", 25 | }, 26 | compile_multilib: "prefer32", 27 | }, 28 | }, 29 | } 30 | 31 | cc_binary { 32 | name: "android.hardware.biometrics.fingerprint-service.xiaomi", 33 | defaults: ["xiaomi_hardware_biometrics_config_default"], 34 | relative_install_path: "hw", 35 | init_rc: ["android.hardware.biometrics.fingerprint-service.xiaomi.rc"], 36 | vintf_fragments: ["android.hardware.biometrics.fingerprint-service.xiaomi.xml"], 37 | srcs: [ 38 | "CancellationSignal.cpp", 39 | "Fingerprint.cpp", 40 | "FingerprintConfig.cpp", 41 | "LockoutTracker.cpp", 42 | "Session.cpp", 43 | "service.cpp", 44 | ], 45 | local_include_dirs: [ 46 | "include", 47 | ], 48 | shared_libs: [ 49 | "libbase", 50 | "libbinder_ndk", 51 | "libcutils", 52 | "libhardware", 53 | "libdl", 54 | "liblog", 55 | "android.hardware.biometrics.fingerprint-V4-ndk", 56 | "android.hardware.biometrics.common-V4-ndk", 57 | "android.hardware.biometrics.common.config", 58 | "android.hardware.biometrics.common.thread", 59 | "android.hardware.biometrics.common.util", 60 | ], 61 | static_libs: [ 62 | "libandroid.hardware.biometrics.fingerprint.Props", 63 | "libudfpshandlerfactory", 64 | ], 65 | vendor: true, 66 | header_libs: ["xiaomifingerprint_headers"], 67 | } 68 | 69 | sysprop_library { 70 | name: "android.hardware.biometrics.fingerprint.Props", 71 | srcs: ["fingerprint.sysprop"], 72 | property_owner: "Vendor", 73 | vendor: true, 74 | } 75 | -------------------------------------------------------------------------------- /aidl/fingerprint/CancellationSignal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "CancellationSignal.h" 8 | 9 | namespace aidl::android::hardware::biometrics::fingerprint { 10 | 11 | CancellationSignal::CancellationSignal(Session* session) : mSession(session) {} 12 | 13 | ndk::ScopedAStatus CancellationSignal::cancel() { 14 | return mSession->cancel(); 15 | } 16 | 17 | } // namespace aidl::android::hardware::biometrics::fingerprint 18 | -------------------------------------------------------------------------------- /aidl/fingerprint/CancellationSignal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "Session.h" 12 | 13 | namespace aidl::android::hardware::biometrics::fingerprint { 14 | 15 | class CancellationSignal 16 | : public ::aidl::android::hardware::biometrics::common::BnCancellationSignal { 17 | public: 18 | CancellationSignal(Session* session); 19 | ndk::ScopedAStatus cancel() override; 20 | 21 | private: 22 | Session* mSession; 23 | }; 24 | 25 | } // namespace aidl::android::hardware::biometrics::fingerprint 26 | -------------------------------------------------------------------------------- /aidl/fingerprint/Fingerprint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 2024 Paranoid Android 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include "FingerprintConfig.h" 13 | #include "LockoutTracker.h" 14 | #include "Session.h" 15 | #include "UdfpsHandler.h" 16 | 17 | using ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType; 18 | using ::aidl::android::hardware::biometrics::fingerprint::ISession; 19 | using ::aidl::android::hardware::biometrics::fingerprint::ISessionCallback; 20 | using ::aidl::android::hardware::biometrics::fingerprint::SensorProps; 21 | 22 | namespace aidl::android::hardware::biometrics::fingerprint { 23 | 24 | class Fingerprint : public BnFingerprint { 25 | public: 26 | Fingerprint(std::shared_ptr config); 27 | ~Fingerprint(); 28 | 29 | ndk::ScopedAStatus getSensorProps(std::vector* _aidl_return) override; 30 | ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId, 31 | const std::shared_ptr& cb, 32 | std::shared_ptr* out) override; 33 | 34 | private: 35 | fingerprint_device_t* openFingerprintHal(const char* class_name, const char* module_id); 36 | std::vector getSensorLocations(); 37 | static void notify(const fingerprint_msg_t* msg); 38 | 39 | std::shared_ptr mConfig; 40 | std::shared_ptr mSession; 41 | LockoutTracker mLockoutTracker; 42 | FingerprintSensorType mSensorType; 43 | 44 | fingerprint_device_t* mDevice; 45 | UdfpsHandlerFactory* mUdfpsHandlerFactory; 46 | UdfpsHandler* mUdfpsHandler; 47 | }; 48 | 49 | } // namespace aidl::android::hardware::biometrics::fingerprint 50 | -------------------------------------------------------------------------------- /aidl/fingerprint/FingerprintConfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The Android Open Source Project 3 | * 2024 Paranoid Android 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #define LOG_TAG "FingerprintConfig" 9 | 10 | #include "FingerprintConfig.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | using namespace ::android::fingerprint::xiaomi; 17 | 18 | namespace aidl::android::hardware::biometrics::fingerprint { 19 | 20 | // Wrapper to system property access functions 21 | #define CREATE_GETTER_SETTER_WRAPPER(_NAME_, _T_) \ 22 | ConfigValue _NAME_##Getter() { \ 23 | return FingerprintHalProperties::_NAME_(); \ 24 | } \ 25 | bool _NAME_##Setter(const ConfigValue& v) { \ 26 | return FingerprintHalProperties::_NAME_(std::get<_T_>(v)); \ 27 | } 28 | 29 | CREATE_GETTER_SETTER_WRAPPER(type, OptString) 30 | CREATE_GETTER_SETTER_WRAPPER(sensor_id, OptInt32) 31 | CREATE_GETTER_SETTER_WRAPPER(sensor_location, OptString) 32 | CREATE_GETTER_SETTER_WRAPPER(sensor_strength, OptInt32) 33 | CREATE_GETTER_SETTER_WRAPPER(navigation_gesture, OptBool) 34 | CREATE_GETTER_SETTER_WRAPPER(detect_interaction, OptBool) 35 | CREATE_GETTER_SETTER_WRAPPER(display_touch, OptBool) 36 | CREATE_GETTER_SETTER_WRAPPER(control_illumination, OptBool) 37 | 38 | // Name, Getter, Setter, Parser and default value 39 | #define NGS(_NAME_) #_NAME_, _NAME_##Getter, _NAME_##Setter 40 | static Config::Data configData[] = { 41 | {NGS(type), &Config::parseString, ""}, 42 | {NGS(sensor_id), &Config::parseInt32, "0"}, 43 | {NGS(sensor_location), &Config::parseString, ""}, 44 | {NGS(sensor_strength), &Config::parseInt32, "2"}, // STRONG 45 | {NGS(navigation_gesture), &Config::parseBool, "false"}, 46 | {NGS(detect_interaction), &Config::parseBool, "false"}, 47 | {NGS(display_touch), &Config::parseBool, "false"}, 48 | {NGS(control_illumination), &Config::parseBool, "false"}, 49 | }; 50 | 51 | Config::Data* FingerprintConfig::getConfigData(int* size) { 52 | *size = sizeof(configData) / sizeof(configData[0]); 53 | return configData; 54 | } 55 | 56 | } // namespace aidl::android::hardware::biometrics::fingerprint 57 | -------------------------------------------------------------------------------- /aidl/fingerprint/FingerprintConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The Android Open Source Project 3 | * 2024 Paranoid Android 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "config/Config.h" 11 | 12 | namespace aidl::android::hardware::biometrics::fingerprint { 13 | 14 | class FingerprintConfig : public Config { 15 | Config::Data* getConfigData(int* size) override; 16 | }; 17 | 18 | } // namespace aidl::android::hardware::biometrics::fingerprint 19 | -------------------------------------------------------------------------------- /aidl/fingerprint/LockoutTracker.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 2024 The LineageOS Project 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #include "LockoutTracker.h" 9 | #include 10 | #include "Fingerprint.h" 11 | #include "util/Util.h" 12 | 13 | using namespace ::android::fingerprint::xiaomi; 14 | 15 | namespace aidl::android::hardware::biometrics::fingerprint { 16 | 17 | void LockoutTracker::reset(bool clearAttemptCounter) { 18 | if (clearAttemptCounter) { 19 | mFailedCount = 0; 20 | } 21 | mLockoutTimedStart = 0; 22 | mCurrentMode = LockoutMode::kNone; 23 | } 24 | 25 | void LockoutTracker::addFailedAttempt() { 26 | mFailedCount++; 27 | if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD) { 28 | mCurrentMode = LockoutMode::kPermanent; 29 | } else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) { 30 | if (mCurrentMode == LockoutMode::kNone) { 31 | mCurrentMode = LockoutMode::kTimed; 32 | mLockoutTimedStart = Util::getSystemNanoTime(); 33 | } 34 | } 35 | } 36 | 37 | LockoutTracker::LockoutMode LockoutTracker::getMode() { 38 | if (mCurrentMode == LockoutMode::kTimed) { 39 | if (Util::hasElapsed(mLockoutTimedStart, LOCKOUT_TIMED_DURATION)) { 40 | mCurrentMode = LockoutMode::kNone; 41 | mLockoutTimedStart = 0; 42 | } 43 | } 44 | 45 | return mCurrentMode; 46 | } 47 | 48 | int64_t LockoutTracker::getLockoutTimeLeft() { 49 | int64_t res = 0; 50 | 51 | if (mLockoutTimedStart > 0) { 52 | auto now = Util::getSystemNanoTime(); 53 | auto elapsed = (now - mLockoutTimedStart) / 1000000LL; 54 | res = LOCKOUT_TIMED_DURATION - elapsed; 55 | LOG(INFO) << "elapsed=" << elapsed << " now = " << now 56 | << " mLockoutTimedStart=" << mLockoutTimedStart << " res=" << res; 57 | } 58 | 59 | return res; 60 | } 61 | 62 | } // namespace aidl::android::hardware::biometrics::fingerprint 63 | -------------------------------------------------------------------------------- /aidl/fingerprint/LockoutTracker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 2024 The LineageOS Project 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #define LOCKOUT_TIMED_THRESHOLD 5 15 | #define LOCKOUT_TIMED_DURATION 10000 16 | #define LOCKOUT_PERMANENT_THRESHOLD 20 17 | 18 | namespace aidl::android::hardware::biometrics::fingerprint { 19 | 20 | class LockoutTracker { 21 | public: 22 | LockoutTracker() : mFailedCount(0) {} 23 | ~LockoutTracker() {} 24 | 25 | enum class LockoutMode : int8_t { kNone = 0, kTimed, kPermanent }; 26 | 27 | void reset(bool clearAttemptCounter); 28 | LockoutMode getMode(); 29 | void addFailedAttempt(); 30 | int64_t getLockoutTimeLeft(); 31 | inline std::string toString() const { 32 | std::ostringstream os; 33 | os << "----- LockoutTracker:: -----" << std::endl; 34 | os << "LockoutTracker::mFailedCount:" << mFailedCount; 35 | os << ", LockoutTracker::mCurrentMode:" << (int)mCurrentMode; 36 | os << std::endl; 37 | return os.str(); 38 | } 39 | 40 | private: 41 | int32_t mFailedCount; 42 | int64_t mLockoutTimedStart; 43 | LockoutMode mCurrentMode; 44 | }; 45 | 46 | } // namespace aidl::android::hardware::biometrics::fingerprint 47 | -------------------------------------------------------------------------------- /aidl/fingerprint/android.hardware.biometrics.fingerprint-service.xiaomi.rc: -------------------------------------------------------------------------------- 1 | service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.xiaomi 2 | # "class hal" causes a race condition on some devices due to files created 3 | # in /data. As a workaround, postpone startup until later in boot once 4 | # /data is mounted. 5 | class late_start 6 | user system 7 | group system input uhid 8 | shutdown critical 9 | -------------------------------------------------------------------------------- /aidl/fingerprint/android.hardware.biometrics.fingerprint-service.xiaomi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.biometrics.fingerprint 4 | 4 5 | IFingerprint/default 6 | 7 | 8 | -------------------------------------------------------------------------------- /aidl/fingerprint/fingerprint.sysprop: -------------------------------------------------------------------------------- 1 | # fingerprint.sysprop 2 | # module becomes static class (Java) / namespace (C++) for serving API 3 | module: "android.fingerprint.xiaomi.FingerprintHalProperties" 4 | owner: Vendor 5 | 6 | # type of fingerprint sensor (default: none) 7 | prop { 8 | prop_name: "persist.vendor.fingerprint.type" 9 | type: String 10 | scope: Internal 11 | access: ReadWrite 12 | enum_values: "udfps|udfps_optical|side|home|rear" 13 | api_name: "type" 14 | } 15 | 16 | # sensor location 17 | # ||| in pixel, can have multiple values separated by comma 18 | prop { 19 | prop_name: "persist.vendor.fingerprint.sensor_location" 20 | type: String 21 | scope: Internal 22 | access: ReadWrite 23 | api_name: "sensor_location" 24 | } 25 | 26 | # sensor id (default: 0) 27 | prop { 28 | prop_name: "persist.vendor.fingerprint.sensor_id" 29 | type: Integer 30 | scope: Internal 31 | access: ReadWrite 32 | api_name: "sensor_id" 33 | } 34 | 35 | # sensor strength (default: 2) 36 | # [0=CONVENIENCE, 1=WEAK, 2=STRONG] 37 | prop { 38 | prop_name: "persist.vendor.fingerprint.sensor_strength" 39 | type: Integer 40 | scope: Internal 41 | access: ReadWrite 42 | api_name: "sensor_strength" 43 | } 44 | 45 | # whether support navigation guestures (default: false) 46 | prop { 47 | prop_name: "persist.vendor.fingerprint.navigation_gesture" 48 | type: Boolean 49 | scope: Internal 50 | access: ReadWrite 51 | api_name: "navigation_gesture" 52 | } 53 | 54 | # whether support detect interaction (default: false) 55 | prop { 56 | prop_name: "persist.vendor.fingerprint.detect_interaction" 57 | type: Boolean 58 | scope: Internal 59 | access: ReadWrite 60 | api_name: "detect_interaction" 61 | } 62 | 63 | # whether support display touch by hal (default: false) 64 | prop { 65 | prop_name: "persist.vendor.fingerprint.udfps.display_touch" 66 | type: Boolean 67 | scope: Internal 68 | access: ReadWrite 69 | api_name: "display_touch" 70 | } 71 | 72 | # whether support illumination control by hal (default: false) 73 | prop { 74 | prop_name: "persist.vendor.fingerprint.udfps.control_illumination" 75 | type: Boolean 76 | scope: Internal 77 | access: ReadWrite 78 | api_name: "control_illumination" 79 | } 80 | -------------------------------------------------------------------------------- /aidl/fingerprint/include/Legacy2Aidl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace aidl::android::hardware::biometrics::fingerprint { 16 | 17 | inline void translate(const ::aidl::android::hardware::keymaster::HardwareAuthToken& authToken, 18 | hw_auth_token_t& hat) { 19 | hat.challenge = authToken.challenge; 20 | hat.user_id = authToken.userId; 21 | hat.authenticator_id = authToken.authenticatorId; 22 | // these are in host order: translate to network order 23 | hat.authenticator_type = htobe32(static_cast(authToken.authenticatorType)); 24 | hat.timestamp = htobe64(authToken.timestamp.milliSeconds); 25 | std::copy(authToken.mac.begin(), authToken.mac.end(), hat.hmac); 26 | } 27 | 28 | inline void translate(const hw_auth_token_t& hat, 29 | ::aidl::android::hardware::keymaster::HardwareAuthToken& authToken) { 30 | authToken.challenge = hat.challenge; 31 | authToken.userId = hat.user_id; 32 | authToken.authenticatorId = hat.authenticator_id; 33 | // these are in network order: translate to host 34 | authToken.authenticatorType = 35 | static_cast<::aidl::android::hardware::keymaster::HardwareAuthenticatorType>( 36 | be32toh(hat.authenticator_type)); 37 | authToken.timestamp.milliSeconds = be64toh(hat.timestamp); 38 | authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac), std::end(hat.hmac)); 39 | } 40 | 41 | } // namespace aidl::android::hardware::biometrics::fingerprint 42 | -------------------------------------------------------------------------------- /aidl/fingerprint/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "Fingerprint.h" 8 | #include "FingerprintConfig.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | using ::aidl::android::hardware::biometrics::fingerprint::Fingerprint; 15 | using ::aidl::android::hardware::biometrics::fingerprint::FingerprintConfig; 16 | 17 | int main() { 18 | ABinderProcess_setThreadPoolMaxThreadCount(0); 19 | 20 | std::shared_ptr config = std::make_shared(); 21 | config->init(); 22 | 23 | std::shared_ptr fingerprint = ndk::SharedRefBase::make(config); 24 | 25 | const std::string instance = std::string() + Fingerprint::descriptor + "/default"; 26 | binder_status_t status = 27 | AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str()); 28 | CHECK(status == STATUS_OK); 29 | 30 | ABinderProcess_joinThreadPool(); 31 | return EXIT_FAILURE; // should not reach 32 | } 33 | -------------------------------------------------------------------------------- /aidl/ir/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // SPDX-FileCopyrightText: 2024 The LineageOS Project 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | 6 | cc_binary { 7 | name: "android.hardware.ir-service.xiaomi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | init_rc: ["android.hardware.ir-service.xiaomi.rc"], 11 | vintf_fragments: ["android.hardware.ir-service.xiaomi.xml"], 12 | srcs: [ 13 | "ConsumerIr.cpp", 14 | "service.cpp", 15 | ], 16 | shared_libs: [ 17 | "libbase", 18 | "libbinder_ndk", 19 | "android.hardware.ir-V1-ndk", 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /aidl/ir/ConsumerIr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2017-2024 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #define LOG_TAG "ConsumerIr" 7 | 8 | #include "ConsumerIr.h" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | using std::vector; 16 | 17 | namespace aidl { 18 | namespace android { 19 | namespace hardware { 20 | namespace ir { 21 | 22 | static const std::string kIrDevice = "/dev/lirc0"; 23 | 24 | static vector kRangeVec{ 25 | {.minHz = 30000, .maxHz = 60000}, 26 | }; 27 | 28 | ::ndk::ScopedAStatus ConsumerIr::getCarrierFreqs(vector* _aidl_return) { 29 | *_aidl_return = kRangeVec; 30 | 31 | return ::ndk::ScopedAStatus::ok(); 32 | } 33 | 34 | ::ndk::ScopedAStatus ConsumerIr::transmit(int32_t carrierFreqHz, const vector& pattern) { 35 | size_t entries = pattern.size(); 36 | 37 | if (entries == 0) { 38 | return ::ndk::ScopedAStatus::ok(); 39 | } 40 | 41 | int fd = open(kIrDevice.c_str(), O_RDWR); 42 | if (fd < 0) { 43 | LOG(ERROR) << "Failed to open " << kIrDevice << ", error " << fd; 44 | 45 | return ::ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); 46 | } 47 | 48 | int rc = ioctl(fd, LIRC_SET_SEND_CARRIER, &carrierFreqHz); 49 | if (rc < 0) { 50 | LOG(ERROR) << "Failed to set carrier " << carrierFreqHz << ", error: " << errno; 51 | 52 | close(fd); 53 | 54 | return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 55 | } 56 | 57 | if ((entries & 1) != 0) { 58 | rc = write(fd, pattern.data(), entries * sizeof(int32_t)); 59 | } else { 60 | rc = write(fd, pattern.data(), (entries - 1) * sizeof(int32_t)); 61 | usleep(pattern[entries - 1]); 62 | } 63 | 64 | if (rc < 0) { 65 | LOG(ERROR) << "Failed to write pattern, " << entries << " entries, error: " << errno; 66 | 67 | close(fd); 68 | 69 | return ::ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); 70 | } 71 | 72 | close(fd); 73 | 74 | return ::ndk::ScopedAStatus::ok(); 75 | } 76 | 77 | } // namespace ir 78 | } // namespace hardware 79 | } // namespace android 80 | } // namespace aidl 81 | -------------------------------------------------------------------------------- /aidl/ir/ConsumerIr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace aidl { 11 | namespace android { 12 | namespace hardware { 13 | namespace ir { 14 | 15 | class ConsumerIr : public BnConsumerIr { 16 | public: 17 | ::ndk::ScopedAStatus getCarrierFreqs( 18 | ::std::vector<::aidl::android::hardware::ir::ConsumerIrFreqRange>* _aidl_return) 19 | override; 20 | ::ndk::ScopedAStatus transmit(int32_t carrierFreqHz, 21 | const ::std::vector& pattern) override; 22 | }; 23 | 24 | } // namespace ir 25 | } // namespace hardware 26 | } // namespace android 27 | } // namespace aidl 28 | -------------------------------------------------------------------------------- /aidl/ir/android.hardware.ir-service.xiaomi.rc: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-FileCopyrightText: 2024 The LineageOS Project 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | on early-boot 7 | # IR device 8 | chown system system /dev/lirc0 9 | 10 | service vendor.ir-default /vendor/bin/hw/android.hardware.ir-service.xiaomi 11 | class hal 12 | user system 13 | group system 14 | shutdown critical 15 | -------------------------------------------------------------------------------- /aidl/ir/android.hardware.ir-service.xiaomi.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | android.hardware.ir 8 | 1 9 | IConsumerIr/default 10 | 11 | 12 | -------------------------------------------------------------------------------- /aidl/ir/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | #include "ConsumerIr.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | using aidl::android::hardware::ir::ConsumerIr; 13 | 14 | int main() { 15 | ABinderProcess_setThreadPoolMaxThreadCount(0); 16 | std::shared_ptr hal = ::ndk::SharedRefBase::make(); 17 | 18 | const std::string instance = std::string(ConsumerIr::descriptor) + "/default"; 19 | binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); 20 | CHECK_EQ(status, STATUS_OK); 21 | 22 | ABinderProcess_joinThreadPool(); 23 | return EXIT_FAILURE; // should not reach 24 | } 25 | -------------------------------------------------------------------------------- /aidl/sensors/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 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 { 18 | // See: http://go/android-license-faq 19 | default_applicable_licenses: ["Android-Apache-2.0"], 20 | } 21 | 22 | cc_binary { 23 | name: "android.hardware.sensors-service.xiaomi-multihal", 24 | vendor: true, 25 | relative_install_path: "hw", 26 | srcs: [ 27 | "service.cpp", 28 | "HalProxy.cpp", 29 | "HalProxyCallback.cpp", 30 | ], 31 | header_libs: [ 32 | "android.hardware.sensors@2.X-multihal.header", 33 | "android.hardware.sensors@2.X-shared-utils", 34 | ], 35 | init_rc: ["android.hardware.sensors-service.xiaomi-multihal.rc"], 36 | vintf_fragments: ["android.hardware.sensors.xiaomi-multihal.xml"], 37 | shared_libs: [ 38 | "android.hardware.sensors@2.0-ScopedWakelock", 39 | "android.hardware.sensors@2.0", 40 | "android.hardware.sensors@2.1", 41 | "android.hardware.sensors-V3-ndk", 42 | "libbase", 43 | "libcutils", 44 | "libfmq", 45 | "liblog", 46 | "libpower", 47 | "libutils", 48 | "libbinder_ndk", 49 | "libhidlbase", 50 | ], 51 | static_libs: [ 52 | "libaidlcommonsupport", 53 | "android.hardware.sensors@1.0-convert", 54 | "android.hardware.sensors@2.X-multihal", 55 | "android.hardware.sensors@aidl-multihal", 56 | ], 57 | } 58 | -------------------------------------------------------------------------------- /aidl/sensors/HalProxyCallback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 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 | #include "HalProxyCallback.h" 18 | 19 | #include 20 | 21 | namespace android { 22 | namespace hardware { 23 | namespace sensors { 24 | namespace V2_0 { 25 | namespace implementation { 26 | 27 | static constexpr int32_t kBitsAfterSubHalIndex = 24; 28 | 29 | /** 30 | * Set the subhal index as first byte of sensor handle and return this modified version. 31 | * 32 | * @param sensorHandle The sensor handle to modify. 33 | * @param subHalIndex The index in the hal proxy of the sub hal this sensor belongs to. 34 | * 35 | * @return The modified sensor handle. 36 | */ 37 | int32_t setSubHalIndex(int32_t sensorHandle, size_t subHalIndex) { 38 | return sensorHandle | (static_cast(subHalIndex) << kBitsAfterSubHalIndex); 39 | } 40 | 41 | void HalProxyCallbackBase::postEvents(const std::vector& events, 42 | ScopedWakelock wakelock) { 43 | if (events.empty() || !mCallback->areThreadsRunning()) return; 44 | size_t numWakeupEvents; 45 | std::vector processedEvents = processEvents(events, &numWakeupEvents); 46 | if (numWakeupEvents > 0) { 47 | ALOG_ASSERT(wakelock.isLocked(), 48 | "Wakeup events posted while wakelock unlocked for subhal" 49 | " w/ index %" PRId32 ".", 50 | mSubHalIndex); 51 | } else { 52 | ALOG_ASSERT(!wakelock.isLocked(), 53 | "No Wakeup events posted but wakelock locked for subhal" 54 | " w/ index %" PRId32 ".", 55 | mSubHalIndex); 56 | } 57 | mCallback->postEventsToMessageQueue(processedEvents, numWakeupEvents, std::move(wakelock)); 58 | } 59 | 60 | ScopedWakelock HalProxyCallbackBase::createScopedWakelock(bool lock) { 61 | ScopedWakelock wakelock(mRefCounter, lock); 62 | return wakelock; 63 | } 64 | 65 | std::vector HalProxyCallbackBase::processEvents(const std::vector& events, 66 | size_t* numWakeupEvents) const { 67 | *numWakeupEvents = 0; 68 | std::vector eventsOut; 69 | for (V2_1::Event event : events) { 70 | event.sensorHandle = setSubHalIndex(event.sensorHandle, mSubHalIndex); 71 | if (event.sensorType == V2_1::SensorType::DYNAMIC_SENSOR_META) { 72 | event.u.dynamic.sensorHandle = 73 | setSubHalIndex(event.u.dynamic.sensorHandle, mSubHalIndex); 74 | } 75 | const V2_1::SensorInfo& sensor = mCallback->getSensorInfo(event.sensorHandle); 76 | 77 | if (sensor.type == V2_1::SensorType::PICK_UP_GESTURE 78 | && event.u.scalar != 1) { 79 | continue; 80 | } 81 | 82 | if ((sensor.flags & V1_0::SensorFlagBits::WAKE_UP) != 0) { 83 | (*numWakeupEvents)++; 84 | } 85 | eventsOut.push_back(event); 86 | } 87 | return eventsOut; 88 | } 89 | 90 | } // namespace implementation 91 | } // namespace V2_0 92 | } // namespace sensors 93 | } // namespace hardware 94 | } // namespace android 95 | -------------------------------------------------------------------------------- /aidl/sensors/android.hardware.sensors-service.xiaomi-multihal.rc: -------------------------------------------------------------------------------- 1 | service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.xiaomi-multihal 2 | class hal 3 | user system 4 | group system wakelock context_hub input uhid 5 | task_profiles ServiceCapacityLow 6 | capabilities BLOCK_SUSPEND 7 | rlimit rtprio 10 10 8 | -------------------------------------------------------------------------------- /aidl/sensors/android.hardware.sensors.xiaomi-multihal.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | android.hardware.sensors 20 | 3 21 | ISensors/default 22 | 23 | 24 | -------------------------------------------------------------------------------- /aidl/sensors/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 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 | #include 18 | #include 19 | #include 20 | #include "HalProxyAidl.h" 21 | 22 | using ::aidl::android::hardware::sensors::implementation::HalProxyAidl; 23 | 24 | int main() { 25 | ABinderProcess_setThreadPoolMaxThreadCount(0); 26 | 27 | // Make a default multihal sensors service 28 | auto halProxy = ndk::SharedRefBase::make(); 29 | const std::string halProxyName = std::string() + HalProxyAidl::descriptor + "/default"; 30 | binder_status_t status = 31 | AServiceManager_addService(halProxy->asBinder().get(), halProxyName.c_str()); 32 | CHECK_EQ(status, STATUS_OK); 33 | 34 | ABinderProcess_joinThreadPool(); 35 | return EXIT_FAILURE; // should not reach 36 | } 37 | -------------------------------------------------------------------------------- /dolby/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2017-2021 The LineageOS Project 3 | // (C) 2023-24 Paranoid Android 4 | // 5 | // SPDX-License-Identifier: Apache-2.0 6 | // 7 | 8 | android_app { 9 | name: "XiaomiDolby", 10 | 11 | srcs: ["src/**/*.kt"], 12 | resource_dirs: ["res"], 13 | certificate: "platform", 14 | platform_apis: true, 15 | system_ext_specific: true, 16 | privileged: true, 17 | 18 | overrides: ["MusicFX", "AudioFX"], 19 | static_libs: [ 20 | "SettingsLib", 21 | "SpaLib", 22 | "androidx.activity_activity-compose", 23 | "androidx.compose.runtime_runtime", 24 | "androidx.preference_preference", 25 | "com.google.android.material_material", 26 | "org.lineageos.settings.resources", 27 | ], 28 | 29 | required: ["preinstalled-packages-platform-dolby.xml"], 30 | } 31 | 32 | prebuilt_etc { 33 | name: "preinstalled-packages-platform-dolby.xml", 34 | src: "preinstalled-packages-platform-dolby.xml", 35 | sub_dir: "sysconfig", 36 | system_ext_specific: true, 37 | } 38 | -------------------------------------------------------------------------------- /dolby/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 11 | 12 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 48 | 49 | 50 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 69 | 70 | 71 | 72 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /dolby/preinstalled-packages-platform-dolby.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_dolby.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_dolby_qs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_ieq_balanced.xml: -------------------------------------------------------------------------------- 1 | 8 | 12 | 16 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_ieq_detailed.xml: -------------------------------------------------------------------------------- 1 | 8 | 12 | 16 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_ieq_off.xml: -------------------------------------------------------------------------------- 1 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_ieq_warm.xml: -------------------------------------------------------------------------------- 1 | 8 | 13 | 18 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_launcher_background__0.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_launcher_background__1.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_launcher_mono.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_profile_custom.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_profile_dynamic.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_profile_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /dolby/res/drawable/ic_profile_music.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /dolby/res/drawable/reset_settings_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /dolby/res/drawable/save_as_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /dolby/res/layout-v34/settingslib_main_switch_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 28 | 29 | 37 | 38 | 51 | 52 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /dolby/res/layout/ieq_icon_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 33 | 34 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /dolby/res/layout/preference_widget_switch_compat.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 27 | -------------------------------------------------------------------------------- /dolby/res/mipmap-anydpi/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dolby/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | Dolby Atmos 10 | Use Dolby Atmos 11 | Choose a profile 12 | Graphic equalizer 13 | Off 14 | On 15 | Low 16 | Medium 17 | High 18 | Max 19 | Unknown 20 | On (%1$s) 21 | Settings 22 | Bass enhancer 23 | Dialogue enhancer 24 | Speaker virtualization 25 | Headphone virtualization 26 | Stereo widening 27 | Volume leveler 28 | Connect headphones 29 | Reset to defaults 30 | Successfully reset settings for %1$s profile 31 | 32 | 33 | Dynamic 34 | Movie 35 | Music 36 | Custom 37 | 38 | 39 | Flat (off) 40 | Rock 41 | Jazz 42 | Pop 43 | Classical 44 | Hip Hop 45 | Blues 46 | Electronic 47 | Country 48 | Dance 49 | Metal 50 | 51 | 52 | Gain 53 | Preset 54 | Preset name 55 | New preset 56 | Rename preset 57 | Delete preset 58 | Do you want to delete this preset? 59 | Reset gains 60 | Do you want to reset this preset to defaults? 61 | Preset name already exists! 62 | Preset name is too long! 63 | 64 | 65 | Intelligent equalizer 66 | Balanced 67 | Warm 68 | Detailed 69 | 70 | 71 | -------------------------------------------------------------------------------- /dolby/res/xml/dolby_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 14 | 15 | 22 | 23 | 25 | 26 | 29 | 33 | 34 | 35 | 40 | 41 | 44 | 45 | 48 | 49 | 55 | 56 | 61 | 62 | 65 | 66 | 69 | 70 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/BootCompletedReceiver.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-24 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi 8 | 9 | import android.content.BroadcastReceiver 10 | import android.content.Context 11 | import android.content.Intent 12 | import android.util.Log 13 | 14 | private const val TAG = "XiaomiDolby-Boot" 15 | 16 | class BootCompletedReceiver : BroadcastReceiver() { 17 | 18 | override fun onReceive(context: Context, intent: Intent) { 19 | Log.d(TAG, "Received intent: ${intent.action}") 20 | if (intent.action != Intent.ACTION_BOOT_COMPLETED) { 21 | return 22 | } 23 | 24 | Log.i(TAG, "Boot completed, starting dolby") 25 | DolbyController.getInstance(context).onBootCompleted() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/DolbyActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-24 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi 8 | 9 | import android.os.Bundle 10 | import co.aospa.dolby.xiaomi.preference.DolbySettingsFragment 11 | import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity 12 | 13 | private const val TAG = "DolbyActivity" 14 | 15 | class DolbyActivity : CollapsingToolbarBaseActivity() { 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | fragmentManager.beginTransaction() 20 | .replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame, DolbySettingsFragment(), TAG) 21 | .commit() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/DolbyConstants.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-24 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi 8 | 9 | import android.util.Log 10 | 11 | class DolbyConstants { 12 | 13 | enum class DsParam(val id: Int, val length: Int = 1) { 14 | HEADPHONE_VIRTUALIZER(101), 15 | SPEAKER_VIRTUALIZER(102), 16 | VOLUME_LEVELER_ENABLE(103), 17 | IEQ_PRESET(104), 18 | DIALOGUE_ENHANCER_ENABLE(105), 19 | DIALOGUE_ENHANCER_AMOUNT(108), 20 | GEQ_BAND_GAINS(110, 20), 21 | BASS_ENHANCER_ENABLE(111), 22 | STEREO_WIDENING_AMOUNT(113); 23 | 24 | override fun toString(): String { 25 | return "${name}(${id})" 26 | } 27 | } 28 | 29 | companion object { 30 | const val TAG = "XiaomiDolby" 31 | const val PREF_ENABLE = "dolby_enable" 32 | const val PREF_PROFILE = "dolby_profile" 33 | const val PREF_PRESET = "dolby_preset" 34 | const val PREF_IEQ = "dolby_ieq" 35 | const val PREF_HP_VIRTUALIZER = "dolby_virtualizer" 36 | const val PREF_SPK_VIRTUALIZER = "dolby_spk_virtualizer" 37 | const val PREF_STEREO = "dolby_stereo" 38 | const val PREF_DIALOGUE = "dolby_dialogue" 39 | const val PREF_BASS = "dolby_bass" 40 | const val PREF_VOLUME = "dolby_volume" 41 | const val PREF_RESET = "dolby_reset" 42 | 43 | val PROFILE_SPECIFIC_PREFS = setOf( 44 | PREF_PRESET, 45 | PREF_IEQ, 46 | PREF_HP_VIRTUALIZER, 47 | PREF_SPK_VIRTUALIZER, 48 | PREF_STEREO, 49 | PREF_DIALOGUE, 50 | PREF_BASS, 51 | PREF_VOLUME 52 | ) 53 | 54 | fun dlog(tag: String, msg: String) { 55 | if (Log.isLoggable(TAG, Log.DEBUG)) { 56 | Log.d(tag, msg) 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/DolbyTileService.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-24 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi 8 | 9 | import android.service.quicksettings.Tile 10 | import android.service.quicksettings.TileService 11 | 12 | private const val TAG = "DolbyTileService" 13 | 14 | class DolbyTileService : TileService() { 15 | 16 | private val dolbyController by lazy { DolbyController.getInstance(applicationContext) } 17 | 18 | override fun onStartListening() { 19 | qsTile.apply { 20 | state = if (dolbyController.dsOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE 21 | subtitle = dolbyController.getProfileName() ?: getString(R.string.dolby_unknown) 22 | updateTile() 23 | } 24 | super.onStartListening() 25 | } 26 | 27 | override fun onClick() { 28 | val isDsOn = dolbyController.dsOn 29 | dolbyController.setDsOnAndPersist(!isDsOn) // toggle 30 | qsTile.apply { 31 | state = if (isDsOn) Tile.STATE_INACTIVE else Tile.STATE_ACTIVE 32 | updateTile() 33 | } 34 | super.onClick() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/SummaryProvider.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 The Android Open Source Project 3 | * (C) 2023-24 Paranoid Android 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | package co.aospa.dolby.xiaomi 9 | 10 | import android.content.ContentProvider 11 | import android.content.ContentValues 12 | import android.database.Cursor 13 | import android.net.Uri 14 | import android.os.Bundle 15 | import co.aospa.dolby.xiaomi.R 16 | import com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY 17 | 18 | private const val KEY_DOLBY = "dolby" 19 | 20 | /** Provide preference summary for injected items. */ 21 | class SummaryProvider : ContentProvider() { 22 | 23 | override fun call( 24 | method: String, 25 | arg: String?, 26 | extras: Bundle? 27 | ): Bundle? { 28 | val summary = when (method) { 29 | KEY_DOLBY -> getDolbySummary() 30 | else -> return null 31 | } 32 | return Bundle().apply { 33 | putString(META_DATA_PREFERENCE_SUMMARY, summary) 34 | } 35 | } 36 | 37 | override fun onCreate(): Boolean = true 38 | 39 | override fun query( 40 | uri: Uri, 41 | projection: Array?, 42 | selection: String?, 43 | selectionArgs: Array?, 44 | sortOrder: String? 45 | ): Cursor? = null 46 | 47 | override fun getType(uri: Uri): String? = null 48 | 49 | override fun insert(uri: Uri, values: ContentValues?): Uri? = null 50 | 51 | override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int = 0 52 | 53 | override fun update( 54 | uri: Uri, 55 | values: ContentValues?, 56 | selection: String?, 57 | selectionArgs: Array? 58 | ): Int = 0 59 | 60 | private fun getDolbySummary(): String { 61 | val dolbyController = DolbyController.getInstance(context!!) 62 | if (!dolbyController.dsOn) { 63 | return context!!.getString(R.string.dolby_off) 64 | } 65 | return dolbyController.getProfileName()?.let { 66 | context!!.getString(R.string.dolby_on_with_profile, it) 67 | } ?: context!!.getString(R.string.dolby_on) 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/EqualizerActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq 8 | 9 | import android.os.Bundle 10 | import androidx.activity.ComponentActivity 11 | import androidx.activity.compose.setContent 12 | import androidx.activity.viewModels 13 | import androidx.compose.foundation.layout.padding 14 | import androidx.compose.runtime.Composable 15 | import androidx.compose.runtime.CompositionLocalProvider 16 | import androidx.compose.ui.Modifier 17 | import androidx.compose.ui.res.stringResource 18 | import androidx.navigation.compose.rememberNavController 19 | import co.aospa.dolby.xiaomi.R 20 | import co.aospa.dolby.xiaomi.geq.ui.EqualizerScreen 21 | import co.aospa.dolby.xiaomi.geq.ui.EqualizerViewModel 22 | import com.android.settingslib.spa.framework.compose.localNavController 23 | import com.android.settingslib.spa.framework.theme.SettingsTheme 24 | import com.android.settingslib.spa.widget.scaffold.SettingsScaffold 25 | 26 | class EqualizerActivity : ComponentActivity() { 27 | 28 | private val viewModel: EqualizerViewModel by viewModels { EqualizerViewModel.Factory } 29 | 30 | override fun onCreate(savedInstanceState: Bundle?) { 31 | super.onCreate(savedInstanceState) 32 | setContent { 33 | SettingsTheme { 34 | MainContent() 35 | } 36 | } 37 | } 38 | 39 | @Composable 40 | private fun MainContent() { 41 | val navController = rememberNavController() 42 | CompositionLocalProvider(navController.localNavController()) { 43 | SettingsScaffold( 44 | title = stringResource(id = R.string.dolby_preset) 45 | ) { paddingValues -> 46 | EqualizerScreen( 47 | viewModel = viewModel, 48 | modifier = Modifier.padding(paddingValues) 49 | ) 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/data/BandGain.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.data 8 | 9 | data class BandGain( 10 | val band: Int, 11 | var gain: Int = 0 12 | ) 13 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/data/Preset.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.data 8 | 9 | data class Preset( 10 | var name: String, 11 | val bandGains: List, 12 | var isUserDefined: Boolean = false, 13 | var isMutated: Boolean = false 14 | ) 15 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/BandGainSlider.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.Column 10 | import androidx.compose.foundation.layout.height 11 | import androidx.compose.foundation.layout.padding 12 | import androidx.compose.foundation.layout.width 13 | import androidx.compose.material3.Slider 14 | import androidx.compose.material3.Text 15 | import androidx.compose.runtime.Composable 16 | import androidx.compose.runtime.getValue 17 | import androidx.compose.runtime.mutableFloatStateOf 18 | import androidx.compose.runtime.remember 19 | import androidx.compose.runtime.setValue 20 | import androidx.compose.ui.Alignment 21 | import androidx.compose.ui.Modifier 22 | import androidx.compose.ui.graphics.TransformOrigin 23 | import androidx.compose.ui.graphics.graphicsLayer 24 | import androidx.compose.ui.layout.layout 25 | import androidx.compose.ui.unit.Constraints 26 | import androidx.compose.ui.unit.dp 27 | import androidx.compose.ui.unit.sp 28 | import co.aospa.dolby.xiaomi.geq.data.BandGain 29 | 30 | @Composable 31 | fun BandGainSlider( 32 | bandGain: BandGain, 33 | onValueChangeFinished: (Int) -> Unit 34 | ) { 35 | // Gain range is of -1->1 in UI, -100->100 in backend, but actually is -10->10 dB. 36 | 37 | // Ensure we update the slider when gain is changed, 38 | // for eg. when changing the preset 39 | var sliderPosition by remember(bandGain.gain) { 40 | mutableFloatStateOf(bandGain.gain / 100f) 41 | } 42 | 43 | Column( 44 | horizontalAlignment = Alignment.CenterHorizontally, 45 | ) { 46 | SliderText( 47 | "%.1f".format(sliderPosition * 10f) 48 | ) 49 | Slider( 50 | value = sliderPosition, 51 | onValueChange = { sliderPosition = it }, 52 | onValueChangeFinished = { 53 | onValueChangeFinished((sliderPosition * 100f).toInt()) 54 | }, 55 | valueRange = -1f..1f, 56 | modifier = Modifier 57 | .graphicsLayer { 58 | rotationZ = 270f 59 | transformOrigin = TransformOrigin(0f, 0f) 60 | } 61 | .layout { measurable, constraints -> 62 | val placeable = measurable.measure( 63 | Constraints( 64 | minWidth = constraints.minHeight, 65 | maxWidth = constraints.maxHeight, 66 | minHeight = constraints.minWidth, 67 | maxHeight = constraints.maxHeight, 68 | ) 69 | ) 70 | layout(placeable.height, placeable.width) { 71 | placeable.place(-placeable.width, 0) 72 | } 73 | } 74 | // horizontal and vertical dimensions are inverted due to rotation 75 | .width(200.dp) 76 | .height(40.dp) 77 | .padding(8.dp) 78 | ) 79 | SliderText( 80 | with(bandGain.band) { 81 | if (this >= 1000) { 82 | "${this / 1000}k" 83 | } else { 84 | "$this" 85 | } 86 | } 87 | ) 88 | } 89 | } 90 | 91 | @Composable 92 | fun SliderText( 93 | text: String, 94 | modifier: Modifier = Modifier 95 | ) { 96 | Text( 97 | text = text, 98 | modifier = modifier, 99 | fontSize = 12.sp 100 | ) 101 | } 102 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/BandGainSliderLabels.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.Column 10 | import androidx.compose.foundation.layout.Spacer 11 | import androidx.compose.foundation.layout.height 12 | import androidx.compose.foundation.layout.padding 13 | import androidx.compose.material3.MaterialTheme 14 | import androidx.compose.material3.Text 15 | import androidx.compose.runtime.Composable 16 | import androidx.compose.ui.Alignment 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.res.stringResource 19 | import androidx.compose.ui.unit.dp 20 | import androidx.compose.ui.unit.sp 21 | import co.aospa.dolby.xiaomi.R 22 | 23 | @Composable 24 | fun BandGainSliderLabels() { 25 | Column( 26 | horizontalAlignment = Alignment.End, 27 | modifier = Modifier.padding(end = 8.dp) 28 | ) { 29 | LabelText( 30 | stringResource(id = R.string.dolby_geq_slider_label_gain) 31 | ) 32 | Column( 33 | modifier = Modifier.height(200.dp), 34 | horizontalAlignment = Alignment.End 35 | ) { 36 | LabelText( 37 | "+10 dB", 38 | modifier = Modifier.padding( 39 | top = 10.dp 40 | ) 41 | ) 42 | Spacer( 43 | modifier = Modifier.weight(1f) 44 | ) 45 | LabelText("0 dB") 46 | Spacer( 47 | modifier = Modifier.weight(1f) 48 | ) 49 | LabelText( 50 | "-10 dB", 51 | modifier = Modifier.padding( 52 | bottom = 10.dp 53 | ) 54 | ) 55 | } 56 | LabelText("Hz") 57 | } 58 | } 59 | 60 | @Composable 61 | fun LabelText( 62 | text: String, 63 | modifier: Modifier = Modifier 64 | ) { 65 | Text( 66 | text = text, 67 | modifier = modifier, 68 | color = MaterialTheme.colorScheme.secondary, 69 | fontSize = 12.sp 70 | ) 71 | } 72 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/ConfirmationDialog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.material3.AlertDialog 10 | import androidx.compose.material3.Text 11 | import androidx.compose.material3.TextButton 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.runtime.getValue 14 | import androidx.compose.runtime.mutableStateOf 15 | import androidx.compose.runtime.remember 16 | import androidx.compose.runtime.setValue 17 | import androidx.compose.ui.res.stringResource 18 | 19 | @Composable 20 | fun ConfirmationDialog( 21 | text: String, 22 | onConfirm: () -> Unit, 23 | onDismiss: () -> Unit 24 | ) { 25 | var showDialog by remember { mutableStateOf(true) } 26 | if (!showDialog) { 27 | onDismiss() 28 | return 29 | } 30 | 31 | AlertDialog( 32 | onDismissRequest = { showDialog = false }, 33 | confirmButton = { 34 | TextButton( 35 | onClick = { 36 | showDialog = false 37 | onConfirm() 38 | } 39 | ) { 40 | Text( 41 | stringResource(id = android.R.string.ok) 42 | ) 43 | } 44 | }, 45 | dismissButton = { 46 | TextButton( 47 | onClick = { showDialog = false } 48 | ) { 49 | Text( 50 | stringResource(id = android.R.string.cancel) 51 | ) 52 | } 53 | }, 54 | text = { 55 | Text(text) 56 | } 57 | ) 58 | } 59 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/EqualizerBands.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.Row 10 | import androidx.compose.foundation.layout.fillMaxWidth 11 | import androidx.compose.foundation.lazy.LazyRow 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.runtime.collectAsState 14 | import androidx.compose.runtime.getValue 15 | import androidx.compose.ui.Alignment 16 | import androidx.compose.ui.Modifier 17 | 18 | @Composable 19 | fun EqualizerBands(viewModel: EqualizerViewModel) { 20 | val preset by viewModel.preset.collectAsState() 21 | val bandGains = preset.bandGains 22 | 23 | LazyRow( 24 | verticalAlignment = Alignment.CenterVertically, 25 | modifier = Modifier.fillMaxWidth() 26 | ) { 27 | item { 28 | BandGainSliderLabels() 29 | } 30 | items(bandGains.size) { index -> 31 | BandGainSlider( 32 | bandGains[index], 33 | onValueChangeFinished = { 34 | viewModel.setGain(index, it) 35 | } 36 | ) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/EqualizerScreen.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.Arrangement 10 | import androidx.compose.foundation.layout.Column 11 | import androidx.compose.foundation.layout.fillMaxHeight 12 | import androidx.compose.foundation.layout.fillMaxSize 13 | import androidx.compose.foundation.layout.padding 14 | import androidx.compose.material3.MaterialTheme 15 | import androidx.compose.material3.Surface 16 | import androidx.compose.runtime.Composable 17 | import androidx.compose.ui.Modifier 18 | import androidx.compose.ui.unit.dp 19 | import com.android.settingslib.spa.framework.theme.settingsBackground 20 | import com.android.settingslib.spa.framework.theme.SettingsDimension 21 | 22 | @Composable 23 | fun EqualizerScreen( 24 | viewModel: EqualizerViewModel, 25 | modifier: Modifier = Modifier 26 | ) { 27 | Surface( 28 | modifier = Modifier 29 | .fillMaxSize() 30 | .padding(SettingsDimension.itemPadding) 31 | .then(modifier), 32 | color = MaterialTheme.colorScheme.settingsBackground 33 | ) { 34 | Column( 35 | verticalArrangement = Arrangement.Top, 36 | modifier = Modifier.fillMaxHeight() 37 | ) { 38 | PresetSelector(viewModel = viewModel) 39 | EqualizerBands(viewModel = viewModel) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/PresetNameDialog.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.Column 10 | import androidx.compose.foundation.layout.padding 11 | import androidx.compose.material3.AlertDialog 12 | import androidx.compose.material3.MaterialTheme 13 | import androidx.compose.material3.OutlinedTextField 14 | import androidx.compose.material3.Text 15 | import androidx.compose.material3.TextButton 16 | import androidx.compose.runtime.Composable 17 | import androidx.compose.runtime.getValue 18 | import androidx.compose.runtime.mutableStateOf 19 | import androidx.compose.runtime.remember 20 | import androidx.compose.runtime.setValue 21 | import androidx.compose.ui.Modifier 22 | import androidx.compose.ui.res.stringResource 23 | import androidx.compose.ui.unit.dp 24 | import co.aospa.dolby.xiaomi.R 25 | 26 | @Composable 27 | fun PresetNameDialog( 28 | title: String, 29 | presetName: String = "", 30 | onPresetNameSet: (String) -> PresetNameValidationError?, 31 | onDismissDialog: () -> Unit 32 | ) { 33 | var showDialog by remember { mutableStateOf(true) } 34 | if (!showDialog) { 35 | onDismissDialog() 36 | return 37 | } 38 | var text by remember { mutableStateOf(presetName) } 39 | var error by remember { mutableStateOf(null) } 40 | 41 | AlertDialog( 42 | onDismissRequest = { showDialog = false }, 43 | confirmButton = { 44 | TextButton( 45 | onClick = { 46 | onPresetNameSet(text)?.let { 47 | // validation failed 48 | error = it 49 | return@TextButton 50 | } 51 | // succeeded 52 | showDialog = false 53 | error = null 54 | } 55 | ) { 56 | Text( 57 | stringResource(id = android.R.string.ok) 58 | ) 59 | } 60 | }, 61 | dismissButton = { 62 | TextButton( 63 | onClick = { showDialog = false } 64 | ) { 65 | Text( 66 | stringResource(id = android.R.string.cancel) 67 | ) 68 | } 69 | }, 70 | title = { Text(title) }, 71 | text = { 72 | Column { 73 | OutlinedTextField( 74 | value = text, 75 | onValueChange = { text = it }, 76 | label = { 77 | Text( 78 | stringResource(id = R.string.dolby_geq_preset_name) 79 | ) 80 | }, 81 | isError = error != null, 82 | singleLine = true 83 | ) 84 | error?.let { 85 | Text( 86 | text = it.toErrorMessage(), 87 | color = MaterialTheme.colorScheme.error, 88 | modifier = Modifier.padding(top = 8.dp) 89 | ) 90 | } 91 | } 92 | } 93 | ) 94 | } 95 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/PresetNameValidationError.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.res.stringResource 11 | import co.aospa.dolby.xiaomi.R 12 | 13 | enum class PresetNameValidationError { 14 | NAME_EXISTS, 15 | NAME_TOO_LONG; 16 | 17 | @Composable 18 | fun toErrorMessage() = 19 | stringResource( 20 | id = when (this) { 21 | NAME_EXISTS -> R.string.dolby_geq_preset_name_exists 22 | NAME_TOO_LONG -> R.string.dolby_geq_preset_name_too_long 23 | } 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/geq/ui/TooltipIconButton.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.geq.ui 8 | 9 | import androidx.compose.foundation.layout.size 10 | import androidx.compose.material3.ExperimentalMaterial3Api 11 | import androidx.compose.material3.Icon 12 | import androidx.compose.material3.IconButton 13 | import androidx.compose.material3.Text 14 | import androidx.compose.material3.TooltipBox 15 | import androidx.compose.material3.TooltipDefaults 16 | import androidx.compose.material3.rememberTooltipState 17 | import androidx.compose.runtime.Composable 18 | import androidx.compose.ui.Modifier 19 | import androidx.compose.ui.graphics.vector.ImageVector 20 | import androidx.compose.ui.unit.dp 21 | 22 | @OptIn(ExperimentalMaterial3Api::class) 23 | @Composable 24 | fun TooltipIconButton( 25 | icon: ImageVector, 26 | text: String, 27 | onClick: () -> Unit 28 | ) { 29 | TooltipBox( 30 | positionProvider = TooltipDefaults.rememberTooltipPositionProvider(), 31 | tooltip = { 32 | Text(text) 33 | }, 34 | state = rememberTooltipState() 35 | ) { 36 | IconButton( 37 | onClick = onClick 38 | ) { 39 | Icon( 40 | imageVector = icon, 41 | contentDescription = text, 42 | modifier = Modifier.size(24.dp) 43 | ) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/preference/DolbyIeqPreference.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.preference 8 | 9 | import android.content.Context 10 | import android.util.AttributeSet 11 | import android.view.View 12 | import android.widget.ImageView 13 | import androidx.appcompat.content.res.AppCompatResources 14 | import androidx.preference.ListPreference 15 | import androidx.preference.PreferenceViewHolder 16 | import co.aospa.dolby.xiaomi.R 17 | 18 | // Preference with icon on the right side 19 | class DolbyIeqPreference( 20 | context: Context, 21 | attrs: AttributeSet?, 22 | ) : ListPreference(context, attrs) { 23 | 24 | init { 25 | widgetLayoutResource = R.layout.ieq_icon_layout 26 | } 27 | 28 | override fun onBindViewHolder(holder: PreferenceViewHolder) { 29 | super.onBindViewHolder(holder) 30 | val iconView = holder.findViewById(R.id.ieq_icon)!! as ImageView 31 | val icon = AppCompatResources.getDrawable(context, getIeqIconResId()) 32 | iconView.setImageDrawable(icon) 33 | } 34 | 35 | private fun getIeqIconResId(): Int { 36 | val ieqValue = value?.toIntOrNull() ?: 0 37 | return when (ieqValue) { 38 | 0 -> R.drawable.ic_ieq_off 39 | 1 -> R.drawable.ic_ieq_balanced 40 | 2 -> R.drawable.ic_ieq_warm 41 | 3 -> R.drawable.ic_ieq_detailed 42 | else -> 0 // should never hit this! 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /dolby/src/co/aospa/dolby/xiaomi/preference/DolbyPreferenceStore.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Paranoid Android 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package co.aospa.dolby.xiaomi.preference 8 | 9 | import android.content.Context 10 | import android.content.SharedPreferences 11 | import androidx.preference.PreferenceDataStore 12 | import androidx.preference.PreferenceManager 13 | import co.aospa.dolby.xiaomi.DolbyConstants 14 | 15 | class DolbyPreferenceStore( 16 | private val context: Context 17 | ) : PreferenceDataStore() { 18 | 19 | private val defaultSharedPrefs by lazy { 20 | PreferenceManager.getDefaultSharedPreferences(context) 21 | } 22 | 23 | private lateinit var profileSharedPrefs: SharedPreferences 24 | 25 | var profile = 0 26 | set(value) { 27 | field = value 28 | profileSharedPrefs = context.getSharedPreferences( 29 | "profile_$value", 30 | Context.MODE_PRIVATE 31 | ) 32 | } 33 | 34 | private fun getSharedPreferences(key: String) = 35 | if (DolbyConstants.PROFILE_SPECIFIC_PREFS.contains(key)) { 36 | profileSharedPrefs 37 | } else { 38 | defaultSharedPrefs 39 | } 40 | 41 | override fun putBoolean(key: String, value: Boolean) = 42 | getSharedPreferences(key).edit() 43 | .putBoolean(key, value) 44 | .apply() 45 | 46 | override fun getBoolean(key: String, defValue: Boolean) = 47 | getSharedPreferences(key).getBoolean(key, defValue) 48 | 49 | override fun putInt(key: String, value: Int) = 50 | getSharedPreferences(key).edit() 51 | .putInt(key, value) 52 | .apply() 53 | 54 | override fun getInt(key: String, defValue: Int) = 55 | getSharedPreferences(key).getInt(key, defValue) 56 | 57 | override fun putString(key: String, value: String?) = 58 | getSharedPreferences(key).edit() 59 | .putString(key, value) 60 | .apply() 61 | 62 | override fun getString(key: String, defValue: String?) = 63 | getSharedPreferences(key).getString(key, defValue) 64 | } 65 | -------------------------------------------------------------------------------- /fingerprint/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022-2024 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_library_static { 8 | name: "libudfpshandlerfactory", 9 | srcs: ["UdfpsHandler.cpp"], 10 | vendor: true, 11 | header_libs: ["xiaomifingerprint_headers"], 12 | } 13 | 14 | cc_library_headers { 15 | name: "xiaomifingerprint_headers", 16 | export_include_dirs: ["include"], 17 | vendor: true, 18 | header_libs: ["libhardware_headers"], 19 | export_header_lib_headers: ["libhardware_headers"], 20 | } 21 | 22 | cc_library_static { 23 | name: "libudfps_extension.xiaomi", 24 | srcs: ["UdfpsExtension.cpp"], 25 | include_dirs: [ 26 | "frameworks/native/services/surfaceflinger/CompositionEngine/include", 27 | ], 28 | header_libs: [ 29 | "generated_kernel_headers", 30 | ], 31 | } 32 | -------------------------------------------------------------------------------- /fingerprint/UdfpsExtension.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include 8 | 9 | #if __has_include() 10 | #include 11 | #elif __has_include() 12 | #include 13 | #endif 14 | 15 | uint32_t getUdfpsDimZOrder(uint32_t z) { 16 | return z; 17 | } 18 | 19 | uint32_t getUdfpsZOrder(uint32_t z, bool touched) { 20 | if (touched) { 21 | z |= FOD_PRESSED_LAYER_ZORDER; 22 | } 23 | return z; 24 | } 25 | 26 | uint64_t getUdfpsUsageBits(uint64_t usageBits, bool /* touched */) { 27 | return usageBits; 28 | } 29 | -------------------------------------------------------------------------------- /fingerprint/UdfpsHandler.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #include "UdfpsHandler.h" 8 | #include 9 | 10 | #define UDFPS_HANDLER_LIB_NAME "libudfpshandler.so" 11 | #define UDFPS_HANDLER_FACTORY "UDFPS_HANDLER_FACTORY" 12 | 13 | UdfpsHandlerFactory* getUdfpsHandlerFactory() { 14 | void* libudfpshander; 15 | UdfpsHandlerFactory* factory_handler; 16 | 17 | libudfpshander = dlopen(UDFPS_HANDLER_LIB_NAME, RTLD_LAZY); 18 | if (!libudfpshander) { 19 | goto error; 20 | } 21 | 22 | factory_handler = (UdfpsHandlerFactory*)dlsym(libudfpshander, UDFPS_HANDLER_FACTORY); 23 | if (!factory_handler) { 24 | goto error; 25 | } 26 | 27 | return factory_handler; 28 | 29 | error: 30 | if (libudfpshander) { 31 | dlclose(libudfpshander); 32 | } 33 | 34 | return nullptr; 35 | } 36 | -------------------------------------------------------------------------------- /fingerprint/include/UdfpsHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022,2025 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "fingerprint.h" 11 | 12 | class UdfpsHandler { 13 | public: 14 | virtual ~UdfpsHandler() = default; 15 | 16 | virtual void init(fingerprint_device_t* device) {}; 17 | virtual void onFingerDown(uint32_t x, uint32_t y, float minor, float major) {}; 18 | virtual void onFingerUp() {}; 19 | 20 | virtual void onAcquired(int32_t result, int32_t vendorCode) {}; 21 | virtual void onAuthenticationSucceeded() {}; 22 | virtual void onAuthenticationFailed() {}; 23 | virtual void cancel() {}; 24 | }; 25 | 26 | struct UdfpsHandlerFactory { 27 | UdfpsHandler* (*create)(); 28 | void (*destroy)(UdfpsHandler* handler); 29 | }; 30 | 31 | UdfpsHandlerFactory* getUdfpsHandlerFactory(); 32 | -------------------------------------------------------------------------------- /hidl/biometrics/fingerprint/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2017 The Android Open Source Project 3 | // 2022 The LineageOS Project 4 | // 5 | // SPDX-License-Identifier: Apache-2.0 6 | // 7 | 8 | cc_binary { 9 | name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi", 10 | defaults: ["hidl_defaults"], 11 | init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc"], 12 | vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml"], 13 | vendor: true, 14 | relative_install_path: "hw", 15 | srcs: [ 16 | "BiometricsFingerprint.cpp", 17 | "service.cpp", 18 | ], 19 | 20 | shared_libs: [ 21 | "libbase", 22 | "libcutils", 23 | "libdl", 24 | "liblog", 25 | "libhidlbase", 26 | "libhardware", 27 | "libutils", 28 | "android.hardware.biometrics.fingerprint@2.1", 29 | "android.hardware.biometrics.fingerprint@2.2", 30 | "android.hardware.biometrics.fingerprint@2.3", 31 | ], 32 | 33 | static_libs: [ 34 | "libudfpshandlerfactory", 35 | ], 36 | 37 | header_libs: ["xiaomifingerprint_headers"], 38 | } 39 | -------------------------------------------------------------------------------- /hidl/biometrics/fingerprint/android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc: -------------------------------------------------------------------------------- 1 | service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi 2 | # "class hal" causes a race condition on some devices due to files created 3 | # in /data. As a workaround, postpone startup until later in boot once 4 | # /data is mounted. 5 | class late_start 6 | user system 7 | group system input uhid 8 | -------------------------------------------------------------------------------- /hidl/biometrics/fingerprint/android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.biometrics.fingerprint 4 | hwbinder 5 | 2.3 6 | 7 | IBiometricsFingerprint 8 | default 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hidl/biometrics/fingerprint/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Android Open Source Project 3 | * 2022 The LineageOS Project 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi" 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "BiometricsFingerprint.h" 16 | 17 | using android::sp; 18 | using android::hardware::configureRpcThreadpool; 19 | using android::hardware::joinRpcThreadpool; 20 | using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint; 21 | using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint; 22 | 23 | int main() { 24 | android::sp bio = BiometricsFingerprint::getInstance(); 25 | 26 | configureRpcThreadpool(1, true /*callerWillJoin*/); 27 | 28 | if (bio != nullptr) { 29 | if (::android::OK != bio->registerAsService()) { 30 | return 1; 31 | } 32 | } else { 33 | ALOGE("Can't create instance of BiometricsFingerprint, nullptr"); 34 | } 35 | 36 | joinRpcThreadpool(); 37 | 38 | return 0; // should never get here 39 | } 40 | -------------------------------------------------------------------------------- /hidl/sensors/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | package { 2 | // See: http://go/android-license-faq 3 | default_applicable_licenses: ["Android-Apache-2.0"], 4 | } 5 | 6 | cc_library_shared { 7 | name: "android.hardware.sensors@1.0-impl-xiaomi", 8 | defaults: ["hidl_defaults"], 9 | proprietary: true, 10 | relative_install_path: "hw", 11 | srcs: [ 12 | "Sensors.cpp", 13 | "convert.cpp", 14 | ], 15 | shared_libs: [ 16 | "liblog", 17 | "libcutils", 18 | "libhardware", 19 | "libbase", 20 | "libutils", 21 | "libhidlbase", 22 | "android.hardware.sensors@1.0", 23 | ], 24 | static_libs: [ 25 | "multihal", 26 | ], 27 | local_include_dirs: ["include/sensors"], 28 | } 29 | -------------------------------------------------------------------------------- /hidl/sensors/1.0/Sensors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 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 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace android { 26 | namespace hardware { 27 | namespace sensors { 28 | namespace V1_0 { 29 | namespace implementation { 30 | 31 | struct Sensors : public ::android::hardware::sensors::V1_0::ISensors { 32 | Sensors(); 33 | 34 | status_t initCheck() const; 35 | 36 | Return getSensorsList(getSensorsList_cb _hidl_cb) override; 37 | 38 | Return setOperationMode(OperationMode mode) override; 39 | 40 | Return activate(int32_t sensor_handle, bool enabled) override; 41 | 42 | Return poll(int32_t maxCount, poll_cb _hidl_cb) override; 43 | 44 | Return batch(int32_t sensor_handle, int64_t sampling_period_ns, 45 | int64_t max_report_latency_ns) override; 46 | 47 | Return flush(int32_t sensor_handle) override; 48 | 49 | Return injectSensorData(const Event& event) override; 50 | 51 | Return registerDirectChannel(const SharedMemInfo& mem, 52 | registerDirectChannel_cb _hidl_cb) override; 53 | 54 | Return unregisterDirectChannel(int32_t channelHandle) override; 55 | 56 | Return configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate, 57 | configDirectReport_cb _hidl_cb) override; 58 | 59 | private: 60 | static constexpr int32_t kPollMaxBufferSize = 128; 61 | status_t mInitCheck; 62 | sensors_module_t* mSensorModule; 63 | sensors_poll_device_1_t* mSensorDevice; 64 | std::mutex mPollLock; 65 | 66 | int getHalDeviceVersion() const; 67 | std::vector getFixedUpSensorList(); 68 | 69 | static void convertFromSensorEvents(size_t count, const sensors_event_t* src, 70 | std::vector& dst, 71 | std::vector sensorsList); 72 | 73 | DISALLOW_COPY_AND_ASSIGN(Sensors); 74 | }; 75 | 76 | extern "C" ISensors* HIDL_FETCH_ISensors(const char* name); 77 | 78 | } // namespace implementation 79 | } // namespace V1_0 80 | } // namespace sensors 81 | } // namespace hardware 82 | } // namespace android 83 | -------------------------------------------------------------------------------- /hidl/sensors/1.0/include/sensors/convert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 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 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace android { 23 | namespace hardware { 24 | namespace sensors { 25 | namespace V1_0 { 26 | namespace implementation { 27 | 28 | void convertFromSensor(const sensor_t& src, SensorInfo* dst); 29 | void convertToSensor(const SensorInfo& src, sensor_t* dst); 30 | 31 | void convertFromSensorEvent(const sensors_event_t& src, Event* dst); 32 | void convertToSensorEvent(const Event& src, sensors_event_t* dst); 33 | 34 | bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t* memOut); 35 | int convertFromRateLevel(RateLevel rate); 36 | 37 | bool patchXiaomiPickupSensor(SensorInfo& sensor); 38 | 39 | } // namespace implementation 40 | } // namespace V1_0 41 | } // namespace sensors 42 | } // namespace hardware 43 | } // namespace android 44 | -------------------------------------------------------------------------------- /hidl/touch/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | soong_config_module_type { 8 | name: "xiaomi_touch_hal_cc_defaults", 9 | module_type: "cc_defaults", 10 | config_namespace: "XIAOMI_TOUCH", 11 | value_variables: ["HIGH_TOUCH_POLLING_PATH"], 12 | properties: ["cppflags"], 13 | } 14 | 15 | xiaomi_touch_hal_cc_defaults { 16 | name: "xiaomi_touch_hal_defaults", 17 | soong_config_variables: { 18 | HIGH_TOUCH_POLLING_PATH: { 19 | cppflags: ["-DHIGH_TOUCH_POLLING_PATH=\"%s\""], 20 | }, 21 | }, 22 | } 23 | 24 | cc_binary { 25 | name: "vendor.lineage.touch@1.0-service.xiaomi", 26 | defaults: [ 27 | "hidl_defaults", 28 | "xiaomi_touch_hal_defaults", 29 | ], 30 | vintf_fragments: ["vendor.lineage.touch@1.0-service.xiaomi.xml"], 31 | init_rc: ["vendor.lineage.touch@1.0-service.xiaomi.rc"], 32 | relative_install_path: "hw", 33 | proprietary: true, 34 | srcs: [ 35 | "HighTouchPollingRate.cpp", 36 | "service.cpp", 37 | ], 38 | shared_libs: [ 39 | "libbase", 40 | "libbinder", 41 | "libhidlbase", 42 | "libutils", 43 | "vendor.lineage.touch@1.0", 44 | ], 45 | } 46 | -------------------------------------------------------------------------------- /hidl/touch/HighTouchPollingRate.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #define LOG_TAG "HighTouchPollingRateService" 8 | 9 | #include "HighTouchPollingRate.h" 10 | 11 | #include 12 | 13 | namespace vendor { 14 | namespace lineage { 15 | namespace touch { 16 | namespace V1_0 { 17 | namespace implementation { 18 | 19 | Return HighTouchPollingRate::isEnabled() { 20 | std::ifstream file(HIGH_TOUCH_POLLING_PATH); 21 | int enabled; 22 | file >> enabled; 23 | 24 | return enabled == 1; 25 | } 26 | 27 | Return HighTouchPollingRate::setEnabled(bool enabled) { 28 | std::ofstream file(HIGH_TOUCH_POLLING_PATH); 29 | file << (enabled ? "1" : "0"); 30 | return !file.fail(); 31 | } 32 | 33 | } // namespace implementation 34 | } // namespace V1_0 35 | } // namespace touch 36 | } // namespace lineage 37 | } // namespace vendor 38 | -------------------------------------------------------------------------------- /hidl/touch/HighTouchPollingRate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace vendor { 12 | namespace lineage { 13 | namespace touch { 14 | namespace V1_0 { 15 | namespace implementation { 16 | 17 | using ::android::hardware::Return; 18 | 19 | class HighTouchPollingRate : public IHighTouchPollingRate { 20 | public: 21 | // Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow. 22 | Return isEnabled() override; 23 | Return setEnabled(bool enabled) override; 24 | }; 25 | 26 | } // namespace implementation 27 | } // namespace V1_0 28 | } // namespace touch 29 | } // namespace lineage 30 | } // namespace vendor 31 | -------------------------------------------------------------------------------- /hidl/touch/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #define LOG_TAG "lineage.touch@1.0-service.xiaomi" 8 | 9 | #include 10 | #include 11 | 12 | #include "HighTouchPollingRate.h" 13 | 14 | using ::vendor::lineage::touch::V1_0::IHighTouchPollingRate; 15 | using ::vendor::lineage::touch::V1_0::implementation::HighTouchPollingRate; 16 | 17 | int main() { 18 | android::sp highTouchPollingRate = new HighTouchPollingRate(); 19 | 20 | android::hardware::configureRpcThreadpool(1, true); 21 | 22 | if (highTouchPollingRate->registerAsService() != android::OK) { 23 | LOG(ERROR) << "Cannot register touchscreen high polling rate HAL service."; 24 | return 1; 25 | } 26 | 27 | LOG(INFO) << "Touchscreen HAL service ready."; 28 | 29 | android::hardware::joinRpcThreadpool(); 30 | 31 | LOG(ERROR) << "Touchscreen HAL service failed to join thread pool."; 32 | return 1; 33 | } 34 | -------------------------------------------------------------------------------- /hidl/touch/vendor.lineage.touch@1.0-service.xiaomi.rc: -------------------------------------------------------------------------------- 1 | service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.xiaomi 2 | interface vendor.lineage.touch@1.0::IHighTouchPollingRate default 3 | class hal 4 | user system 5 | group system 6 | -------------------------------------------------------------------------------- /hidl/touch/vendor.lineage.touch@1.0-service.xiaomi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | vendor.lineage.touch 4 | hwbinder 5 | 1.0 6 | 7 | IHighTouchPollingRate 8 | default 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "com.fingerprints.extension@1.0", 5 | root: "com.fingerprints", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "types.hal", 9 | "IAuthenticatorCallback.hal", 10 | "ICalibrationCallback.hal", 11 | "ICryptCallback.hal", 12 | "IFingerprintAuthenticator.hal", 13 | "IFingerprintCalibration.hal", 14 | "IFingerprintEngineering.hal", 15 | "IFingerprintNavigation.hal", 16 | "IFingerprintOptical.hal", 17 | "IFingerprintOpticalCallback.hal", 18 | "IFingerprintRecalibration.hal", 19 | "IFingerprintSenseTouch.hal", 20 | "IFingerprintSensorTest.hal", 21 | "IFpcFingerprintAuthenticator.hal", 22 | "IIlluminationTuningCallback.hal", 23 | "IImageCaptureCallback.hal", 24 | "IImageInjectionCallback.hal", 25 | "IRecalibrationCallback.hal", 26 | "ISensorTestCallback.hal", 27 | "ISensorTestCaptureCallback.hal", 28 | "IVerifyUserCallback.hal", 29 | ], 30 | interfaces: [ 31 | "android.hidl.base@1.0", 32 | ], 33 | gen_java: true, 34 | } 35 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IAuthenticatorCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IAuthenticatorCallback { 10 | oneway onAcquired(uint32_t status); 11 | 12 | oneway onAuthenticated(uint32_t fingerId); 13 | 14 | oneway onEnrollResult(uint32_t fingerId, uint32_t remaining); 15 | 16 | oneway onEnumerate(uint32_t fingerId, uint32_t remaining); 17 | 18 | oneway onError(uint32_t errorCode); 19 | 20 | oneway onRemoved(uint32_t fingerId, uint32_t remaining); 21 | }; 22 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/ICalibrationCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface ICalibrationCallback { 10 | oneway onStatus(uint32_t code); 11 | 12 | oneway onError(uint32_t error); 13 | 14 | oneway onInitTransferData(uint32_t totalSize); 15 | 16 | oneway onTransferData(vec buffer, uint32_t remaning); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/ICryptCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface ICryptCallback { 10 | oneway onResult(uint32_t result); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintAuthenticator.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import IVerifyUserCallback; 10 | 11 | interface IFingerprintAuthenticator { 12 | verifyUser(IVerifyUserCallback callback, vec fido_auth_input_1, vec fido_auth_input_2, vec dstAppName) generates (int32_t result); 13 | 14 | isUserValid(uint64_t userId) generates (bool userValid); 15 | 16 | oneway cancel(); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintCalibration.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import ICalibrationCallback; 10 | 11 | interface IFingerprintCalibration { 12 | oneway calibrate(ICalibrationCallback callback); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintEngineering.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import IImageCaptureCallback; 10 | import IImageInjectionCallback; 11 | import ICryptCallback; 12 | import ICalibrationCallback; 13 | import IIlluminationTuningCallback; 14 | 15 | interface IFingerprintEngineering { 16 | getSensorSize() generates (SensorSize sensorSize); 17 | 18 | oneway startImageSubscription(IImageCaptureCallback callback); 19 | 20 | oneway stopImageSubscription(); 21 | 22 | oneway startImageInjection(IImageInjectionCallback callback); 23 | 24 | oneway stopImageInjection(); 25 | 26 | oneway startCapture(IImageCaptureCallback callback, uint32_t mode); 27 | 28 | oneway cancelCapture(); 29 | 30 | oneway setEnrollToken(vec token); 31 | 32 | getEnrollChallenge() generates (int64_t enrollChallenge); 33 | 34 | getBuildInfo() generates (string buildInfo); 35 | 36 | oneway cryptBlob(ICryptCallback callback, uint32_t mode); 37 | 38 | oneway startCalibration(ICalibrationCallback callback); 39 | 40 | oneway captureCalibration(ICalibrationCallback callback, uint32_t type, uint32_t level); 41 | 42 | oneway finishCalibration(ICalibrationCallback callback, uint32_t level); 43 | 44 | oneway saveCalibration(ICalibrationCallback callback, uint32_t level); 45 | 46 | oneway saveCalibrationDecrypted(ICalibrationCallback callback, uint32_t level); 47 | 48 | oneway cancelCalibration(ICalibrationCallback callback); 49 | 50 | oneway getCalibrationData(ICalibrationCallback callback); 51 | 52 | oneway startBarTarget(ICalibrationCallback callback); 53 | 54 | oneway captureBarTarget(ICalibrationCallback callback, uint32_t level); 55 | 56 | oneway finishBarTarget(ICalibrationCallback callback, uint32_t level); 57 | 58 | oneway saveBarTarget(ICalibrationCallback callback, uint32_t level); 59 | 60 | oneway cancelBarTarget(ICalibrationCallback callback); 61 | 62 | oneway setIlluminationLevel(IIlluminationTuningCallback callback, uint32_t level); 63 | }; 64 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintNavigation.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IFingerprintNavigation { 10 | setNavigation(bool enabled); 11 | 12 | getNavigationConfig() generates (NavigationConfig navigationConfig); 13 | 14 | oneway setNavigationConfig(NavigationConfig navigationConfig); 15 | 16 | isEnabled() generates (bool isEnabled); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintOptical.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import IFingerprintOpticalCallback; 10 | 11 | interface IFingerprintOptical { 12 | oneway setNotify(IFingerprintOpticalCallback callback); 13 | 14 | oneway setIlluminationStatus(uint32_t value); 15 | 16 | oneway etFingerListenerStatus(uint32_t value); 17 | 18 | setExposure(uint16_t exposureTime) generates (bool result); 19 | 20 | getExposure() generates (int16_t retVal); 21 | 22 | setAnalogGain(uint16_t gain) generates (bool result); 23 | 24 | getAnalogGain() generates (int16_t retVal); 25 | 26 | oneway setHotZoneData(HotZoneData hotZoneData); 27 | 28 | oneway setTouchEventData(TouchEventData touchEventData); 29 | 30 | getToutchEventData() generates (TouchEventData touchEventData); 31 | }; 32 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintOpticalCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IFingerprintOpticalCallback { 10 | oneway onStartWaitingForFinger(); 11 | 12 | oneway onStopWaitingForFinger(); 13 | 14 | oneway onFingerDown(); 15 | 16 | oneway onFingerLost(); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintRecalibration.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import IRecalibrationCallback; 10 | 11 | interface IFingerprintRecalibration { 12 | oneway recalibrate(vec token, IRecalibrationCallback callback); 13 | 14 | preRecalibrate() generates (int64_t challenge); 15 | 16 | oneway cancel(); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintSenseTouch.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IFingerprintSenseTouch { 10 | getForce() generates (int32_t force); 11 | 12 | isSupported() generates (bool isSupported); 13 | 14 | finishCalibration(uint32_t ground, uint32_t threshold) generates (bool result); 15 | 16 | setAuthMode(uint32_t mode, uint32_t buttonTimeoutMs) generates (bool result); 17 | 18 | readConfig() generates (SenseTouchConfig senseTouchConfig); 19 | }; 20 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFingerprintSensorTest.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import ISensorTestCaptureCallback; 10 | import ISensorTestCallback; 11 | 12 | interface IFingerprintSensorTest { 13 | getSensorInfo() generates (SensorInfo sensorInfo); 14 | 15 | getSensorTests() generates (vec sensorTests); 16 | 17 | oneway runSensorTest(ISensorTestCallback callback, SensorTest test, SensorTestInput input); 18 | 19 | oneway cancelSensorTest(); 20 | 21 | oneway capture(ISensorTestCaptureCallback callback, bool waitForFinger, bool uncalibrated); 22 | 23 | oneway cancelCapture(); 24 | }; 25 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IFpcFingerprintAuthenticator.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | import IAuthenticatorCallback; 10 | 11 | interface IFpcFingerprintAuthenticator { 12 | oneway authenticate(); 13 | 14 | oneway cancel(); 15 | 16 | oneway enroll(); 17 | 18 | oneway enumerate(); 19 | 20 | oneway remove(uint32_t fingerId); 21 | 22 | oneway setNotify(IAuthenticatorCallback callback); 23 | }; 24 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IIlluminationTuningCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IIlluminationTuningCallback { 10 | oneway onResult(uint32_t code); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IImageCaptureCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IImageCaptureCallback { 10 | oneway onImage(ImageCaptureData imageCaptureData); 11 | 12 | oneway onImageTransferData(uint8_t type, vec buffer); 13 | 14 | oneway onImageFinish(); 15 | }; 16 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IImageInjectionCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IImageInjectionCallback { 10 | onInject() generates (vec imageData); 11 | 12 | oneway onCancel(); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IRecalibrationCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IRecalibrationCallback { 10 | oneway onStatus(uint32_t code, bool imageDecision, uint32_t imageQuality, uint32_t pnQuality, uint32_t progress); 11 | 12 | oneway onError(uint32_t error); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/ISensorTestCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface ISensorTestCallback { 10 | oneway onResult(SensorTestResult result); 11 | 12 | onResultInit(uint32_t resultCode, uint32_t errorCode, bool imageFetched) generates (int32_t result); 13 | 14 | onResultTransfer(uint8_t type, string input) generates (int32_t result); 15 | 16 | onResultTransferImg(vec input) generates (int32_t result); 17 | 18 | oneway onResultFinish(); 19 | }; 20 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/ISensorTestCaptureCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface ISensorTestCaptureCallback { 10 | oneway onAcquired(uint32_t acquiredInfo); 11 | 12 | oneway onError(uint32_t error); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/IVerifyUserCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | interface IVerifyUserCallback { 10 | oneway onResult(uint32_t result, uint64_t userId, uint64_t userEntityId, vec encapsulatedResult); 11 | 12 | oneway onHelp(uint32_t helpCode); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/1.0/types.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@1.0; 8 | 9 | struct HotZoneData { 10 | int32_t left; 11 | int32_t right; 12 | int32_t top; 13 | int32_t bottom; 14 | int32_t update; 15 | }; 16 | 17 | struct ImageCaptureData { 18 | int32_t mode; 19 | int32_t captureResult; 20 | int32_t identifyResult; 21 | int32_t templateUpdateResult; 22 | int32_t enrollResult; 23 | int32_t cacResult; 24 | int32_t userId; 25 | int32_t remainingSamples; 26 | int32_t coverage; 27 | int32_t quality; 28 | vec rawImage; 29 | vec enhancedImage; 30 | }; 31 | 32 | struct NavigationConfig { 33 | int32_t tapNoImageMaxThreshold; 34 | int32_t holdNoImageMinThreshold; 35 | int32_t doubleClickTimeInterval; 36 | int32_t tapImageTransMaxThreshold; 37 | int32_t swipeImageTransMinThreshold; 38 | int32_t backGroundAlgo; 39 | }; 40 | 41 | struct SensorInfo { 42 | int32_t sensorDieValidFlag; 43 | int32_t hardwareId; 44 | string lotId; 45 | int32_t waferId; 46 | int32_t waferPositionX; 47 | int32_t waferPositionY; 48 | string productionTimestamp; 49 | int32_t companionDieValidFlag; 50 | int32_t companionChipHardwareId; 51 | string companionChipLotId; 52 | int32_t vendorHwValidFlag; 53 | vec vendorData; 54 | int32_t totalNumOtpBitErrors; 55 | int32_t maxNumOtpBitErrorsInByte; 56 | int32_t productType; 57 | }; 58 | 59 | struct SensorSize { 60 | int32_t width; 61 | int32_t height; 62 | }; 63 | 64 | struct SensorTest { 65 | string name; 66 | string description; 67 | bool waitForFingerDown; 68 | string rubberStampType; 69 | }; 70 | 71 | struct SensorTestInput { 72 | string testLimitsKeyValuePair; 73 | }; 74 | 75 | struct SensorTestResult { 76 | int32_t resultCode; 77 | string resultString; 78 | int32_t errorCode; 79 | string errorString; 80 | vec imageData; 81 | string log; 82 | }; 83 | 84 | struct SenseTouchConfig { 85 | bool success; 86 | int32_t version; 87 | int32_t ground; 88 | int32_t triggerThreshold; 89 | int32_t untriggerThreshold; 90 | bool authTriggerOnDown; 91 | bool authTriggerOnUp; 92 | int32_t authButtonTimeoutMs; 93 | }; 94 | 95 | struct TouchEventData { 96 | int32_t hotzone_top; 97 | int32_t hotzone_left; 98 | int32_t hotzone_right; 99 | int32_t hotzone_bottom; 100 | int32_t pos_x; 101 | int32_t pos_y; 102 | float pressure; 103 | float size; 104 | int32_t major; 105 | int32_t minor; 106 | }; 107 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "com.fingerprints.extension@2.0", 5 | root: "com.fingerprints", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "ICalibrationCallback.hal", 9 | "IFingerprintAuthenticator.hal", 10 | "IFingerprintCalibration.hal", 11 | "IFingerprintEngineering.hal", 12 | "IFingerprintNavigation.hal", 13 | "IFingerprintRecalibration.hal", 14 | "IFingerprintSenseTouch.hal", 15 | "IFingerprintSensorTest.hal", 16 | "ISensorTestCallback.hal", 17 | ], 18 | interfaces: [ 19 | "android.hidl.base@1.0", 20 | "com.fingerprints.extension@1.0", 21 | ], 22 | gen_java: true, 23 | } 24 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/ICalibrationCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | interface ICalibrationCallback { 10 | oneway onStatus(uint32_t code); 11 | 12 | oneway onError(uint32_t error); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintAuthenticator.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::IFingerprintAuthenticator; 10 | 11 | interface IFingerprintAuthenticator extends @1.0::IFingerprintAuthenticator { 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintCalibration.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import ICalibrationCallback; 10 | 11 | interface IFingerprintCalibration { 12 | oneway calibrate(ICalibrationCallback callback); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintEngineering.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::IImageCaptureCallback; 10 | import @1.0::IImageInjectionCallback; 11 | import @1.0::SensorSize; 12 | 13 | interface IFingerprintEngineering { 14 | 15 | getSensorSize() generates (SensorSize sensorSize); 16 | 17 | oneway startImageSubscription(IImageCaptureCallback callback); 18 | 19 | oneway stopImageSubscription(); 20 | 21 | oneway startImageInjection(IImageInjectionCallback callback); 22 | 23 | oneway stopImageInjection(); 24 | 25 | oneway startCapture(IImageCaptureCallback callback, uint32_t mode); 26 | 27 | oneway cancelCapture(); 28 | 29 | oneway setEnrollToken(vec token); 30 | 31 | getEnrollChallenge() generates (int64_t enrollChallenge); 32 | 33 | getBuildInfo() generates (string buildInfo); 34 | }; 35 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintNavigation.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::IFingerprintNavigation; 10 | 11 | interface IFingerprintNavigation extends @1.0::IFingerprintNavigation { 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintRecalibration.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::IFingerprintRecalibration; 10 | 11 | interface IFingerprintRecalibration extends @1.0::IFingerprintRecalibration { 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintSenseTouch.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::IFingerprintSenseTouch; 10 | 11 | interface IFingerprintSenseTouch extends @1.0::IFingerprintSenseTouch { 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/IFingerprintSensorTest.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::ISensorTestCaptureCallback; 10 | import @1.0::SensorInfo; 11 | import @1.0::SensorTest; 12 | import @1.0::SensorTestInput; 13 | import ISensorTestCallback; 14 | 15 | interface IFingerprintSensorTest { 16 | 17 | getSensorInfo() generates (SensorInfo sensorInfo); 18 | 19 | getSensorTests() generates (vec sensorTests); 20 | 21 | oneway runSensorTest(ISensorTestCallback callback, SensorTest test, SensorTestInput input); 22 | 23 | oneway cancelSensorTest(); 24 | 25 | oneway capture(ISensorTestCaptureCallback callback, bool waitForFinger, bool uncalibrated); 26 | 27 | oneway cancelCapture(); 28 | }; 29 | -------------------------------------------------------------------------------- /interfaces/fingerprints/extension/2.0/ISensorTestCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package com.fingerprints.extension@2.0; 8 | 9 | import @1.0::SensorTestResult; 10 | 11 | interface ISensorTestCallback { 12 | oneway onResult(SensorTestResult result); 13 | }; 14 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.goodix.hardware.biometrics.fingerprint@2.1", 5 | root: "vendor.goodix", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IGoodixFingerprintDaemon.hal", 9 | "IGoodixFingerprintDaemonCallback.hal", 10 | "IGoodixFingerprintDaemonExt.hal", 11 | "IGoodixFingerprintDaemonExtCallback.hal", 12 | "IGoodixFingerprintDaemonFido.hal", 13 | "IGoodixFingerprintDaemonFidoCallback.hal", 14 | "IGoodixFingerprintDaemonHbd.hal", 15 | "IGoodixFingerprintDaemonHbdCallback.hal", 16 | ], 17 | interfaces: [ 18 | "android.hidl.base@1.0", 19 | ], 20 | gen_java: true, 21 | } 22 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemon.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020, 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | import IGoodixFingerprintDaemonCallback; 10 | 11 | interface IGoodixFingerprintDaemon { 12 | oneway initCallback(IGoodixFingerprintDaemonCallback callback); 13 | 14 | oneway setNotify(IGoodixFingerprintDaemonCallback Callback); 15 | 16 | testCmd(uint32_t cmdId, vec param) generates (int32_t debugErrno); 17 | 18 | sendCommand(uint32_t cmd, vec data) generates (int32_t resultCode, vec data); 19 | }; 20 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020, 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | interface IGoodixFingerprintDaemonCallback { 10 | oneway onEnrollResult(uint64_t devId, uint32_t fingerId, uint32_t groupId, uint32_t rem); 11 | 12 | oneway onAcquired(uint64_t devId, uint32_t acquiredInfo); 13 | 14 | oneway onAuthenticated(uint64_t devId, uint32_t fingerId, uint32_t groupId, vec hat); 15 | 16 | oneway onError(uint64_t devId, uint32_t error); 17 | 18 | oneway onRemoved(uint64_t devId, uint32_t fingerId, uint32_t groupId); 19 | 20 | oneway onTestCmd(uint64_t devId, uint32_t cmdId, vec result); 21 | 22 | oneway onDaemonMessage(uint64_t devId, uint32_t msgId, uint32_t cmdId, vec msgData); 23 | }; 24 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonExt.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | import IGoodixFingerprintDaemonExtCallback; 10 | 11 | interface IGoodixFingerprintDaemonExt { 12 | oneway initCallback(IGoodixFingerprintDaemonExtCallback callback); 13 | 14 | setSafeClass(uint32_t safeClass) generates (int32_t debugErrno); 15 | 16 | navigate(uint32_t navMode) generates (int32_t debugErrno); 17 | 18 | stopNavigation() generates (int32_t debugErrno); 19 | 20 | enableFingerprintModule(uint8_t enableFlag) generates (int32_t debugErrno); 21 | 22 | cameraCapture() generates (int32_t debugErrno); 23 | 24 | stopCameraCapture() generates (int32_t debugErrno); 25 | 26 | enableFfFeature(uint8_t enableFlag) generates (int32_t debugErrno); 27 | 28 | screenOn() generates (int32_t debugErrno); 29 | 30 | screenOff() generates (int32_t debugErrno); 31 | 32 | enumerate() generates (int32_t debugErrno); 33 | 34 | reset_lockout() generates (int32_t debugErrno); 35 | 36 | dumpCmd(uint32_t cmdId, vec param) generates (int32_t debugErrno); 37 | 38 | lockout() generates (int32_t debugErrno); 39 | 40 | pauseEnroll() generates (int32_t debugErrno); 41 | 42 | resumeEnroll() generates (int32_t debugErrno); 43 | }; 44 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonExtCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | interface IGoodixFingerprintDaemonExtCallback { 10 | oneway onDump(uint64_t devId, uint32_t cmdId, vec data); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonFido.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | import IGoodixFingerprintDaemonFidoCallback; 10 | 11 | interface IGoodixFingerprintDaemonFido { 12 | oneway initCallback(IGoodixFingerprintDaemonFidoCallback callback); 13 | 14 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (int32_t debugErrno); 15 | 16 | stopAuthenticateFido() generates (int32_t debugErrno); 17 | 18 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (int32_t debugErrno); 19 | 20 | getIdList(uint32_t groupId) generates (int32_t debugErrno, vec list); 21 | 22 | invokeFidoCommand(vec in_buf) generates (int32_t out_buf_len, vec out_buf); 23 | }; 24 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonFidoCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | interface IGoodixFingerprintDaemonFidoCallback { 10 | oneway onAuthenticatedFido(uint64_t devId, uint32_t fpId, vec uvtData); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonHbd.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | import IGoodixFingerprintDaemonHbdCallback; 10 | 11 | interface IGoodixFingerprintDaemonHbd { 12 | oneway initCallback(IGoodixFingerprintDaemonHbdCallback callback); 13 | 14 | startHbd() generates (int32_t debugErrno); 15 | 16 | stopHbd() generates (int32_t debugErrno); 17 | 18 | enableBioAssayFeature(uint8_t enableFlag) generates (int32_t debugErrno); 19 | }; 20 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonHbdCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1; 8 | 9 | interface IGoodixFingerprintDaemonHbdCallback { 10 | oneway onHbdData(uint64_t devId, uint32_t heartBeatRate, uint32_t status, vec displayData, vec rawData); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/fingerprint/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.goodix.hardware.fingerprint@1.0", 5 | root: "vendor.goodix", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IGoodixBiometricsFingerprint.hal", 9 | "IGoodixBiometricsFingerprintClientCallback.hal", 10 | ], 11 | interfaces: [ 12 | "android.hidl.base@1.0", 13 | ], 14 | gen_java: true, 15 | } 16 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/fingerprint/1.0/IGoodixBiometricsFingerprint.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.fingerprint@1.0; 8 | 9 | import IGoodixBiometricsFingerprintClientCallback; 10 | 11 | interface IGoodixBiometricsFingerprint { 12 | setSafeClass(uint32_t safeClass) generates (uint32_t retval); 13 | 14 | navigate(uint32_t navMode) generates (uint32_t retval); 15 | 16 | stopNavigation() generates (uint32_t retval); 17 | 18 | enableFingerprintModule(uint8_t enableFlag) generates (uint32_t retval); 19 | 20 | cameraCapture() generates (uint32_t retval); 21 | 22 | stopCameraCapture() generates (uint32_t retval); 23 | 24 | enableFfFeature(uint8_t enableFlag) generates (uint32_t retval); 25 | 26 | testInit(IGoodixBiometricsFingerprintClientCallback callback) generates (uint32_t retval); 27 | 28 | testCmd(uint32_t cmdId, vec param) generates (uint32_t retval); 29 | 30 | screenOn() generates (uint32_t retval); 31 | 32 | screenOff() generates (uint32_t retval); 33 | 34 | startHbd() generates (uint32_t retval); 35 | 36 | stopHbd() generates (uint32_t retval); 37 | 38 | enumerate() generates (uint32_t retval); 39 | 40 | reset_lockout(vec token) generates (uint32_t retval); 41 | 42 | enableBioAssayFeature(uint8_t enableFlag) generates (uint32_t retval); 43 | 44 | dumpCmd(uint32_t cmdId, vec param) generates (uint32_t retval); 45 | 46 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (uint32_t retval); 47 | 48 | stopAuthenticateFido() generates (uint32_t retval); 49 | 50 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (uint32_t retval); 51 | 52 | getIdList(uint32_t groupId) generates (uint32_t retval, vec list); 53 | 54 | invoke_fido_command(vec in_buf) generates (uint32_t retval, vec list); 55 | }; 56 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/fingerprint/1.0/IGoodixBiometricsFingerprintClientCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.goodix.hardware.fingerprint@1.0; 8 | 9 | interface IGoodixBiometricsFingerprintClientCallback { 10 | oneway onEnrollResult(uint64_t devId, uint32_t fpId, uint32_t gpId, uint32_t rem); 11 | 12 | oneway onAcquired(uint64_t devId, uint32_t acquiredInfo); 13 | 14 | oneway onAuthenticated(uint64_t devId, uint32_t fingerId, uint32_t groupId, vec token); 15 | 16 | oneway onError(uint64_t devId, uint32_t error); 17 | 18 | oneway onRemoved(uint64_t devId, uint32_t fingerId, uint32_t groupId); 19 | 20 | oneway onTestCmd(uint64_t devId, uint32_t cmdId, vec result); 21 | 22 | oneway onHbdData(uint64_t devId, uint32_t heartBeatRate, uint32_t status, vec displayData); 23 | 24 | oneway onDump(uint64_t devId, uint32_t cmdId, vec data); 25 | 26 | oneway onAuthenticatedFido(uint64_t devId, uint32_t fpId, vec uvtData); 27 | }; 28 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/fingerprintextension/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.goodix.hardware.fingerprintextension@1.0", 5 | root: "vendor.goodix", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IGoodixBiometricsFingerprint.hal", 9 | "IGoodixBiometricsFingerprintClientCallback.hal", 10 | ], 11 | interfaces: [ 12 | "android.hidl.base@1.0", 13 | ], 14 | gen_java: true, 15 | } 16 | -------------------------------------------------------------------------------- /interfaces/goodix/hardware/fingerprintextension/1.0/IGoodixBiometricsFingerprint.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 bengris32 3 | * 2024 The LineageOS Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package vendor.goodix.hardware.fingerprintextension@1.0; 19 | 20 | import IGoodixBiometricsFingerprintClientCallback; 21 | 22 | interface IGoodixBiometricsFingerprint { 23 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (uint32_t ret); 24 | cameraCapture() generates (uint32_t ret); 25 | dumpCmd(uint32_t cmdId, vec param) generates (uint32_t ret); 26 | enableFfFeature(uint8_t enableFlag) generates (uint32_t ret); 27 | enableFingerprintModule(uint8_t enableFlag) generates (uint32_t ret); 28 | getIdList(uint32_t groupId) generates (uint32_t i, vec arrayList); 29 | invoke_fido_command(vec in_buf) generates (uint32_t i, vec arrayList); 30 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (uint32_t ret); 31 | navigate(uint32_t navMode) generates (uint32_t ret); 32 | screenOff() generates (uint32_t ret); 33 | screenOn() generates (uint32_t ret); 34 | setSafeClass(uint32_t safeClass) generates (uint32_t ret); 35 | startHbd() generates (uint32_t ret); 36 | stopAuthenticateFido() generates (uint32_t ret); 37 | stopCameraCapture() generates (uint32_t ret); 38 | stopHbd() generates (uint32_t ret); 39 | stopNavigation() generates (uint32_t ret); 40 | testCmd(uint32_t cmdId, vec param) generates (uint32_t ret); 41 | testInit(IGoodixBiometricsFingerprintClientCallback callback) generates (uint32_t ret); 42 | }; 43 | -------------------------------------------------------------------------------- /interfaces/updates-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $ANDROID_BUILD_TOP/system/tools/hidl/update-makefiles-helper.sh 4 | 5 | do_makefiles_update \ 6 | "vendor.goodix:hardware/xiaomi/interfaces/goodix" 7 | 8 | do_makefiles_update \ 9 | "vendor.xiaomi:hardware/xiaomi/interfaces/xiaomi" 10 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/displayfeature/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.displayfeature@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "types.hal", 9 | "IDisplayFeature.hal", 10 | "IDisplayFeatureCallback.hal", 11 | ], 12 | interfaces: [ 13 | "android.hidl.base@1.0", 14 | ], 15 | gen_java: true, 16 | } 17 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/displayfeature/1.0/IDisplayFeature.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2022 The LineageOS 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 vendor.xiaomi.hardware.displayfeature@1.0; 18 | 19 | import @1.0::IDisplayFeatureCallback; 20 | 21 | interface IDisplayFeature { 22 | notifyBrightness(uint32_t brightness); 23 | registerCallback(uint32_t displayId, IDisplayFeatureCallback callback) generates (Status status); 24 | sendMessage(uint32_t index, uint32_t value, string cmd); 25 | sendPanelCommand(string cmd) generates (Status status); 26 | sendPostProcCommand(uint32_t cmd, uint32_t value) generates (Status status); 27 | sendRefreshCommand() generates (Status status); 28 | setFeature(uint32_t displayId, uint32_t caseId, uint32_t modeId, uint32_t cookie) generates (Status status); 29 | setFunction(uint32_t displayId, uint32_t caseId, uint32_t modeId, uint32_t cookie) generates (Status status); 30 | }; 31 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/displayfeature/1.0/IDisplayFeatureCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS 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 vendor.xiaomi.hardware.displayfeature@1.0; 18 | 19 | interface IDisplayFeatureCallback { 20 | oneway displayfeatureInfoChanged(uint32_t caseId, uint32_t value, float red, float green, float blue); 21 | }; 22 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/displayfeature/1.0/types.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS 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 vendor.xiaomi.hardware.displayfeature@1.0; 18 | 19 | // Based on observations using Ghidra, all methods that return Status 20 | // only set the result of __android_log_print and cast it to Status. 21 | enum Status : int32_t {}; 22 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/fingerprintextension/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.fingerprintextension@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IXiaomiFingerprint.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 The LineageOS 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 vendor.xiaomi.hardware.fingerprintextension@1.0; 18 | 19 | interface IXiaomiFingerprint { 20 | extCmd(int32_t cmd, int32_t param) generates (int32_t result); 21 | }; 22 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/fx/tunnel/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.fx.tunnel@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMiFxTunnel.hal", 9 | "IMiFxTunnelCallback.hal", 10 | ], 11 | interfaces: [ 12 | "android.hidl.base@1.0", 13 | ], 14 | gen_java: true, 15 | } 16 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/fx/tunnel/1.0/IMiFxTunnel.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.fx.tunnel@1.0; 8 | 9 | import @1.0::IMiFxTunnelCallback; 10 | 11 | interface IMiFxTunnel { 12 | setNotify(IMiFxTunnelCallback callback); 13 | invokeCommand(int32_t cmdId, vec params) generates (int32_t resultCode, vec out_buf); 14 | }; 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/fx/tunnel/1.0/IMiFxTunnelCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.fx.tunnel@1.0; 8 | 9 | interface IMiFxTunnelCallback { 10 | onMessage(uint64_t param_1, uint32_t param_2, uint32_t param_3, vec param_4); 11 | }; 12 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mfidoca/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mfidoca@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IFidoService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mfidoca/1.0/IFidoService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mfidoca@1.0; 8 | 9 | interface IFidoService { 10 | execute(vec bArr, int32_t i) generates (vec result); 11 | fido_key_load(string str, string str2) generates (int32_t result); 12 | fido_key_get_version() generates (int32_t version); 13 | fido_key_prepare() generates (string result); 14 | }; 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mlipay/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mlipay@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMlipayService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mlipay/1.0/IMlipayService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mlipay@1.0; 8 | 9 | interface IMlipayService { 10 | invoke_command(vec sbuf, uint32_t sbuf_len) generates (vec ret); 11 | ifaa_key_get_version() generates (int32_t result); 12 | ifaa_key_prepare() generates (string hex); 13 | ifaa_key_load(string data_text, string sign_text) generates (int32_t result); 14 | ifaa_key_extract(vec buf, uint32_t buf_len) generates (int32_t result); 15 | }; 16 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mlipay/1.1/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mlipay@1.1", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMlipayService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | "vendor.xiaomi.hardware.mlipay@1.0", 13 | ], 14 | gen_java: true, 15 | } 16 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mlipay/1.1/IMlipayService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mlipay@1.1; 8 | 9 | import @1.0::IMlipayService; 10 | 11 | interface IMlipayService extends @1.0::IMlipayService { 12 | ifaa_key_dump() generates (string hex); 13 | ifaa_get_idlist(uint32_t bioType) generates (vec idList); 14 | }; 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/motor/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.motor@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "types.hal", 9 | "IMotor.hal", 10 | "IMotorCallback.hal", 11 | ], 12 | interfaces: [ 13 | "android.hidl.base@1.0", 14 | ], 15 | gen_java: true, 16 | } 17 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/motor/1.0/IMotor.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 The LineageOS 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 vendor.xiaomi.hardware.motor@1.0; 18 | 19 | import vendor.xiaomi.hardware.motor@1.0::IMotorCallback; 20 | 21 | interface IMotor { 22 | popupMotor(int32_t cookie); 23 | takebackMotor(int32_t cookie); 24 | setMotorCallback(IMotorCallback motorcallback); 25 | init(); 26 | release(); 27 | getMotorStatus() generates (int32_t result); 28 | calibration(); 29 | takebackMotorShortly(); 30 | }; 31 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/motor/1.0/IMotorCallback.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 The LineageOS 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 vendor.xiaomi.hardware.motor@1.0; 18 | 19 | interface IMotorCallback { 20 | oneway onNotify(MotorEvent event); 21 | }; 22 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/motor/1.0/types.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 The LineageOS 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 vendor.xiaomi.hardware.motor@1.0; 18 | 19 | struct MotorEvent { 20 | int32_t vaalue; 21 | int32_t cookie; 22 | }; 23 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mtdservice@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMTService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.0/IMTService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mtdservice@1.0; 8 | 9 | interface IMTService { 10 | getFid() generates (string fid); 11 | eccSign(uint32_t keyType, string text) generates (string signData); 12 | reload(string text, string sign) generates (int32_t result); 13 | enroll(string appname, int32_t enrollType) generates (string enrolldata); 14 | ifaa_key_get_version() generates (int32_t result); 15 | ifaa_key_prepare() generates (string ret); 16 | ifaa_key_load(string data_text, string sign_text) generates (int32_t result); 17 | fido_key_get_version() generates (int32_t result); 18 | fido_key_prepare() generates (string ret); 19 | fido_key_load(string data_text, string sign_text) generates (int32_t result); 20 | soter_generate() generates (string ret); 21 | soter_get_state() generates (int32_t result); 22 | soter_set_state(int32_t state); 23 | }; 24 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.1/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mtdservice@1.1", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMTService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | "vendor.xiaomi.hardware.mtdservice@1.0", 13 | ], 14 | gen_java: true, 15 | } 16 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.1/IMTService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mtdservice@1.1; 8 | 9 | import @1.0::IMTService; 10 | 11 | interface IMTService extends @1.0::IMTService { 12 | persist_read(int32_t dir_id, string file_name) generates (int32_t ret, vec rbuf); 13 | persist_write(int32_t dir_id, string file_name, vec sbuf, uint32_t sbuf_len) generates (int32_t ret); 14 | persist_remove(int32_t dir_id, string file_name) generates (int32_t ret); 15 | ifaa_key_dump() generates (string ret); 16 | }; 17 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.2/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mtdservice@1.2", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMTService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | "vendor.xiaomi.hardware.mtdservice@1.0", 13 | "vendor.xiaomi.hardware.mtdservice@1.1", 14 | ], 15 | gen_java: true, 16 | } 17 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.2/IMTService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mtdservice@1.2; 8 | 9 | import @1.1::IMTService; 10 | 11 | interface IMTService extends @1.1::IMTService { 12 | widevine_get_version() generates (int32_t ret); 13 | widevine_prepare() generates (string ret); 14 | widevine_load(string data_text, string sign_text) generates (int32_t ret); 15 | widevine_dump() generates (string ret); 16 | runExternalCmd(int32_t taType, vec ta, uint32_t cmdId, vec data) generates (int32_t ret, vec rsp); 17 | installTa(int32_t taType, vec ta, vec ta_buf) generates (int32_t ret); 18 | unInstallTa(int32_t taType, vec ta) generates (int32_t ret); 19 | loadTa(int32_t taType, vec ta) generates (int32_t ret); 20 | runTaCmd(int32_t taType, vec ta, vec data) generates (int32_t ret, vec rsp); 21 | unloadTa(int32_t taType, vec ta) generates (int32_t ret); 22 | checkPermission(vec packageName, vec signature) generates (bool ret); 23 | updateWhitelist(int32_t operation, vec whitelist) generates (int32_t ret); 24 | getWhitelistVersion() generates (int32_t ret); 25 | enrollV2(int32_t taType, vec ta, vec data) generates (int32_t ret, vec rsp); 26 | external_key_version(int32_t key_type) generates (int32_t ret); 27 | external_key_prepare(int32_t key_type) generates (string ret); 28 | external_key_load(int32_t key_type, string data_text, string sign_text) generates (int32_t ret); 29 | external_key_dump(int32_t key_type) generates (string ret); 30 | }; 31 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.3/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.mtdservice@1.3", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "IMTService.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | "vendor.xiaomi.hardware.mtdservice@1.0", 13 | "vendor.xiaomi.hardware.mtdservice@1.1", 14 | "vendor.xiaomi.hardware.mtdservice@1.2", 15 | ], 16 | gen_java: true, 17 | } 18 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/mtdservice/1.3/IMTService.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hardware.mtdservice@1.3; 8 | 9 | import @1.2::IMTService; 10 | 11 | interface IMTService extends @1.2::IMTService { 12 | external_id_load(int32_t id) generates (bool result); 13 | getTAVersion() generates (string version); 14 | get_device_rpmb_counter() generates (int32_t counter); 15 | get_device_secure_status() generates (vec status); 16 | refreash_device_rpmb_status() generates (int32_t result); 17 | }; 18 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/touchfeature/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hardware.touchfeature@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "ITouchFeature.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hardware/touchfeature/1.0/ITouchFeature.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2020 The LineageOS 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 vendor.xiaomi.hardware.touchfeature@1.0; 18 | 19 | interface ITouchFeature { 20 | setTouchMode(int32_t mode, int32_t value) generates (int32_t result); 21 | getTouchModeCurValue(int32_t mode) generates (int32_t result); 22 | getTouchModeMaxValue(int32_t mode) generates (int32_t result); 23 | getTouchModeMinValue(int32_t mode) generates (int32_t result); 24 | getTouchModeDefValue(int32_t mode) generates (int32_t result); 25 | resetTouchMode(int32_t mode) generates (int32_t result); 26 | getModeValues(int32_t mode) generates (vec result); 27 | }; 28 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hw/touchfeature/1.0/Android.bp: -------------------------------------------------------------------------------- 1 | // This file is autogenerated by hidl-gen -Landroidbp. 2 | 3 | hidl_interface { 4 | name: "vendor.xiaomi.hw.touchfeature@1.0", 5 | root: "vendor.xiaomi", 6 | system_ext_specific: true, 7 | srcs: [ 8 | "ITouchFeature.hal", 9 | ], 10 | interfaces: [ 11 | "android.hidl.base@1.0", 12 | ], 13 | gen_java: true, 14 | } 15 | -------------------------------------------------------------------------------- /interfaces/xiaomi/hw/touchfeature/1.0/ITouchFeature.hal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package vendor.xiaomi.hw.touchfeature@1.0; 8 | 9 | interface ITouchFeature { 10 | getModeCurValue(int32_t touchId, int32_t ControlMode) generates (int32_t result); 11 | getModeDefaultValue(int32_t touchId, int32_t ControlMode) generates (int32_t result); 12 | getModeMaxValue(int32_t touchId, int32_t ControlMode) generates (int32_t result); 13 | getModeMinValue(int32_t touchId, int32_t ControlMode) generates (int32_t result); 14 | getModeValue(int32_t touchId, int32_t mode) generates (vec result); 15 | modeReset(int32_t touchId, int32_t ControlMode) generates (int32_t result); 16 | setModeLongValue(int32_t touchId, int32_t ControlMode, uint32_t ValueLen, vec ValueBuf) generates (int32_t result); 17 | setModeValue(int32_t touchId, int32_t ControlMode, int32_t ModeValue) generates (int32_t result); 18 | }; 19 | -------------------------------------------------------------------------------- /megvii/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_defaults { 8 | name: "libMegviiFacepp_defaults", 9 | vendor: true, 10 | srcs: [ 11 | "megvii.c", 12 | ], 13 | } 14 | 15 | cc_library_shared { 16 | name: "libMegviiFacepp-0.5.2", 17 | defaults: ["libMegviiFacepp_defaults"], 18 | } 19 | 20 | cc_library_shared { 21 | name: "libmegface", 22 | vendor: true, 23 | } 24 | -------------------------------------------------------------------------------- /megvii/megvii.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The LineageOS Project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | static int stub_fail() { 8 | return -1; 9 | } 10 | 11 | static char *stub_fail_str() { 12 | return "stub"; 13 | } 14 | 15 | void *mg_facepp[] = { 16 | &stub_fail, 17 | &stub_fail, 18 | &stub_fail, 19 | &stub_fail_str, 20 | &stub_fail_str, 21 | &stub_fail, 22 | &stub_fail, 23 | &stub_fail, 24 | &stub_fail, 25 | &stub_fail, 26 | &stub_fail, 27 | &stub_fail, 28 | &stub_fail, 29 | &stub_fail, 30 | &stub_fail, 31 | &stub_fail, 32 | &stub_fail, 33 | &stub_fail, 34 | &stub_fail, 35 | &stub_fail, 36 | &stub_fail, 37 | &stub_fail, 38 | &stub_fail, 39 | &stub_fail, 40 | &stub_fail, 41 | &stub_fail, 42 | &stub_fail, 43 | }; 44 | -------------------------------------------------------------------------------- /sensors/v1/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_library_shared { 8 | name: "sensors.udfps", 9 | defaults: ["hidl_defaults"], 10 | srcs: [ 11 | "udfps_hal.cpp", 12 | ], 13 | shared_libs: [ 14 | "libcutils", 15 | "liblog", 16 | "libutils", 17 | ], 18 | header_libs: [ 19 | "libhardware_headers", 20 | ], 21 | vendor: true, 22 | } 23 | -------------------------------------------------------------------------------- /sensors/v2/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2022 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | cc_library_shared { 8 | name: "sensors.xiaomi.v2", 9 | defaults: ["hidl_defaults"], 10 | srcs: [ 11 | "Sensor.cpp", 12 | "SensorsSubHal.cpp", 13 | ], 14 | shared_libs: [ 15 | "android.hardware.sensors@1.0", 16 | "android.hardware.sensors@2.0", 17 | "android.hardware.sensors@2.0-ScopedWakelock", 18 | "android.hardware.sensors@2.1", 19 | "libcutils", 20 | "libfmq", 21 | "libhardware", 22 | "libhidlbase", 23 | "liblog", 24 | "libpower", 25 | "libutils", 26 | ], 27 | static_libs: [ 28 | "android.hardware.sensors@1.0-convert", 29 | "android.hardware.sensors@2.X-multihal", 30 | ], 31 | cflags: [ 32 | "-DLOG_TAG=\"sensors.xiaomi\"", 33 | ], 34 | vendor: true, 35 | } 36 | -------------------------------------------------------------------------------- /sensors/v2/SensorsSubHal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 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 | #pragma once 18 | 19 | #include 20 | 21 | #include "Sensor.h" 22 | #include "V2_1/SubHal.h" 23 | 24 | namespace android { 25 | namespace hardware { 26 | namespace sensors { 27 | namespace V2_1 { 28 | namespace subhal { 29 | namespace implementation { 30 | 31 | using ::android::hardware::sensors::V1_0::OperationMode; 32 | using ::android::hardware::sensors::V1_0::RateLevel; 33 | using ::android::hardware::sensors::V1_0::Result; 34 | using ::android::hardware::sensors::V1_0::SharedMemInfo; 35 | using ::android::hardware::sensors::V2_1::Event; 36 | using ::android::hardware::sensors::V2_1::implementation::IHalProxyCallback; 37 | using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal; 38 | 39 | class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback { 40 | public: 41 | SensorsSubHal(); 42 | 43 | Return getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb); 44 | Return injectSensorData_2_1(const Event& event); 45 | Return initialize(const sp& halProxyCallback); 46 | 47 | virtual Return setOperationMode(OperationMode mode); 48 | 49 | OperationMode getOperationMode() const { return mCurrentOperationMode; } 50 | 51 | Return activate(int32_t sensorHandle, bool enabled); 52 | 53 | Return batch(int32_t sensorHandle, int64_t samplingPeriodNs, 54 | int64_t maxReportLatencyNs); 55 | 56 | Return flush(int32_t sensorHandle); 57 | 58 | Return registerDirectChannel(const SharedMemInfo& mem, 59 | ISensors::registerDirectChannel_cb _hidl_cb); 60 | 61 | Return unregisterDirectChannel(int32_t channelHandle); 62 | 63 | Return configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate, 64 | ISensors::configDirectReport_cb _hidl_cb); 65 | 66 | Return debug(const hidl_handle& fd, const hidl_vec& args); 67 | 68 | const std::string getName() { return "FakeSubHal"; } 69 | 70 | void postEvents(const std::vector& events, bool wakeup) override; 71 | 72 | protected: 73 | template 74 | void AddSensor() { 75 | std::shared_ptr sensor = 76 | std::make_shared(mNextHandle++ /* sensorHandle */, this /* callback */); 77 | mSensors[sensor->getSensorInfo().sensorHandle] = sensor; 78 | } 79 | 80 | std::map> mSensors; 81 | 82 | sp mCallback; 83 | 84 | private: 85 | OperationMode mCurrentOperationMode = OperationMode::NORMAL; 86 | 87 | int32_t mNextHandle; 88 | }; 89 | 90 | } // namespace implementation 91 | } // namespace subhal 92 | } // namespace V2_1 93 | } // namespace sensors 94 | } // namespace hardware 95 | } // namespace android 96 | -------------------------------------------------------------------------------- /telephony/Android.bp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2024 The LineageOS Project 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | 7 | java_library { 8 | name: "xiaomi-telephony-stub", 9 | installable: true, 10 | provides_uses_lib: "xiaomi-telephony-stub", 11 | sdk_version: "system_current", 12 | srcs: [ 13 | "src/**/*.java", 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /telephony/src/android/telephony/TelephonyBaseUtilsStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2024 The LineageOS Project 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package android.telephony; 7 | 8 | public class TelephonyBaseUtilsStub { 9 | public static boolean isMiuiRom() { 10 | return false; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vibrator/effect/Android.bp: -------------------------------------------------------------------------------- 1 | Common_CFlags = ["-Wall"] 2 | Common_CFlags += ["-Werror"] 3 | 4 | cc_library_shared { 5 | name: "libqtivibratoreffect.xiaomi", 6 | vendor: true, 7 | cflags: Common_CFlags, 8 | srcs: [ 9 | "effect.cpp", 10 | ], 11 | shared_libs: [ 12 | "android.hardware.vibrator-V2-ndk", 13 | "libbase", 14 | "libcutils", 15 | "libutils", 16 | ], 17 | static_libs: [ 18 | "libc++fs", 19 | ], 20 | export_include_dirs: ["."], 21 | } 22 | -------------------------------------------------------------------------------- /vibrator/effect/effect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, The Linux Foundation. All rights reserved. 3 | * Copyright (C) 2022-2023 The LineageOS Project 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are 7 | * met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following 12 | * disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * * Neither the name of The Linux Foundation nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 28 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef QTI_VIBRATOR_EFFECT_STREAM_H 32 | #define QTI_VIBRATOR_EFFECT_STREAM_H 33 | #include 34 | 35 | struct effect_stream { 36 | uint32_t effect_id; 37 | uint32_t length; 38 | uint32_t play_rate_hz; 39 | const int8_t* data; 40 | 41 | effect_stream(uint32_t effect_id, uint32_t length, uint32_t play_rate_hz, const int8_t* data) 42 | : effect_id(effect_id), length(length), play_rate_hz(play_rate_hz), data(data) {} 43 | }; 44 | 45 | const struct effect_stream* get_effect_stream(uint32_t effect_id); 46 | 47 | #endif 48 | --------------------------------------------------------------------------------