├── Android.bp ├── sepolicy ├── public │ ├── attributes │ └── file.te ├── vendor │ ├── sensors.te │ ├── system_server.te │ ├── mm-pp-daemon.te │ ├── hwservice.te │ ├── healthd.te │ ├── vndservice.te │ ├── vndservice_contexts │ ├── device.te │ ├── tee.te │ ├── app.te │ ├── hal_power_default.te │ ├── hal_bluetooth_qti.te │ ├── hal_gnss_default.te │ ├── property.te │ ├── hal_health_default.te │ ├── hal_mlipay.te │ ├── thermal-engine.te │ ├── hal_audio_default.te │ ├── remosaic_daemon.te │ ├── hal_sensors_default.te │ ├── lhd.te │ ├── file.te │ ├── hal_mlipay_default.te │ ├── hal_camera_default.te │ ├── glgps.te │ ├── genfs_contexts │ ├── hal_fingerprint_default.te │ ├── property_contexts │ └── hwservice_contexts └── private │ ├── init.te │ ├── file_contexts │ ├── system_app.te │ ├── seapp_contexts │ ├── pocketmode_app.te │ └── thermalcontroller_app.te ├── pocketmode ├── proguard.flags ├── Android.mk ├── src │ └── org │ │ └── lineageos │ │ └── pocketmode │ │ ├── BootCompletedReceiver.java │ │ ├── PocketModeService.java │ │ └── ProximitySensor.java └── AndroidManifest.xml ├── ThermalController ├── README.md ├── Android.mk ├── res │ └── values │ │ └── strings.xml ├── AndroidManifest.xml └── src │ └── org │ └── pixelexperience │ └── thermalcontroller │ ├── Preferences.java │ ├── Receiver.java │ └── PreferencesProvider.java ├── README.md ├── parts ├── proguard.flags ├── res │ ├── drawable │ │ ├── ic_preset.xml │ │ ├── ic_display.xml │ │ ├── ic_headphone.xml │ │ ├── ic_pickup.xml │ │ ├── switchbar_background.xml │ │ ├── ic_hand.xml │ │ └── ic_pocket.xml │ ├── color │ │ ├── switchbar_switch_thumb_tint.xml │ │ ├── switchbar_switch_track_tint.xml │ │ └── switch_bar_bg.xml │ ├── layout │ │ ├── dirac.xml │ │ ├── doze.xml │ │ └── switch_bar.xml │ ├── xml │ │ ├── dirac_settings.xml │ │ └── doze_settings.xml │ ├── values-zh-rCN │ │ └── strings.xml │ ├── values-zh-rHK │ │ └── strings.xml │ ├── values-zh-rSG │ │ └── strings.xml │ ├── values-zh-rTW │ │ └── strings.xml │ ├── values │ │ ├── styles.xml │ │ └── strings.xml │ ├── values-ko-rKR │ │ └── strings.xml │ ├── values-ja-rJP │ │ └── strings.xml │ ├── values-ar-rSA │ │ └── strings.xml │ ├── values-iw-rIL │ │ └── strings.xml │ ├── values-ur-rIN │ │ └── strings.xml │ ├── values-ur-rPK │ │ └── strings.xml │ ├── values-in-rID │ │ └── strings.xml │ ├── values-cs-rCZ │ │ └── strings.xml │ ├── values-fi-rFI │ │ └── strings.xml │ └── values-hi-rIN │ │ └── strings.xml ├── Android.mk ├── src │ └── org │ │ └── lineageos │ │ └── settings │ │ ├── dirac │ │ ├── DiracActivity.java │ │ ├── DiracUtils.java │ │ └── DiracSound.java │ │ ├── doze │ │ ├── DozeSettingsActivity.java │ │ └── PickupSensor.java │ │ └── BootCompletedReceiver.java └── AndroidManifest.xml ├── ims └── Android.bp ├── power ├── android.hardware.power@1.2-service.xiaomi_sdm845.rc ├── Android.mk ├── hint-data.c ├── list.h ├── powerhintparser.h ├── metadata-defs.h ├── utils.h ├── power-common.h ├── service.cpp └── hint-data.h ├── org.ifaa.android.manager ├── src │ └── org │ │ └── ifaa │ │ └── android │ │ └── manager │ │ ├── IFAAManagerV4.java │ │ ├── IFAAManagerV2.java │ │ ├── IFAAManagerFactory.java │ │ ├── IIFAAService.aidl │ │ ├── IFAAManagerV3.java │ │ └── IFAAManager.java └── Android.bp ├── recovery └── Android.mk ├── framework_manifest.xml ├── seccomp └── mediacodec-seccomp.policy ├── permissions ├── privapp-permissions-hotword.xml └── privapp-permissions-qti.xml ├── configs ├── public.libraries.txt └── system_properties.xml ├── overlay ├── packages │ ├── apps │ │ ├── Settings │ │ │ └── res │ │ │ │ └── values │ │ │ │ ├── bools.xml │ │ │ │ ├── arrays.xml │ │ │ │ └── config.xml │ │ └── Bluetooth │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ └── services │ │ └── Telephony │ │ └── res │ │ └── xml │ │ └── telephony_injection.xml └── frameworks │ └── base │ ├── packages │ ├── SettingsProvider │ │ └── res │ │ │ └── values │ │ │ └── defaults.xml │ └── SystemUI │ │ └── res │ │ ├── values │ │ └── config.xml │ │ └── drawable │ │ └── ic_volte.xml │ └── core │ └── res │ └── res │ ├── values-mcc302-mnc370 │ └── config.xml │ └── values-mcc302-mnc720 │ └── config.xml ├── vndk ├── vndk-sp-libs.mk └── Android.mk ├── overlay-aosip ├── packages │ └── apps │ │ ├── Dialer │ │ └── java │ │ │ └── com │ │ │ └── android │ │ │ └── dialer │ │ │ └── callrecord │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ │ └── Settings │ │ └── res │ │ └── values │ │ └── config.xml └── frameworks │ └── base │ └── core │ └── res │ └── res │ └── values │ └── aosip_config.xml ├── light ├── android.hardware.light@2.0-service.xiaomi_sdm845.rc ├── Android.bp ├── service.cpp └── Light.h ├── setup-makefiles.sh ├── keylayout └── sdm845-tavil-snd-card_Button_Jack.kl ├── libhidl └── Android.mk ├── rootdir └── etc │ ├── init.qti.qseecomd.sh │ ├── init.qcom.sensors.sh │ └── init.qcom.post_boot.sh ├── extract-files.sh ├── releasetools.py ├── bluetooth └── include │ └── bdroid_buildcfg.h ├── config.fs ├── fingerprint └── android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sdm845.rc └── audio ├── listen_platform_info.xml └── graphite_ipc_platform_info.xml /Android.bp: -------------------------------------------------------------------------------- 1 | soong_namespace { 2 | } 3 | -------------------------------------------------------------------------------- /sepolicy/public/attributes: -------------------------------------------------------------------------------- 1 | hal_attribute(mlipay) 2 | -------------------------------------------------------------------------------- /sepolicy/public/file.te: -------------------------------------------------------------------------------- 1 | type sysfs_fingerprint, sysfs_type, fs_type; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/sensors.te: -------------------------------------------------------------------------------- 1 | allow sensors proc_tp:file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/system_server.te: -------------------------------------------------------------------------------- 1 | binder_call(system_server, glgps) 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/mm-pp-daemon.te: -------------------------------------------------------------------------------- 1 | get_prop(mm-pp-daemon, vendor_dpps_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/hwservice.te: -------------------------------------------------------------------------------- 1 | type hal_mlipay_hwservice, hwservice_manager_type; 2 | -------------------------------------------------------------------------------- /pocketmode/proguard.flags: -------------------------------------------------------------------------------- 1 | -keep class org.lineageos.pocketmode.* { 2 | *; 3 | } 4 | -------------------------------------------------------------------------------- /sepolicy/vendor/healthd.te: -------------------------------------------------------------------------------- 1 | allow healthd sysfs_wireless_supply:file r_file_perms; 2 | -------------------------------------------------------------------------------- /sepolicy/vendor/vndservice.te: -------------------------------------------------------------------------------- 1 | type remosaic_daemon_service, vndservice_manager_type; 2 | -------------------------------------------------------------------------------- /sepolicy/private/init.te: -------------------------------------------------------------------------------- 1 | allow init input_device:chr_file ioctl; 2 | allow init input_device:chr_file write; 3 | -------------------------------------------------------------------------------- /ThermalController/README.md: -------------------------------------------------------------------------------- 1 | ThermalController app used by some Xiaomi devices, see fwb and Settings for more information 2 | -------------------------------------------------------------------------------- /sepolicy/private/file_contexts: -------------------------------------------------------------------------------- 1 | # Executables 2 | /system/bin/chargeonlymode u:object_r:charger_exec:s0 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/vndservice_contexts: -------------------------------------------------------------------------------- 1 | android.IRemosaicDaemon u:object_r:remosaic_daemon_service:s0 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2018 - The LineageOS Project 2 | 3 | Common device tree for Xiaomi SDM845 based devices 4 | ============== 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/device.te: -------------------------------------------------------------------------------- 1 | type fingerprint_device, dev_type; 2 | 3 | type gps_device, dev_type; 4 | 5 | type sound_device, dev_type; 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/tee.te: -------------------------------------------------------------------------------- 1 | allow tee fingerprint_data_file:dir create_dir_perms; 2 | allow tee fingerprint_data_file:file create_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/private/system_app.te: -------------------------------------------------------------------------------- 1 | hal_client_domain(system_app, hal_mlipay) 2 | 3 | #Thermals stuff 4 | allow system_app sysfs_thermal:file write; 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/app.te: -------------------------------------------------------------------------------- 1 | get_prop({ appdomain -isolated_app }, vendor_fp_prop) 2 | get_prop({ appdomain -isolated_app }, vendor_tee_listener_prop) 3 | -------------------------------------------------------------------------------- /parts/proguard.flags: -------------------------------------------------------------------------------- 1 | -keep class org.lineageos.settings.dirac.* { 2 | *; 3 | } 4 | 5 | -keep class org.lineageos.settings.doze.* { 6 | *; 7 | } 8 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_power_default.te: -------------------------------------------------------------------------------- 1 | allow hal_power_default input_device:dir search; 2 | allow hal_power_default input_device:chr_file rw_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_bluetooth_qti.te: -------------------------------------------------------------------------------- 1 | allow hal_bluetooth_qti wifi_vendor_data_file:dir search; 2 | allow hal_bluetooth_qti wifi_vendor_data_file:file r_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_gnss_default.te: -------------------------------------------------------------------------------- 1 | allow hal_gnss_default gps_data_file:dir rw_dir_perms; 2 | allow hal_gnss_default gps_data_file:fifo_file create_file_perms; 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/property.te: -------------------------------------------------------------------------------- 1 | type thermal_engine_prop, property_type; 2 | 3 | type vendor_dpps_prop, property_type; 4 | 5 | type vendor_fp_prop, property_type; 6 | -------------------------------------------------------------------------------- /ims/Android.bp: -------------------------------------------------------------------------------- 1 | java_library { 2 | name: "ims-ext-common_system", 3 | installable: true, 4 | static_libs: [ 5 | "ims-ext-common", 6 | ], 7 | } 8 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_health_default.te: -------------------------------------------------------------------------------- 1 | allow hal_health_default sysfs_wireless_supply:dir search; 2 | allow hal_health_default sysfs_wireless_supply:file r_file_perms; 3 | -------------------------------------------------------------------------------- /power/android.hardware.power@1.2-service.xiaomi_sdm845.rc: -------------------------------------------------------------------------------- 1 | service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service.xiaomi_sdm845 2 | class hal 3 | user system 4 | group system input 5 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_mlipay.te: -------------------------------------------------------------------------------- 1 | # HwBinder IPC from client to server 2 | binder_call(hal_mlipay_client, hal_mlipay_server) 3 | 4 | add_hwservice(hal_mlipay_server, hal_mlipay_hwservice) 5 | allow hal_mlipay_client hal_mlipay_hwservice:hwservice_manager find; 6 | -------------------------------------------------------------------------------- /sepolicy/vendor/thermal-engine.te: -------------------------------------------------------------------------------- 1 | allow thermal-engine self:capability chown; 2 | allow thermal-engine thermal_data_file:dir rw_dir_perms; 3 | allow thermal-engine thermal_data_file:file create_file_perms; 4 | set_prop(thermal-engine, thermal_engine_prop) 5 | -------------------------------------------------------------------------------- /sepolicy/private/seapp_contexts: -------------------------------------------------------------------------------- 1 | user=system seinfo=platform name=org.lineageos.pocketmode domain=pocketmode_app type=system_app_data_file 2 | user=system seinfo=platform name=org.pixelexperience.thermalcontroller domain=thermalcontroller_app type=system_app_data_file 3 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_audio_default.te: -------------------------------------------------------------------------------- 1 | allow hal_audio_default mnt_vendor_file:dir search; 2 | r_dir_file(hal_audio_default, persist_audio_file) 3 | 4 | set_prop(hal_audio_default, vendor_audio_prop) 5 | 6 | allow hal_audio_default audio_socket:sock_file rw_file_perms; 7 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV4.java: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | public abstract class IFAAManagerV4 extends IFAAManagerV3 { 4 | public abstract int getEnabled(int i); 5 | 6 | public abstract int[] getIDList(int i); 7 | } 8 | -------------------------------------------------------------------------------- /sepolicy/vendor/remosaic_daemon.te: -------------------------------------------------------------------------------- 1 | type remosaic_daemon, domain; 2 | type remosaic_daemon_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(remosaic_daemon) 5 | 6 | vndbinder_use(remosaic_daemon) 7 | 8 | allow remosaic_daemon remosaic_daemon_service:service_manager add; 9 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV2.java: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | import android.content.Context; 4 | 5 | public abstract class IFAAManagerV2 extends IFAAManager { 6 | public abstract byte[] processCmdV2(Context paramContext, byte[] paramArrayOfByte); 7 | } 8 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_sensors_default.te: -------------------------------------------------------------------------------- 1 | allow hal_sensors_default mnt_vendor_file:file r_file_perms; 2 | allow hal_sensors_default sound_device:chr_file rw_file_perms; 3 | 4 | allow hal_sensors_default audio_socket:sock_file rw_file_perms; 5 | unix_socket_connect(hal_sensors_default, audio, hal_audio_default) 6 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerFactory.java: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | import android.content.Context; 4 | 5 | public class IFAAManagerFactory { 6 | public static IFAAManager getIFAAManager(Context context, int authType) { 7 | return IFAAManagerImpl.getInstance(context); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /recovery/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_C_INCLUDES := \ 5 | bootable/recovery \ 6 | bootable/recovery/edify/include \ 7 | bootable/recovery/otautil/include 8 | LOCAL_SRC_FILES := recovery_updater.cpp 9 | LOCAL_MODULE := librecovery_updater_xiaomi 10 | 11 | include $(BUILD_STATIC_LIBRARY) 12 | -------------------------------------------------------------------------------- /pocketmode/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE_TAGS := optional 6 | 7 | LOCAL_SRC_FILES := $(call all-java-files-under, src) 8 | 9 | LOCAL_PACKAGE_NAME := XiaomiPocketMode 10 | LOCAL_CERTIFICATE := platform 11 | LOCAL_PRIVATE_PLATFORM_APIS := true 12 | LOCAL_PRIVILEGED_MODULE := true 13 | 14 | LOCAL_PROGUARD_FLAG_FILES := proguard.flags 15 | 16 | include $(BUILD_PACKAGE) 17 | -------------------------------------------------------------------------------- /sepolicy/vendor/lhd.te: -------------------------------------------------------------------------------- 1 | type lhd, domain; 2 | type lhd_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(lhd) 5 | net_domain(lhd) 6 | 7 | allow lhd gps_data_file:dir create_dir_perms; 8 | allow lhd gps_data_file:fifo_file create_file_perms; 9 | allow lhd gps_data_file:file create_file_perms; 10 | 11 | allow lhd gps_device:chr_file rw_file_perms; 12 | allow lhd sysfs_gps:file rw_file_perms; 13 | 14 | wakelock_use(lhd) 15 | -------------------------------------------------------------------------------- /framework_manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | vendor.qti.hardware.wifi.keystore 4 | hwbinder 5 | 1.0 6 | 7 | IKeystoreExt 8 | default 9 | 10 | @1.0::IKeystoreExt/default 11 | 12 | 13 | -------------------------------------------------------------------------------- /seccomp/mediacodec-seccomp.policy: -------------------------------------------------------------------------------- 1 | # device specific syscalls 2 | # extension of services/mediacodec/minijail/seccomp_policy/mediacodec-seccomp-arm.policy 3 | pselect6: 1 4 | eventfd2: 1 5 | sendto: 1 6 | recvfrom: 1 7 | _llseek: 1 8 | sysinfo: 1 9 | getcwd: 1 10 | getdents64: 1 11 | ARM_cacheflush: 1 12 | inotify_init1: 1 13 | inotify_add_watch: 1 14 | inotify_rm_watch: 1 15 | uname: 1 16 | ueventd: 1 17 | timer_create: 1 18 | timer_settime: 1 19 | rt_sigtimedwait: 1 20 | -------------------------------------------------------------------------------- /permissions/privapp-permissions-hotword.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_preset.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_display.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sepolicy/vendor/file.te: -------------------------------------------------------------------------------- 1 | type audio_socket, file_type; 2 | 3 | type fingerprint_data_file, data_file_type, file_type; 4 | type gps_data_file, data_file_type, file_type; 5 | type gps_socket, file_type; 6 | type thermal_data_file, data_file_type, file_type; 7 | 8 | type proc_tp, proc_type, fs_type; 9 | 10 | type sysfs_gps, sysfs_type, fs_type; 11 | type sysfs_wireless_supply, sysfs_type, fs_type; 12 | 13 | type persist_audio_file, file_type, vendor_persist_type; 14 | type persist_camera_file, file_type, vendor_persist_type; 15 | -------------------------------------------------------------------------------- /ThermalController/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2019 The PixelExperience Project 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | LOCAL_PATH := $(call my-dir) 8 | 9 | include $(CLEAR_VARS) 10 | 11 | LOCAL_MODULE_TAGS := optional 12 | 13 | LOCAL_SRC_FILES := $(call all-java-files-under, src) 14 | 15 | LOCAL_PACKAGE_NAME := ThermalController 16 | LOCAL_CERTIFICATE := platform 17 | LOCAL_PRIVATE_PLATFORM_APIS := true 18 | LOCAL_PRIVILEGED_MODULE := true 19 | 20 | LOCAL_USE_AAPT2 := true 21 | 22 | include $(BUILD_PACKAGE) 23 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_mlipay_default.te: -------------------------------------------------------------------------------- 1 | type hal_mlipay_default, domain; 2 | hal_server_domain(hal_mlipay_default, hal_mlipay) 3 | 4 | type hal_mlipay_default_exec, exec_type, vendor_file_type, file_type; 5 | 6 | init_daemon_domain(hal_mlipay_default) 7 | 8 | allow hal_mlipay_default ion_device:chr_file rw_file_perms; 9 | allow hal_mlipay_default tee_device:chr_file rw_file_perms; 10 | r_dir_file(hal_mlipay_default, firmware_file) 11 | 12 | get_prop(hal_mlipay_default, vendor_fp_prop) 13 | set_prop(hal_mlipay_default, vendor_tee_listener_prop) 14 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IIFAAService.aidl: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | interface IIFAAService { 4 | byte[] processCmd_v2(in byte[] param); 5 | int[] getIDList(int bioType); 6 | int faceEnroll(String sessionId, int flags); 7 | int faceUpgrade(int action, String path, int offset, in byte[] data, int data_len); 8 | int faceAuthenticate_v2(String sessionId, int flags); 9 | int faceCancel_v2(String sessionId); 10 | byte[] faceInvokeCommand(in byte[] param); 11 | int faceGetCellinfo(); 12 | } 13 | -------------------------------------------------------------------------------- /sepolicy/private/pocketmode_app.te: -------------------------------------------------------------------------------- 1 | type pocketmode_app, domain; 2 | 3 | app_domain(pocketmode_app) 4 | 5 | # Allow pocketmode_app to find app_api_service 6 | allow pocketmode_app app_api_service:service_manager find; 7 | 8 | # Allow pocketmode_app read and write /data/data subdirectory 9 | allow pocketmode_app system_app_data_file:dir create_dir_perms; 10 | allow pocketmode_app system_app_data_file:{ file lnk_file } create_file_perms; 11 | 12 | # Allow pocketmode_app to write to sysfs fingerprint nodes 13 | allow pocketmode_app sysfs_fingerprint:file { w_file_perms getattr }; 14 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_camera_default.te: -------------------------------------------------------------------------------- 1 | allow hal_camera_default gpu_device:chr_file rw_file_perms; 2 | 3 | allow hal_camera_default remosaic_daemon_service:service_manager find; 4 | 5 | allow hal_camera_default sysfs_kgsl:dir search; 6 | allow hal_camera_default sysfs_kgsl:file r_file_perms; 7 | 8 | allow hal_camera_default sysfs_leds:dir r_dir_perms; 9 | allow hal_camera_default sysfs_leds:file rw_file_perms; 10 | allow hal_camera_default sysfs_leds:lnk_file read; 11 | 12 | allow hal_camera_default sysfs_thermal:file write; 13 | 14 | r_dir_file(hal_camera_default, persist_camera_file) 15 | -------------------------------------------------------------------------------- /sepolicy/private/thermalcontroller_app.te: -------------------------------------------------------------------------------- 1 | type thermalcontroller_app, domain; 2 | 3 | app_domain(thermalcontroller_app) 4 | 5 | # Allow thermalcontroller_app to find app_api_service 6 | allow thermalcontroller_app app_api_service:service_manager find; 7 | 8 | # Allow thermalcontroller_app read and write /data/data subdirectory 9 | allow thermalcontroller_app system_app_data_file:dir create_dir_perms; 10 | allow thermalcontroller_app system_app_data_file:{ file lnk_file } create_file_perms; 11 | 12 | # Allow thermalcontroller_app to write to sysfs thermal nodes 13 | allow thermalcontroller_app sysfs_thermal:file { w_file_perms getattr }; 14 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_headphone.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManagerV3.java: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | public abstract class IFAAManagerV3 extends IFAAManagerV2 { 4 | public static final String KEY_FINGERPRINT_FULLVIEW = "org.ifaa.ext.key.CUSTOM_VIEW"; 5 | public static final String KEY_GET_SENSOR_LOCATION = "org.ifaa.ext.key.GET_SENSOR_LOCATION"; 6 | public static final String VALUE_FINGERPRINT_DISABLE = "disable"; 7 | public static final String VLAUE_FINGERPRINT_ENABLE = "enable"; 8 | 9 | public abstract String getExtInfo(int authType, String keyExtInfo); 10 | 11 | public abstract void setExtInfo(int authType, String keyExtInfo, String valExtInfo); 12 | } 13 | -------------------------------------------------------------------------------- /parts/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2017-2019 The LineageOS Project 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | LOCAL_PATH := $(call my-dir) 8 | 9 | include $(CLEAR_VARS) 10 | 11 | LOCAL_MODULE_TAGS := optional 12 | 13 | LOCAL_SRC_FILES := $(call all-java-files-under, src) 14 | 15 | LOCAL_PACKAGE_NAME := XiaomiParts 16 | LOCAL_CERTIFICATE := platform 17 | LOCAL_PRIVATE_PLATFORM_APIS := true 18 | LOCAL_PRIVILEGED_MODULE := true 19 | 20 | LOCAL_USE_AAPT2 := true 21 | 22 | LOCAL_STATIC_ANDROID_LIBRARIES := \ 23 | androidx.core_core \ 24 | androidx.preference_preference 25 | 26 | LOCAL_RESOURCE_DIR := \ 27 | $(LOCAL_PATH)/res \ 28 | $(TOP)/packages/resources/devicesettings/res 29 | 30 | LOCAL_PROGUARD_FLAG_FILES := proguard.flags 31 | 32 | include $(BUILD_PACKAGE) 33 | -------------------------------------------------------------------------------- /sepolicy/vendor/glgps.te: -------------------------------------------------------------------------------- 1 | type glgps, domain; 2 | type glgps_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(glgps) 5 | net_domain(glgps) 6 | 7 | allow glgps fwk_sensor_hwservice:hwservice_manager find; 8 | 9 | allow glgps gps_data_file:dir create_dir_perms; 10 | allow glgps gps_data_file:fifo_file create_file_perms; 11 | allow glgps gps_data_file:file create_file_perms; 12 | allow glgps gps_data_file:lnk_file create_file_perms; 13 | allow glgps gps_data_file:sock_file create_file_perms; 14 | 15 | allow glgps gps_device:chr_file rw_file_perms; 16 | 17 | allow glgps self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; 18 | allow glgps gps_socket:sock_file create_file_perms; 19 | 20 | binder_call(glgps, system_server) 21 | 22 | typeattribute glgps halclientdomain; 23 | 24 | wakelock_use(glgps) 25 | -------------------------------------------------------------------------------- /configs/public.libraries.txt: -------------------------------------------------------------------------------- 1 | libqti-perfd-client.so 2 | libadsprpc.so 3 | libcdsprpc.so 4 | libsdsprpc.so 5 | libqvrservice_client.so 6 | libtzcom.so 7 | libfastcvopt.so 8 | liblistenjni.so 9 | liblistensoundmodel2.so 10 | libOpenCL.so 11 | libmpbase.so 12 | libmialgoengine.so 13 | libVDClearShot.so 14 | libVDDualCameraClearShot.so 15 | libHalSuperSensorServer.so 16 | libSuperSensor.so 17 | libSuperSensorCPU.so 18 | libSuperSensor_skel.so 19 | libarcsoft_beautyshot.so 20 | libarcsoft_dualcam_refocus.so 21 | libarcsoft_dualcam_refocus_rear_t.so 22 | libarcsoft_dualcam_refocus_rear_w.so 23 | libarcsoft_dualcam_refocus_front.so 24 | libarcsoft_portrait_lighting.so 25 | libarcsoft_portrait_lighting_c.so 26 | libarcsoft_high_dynamic_range.so 27 | libarcsoft_low_light_hdr.so 28 | libarcsoft_supernight.so 29 | libmisegment_front_845.so 30 | libalCFR.so 31 | libbeauty.so 32 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_pickup.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ThermalController/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | Thermal Controller 19 | 20 | -------------------------------------------------------------------------------- /sepolicy/vendor/genfs_contexts: -------------------------------------------------------------------------------- 1 | genfscon proc /tp_fw_version u:object_r:proc_tp:s0 2 | genfscon proc /tp_lockdown_info u:object_r:proc_tp:s0 3 | 4 | genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pmi8998@3:qcom,leds@d000/leds/white u:object_r:sysfs_graphics:s0 5 | genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc/device_prepare u:object_r:sysfs_fingerprint:s0 6 | genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc/fingerdown_wait u:object_r:sysfs_fingerprint:s0 7 | genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc/irq u:object_r:sysfs_fingerprint:s0 8 | genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc/wakeup_enable u:object_r:sysfs_fingerprint:s0 9 | genfscon sysfs /devices/platform/soc/soc:fingerprint_goodix/proximity_state u:object_r:sysfs_fingerprint:s0 10 | -------------------------------------------------------------------------------- /parts/res/color/switchbar_switch_thumb_tint.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sepolicy/vendor/hal_fingerprint_default.te: -------------------------------------------------------------------------------- 1 | allow hal_fingerprint_default fingerprint_device:chr_file rw_file_perms; 2 | allow hal_fingerprint_default fingerprint_data_file:dir create_dir_perms; 3 | allow hal_fingerprint_default fingerprint_data_file:file create_file_perms; 4 | allow hal_fingerprint_default self:netlink_socket create_socket_perms_no_ioctl; 5 | allow hal_fingerprint_default sysfs_graphics:dir search; 6 | allow hal_fingerprint_default sysfs_graphics:file read; 7 | allow hal_fingerprint_default sysfs_fingerprint:file rw_file_perms; 8 | allow hal_fingerprint_default tee_device:chr_file rw_file_perms; 9 | allow hal_fingerprint_default uhid_device:chr_file rw_file_perms; 10 | 11 | set_prop(hal_fingerprint_default, vendor_fp_prop) 12 | hal_client_domain(hal_fingerprint_default, hal_perf) 13 | 14 | # Ignore all logging requests 15 | dontaudit hal_fingerprint storage_file:dir search; 16 | -------------------------------------------------------------------------------- /parts/res/color/switchbar_switch_track_tint.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /overlay/packages/apps/Settings/res/values/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | true 17 | 18 | -------------------------------------------------------------------------------- /vndk/vndk-sp-libs.mk: -------------------------------------------------------------------------------- 1 | VNDK_SP_LIBRARIES := \ 2 | android.hardware.graphics.allocator@2.0 \ 3 | android.hardware.graphics.mapper@2.0 \ 4 | android.hardware.graphics.mapper@2.1 \ 5 | android.hardware.graphics.common@1.0 \ 6 | android.hardware.graphics.common@1.1 \ 7 | android.hardware.renderscript@1.0 \ 8 | android.hidl.base@1.0 \ 9 | android.hidl.memory@1.0 \ 10 | libRSCpuRef \ 11 | libRSDriver \ 12 | libRS_internal \ 13 | libbacktrace \ 14 | libbase \ 15 | libbcinfo \ 16 | libblas \ 17 | libc++ \ 18 | libcompiler_rt \ 19 | libcutils \ 20 | libft2 \ 21 | libhardware \ 22 | libhidlbase \ 23 | libhidlmemory \ 24 | libhidltransport \ 25 | libhwbinder \ 26 | libion \ 27 | liblzma \ 28 | libpng \ 29 | libunwind \ 30 | libunwindstack \ 31 | libutils \ 32 | libutilscallstack \ 33 | libdexfile 34 | -------------------------------------------------------------------------------- /parts/res/drawable/switchbar_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/Android.bp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 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 | java_library { 18 | name: "org.ifaa.android.manager", 19 | installable: true, 20 | srcs: [ 21 | "src/**/*.java", 22 | "src/**/I*.aidl", 23 | ], 24 | aidl: { 25 | local_include_dirs: ["src"], 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_hand.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /overlay-aosip/packages/apps/Dialer/java/com/android/dialer/callrecord/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | true 19 | 4 20 | 21 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | true 22 | 23 | -------------------------------------------------------------------------------- /overlay-aosip/packages/apps/Settings/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | org.lineageos.settings/org.lineageos.settings.doze.DozeSettingsActivity 20 | 21 | -------------------------------------------------------------------------------- /parts/res/color/switch_bar_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /overlay/frameworks/base/core/res/res/values-mcc302-mnc370/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | %s 24 | %s Wi-Fi 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /overlay/frameworks/base/core/res/res/values-mcc302-mnc720/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | %s 24 | %s Wi-Fi 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /parts/res/layout/dirac.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /parts/res/layout/doze.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /light/android.hardware.light@2.0-service.xiaomi_sdm845.rc: -------------------------------------------------------------------------------- 1 | on boot 2 | chown system system /sys/class/leds/white/brightness 3 | 4 | chown system system /sys/class/leds/white/blink 5 | chown system system /sys/class/leds/white/duty_pcts 6 | chown system system /sys/class/leds/white/pause_hi 7 | chown system system /sys/class/leds/white/pause_lo 8 | chown system system /sys/class/leds/white/ramp_step_ms 9 | chown system system /sys/class/leds/white/start_idx 10 | 11 | chmod 660 /sys/class/leds/white/blink 12 | chmod 660 /sys/class/leds/white/duty_pcts 13 | chmod 660 /sys/class/leds/white/pause_hi 14 | chmod 660 /sys/class/leds/white/pause_lo 15 | chmod 660 /sys/class/leds/white/ramp_step_ms 16 | chmod 660 /sys/class/leds/white/start_idx 17 | 18 | service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.xiaomi_sdm845 19 | interface android.hardware.light@2.0::ILight default 20 | class hal 21 | user system 22 | group system 23 | # shutting off lights while powering-off 24 | shutdown critical 25 | -------------------------------------------------------------------------------- /overlay/packages/apps/Settings/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 23 | 24 | 0 25 | -1 26 | -1 27 | 28 | 29 | -------------------------------------------------------------------------------- /parts/res/drawable/ic_pocket.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /overlay-aosip/frameworks/base/core/res/res/values/aosip_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | true 19 | 20 | 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /sepolicy/vendor/property_contexts: -------------------------------------------------------------------------------- 1 | # Camera 2 | camera. u:object_r:camera_prop:s0 3 | persist.camera. u:object_r:camera_prop:s0 4 | persist.vendor.camera. u:object_r:camera_prop:s0 5 | vendor.camera. u:object_r:camera_prop:s0 6 | vidhance. u:object_r:camera_prop:s0 7 | 8 | # Display post processing 9 | init.svc.ppd u:object_r:vendor_dpps_prop:s0 10 | ro.vendor.display.ad u:object_r:vendor_dpps_prop:s0 11 | ro.vendor.display.ad.sdr_calib_data u:object_r:vendor_dpps_prop:s0 12 | ro.vendor.display.ad.hdr_calib_data u:object_r:vendor_dpps_prop:s0 13 | ro.vendor.display.sensortype u:object_r:vendor_dpps_prop:s0 14 | 15 | # Fingerprint 16 | persist.vendor.sys.fp. u:object_r:vendor_fp_prop:s0 17 | ro.boot.fpsensor u:object_r:vendor_fp_prop:s0 18 | ro.hardware.fp u:object_r:vendor_fp_prop:s0 19 | vendor.fps_hal. u:object_r:vendor_fp_prop:s0 20 | 21 | # Mlipay 22 | persist.vendor.sys.pay.ifaa u:object_r:vendor_tee_listener_prop:s0 23 | 24 | # Thermal 25 | sys.thermal. u:object_r:thermal_engine_prop:s0 26 | -------------------------------------------------------------------------------- /light/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The LineageOS Project 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | cc_binary { 16 | relative_install_path: "hw", 17 | defaults: ["hidl_defaults"], 18 | name: "android.hardware.light@2.0-service.xiaomi_sdm845", 19 | init_rc: ["android.hardware.light@2.0-service.xiaomi_sdm845.rc"], 20 | srcs: ["service.cpp", "Light.cpp"], 21 | vendor: true, 22 | shared_libs: [ 23 | "android.hardware.light@2.0", 24 | "libbase", 25 | "libhardware", 26 | "libhidlbase", 27 | "libhidltransport", 28 | "libhwbinder", 29 | "liblog", 30 | "libutils", 31 | ], 32 | } 33 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/dirac/DiracActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 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 org.lineageos.settings.dirac; 18 | 19 | import android.os.Bundle; 20 | import android.preference.PreferenceActivity; 21 | 22 | public class DiracActivity extends PreferenceActivity { 23 | 24 | private static final String TAG_DIRAC = "dirac"; 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | 30 | getFragmentManager().beginTransaction().replace(android.R.id.content, 31 | new DiracSettingsFragment(), TAG_DIRAC).commit(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /power/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | ifneq ($(TARGET_TAP_TO_WAKE_NODE),) 6 | LOCAL_CFLAGS += -DTAP_TO_WAKE_NODE=\"$(TARGET_TAP_TO_WAKE_NODE)\" 7 | endif 8 | 9 | LOCAL_MODULE := android.hardware.power@1.2-service.xiaomi_sdm845 10 | LOCAL_INIT_RC := android.hardware.power@1.2-service.xiaomi_sdm845.rc 11 | LOCAL_MODULE_RELATIVE_PATH := hw 12 | LOCAL_MODULE_TAGS := optional 13 | 14 | LOCAL_VENDOR_MODULE := true 15 | 16 | LOCAL_SRC_FILES := \ 17 | hint-data.c \ 18 | list.c \ 19 | metadata-parser.c \ 20 | power-845.c \ 21 | power-common.c \ 22 | powerhintparser.c \ 23 | Power.cpp \ 24 | service.cpp \ 25 | utils.c 26 | 27 | LOCAL_C_INCLUDES := external/libxml2/include \ 28 | external/icu/icu4c/source/common 29 | 30 | LOCAL_SHARED_LIBRARIES := \ 31 | android.hardware.power@1.2 \ 32 | libbase \ 33 | libcutils \ 34 | libdl \ 35 | libhidlbase \ 36 | libhidltransport \ 37 | liblog \ 38 | libutils \ 39 | libxml2 40 | 41 | LOCAL_HEADER_LIBRARIES := generated_kernel_headers 42 | LOCAL_HEADER_LIBRARIES += libutils_headers 43 | LOCAL_HEADER_LIBRARIES += libhardware_headers 44 | 45 | LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter 46 | LOCAL_CFLAGS += -DINTERACTION_BOOST 47 | 48 | include $(BUILD_EXECUTABLE) 49 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/doze/DozeSettingsActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2016 The CyanogenMod Project 3 | * 2017 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 org.lineageos.settings.doze; 19 | 20 | import android.os.Bundle; 21 | import android.preference.PreferenceActivity; 22 | 23 | public class DozeSettingsActivity extends PreferenceActivity { 24 | 25 | private static final String TAG_DOZE = "doze"; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | 31 | getFragmentManager().beginTransaction().replace(android.R.id.content, 32 | new DozeSettingsFragment(), TAG_DOZE).commit(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pocketmode/src/org/lineageos/pocketmode/BootCompletedReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The CyanogenMod Project 3 | * 2017 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 org.lineageos.pocketmode; 19 | 20 | import android.content.BroadcastReceiver; 21 | import android.content.Context; 22 | import android.content.Intent; 23 | import android.os.UserHandle; 24 | import android.util.Log; 25 | 26 | public class BootCompletedReceiver extends BroadcastReceiver { 27 | 28 | private static final String TAG = "XiaomiPocketMode"; 29 | 30 | @Override 31 | public void onReceive(Context context, Intent intent) { 32 | Log.d(TAG, "Starting"); 33 | context.startServiceAsUser(new Intent(context, PocketModeService.class), 34 | UserHandle.CURRENT); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | true 25 | 26 | 27 | 6 28 | 7 29 | 30 | 31 | true 32 | 33 | 34 | -------------------------------------------------------------------------------- /setup-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2018-2019 The LineageOS Project 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | 8 | set -e 9 | 10 | INITIAL_COPYRIGHT_YEAR=2018 11 | 12 | # Load extract_utils and do some sanity checks 13 | MY_DIR="${BASH_SOURCE%/*}" 14 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi 15 | 16 | LINEAGE_ROOT="${MY_DIR}/../../.." 17 | 18 | HELPER="${LINEAGE_ROOT}/vendor/aosip/build/tools/extract_utils.sh" 19 | if [ ! -f "${HELPER}" ]; then 20 | echo "Unable to find helper script at ${HELPER}" 21 | exit 1 22 | fi 23 | source "${HELPER}" 24 | 25 | # Initialize the helper for common 26 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true 27 | 28 | # Copyright headers and guards 29 | write_headers "beryllium dipper equuleus perseus polaris ursa" 30 | 31 | # The standard common blobs 32 | write_makefiles "${MY_DIR}/proprietary-files.txt" true 33 | 34 | # Finish 35 | write_footers 36 | 37 | if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then 38 | # Reinitialize the helper for device 39 | INITIAL_COPYRIGHT_YEAR="$DEVICE_BRINGUP_YEAR" 40 | setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false 41 | 42 | # Copyright headers and guards 43 | write_headers 44 | 45 | # The standard device blobs 46 | write_makefiles "${MY_DIR}/../${DEVICE}/proprietary-files.txt" true 47 | 48 | # Finish 49 | write_footers 50 | fi 51 | -------------------------------------------------------------------------------- /overlay/packages/apps/Settings/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 20 | true 21 | 22 | 24 | true 25 | 26 | 27 | org.lineageos.settings/org.lineageos.settings.doze.DozeSettingsActivity 28 | 29 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/BootCompletedReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The CyanogenMod Project 3 | * 2017-2019 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 org.lineageos.settings; 19 | 20 | import android.content.BroadcastReceiver; 21 | import android.content.Context; 22 | import android.content.Intent; 23 | import android.util.Log; 24 | 25 | import org.lineageos.settings.dirac.DiracUtils; 26 | import org.lineageos.settings.doze.DozeUtils; 27 | 28 | public class BootCompletedReceiver extends BroadcastReceiver { 29 | 30 | private static final boolean DEBUG = false; 31 | private static final String TAG = "XiaomiParts"; 32 | 33 | @Override 34 | public void onReceive(final Context context, Intent intent) { 35 | if (DEBUG) Log.d(TAG, "Received boot completed intent"); 36 | DiracUtils.initialize(); 37 | DozeUtils.checkDozeService(context); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sepolicy/vendor/hwservice_contexts: -------------------------------------------------------------------------------- 1 | com.fingerprints.extension::IFingerprintEngineering u:object_r:hal_fingerprint_hwservice:s0 2 | com.fingerprints.extension::IFingerprintSensorTest u:object_r:hal_fingerprint_hwservice:s0 3 | com.fingerprints.extension::IFingerprintNavigation u:object_r:hal_fingerprint_hwservice:s0 4 | com.fingerprints.extension::IFingerprintCalibration u:object_r:hal_fingerprint_hwservice:s0 5 | com.fingerprints.extension::IFingerprintSenseTouch u:object_r:hal_fingerprint_hwservice:s0 6 | vendor.goodix.hardware.fingerprintextension::IGoodixBiometricsFingerprint u:object_r:hal_fingerprint_hwservice:s0 7 | vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_fingerprint_hwservice:s0 8 | vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemonExt u:object_r:hal_fingerprint_hwservice:s0 9 | vendor.synaptics.fingerprints.interfaces.extensions::ISensorTest u:object_r:hal_fingerprint_hwservice:s0 10 | vendor.synaptics.fingerprints.interfaces.extensions::INavigation u:object_r:hal_fingerprint_hwservice:s0 11 | vendor.synaptics.fingerprints.interfaces.extensions::IFpCollection u:object_r:hal_fingerprint_hwservice:s0 12 | vendor.xiaomi.hardware.fingerprintextension::IXiaomiFingerprint u:object_r:hal_fingerprint_hwservice:s0 13 | 14 | vendor.xiaomi.hardware.mlipay::IMlipayService u:object_r:hal_mlipay_hwservice:s0 15 | -------------------------------------------------------------------------------- /parts/res/xml/dirac_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 27 | 28 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /vndk/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(BOARD_VNDK_VERSION),) 2 | $(warning ************* BOARD VNDK is not enabled - compiling vndk-sp ***************************) 3 | LOCAL_PATH := $(call my-dir) 4 | 5 | include $(LOCAL_PATH)/vndk-sp-libs.mk 6 | 7 | vndk_sp_dir := vndk-sp-$(PLATFORM_VNDK_VERSION) 8 | 9 | define define-vndk-sp-lib 10 | include $$(CLEAR_VARS) 11 | LOCAL_MODULE := $1.vndk-sp-gen 12 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 13 | LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so 14 | LOCAL_STRIP_MODULE := false 15 | LOCAL_MULTILIB := first 16 | LOCAL_MODULE_TAGS := optional 17 | LOCAL_INSTALLED_MODULE_STEM := $1.so 18 | LOCAL_MODULE_SUFFIX := .so 19 | LOCAL_MODULE_RELATIVE_PATH := $(vndk_sp_dir) 20 | include $$(BUILD_PREBUILT) 21 | 22 | ifneq ($$(TARGET_2ND_ARCH),) 23 | ifneq ($$(TARGET_TRANSLATE_2ND_ARCH),true) 24 | include $$(CLEAR_VARS) 25 | LOCAL_MODULE := $1.vndk-sp-gen 26 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 27 | LOCAL_PREBUILT_MODULE_FILE := $$($$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so 28 | LOCAL_STRIP_MODULE := false 29 | LOCAL_MULTILIB := 32 30 | LOCAL_MODULE_TAGS := optional 31 | LOCAL_INSTALLED_MODULE_STEM := $1.so 32 | LOCAL_MODULE_SUFFIX := .so 33 | LOCAL_MODULE_RELATIVE_PATH := $(vndk_sp_dir) 34 | include $$(BUILD_PREBUILT) 35 | endif # TARGET_TRANSLATE_2ND_ARCH is not true 36 | endif # TARGET_2ND_ARCH is not empty 37 | endef 38 | 39 | $(foreach lib,$(VNDK_SP_LIBRARIES),\ 40 | $(eval $(call define-vndk-sp-lib,$(lib)))) 41 | 42 | include $(CLEAR_VARS) 43 | LOCAL_MODULE := vndk-sp 44 | LOCAL_MODULE_TAGS := optional 45 | LOCAL_REQUIRED_MODULES := $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) 46 | include $(BUILD_PHONY_PACKAGE) 47 | 48 | vndk_sp_dir := 49 | endif 50 | -------------------------------------------------------------------------------- /keylayout/sdm845-tavil-snd-card_Button_Jack.kl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, The Linux Foundation. All rights reserved. 2 | # 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are 5 | # met: 6 | # * Redistributions of source code must retain the above copyright 7 | # notice, this list of conditions and the following disclaimer. 8 | # * Redistributions in binary form must reproduce the above 9 | # copyright notice, this list of conditions and the following 10 | # disclaimer in the documentation and/or other materials provided 11 | # with the distribution. 12 | # * Neither the name of The Linux Foundation nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | key 226 HEADSETHOOK 29 | key 257 VOLUME_UP 30 | key 258 VOLUME_DOWN 31 | -------------------------------------------------------------------------------- /libhidl/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2017 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 | include $(CLEAR_VARS) 17 | LOCAL_SHARED_LIBRARIES := libhidltransport 18 | LOCAL_MODULE := android.hidl.base@1.0 19 | LOCAL_MODULE_TAGS := optional 20 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 21 | LOCAL_VENDOR_MODULE := true 22 | include $(BUILD_SHARED_LIBRARY) 23 | 24 | include $(CLEAR_VARS) 25 | LOCAL_SHARED_LIBRARIES := libhidltransport 26 | LOCAL_MODULE := android.hidl.manager@1.0 27 | LOCAL_MODULE_TAGS := optional 28 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 29 | LOCAL_VENDOR_MODULE := true 30 | include $(BUILD_SHARED_LIBRARY) 31 | 32 | include $(CLEAR_VARS) 33 | LOCAL_SHARED_LIBRARIES := libhidltransport 34 | LOCAL_MODULE := android.hidl.base@1.0_system 35 | LOCAL_INSTALLED_MODULE_STEM := android.hidl.base@1.0.so 36 | LOCAL_MODULE_TAGS := optional 37 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 38 | include $(BUILD_SHARED_LIBRARY) 39 | 40 | include $(CLEAR_VARS) 41 | LOCAL_SHARED_LIBRARIES := libhidltransport 42 | LOCAL_MODULE := android.hidl.manager@1.0_system 43 | LOCAL_INSTALLED_MODULE_STEM := android.hidl.manager@1.0.so 44 | LOCAL_MODULE_TAGS := optional 45 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 46 | include $(BUILD_SHARED_LIBRARY) 47 | -------------------------------------------------------------------------------- /pocketmode/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 23 | 24 | 25 | 26 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /rootdir/etc/init.qti.qseecomd.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # Copyright (c) 2017, The Linux Foundation. All rights reserved. 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 | 32 | while [ "$registered" != "true" ] 33 | do 34 | sleep 0.1 35 | registered="`getprop vendor.sys.listeners.registered`" 36 | done 37 | -------------------------------------------------------------------------------- /extract-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2018-2019 The LineageOS Project 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | 8 | set -e 9 | 10 | # Load extract_utils and do some sanity checks 11 | MY_DIR="${BASH_SOURCE%/*}" 12 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi 13 | 14 | LINEAGE_ROOT="${MY_DIR}"/../../.. 15 | 16 | HELPER="${LINEAGE_ROOT}/vendor/aosip/build/tools/extract_utils.sh" 17 | if [ ! -f "${HELPER}" ]; then 18 | echo "Unable to find helper script at ${HELPER}" 19 | exit 1 20 | fi 21 | source "${HELPER}" 22 | 23 | # Default to sanitizing the vendor folder before extraction 24 | CLEAN_VENDOR=true 25 | 26 | SECTION= 27 | KANG= 28 | 29 | while [ "${#}" -gt 0 ]; do 30 | case "${1}" in 31 | -n | --no-cleanup ) 32 | CLEAN_VENDOR=false 33 | ;; 34 | -k | --kang ) 35 | KANG="--kang" 36 | ;; 37 | -s | --section ) 38 | SECTION="${2}"; shift 39 | CLEAN_VENDOR=false 40 | ;; 41 | * ) 42 | SRC="${1}" 43 | ;; 44 | esac 45 | shift 46 | done 47 | 48 | if [ -z "${SRC}" ]; then 49 | SRC="adb" 50 | fi 51 | 52 | # Initialize the helper for common device 53 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true "${CLEAN_VENDOR}" 54 | 55 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" \ 56 | "${KANG}" --section "${SECTION}" 57 | 58 | if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then 59 | # Reinitialize the helper for device 60 | source "${MY_DIR}/../${DEVICE}/extract-files.sh" 61 | setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false "${CLEAN_VENDOR}" 62 | 63 | extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" \ 64 | "${KANG}" --section "${SECTION}" 65 | fi 66 | 67 | "${MY_DIR}/setup-makefiles.sh" 68 | -------------------------------------------------------------------------------- /ThermalController/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 26 | 27 | 30 | 31 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /ThermalController/src/org/pixelexperience/thermalcontroller/Preferences.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The PixelExperience 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 org.pixelexperience.thermalcontroller; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | import android.text.TextUtils; 22 | import java.util.stream.IntStream; 23 | 24 | import static android.content.Context.MODE_PRIVATE; 25 | 26 | public class Preferences { 27 | private static String PREFS_NAME = "ThermalController_Settings"; 28 | public static void setProfileId(Context context, String packageName, int profileId){ 29 | if (TextUtils.isEmpty(packageName) || !IntStream.of(ThermalProfiles.supportedProfiles).anyMatch(x -> x == profileId)){ 30 | return; 31 | } 32 | SharedPreferences.Editor editor = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE).edit(); 33 | editor.putInt(packageName, profileId); 34 | editor.commit(); 35 | } 36 | public static int getProfileId(Context context, String packageName){ 37 | if (TextUtils.isEmpty(packageName)){ 38 | return ThermalProfiles.MODE_DEFAULT; 39 | } 40 | SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE); 41 | return prefs.getInt(packageName, ThermalProfiles.getDefaultProfileId(packageName)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManager.java: -------------------------------------------------------------------------------- 1 | package org.ifaa.android.manager; 2 | 3 | import android.content.Context; 4 | import android.os.Build.VERSION; 5 | import android.os.SystemProperties; 6 | 7 | public abstract class IFAAManager { 8 | private static final int IFAA_VERSION_V2 = 2; 9 | private static final int IFAA_VERSION_V3 = 3; 10 | private static final int IFAA_VERSION_V4 = 4; 11 | 12 | static int sIfaaVer; 13 | static boolean sIsFod = SystemProperties.getBoolean("ro.hardware.fp.fod", false); 14 | 15 | /** 16 | * 返回手机系统上支持的校验方式,目前IFAF协议1.0版本指纹为0x01、虹膜为0x02 17 | */ 18 | public abstract int getSupportBIOTypes(Context context); 19 | 20 | /** 21 | * 启动系统的指纹/虹膜管理应用界面,让用户进行指纹录入。指纹录入是在系统的指纹管理应用中实现的, 22 | * 本函数的作用只是将指纹管理应用运行起来,直接进行页面跳转,方便用户录入。 23 | * @param context 24 | * @param authType 生物特征识别类型,指纹为1,虹膜为2 25 | * @return 0,成功启动指纹管理应用;-1,启动指纹管理应用失败。 26 | */ 27 | public abstract int startBIOManager(Context context, int authType); 28 | 29 | /** 30 | * 通过ifaateeclient的so文件实现REE到TA的通道 31 | * @param context 32 | * @param param 用于传输到IFAA TA的数据buffer 33 | * @return IFAA TA返回给REE数据buffer 34 | */ 35 | public native byte[] processCmd(Context context, byte[] param); 36 | 37 | /** 38 | * 获取设备型号,同一款机型型号需要保持一致 39 | */ 40 | public abstract String getDeviceModel(); 41 | 42 | /** 43 | * 获取IFAAManager接口定义版本,目前为1 44 | */ 45 | public abstract int getVersion(); 46 | 47 | /** 48 | * load so to communicate from REE to TEE 49 | */ 50 | static { 51 | sIfaaVer = 1; 52 | 53 | if (VERSION.SDK_INT >= 28) { 54 | sIfaaVer = IFAA_VERSION_V4; 55 | } else if (sIsFod) { 56 | sIfaaVer = IFAA_VERSION_V3; 57 | } else if (VERSION.SDK_INT >= 24) { 58 | sIfaaVer = IFAA_VERSION_V2; 59 | } else { 60 | System.loadLibrary("teeclientjni"); //teeclientjni for TA test binary //ifaateeclient 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /parts/res/layout/switch_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 26 | 27 | 39 | 40 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /light/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 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 | #define LOG_TAG "android.hardware.light@2.0-service.xiaomi_sdm845" 18 | 19 | #include 20 | #include 21 | 22 | #include "Light.h" 23 | 24 | using android::hardware::configureRpcThreadpool; 25 | using android::hardware::joinRpcThreadpool; 26 | 27 | using android::hardware::light::V2_0::ILight; 28 | using android::hardware::light::V2_0::implementation::Light; 29 | 30 | using android::OK; 31 | using android::sp; 32 | using android::status_t; 33 | 34 | int main() { 35 | status_t status; 36 | sp service = nullptr; 37 | 38 | LOG(INFO) << "Light HAL service 2.0 is starting."; 39 | 40 | service = new Light(); 41 | if (service == nullptr) { 42 | LOG(ERROR) << "Can not create an instance of Light HAL Iface, exiting."; 43 | goto shutdown; 44 | } 45 | 46 | configureRpcThreadpool(1, true /*callerWillJoin*/); 47 | 48 | status = service->registerAsService(); 49 | if (status != OK) { 50 | LOG(ERROR) << "Could not register service for Light HAL Iface (" << status << ")"; 51 | goto shutdown; 52 | } 53 | 54 | LOG(INFO) << "Light HAL service is ready."; 55 | joinRpcThreadpool(); 56 | // Should not pass this line 57 | 58 | shutdown: 59 | // In normal operation, we don't expect the thread pool to exit 60 | LOG(ERROR) << "Light HAL service is shutting down."; 61 | return 1; 62 | } 63 | -------------------------------------------------------------------------------- /configs/system_properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /rootdir/etc/init.qcom.sensors.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # Copyright (c) 2015,2018 The Linux Foundation. All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of The Linux Foundation nor 13 | # the names of its contributors may be used to endorse or promote 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | # 31 | # Function to start sensors for SSC enabled platforms 32 | # 33 | start_sensors() 34 | { 35 | 36 | chmod -h 664 /persist/sensors/sensors_settings 37 | chown -h -R system.system /persist/sensors 38 | start vendor.sensors.qti 39 | 40 | # Only for SLPI 41 | if [ -c /dev/msm_dsps -o -c /dev/sensors ] ; then 42 | start vendor.sensors 43 | fi 44 | } 45 | 46 | start_sensors 47 | -------------------------------------------------------------------------------- /power/hint-data.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | 32 | #include "hint-data.h" 33 | 34 | int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint) { 35 | if (first_hint == other_hint) { 36 | return 0; 37 | } else if ((first_hint && other_hint) && (first_hint->hint_id == other_hint->hint_id)) { 38 | return 0; 39 | } else { 40 | return 1; 41 | } 42 | } 43 | 44 | void hint_dump(struct hint_data* hint) { 45 | ALOGI("hint_id: %lu", hint->hint_id); 46 | } 47 | -------------------------------------------------------------------------------- /power/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | struct list_node { 31 | struct list_node* next; 32 | void* data; 33 | int (*compare)(void* data1, void* data2); 34 | void (*dump)(void* data); 35 | }; 36 | 37 | int init_list_head(struct list_node* head); 38 | struct list_node* add_list_node(struct list_node* head, void* data); 39 | int remove_list_node(struct list_node* head, struct list_node* del_node); 40 | void dump_list(struct list_node* head); 41 | struct list_node* find_node(struct list_node* head, void* comparison_data); 42 | -------------------------------------------------------------------------------- /light/Light.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 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 | #ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 18 | #define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace android { 27 | namespace hardware { 28 | namespace light { 29 | namespace V2_0 { 30 | namespace implementation { 31 | 32 | using ::android::hardware::Return; 33 | using ::android::hardware::Void; 34 | using ::android::hardware::hidl_vec; 35 | using ::android::hardware::light::V2_0::ILight; 36 | using ::android::hardware::light::V2_0::LightState; 37 | using ::android::hardware::light::V2_0::Status; 38 | using ::android::hardware::light::V2_0::Type; 39 | 40 | class Light : public ILight { 41 | public: 42 | Light(); 43 | 44 | Return setLight(Type type, const LightState& state) override; 45 | Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; 46 | 47 | private: 48 | void handleBacklight(const LightState& state); 49 | void handleBattery(const LightState& state); 50 | void handleNotification(const LightState& state, size_t index); 51 | 52 | std::mutex mLock; 53 | std::unordered_map> mLights; 54 | std::array mLightStates; 55 | }; 56 | 57 | } // namespace implementation 58 | } // namespace V2_0 59 | } // namespace light 60 | } // namespace hardware 61 | } // namespace android 62 | 63 | #endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H 64 | -------------------------------------------------------------------------------- /power/powerhintparser.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #ifndef __POWERHINTPARSER__ 31 | #define __POWERHINTPARSER__ 32 | 33 | #define POWERHINT_XML "/vendor/etc/powerhint.xml" 34 | #define MAX_HINT 6 35 | #define MAX_PARAM 30 36 | 37 | typedef struct perflock_param_t { 38 | int type; 39 | int numParams; 40 | int paramList[MAX_PARAM]; // static limit on number of hints - 15 41 | } perflock_param_t; 42 | 43 | static perflock_param_t powerhint[MAX_HINT]; 44 | 45 | int parsePowerhintXML(); 46 | int* getPowerhint(int, int*); 47 | 48 | #endif /* __POWERHINTPARSER__ */ 49 | -------------------------------------------------------------------------------- /overlay/packages/apps/Bluetooth/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | true 34 | true 35 | false 36 | true 37 | 38 | -------------------------------------------------------------------------------- /permissions/privapp-permissions-qti.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ThermalController/src/org/pixelexperience/thermalcontroller/Receiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The PixelExperience 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 org.pixelexperience.thermalcontroller; 18 | 19 | import android.content.BroadcastReceiver; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.util.Log; 23 | import android.text.TextUtils; 24 | 25 | import com.android.internal.util.custom.thermal.ThermalController; 26 | 27 | public class Receiver extends BroadcastReceiver { 28 | private static final String TAG = "ThermalController:Receiver"; 29 | private static final boolean DEBUG = false; 30 | 31 | @Override 32 | public void onReceive(Context context, Intent intent) { 33 | if (intent.getAction() != null && intent.getAction().equals(ThermalController.ACTIVE_PACKAGE_CHANGED_ACTION)) { 34 | if (DEBUG) Log.d(TAG, "Received " + ThermalController.ACTIVE_PACKAGE_CHANGED_ACTION); 35 | if (intent.getExtras() != null) { 36 | String packageName = intent.getExtras().getString(ThermalController.ACTIVE_PACKAGE_CHANGED_EXTRA); 37 | int profile = 0; 38 | if (packageName != null && !TextUtils.isEmpty(packageName)) { 39 | if (DEBUG) Log.d(TAG, "Received " + packageName); 40 | profile = Preferences.getProfileId(context, packageName); 41 | if (packageName.equals("com.tencent.ig") && profile == ThermalProfiles.MODE_GAME) { 42 | profile = ThermalProfiles.MODE_PUBG; 43 | } 44 | } 45 | ThermalProfiles.writeProfile(profile); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/dirac/DiracUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 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 org.lineageos.settings.dirac; 18 | 19 | import android.content.Context; 20 | import android.content.Intent; 21 | import android.os.UserHandle; 22 | 23 | public final class DiracUtils { 24 | 25 | protected static DiracSound mDiracSound; 26 | private static boolean mInitialized; 27 | 28 | public static void initialize() { 29 | if (!mInitialized) { 30 | mInitialized = true; 31 | mDiracSound = new DiracSound(0, 0); 32 | mDiracSound.setMusic(mDiracSound.getMusic()); 33 | mDiracSound.setHeadsetType(mDiracSound.getHeadsetType()); 34 | setLevel(getLevel()); 35 | } 36 | } 37 | 38 | protected static void setMusic(boolean enable) { 39 | mDiracSound.setMusic(enable ? 1 : 0); 40 | } 41 | 42 | protected static boolean isDiracEnabled(Context context) { 43 | return mDiracSound.getMusic() == 1; 44 | } 45 | 46 | protected static void setLevel(String preset) { 47 | String[] level = preset.split("\\s*,\\s*"); 48 | 49 | for (int band = 0; band <= level.length - 1; band++) { 50 | mDiracSound.setLevel(band, Float.valueOf(level[band])); 51 | } 52 | } 53 | 54 | protected static String getLevel() { 55 | String selected = ""; 56 | for (int band = 0; band <= 6; band++) { 57 | int temp = (int) mDiracSound.getLevel(band); 58 | selected += String.valueOf(temp); 59 | if (band != 6) selected += ","; 60 | } 61 | return selected; 62 | } 63 | 64 | protected static void setHeadsetType(int paramInt) { 65 | mDiracSound.setHeadsetType(paramInt); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /overlay/frameworks/base/packages/SystemUI/res/drawable/ic_volte.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 20 | 24 | 28 | 31 | 35 | 39 | 42 | 43 | -------------------------------------------------------------------------------- /releasetools.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 The Android Open Source Project 2 | # Copyright (c) 2011, The Linux Foundation. All rights reserved. 3 | # Copyright (C) 2017-2019 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 | import re 18 | 19 | def FullOTA_InstallEnd(info): 20 | OTA_InstallEnd(info) 21 | return 22 | 23 | def IncrementalOTA_InstallEnd(info): 24 | OTA_InstallEnd(info) 25 | return 26 | 27 | def FullOTA_Assertions(info): 28 | AddModemAssertion(info, info.input_zip) 29 | return 30 | 31 | def IncrementalOTA_Assertions(info): 32 | AddModemAssertion(info, info.target_zip) 33 | return 34 | 35 | def AddImage(info, basename, dest): 36 | path = "IMAGES/" + basename 37 | if path not in info.input_zip.namelist(): 38 | return 39 | 40 | data = info.input_zip.read(path) 41 | common.ZipWriteStr(info.output_zip, basename, data) 42 | info.script.Print("Patching {} image unconditionally...".format(dest.split('/')[-1])) 43 | info.script.AppendExtra('package_extract_file("%s", "%s");' % (basename, dest)) 44 | 45 | def OTA_InstallEnd(info): 46 | AddImage(info, "dtbo.img", "/dev/block/bootdevice/by-name/dtbo") 47 | return 48 | 49 | def AddModemAssertion(info, input_zip): 50 | android_info = info.input_zip.read("OTA/android-info.txt") 51 | m = re.search(r'require\s+version-modem\s*=\s*(.+)', android_info) 52 | miui_version = re.search(r'require\s+version-miui\s*=\s*(.+)', android_info) 53 | if m and miui_version: 54 | timestamp = m.group(1).rstrip() 55 | firmware_version = miui_version.group(1).rstrip() 56 | if ((len(timestamp) and '*' not in timestamp) and \ 57 | (len(firmware_version) and '*' not in firmware_version)): 58 | cmd = 'assert(xiaomi.verify_modem("{}") == "1" || abort("ERROR: This package requires firmware from MIUI {} developer build or newer. Please upgrade firmware and retry!"););' 59 | info.script.AppendExtra(cmd.format(timestamp, firmware_version)) 60 | return 61 | -------------------------------------------------------------------------------- /parts/res/xml/doze_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 27 | 28 | 31 | 32 | 38 | 39 | 40 | 41 | 44 | 45 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /bluetooth/include/bdroid_buildcfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. 4 | * Not a Contribution, Apache license notifications and license are retained 5 | * for attribution purposes only. 6 | * 7 | * Copyright (C) 2012 The Android Open Source Project 8 | * Copyright (C) 2018-2019 The LineageOS Project 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifndef _BDROID_BUILDCFG_H 24 | #define _BDROID_BUILDCFG_H 25 | 26 | #pragma push_macro("PROPERTY_VALUE_MAX") 27 | 28 | #include 29 | #include 30 | 31 | #include "osi/include/osi.h" 32 | 33 | typedef struct { 34 | const char *product_device; 35 | const char *product_model; 36 | } device_t; 37 | 38 | static const device_t devices[] = { 39 | {"beryllium", "Pocophone F1"}, 40 | {"dipper", "Xiaomi Mi 8"}, 41 | {"equuleus", "Xiaomi Mi 8 Pro"}, 42 | {"perseus", "Xiaomi Mi MIX 3"}, 43 | {"polaris", "Xiaomi Mi MIX 2S"}, 44 | {"ursa", "Xiaomi Mi 8 Explorer Edition"}, 45 | }; 46 | 47 | static inline const char *BtmGetDefaultName() 48 | { 49 | char product_device[PROPERTY_VALUE_MAX]; 50 | property_get("ro.product.device", product_device, ""); 51 | 52 | for (unsigned int i = 0; i < ARRAY_SIZE(devices); i++) { 53 | device_t device = devices[i]; 54 | 55 | if (strcmp(device.product_device, product_device) == 0) { 56 | return device.product_model; 57 | } 58 | } 59 | 60 | // Fallback to ro.product.model 61 | return ""; 62 | } 63 | 64 | #define BTM_DEF_LOCAL_NAME BtmGetDefaultName() 65 | // Disables read remote device feature 66 | #define MAX_ACL_CONNECTIONS 16 67 | #define MAX_L2CAP_CHANNELS 16 68 | #define BLE_VND_INCLUDED TRUE 69 | // Skips conn update at conn completion 70 | #define BT_CLEAN_TURN_ON_DISABLED 1 71 | // Increasing SEPs to 12 from 6 to support SHO/MCast i.e. two streams per codec 72 | #define AVDT_NUM_SEPS 12 73 | 74 | #pragma pop_macro("PROPERTY_VALUE_MAX") 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /power/metadata-defs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are 5 | * met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above 9 | * copyright notice, this list of conditions and the following 10 | * disclaimer in the documentation and/or other materials provided 11 | * with the distribution. 12 | * * Neither the name of The Linux Foundation nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | #define ATTRIBUTE_VALUE_DELIM ('=') 31 | #define ATTRIBUTE_STRING_DELIM (";") 32 | 33 | #define METADATA_PARSING_ERR (-1) 34 | #define METADATA_PARSING_CONTINUE (0) 35 | #define METADATA_PARSING_DONE (1) 36 | 37 | #define MIN(x, y) (((x) > (y)) ? (y) : (x)) 38 | 39 | struct video_encode_metadata_t { 40 | int hint_id; 41 | int state; 42 | }; 43 | 44 | struct video_decode_metadata_t { 45 | int hint_id; 46 | int state; 47 | }; 48 | 49 | int parse_metadata(char* metadata, char** metadata_saveptr, char* attribute, 50 | unsigned int attribute_size, char* value, unsigned int value_size); 51 | int parse_video_encode_metadata(char* metadata, 52 | struct video_encode_metadata_t* video_encode_metadata); 53 | int parse_video_decode_metadata(char* metadata, 54 | struct video_decode_metadata_t* video_decode_metadata); 55 | -------------------------------------------------------------------------------- /overlay/packages/services/Telephony/res/xml/telephony_injection.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 27 | 29 | 30 | 33 | 34 | 35 | com.android.internal.telephony.ServiceStateTracker 36 | com.android.internal.telephony.SubscriptionController 37 | com.android.internal.telephony.SubscriptionInfoUpdater 38 | com.android.internal.telephony.GsmCdmaPhone 39 | com.android.internal.telephony.PhoneSwitcher 40 | com.android.internal.telephony.dataconnection.DcTracker 41 | com.android.internal.telephony.RIL 42 | com.android.internal.telephony.TelephonyComponentFactory 43 | com.android.internal.telephony.MultiSimSettingController 44 | 45 | 46 | -------------------------------------------------------------------------------- /power/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013,2015-2017, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | 32 | int sysfs_read(char* path, char* s, int num_bytes); 33 | int sysfs_write(char* path, char* s); 34 | int get_scaling_governor(char governor[], int size); 35 | int get_scaling_governor_check_cores(char governor[], int size, int core_num); 36 | int is_interactive_governor(char*); 37 | 38 | void vote_ondemand_io_busy_off(); 39 | void unvote_ondemand_io_busy_off(); 40 | void vote_ondemand_sdf_low(); 41 | void unvote_ondemand_sdf_low(); 42 | void perform_hint_action(int hint_id, int resource_values[], int num_resources); 43 | void undo_hint_action(int hint_id); 44 | void release_request(int lock_handle); 45 | int interaction_with_handle(int lock_handle, int duration, int num_args, int opt_list[]); 46 | int perf_hint_enable(int hint_id, int duration); 47 | int perf_hint_enable_with_type(int hint_id, int duration, int type); 48 | 49 | long long calc_timespan_us(struct timespec start, struct timespec end); 50 | -------------------------------------------------------------------------------- /rootdir/etc/init.qcom.post_boot.sh: -------------------------------------------------------------------------------- 1 | #! /vendor/bin/sh 2 | 3 | # Copyright (c) 2012-2013, 2016-2018, The Linux Foundation. All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of The Linux Foundation nor 13 | # the names of its contributors may be used to endorse or promote 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | # Let kernel know our image version/variant/crm_version 31 | if [ -f /sys/devices/soc0/select_image ]; then 32 | image_version="10:" 33 | image_version+=`getprop ro.build.id` 34 | image_version+=":" 35 | image_version+=`getprop ro.build.version.incremental` 36 | image_variant=`getprop ro.product.name` 37 | image_variant+="-" 38 | image_variant+=`getprop ro.build.type` 39 | oem_version=`getprop ro.build.version.codename` 40 | echo 10 > /sys/devices/soc0/select_image 41 | echo $image_version > /sys/devices/soc0/image_version 42 | echo $image_variant > /sys/devices/soc0/image_variant 43 | echo $oem_version > /sys/devices/soc0/image_crm_version 44 | fi 45 | 46 | # Parse misc partition path and set property 47 | misc_link=$(ls -l /dev/block/bootdevice/by-name/misc) 48 | real_path=${misc_link##*>} 49 | setprop persist.vendor.mmi.misc_dev_path $real_path 50 | -------------------------------------------------------------------------------- /config.fs: -------------------------------------------------------------------------------- 1 | [AID_VENDOR_QTI_DIAG] 2 | value:2901 3 | 4 | [AID_VENDOR_QDSS] 5 | value:2902 6 | 7 | [AID_VENDOR_RFS] 8 | value:2903 9 | 10 | [AID_VENDOR_RFS_SHARED] 11 | value:2904 12 | 13 | [AID_VENDOR_ADPL_ODL] 14 | value:2905 15 | 16 | [AID_VENDOR_QRTR] 17 | value:2906 18 | 19 | [vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti] 20 | mode: 0755 21 | user: AID_BLUETOOTH 22 | group: AID_BLUETOOTH 23 | caps: BLOCK_SUSPEND NET_ADMIN 24 | 25 | [vendor/bin/pm-service] 26 | mode: 0755 27 | user: AID_SYSTEM 28 | group: AID_SYSTEM 29 | caps: NET_BIND_SERVICE 30 | 31 | [vendor/bin/pd-mapper] 32 | mode: 0755 33 | user: AID_SYSTEM 34 | group: AID_SYSTEM 35 | caps: NET_BIND_SERVICE 36 | 37 | [vendor/bin/imsdatadaemon] 38 | mode: 0755 39 | user: AID_RADIO 40 | group: AID_RADIO 41 | caps: NET_BIND_SERVICE 42 | 43 | [vendor/bin/ims_rtp_daemon] 44 | mode: 0755 45 | user: AID_RADIO 46 | group: AID_RADIO 47 | caps: NET_BIND_SERVICE 48 | 49 | [vendor/bin/imsrcsd] 50 | mode: 0755 51 | user: AID_RADIO 52 | group: AID_RADIO 53 | caps: WAKE_ALARM 54 | 55 | [vendor/bin/cnd] 56 | mode: 0755 57 | user: AID_SYSTEM 58 | group: AID_SYSTEM 59 | caps: NET_BIND_SERVICE BLOCK_SUSPEND NET_ADMIN 60 | 61 | [vendor/bin/slim_daemon] 62 | mode: 0755 63 | user: AID_GPS 64 | group: AID_GPS 65 | caps: NET_BIND_SERVICE 66 | 67 | [vendor/bin/loc_launcher] 68 | mode: 0755 69 | user: AID_GPS 70 | group: AID_GPS 71 | caps: SETUID SETGID 72 | 73 | [vendor/bin/xtwifi-client] 74 | mode: 0755 75 | user: AID_GPS 76 | group: AID_GPS 77 | caps: NET_BIND_SERVICE BLOCK_SUSPEND WAKE_ALARM 78 | 79 | [vendor/bin/sensors.qti] 80 | mode: 0755 81 | user: AID_SYSTEM 82 | group: AID_SYSTEM 83 | caps: NET_BIND_SERVICE 84 | 85 | [vendor/bin/glgps] 86 | mode: 0755 87 | user: AID_GPS 88 | group: AID_SYSTEM 89 | caps: BLOCK_SUSPEND 90 | 91 | [vendor/bin/ignss_1_1] 92 | mode: 0755 93 | user: AID_GPS 94 | group: AID_SYSTEM 95 | caps: BLOCK_SUSPEND 96 | 97 | [vendor/bin/lhd] 98 | mode: 0755 99 | user: AID_GPS 100 | group: AID_SYSTEM 101 | caps: BLOCK_SUSPEND 102 | 103 | [firmware/] 104 | mode: 0771 105 | user: AID_SYSTEM 106 | group: AID_SYSTEM 107 | caps: 0 108 | 109 | [firmware/image/*] 110 | mode: 0771 111 | user: AID_SYSTEM 112 | group: AID_SYSTEM 113 | caps: 0 114 | 115 | [vendor/firmware_mnt/image/*] 116 | mode: 0771 117 | user: AID_SYSTEM 118 | group: AID_SYSTEM 119 | caps: 0 120 | 121 | [bt_firmware/] 122 | mode: 0771 123 | user: AID_SYSTEM 124 | group: AID_SYSTEM 125 | caps: 0 126 | 127 | [persist/] 128 | mode: 0771 129 | user: AID_SYSTEM 130 | group: AID_SYSTEM 131 | caps: 0 132 | 133 | [dsp/] 134 | mode: 0771 135 | user: AID_MEDIA 136 | group: AID_MEDIA 137 | caps: 0 138 | -------------------------------------------------------------------------------- /fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sdm845.rc: -------------------------------------------------------------------------------- 1 | on init 2 | # Goodix fingerprint 3 | chown system system /dev/goodix_fp 4 | 5 | # Synaptics fingerpint 6 | chown system system /dev/vfsspi 7 | 8 | on boot 9 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq 10 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable 11 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable 12 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset 13 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare 14 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait 15 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor 16 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/regulator_enable 17 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/screen_status 18 | chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vreg_op_cnt 19 | 20 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/irq 21 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable 22 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset 23 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare 24 | chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/vendor 25 | chmod 0660 /sys/bus/platform/devices/soc:fingerprint_fpc/regulator_enable 26 | chmod 0660 /sys/bus/platform/devices/soc:fingerprint_fpc/screen_status 27 | chmod 0660 /sys/bus/platform/devices/soc:fingerprint_fpc/vreg_op_cnt 28 | 29 | chown system system /sys/devices/platform/soc/soc:fingerprint_goodix/proximity_state 30 | 31 | chmod 0666 /dev/input/event2 32 | 33 | on post-fs-data 34 | mkdir /data/vendor/fpc 0770 system system 35 | mkdir /data/vendor/goodix 0770 system system 36 | mkdir /data/vendor/goodix/gf_data/authenticate 0770 system system 37 | mkdir /data/vendor/goodix/gf_data/enroll 0770 system system 38 | mkdir /data/vendor/syna 0770 system system 39 | mkdir /data/vendor/syna/ist/ 0770 system system 40 | chown system system /data/vendor 41 | chgrp system system /data/vendor 42 | 43 | service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sdm845 44 | # "class hal" causes a race condition on some devices due to files created 45 | # in /data. As a workaround, postpone startup until later in boot once 46 | # /data is mounted. 47 | class late_start 48 | user system 49 | group system input uhid 50 | writepid /dev/cpuset/system-background/tasks 51 | 52 | on property:vendor.fps_hal.restartimes=max 53 | stop vendor.fps_hal 54 | -------------------------------------------------------------------------------- /parts/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 53 | 55 | 56 | 57 | 59 | 60 | 61 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /power/power-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, 2018-2019 The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef __POWER_COMMON_H__ 31 | #define __POWER_COMMON_H__ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #define NODE_MAX (64) 38 | 39 | #define SCALING_GOVERNOR_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" 40 | #define DCVS_CPU0_SLACK_MAX_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_max_us" 41 | #define DCVS_CPU0_SLACK_MIN_NODE "/sys/module/msm_dcvs/cores/cpu0/slack_time_min_us" 42 | #define MPDECISION_SLACK_MAX_NODE "/sys/module/msm_mpdecision/slack_time_max_us" 43 | #define MPDECISION_SLACK_MIN_NODE "/sys/module/msm_mpdecision/slack_time_min_us" 44 | #define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" 45 | #define ONDEMAND_GOVERNOR "ondemand" 46 | #define INTERACTIVE_GOVERNOR "interactive" 47 | #define MSMDCVS_GOVERNOR "msm-dcvs" 48 | 49 | #define HINT_HANDLED (0) 50 | #define HINT_NONE (-1) 51 | 52 | #define INPUT_EVENT_WAKUP_MODE_OFF 4 53 | #define INPUT_EVENT_WAKUP_MODE_ON 5 54 | 55 | #include 56 | 57 | enum CPU_GOV_CHECK { CPU0 = 0, CPU1 = 1, CPU2 = 2, CPU3 = 3 }; 58 | 59 | void power_init(void); 60 | void power_hint(power_hint_t hint, void *data); 61 | void set_interactive(int on); 62 | void set_feature(feature_t feature, int state); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif //__POWER_COMMON_H___ 69 | -------------------------------------------------------------------------------- /pocketmode/src/org/lineageos/pocketmode/PocketModeService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The CyanogenMod Project 3 | * 2017 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 org.lineageos.pocketmode; 19 | 20 | import android.app.Service; 21 | import android.content.BroadcastReceiver; 22 | import android.content.Context; 23 | import android.content.Intent; 24 | import android.content.IntentFilter; 25 | import android.os.IBinder; 26 | import android.util.Log; 27 | 28 | public class PocketModeService extends Service { 29 | private static final String TAG = "PocketModeService"; 30 | private static final boolean DEBUG = false; 31 | 32 | private ProximitySensor mProximitySensor; 33 | 34 | @Override 35 | public void onCreate() { 36 | if (DEBUG) Log.d(TAG, "Creating service"); 37 | mProximitySensor = new ProximitySensor(this); 38 | 39 | IntentFilter screenStateFilter = new IntentFilter(); 40 | screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF); 41 | screenStateFilter.addAction(Intent.ACTION_USER_PRESENT); 42 | registerReceiver(mScreenStateReceiver, screenStateFilter); 43 | } 44 | 45 | @Override 46 | public int onStartCommand(Intent intent, int flags, int startId) { 47 | if (DEBUG) Log.d(TAG, "Starting service"); 48 | return START_STICKY; 49 | } 50 | 51 | @Override 52 | public void onDestroy() { 53 | if (DEBUG) Log.d(TAG, "Destroying service"); 54 | this.unregisterReceiver(mScreenStateReceiver); 55 | mProximitySensor.disable(); 56 | super.onDestroy(); 57 | } 58 | 59 | @Override 60 | public IBinder onBind(Intent intent) { 61 | return null; 62 | } 63 | 64 | private void onDeviceUnlocked() { 65 | if (DEBUG) Log.d(TAG, "Device unlocked"); 66 | mProximitySensor.disable(); 67 | } 68 | 69 | private void onDisplayOff() { 70 | if (DEBUG) Log.d(TAG, "Display off"); 71 | mProximitySensor.enable(); 72 | } 73 | 74 | private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() { 75 | @Override 76 | public void onReceive(Context context, Intent intent) { 77 | if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { 78 | onDeviceUnlocked(); 79 | } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { 80 | onDisplayOff(); 81 | } 82 | } 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /power/service.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #define LOG_TAG "android.hardware.power@1.2-service.xiaomi_sdm845" 31 | 32 | #include 33 | #include 34 | #include 35 | #include "Power.h" 36 | 37 | using android::sp; 38 | using android::status_t; 39 | using android::OK; 40 | 41 | // libhwbinder: 42 | using android::hardware::configureRpcThreadpool; 43 | using android::hardware::joinRpcThreadpool; 44 | 45 | // Generated HIDL files 46 | using android::hardware::power::V1_2::IPower; 47 | using android::hardware::power::V1_2::implementation::Power; 48 | 49 | int main() { 50 | 51 | status_t status; 52 | android::sp service = nullptr; 53 | 54 | ALOGI("Power HAL Service 1.2 is starting."); 55 | 56 | service = new Power(); 57 | if (service == nullptr) { 58 | ALOGE("Can not create an instance of Power HAL interface."); 59 | 60 | goto shutdown; 61 | } 62 | 63 | configureRpcThreadpool(1, true /*callerWillJoin*/); 64 | 65 | status = service->registerAsService(); 66 | if (status != OK) { 67 | ALOGE("Could not register service for Power HAL(%d).", status); 68 | goto shutdown; 69 | } 70 | 71 | ALOGI("Power Service is ready"); 72 | joinRpcThreadpool(); 73 | //Should not pass this line 74 | 75 | shutdown: 76 | // In normal operation, we don't expect the thread pool to exit 77 | 78 | ALOGE("Power Service is shutting down"); 79 | return 1; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /audio/listen_platform_info.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /parts/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 使用米音提升音质 21 | 米音 22 | 耳机类型设置 23 | 请选择预设效果 24 | 25 | 26 | 灵动耳塞式 27 | 灵悦入耳式 28 | 小米活塞1 29 | 通用耳塞式 30 | 通用入耳式 31 | 小米活塞简装版 32 | 小米活塞2 33 | 小米活塞标准版 34 | 小米头戴式 35 | 小米活塞青春版 36 | 小米活塞炫彩版 37 | 小米圈铁 38 | 小米胶囊 39 | 小米圈铁Pro 40 | 小米头戴轻松版 41 | 小米降噪 typeC 42 | 小米降噪 3.5mm 43 | 小米半入耳式 44 | 小米圈铁2 45 | 小米耳机基本款 46 | 小米耳机 47 | 48 | 49 | 摇滚 50 | 爵士 51 | 流行 52 | 古典 53 | 嘻哈 54 | 布鲁斯 55 | 电子音乐 56 | 乡村 57 | 舞曲 58 | 金属 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-zh-rHK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 使用米音提升音質 21 | 米音 22 | 耳機類型設定 23 | 請選擇預設等化器 24 | 25 | 26 | 靈動耳塞式 27 | 靈悅入耳式 28 | 小米活塞1 29 | 通用耳塞式 30 | 通用入耳式 31 | 小米活塞簡裝版 32 | 小米活塞2 33 | 小米活塞標準版 34 | 小米頭戴式 35 | 小米活塞青春版 36 | 小米活塞耳機炫彩版 37 | 小米圈鐵耳機 38 | 小米膠囊 39 | 小米圈鐵耳機Pro 40 | 小米頭戴式耳機輕鬆版 41 | 小米降噪耳機 typeC 42 | 小米降噪耳機 3.5mm 43 | 小米半入耳式 44 | 小米圈鐵耳機2 45 | 小米耳機基本款 46 | 小米耳機 47 | 48 | 49 | 搖滾 50 | 爵士 51 | 流行 52 | 古典 53 | 嘻哈 54 | 布魯斯 55 | 電子音樂 56 | 鄉村 57 | 舞曲 58 | 金屬 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-zh-rSG/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 使用米音提升音質 21 | 米音 22 | 耳機類型設定 23 | 請選擇預設等化器 24 | 25 | 26 | 靈動耳塞式 27 | 靈悅入耳式 28 | 小米活塞1 29 | 通用耳塞式 30 | 通用入耳式 31 | 小米活塞簡裝版 32 | 小米活塞2 33 | 小米活塞標準版 34 | 小米頭戴式 35 | 小米活塞青春版 36 | 小米活塞耳機炫彩版 37 | 小米圈鐵耳機 38 | 小米膠囊 39 | 小米圈鐵耳機Pro 40 | 小米頭戴式耳機輕鬆版 41 | 小米降噪耳機 typeC 42 | 小米降噪耳機 3.5mm 43 | 小米半入耳式 44 | 小米圈鐵耳機2 45 | 小米耳機基本款 46 | 小米耳機 47 | 48 | 49 | 搖滾 50 | 爵士 51 | 流行 52 | 古典 53 | 嘻哈 54 | 布魯斯 55 | 電子音樂 56 | 鄉村 57 | 舞曲 58 | 金屬 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-zh-rTW/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 使用米音提升音質 21 | 米音 22 | 耳機類型設定 23 | 請選擇預設等化器 24 | 25 | 26 | 靈動耳塞式 27 | 靈悅入耳式 28 | 小米活塞1 29 | 通用耳塞式 30 | 通用入耳式 31 | 小米活塞簡裝版 32 | 小米活塞2 33 | 小米活塞標準版 34 | 小米頭戴式 35 | 小米活塞青春版 36 | 小米活塞耳機炫彩版 37 | 小米圈鐵耳機 38 | 小米膠囊 39 | 小米圈鐵耳機Pro 40 | 小米頭戴式耳機輕鬆版 41 | 小米降噪耳機 typeC 42 | 小米降噪耳機 3.5mm 43 | 小米半入耳式 44 | 小米圈鐵耳機2 45 | 小米耳機基本款 46 | 小米耳機 47 | 48 | 49 | 搖滾 50 | 爵士 51 | 流行 52 | 古典 53 | 嘻哈 54 | 布魯斯 55 | 電子音樂 56 | 鄉村 57 | 舞曲 58 | 金屬 59 | 60 | -------------------------------------------------------------------------------- /pocketmode/src/org/lineageos/pocketmode/ProximitySensor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The CyanogenMod Project 3 | * 2017-2019 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 org.lineageos.pocketmode; 19 | 20 | import android.content.Context; 21 | import android.hardware.Sensor; 22 | import android.hardware.SensorEvent; 23 | import android.hardware.SensorEventListener; 24 | import android.hardware.SensorManager; 25 | import android.os.FileUtils; 26 | import android.util.Log; 27 | 28 | import java.io.IOException; 29 | import java.util.concurrent.ExecutorService; 30 | import java.util.concurrent.Executors; 31 | import java.util.concurrent.Future; 32 | 33 | public class ProximitySensor implements SensorEventListener { 34 | private static final String TAG = "PocketModeProximity"; 35 | private static final boolean DEBUG = false; 36 | 37 | private static final String FP_PROX_NODE = 38 | "/sys/devices/platform/soc/soc:fingerprint_goodix/proximity_state"; 39 | 40 | private ExecutorService mExecutorService; 41 | private Context mContext; 42 | private Sensor mSensor; 43 | private SensorManager mSensorManager; 44 | 45 | public ProximitySensor(Context context) { 46 | mContext = context; 47 | mSensorManager = mContext.getSystemService(SensorManager.class); 48 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); 49 | mExecutorService = Executors.newSingleThreadExecutor(); 50 | } 51 | 52 | private Future submit(Runnable runnable) { 53 | return mExecutorService.submit(runnable); 54 | } 55 | 56 | @Override 57 | public void onSensorChanged(SensorEvent event) { 58 | boolean isNear = event.values[0] < mSensor.getMaximumRange(); 59 | try { 60 | FileUtils.stringToFile(FP_PROX_NODE, isNear ? "1" : "0"); 61 | } catch (IOException e) { 62 | Log.e(TAG, "Failed to write to " + FP_PROX_NODE, e); 63 | } 64 | } 65 | 66 | @Override 67 | public void onAccuracyChanged(Sensor sensor, int accuracy) { 68 | /* Empty */ 69 | } 70 | 71 | protected void enable() { 72 | if (DEBUG) Log.d(TAG, "Enabling"); 73 | submit(() -> { 74 | mSensorManager.registerListener(this, mSensor, 75 | SensorManager.SENSOR_DELAY_NORMAL); 76 | }); 77 | } 78 | 79 | protected void disable() { 80 | if (DEBUG) Log.d(TAG, "Disabling"); 81 | submit(() -> { 82 | mSensorManager.unregisterListener(this, mSensor); 83 | }); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /audio/graphite_ipc_platform_info.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 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 38 | 39 | 40 | 42 | 43 | 44 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /parts/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 27 | 28 | 30 | 31 | 36 | 37 | 40 | 41 | 47 | 48 | 50 | 51 | 54 | 55 | 57 | 58 | 62 | 63 | -------------------------------------------------------------------------------- /parts/res/values-ko-rKR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi 사운드 강화 21 | 음질 최적화 22 | 헤드폰 유형 선택 23 | 프리셋 선택 24 | 25 | 기본 26 | Mi 이어버드 27 | Mi 인이어 (2013) 28 | Mi 피스톤 1 29 | 일반 30 | 일반 이어폰 31 | 기본 에디션 32 | Mi 피스톤 2 33 | 표준 에디션 34 | Mi 헤드폰 35 | 청소년 에디션 36 | 컬러 에디션 37 | Mi 이어폰 38 | Mi 캡슐 39 | Mi 인이어 프로 40 | Mi Comfort 41 | Mi 노이즈 캔슬링 Type-C 42 | Mi 노이즈 캔슬링 3.5mm 43 | Mi 하프 인이어 44 | Mi 인이어 2 45 | Mi 이어폰 베이직 46 | Mi 이어폰 47 | 48 | 기본 49 | 50 | 재즈 51 | 52 | 클래식 53 | 힙합 54 | 블루스 55 | 일렉트로닉 56 | 컨트리 57 | 댄스 58 | 메탈 59 | 60 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/dirac/DiracSound.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 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 org.lineageos.settings.dirac; 18 | 19 | import android.media.audiofx.AudioEffect; 20 | 21 | import java.util.UUID; 22 | 23 | public class DiracSound extends AudioEffect { 24 | 25 | private static final int DIRACSOUND_PARAM_HEADSET_TYPE = 1; 26 | private static final int DIRACSOUND_PARAM_EQ_LEVEL = 2; 27 | private static final int DIRACSOUND_PARAM_MUSIC = 4; 28 | 29 | private static final UUID EFFECT_TYPE_DIRACSOUND = 30 | UUID.fromString("e069d9e0-8329-11df-9168-0002a5d5c51b"); 31 | private static final String TAG = "DiracSound"; 32 | 33 | public DiracSound(int priority, int audioSession) { 34 | super(EFFECT_TYPE_NULL, EFFECT_TYPE_DIRACSOUND, priority, audioSession); 35 | } 36 | 37 | public void setMusic(int enable) throws IllegalStateException, 38 | IllegalArgumentException, UnsupportedOperationException { 39 | checkStatus(setParameter(DIRACSOUND_PARAM_MUSIC, enable)); 40 | } 41 | 42 | public int getMusic() throws IllegalStateException, 43 | IllegalArgumentException, UnsupportedOperationException { 44 | int[] value = new int[1]; 45 | checkStatus(getParameter(DIRACSOUND_PARAM_MUSIC, value)); 46 | return value[0]; 47 | } 48 | 49 | public void setHeadsetType(int type) throws IllegalStateException, 50 | IllegalArgumentException, UnsupportedOperationException { 51 | checkStatus(setParameter(DIRACSOUND_PARAM_HEADSET_TYPE, type)); 52 | } 53 | 54 | public int getHeadsetType() throws IllegalStateException, 55 | IllegalArgumentException, UnsupportedOperationException { 56 | int[] value = new int[1]; 57 | checkStatus(getParameter(DIRACSOUND_PARAM_HEADSET_TYPE, value)); 58 | return value[0]; 59 | } 60 | 61 | public void setLevel(int band, float level) throws IllegalStateException, 62 | IllegalArgumentException, UnsupportedOperationException { 63 | checkStatus(setParameter(new int[]{DIRACSOUND_PARAM_EQ_LEVEL, band}, 64 | String.valueOf(level).getBytes())); 65 | } 66 | 67 | public float getLevel(int band) throws IllegalStateException, 68 | IllegalArgumentException, UnsupportedOperationException { 69 | int[] param = new int[2]; 70 | byte[] value = new byte[10]; 71 | param[0] = DIRACSOUND_PARAM_EQ_LEVEL; 72 | param[1] = band; 73 | checkStatus(getParameter(param, value)); 74 | return new Float(new String(value)).floatValue(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /parts/res/values-ja-rJP/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi サウンドエンハンサー 21 | オーディオ品質を最適化 22 | ヘッドフォンの種類を選択 23 | プリセットを選択してください 24 | 25 | デフォルト 26 | Mi イヤーバッド 27 | Mi インイヤー (2013) 28 | Mi ピストン 1 29 | 一般 30 | 一般的なインイヤー型 31 | ベーシック版 32 | Mi ピストン 2 33 | スタンダード版 34 | Mi ヘッドフォン 35 | 青春版 36 | カラー版 37 | Mi インイヤー 38 | Mi カプセル 39 | Mi インイヤー Pro 40 | Mi コンフォート 41 | Mi ノイズキャンセリング Type-C 42 | Mi ノイズキャンセリング 3.5mm 43 | Mi ハーフインイヤー 44 | Mi インイヤー2 45 | Mi イヤフォン ベーシック 46 | Mi イヤホン 47 | 48 | デフォルト 49 | ロック 50 | ジャズ 51 | ポップ 52 | クラシック 53 | ヒップホップ 54 | ブルース 55 | エレクトロニック 56 | カントリー 57 | ダンス 58 | メタル 59 | 60 | -------------------------------------------------------------------------------- /power/hint-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, 2013, 2015, 2017-2018, The Linux Foundation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above 10 | * copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided 12 | * with the distribution. 13 | * * Neither the name of The Linux Foundation nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* Default use-case hint IDs */ 31 | #define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00) 32 | #define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00) 33 | #define DISPLAY_STATE_HINT_ID (0x0C00) 34 | #define DISPLAY_STATE_HINT_ID_2 (0x0D00) 35 | #define CAM_PREVIEW_HINT_ID (0x0E00) 36 | #define SUSTAINED_PERF_HINT_ID (0x0F00) 37 | #define VR_MODE_HINT_ID (0x1000) 38 | #define VR_MODE_SUSTAINED_PERF_HINT_ID (0x1001) 39 | #define INTERACTION_HINT_ID (0x1A00) 40 | 41 | #define AOSP_DELTA (0x1200) 42 | 43 | #define VSYNC_HINT AOSP_DELTA + POWER_HINT_VSYNC 44 | #define INTERACTION_HINT AOSP_DELTA + POWER_HINT_INTERACTION 45 | #define VIDEO_DECODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_DECODE 46 | #define VIDEO_ENCODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_ENCODE 47 | #define LOW_POWER_HINT AOSP_DELTA + POWER_HINT_LOW_POWER 48 | #define SUSTAINED_PERF_HINT AOSP_DELTA + POWER_HINT_SUSTAINED_PERFORMANCE 49 | #define VR_MODE_HINT AOSP_DELTA + POWER_HINT_VR_MODE 50 | #define LAUNCH_HINT AOSP_DELTA + POWER_HINT_LAUNCH 51 | #define DISABLE_TOUCH_HINT AOSP_DELTA + POWER_HINT_DISABLE_TOUCH 52 | 53 | //update NUM_HINTS if hints are added to AOSP 54 | #define NUM_HINTS (POWER_HINT_DISABLE_TOUCH +1) 55 | 56 | #define VR_MODE_SUSTAINED_PERF_HINT (0x1301) 57 | 58 | struct hint_handles{ 59 | int handle; 60 | int ref_count; 61 | }; 62 | 63 | struct hint_data { 64 | unsigned long hint_id; /* This is our key. */ 65 | unsigned long perflock_handle; 66 | }; 67 | 68 | int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint); 69 | void hint_dump(struct hint_data* hint); 70 | -------------------------------------------------------------------------------- /parts/src/org/lineageos/settings/doze/PickupSensor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The CyanogenMod Project 3 | * 2017-2018 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 org.lineageos.settings.doze; 19 | 20 | import android.content.Context; 21 | import android.hardware.Sensor; 22 | import android.hardware.SensorEvent; 23 | import android.hardware.SensorEventListener; 24 | import android.hardware.SensorManager; 25 | import android.os.SystemClock; 26 | import android.util.Log; 27 | 28 | import java.util.concurrent.ExecutorService; 29 | import java.util.concurrent.Executors; 30 | import java.util.concurrent.Future; 31 | 32 | public class PickupSensor implements SensorEventListener { 33 | 34 | private static final boolean DEBUG = false; 35 | private static final String TAG = "PickupSensor"; 36 | 37 | private static final int MIN_PULSE_INTERVAL_MS = 2500; 38 | 39 | private SensorManager mSensorManager; 40 | private Sensor mSensor; 41 | private Context mContext; 42 | private ExecutorService mExecutorService; 43 | 44 | private long mEntryTimestamp; 45 | 46 | public PickupSensor(Context context) { 47 | mContext = context; 48 | mSensorManager = mContext.getSystemService(SensorManager.class); 49 | mSensor = DozeUtils.getSensor(mSensorManager, "xiaomi.sensor.pickup"); 50 | mExecutorService = Executors.newSingleThreadExecutor(); 51 | } 52 | 53 | private Future submit(Runnable runnable) { 54 | return mExecutorService.submit(runnable); 55 | } 56 | 57 | @Override 58 | public void onSensorChanged(SensorEvent event) { 59 | if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]); 60 | 61 | long delta = SystemClock.elapsedRealtime() - mEntryTimestamp; 62 | if (delta < MIN_PULSE_INTERVAL_MS) { 63 | return; 64 | } 65 | 66 | mEntryTimestamp = SystemClock.elapsedRealtime(); 67 | 68 | if (event.values[0] == 1) { 69 | DozeUtils.launchDozePulse(mContext); 70 | } 71 | } 72 | 73 | @Override 74 | public void onAccuracyChanged(Sensor sensor, int accuracy) { 75 | /* Empty */ 76 | } 77 | 78 | protected void enable() { 79 | if (DEBUG) Log.d(TAG, "Enabling"); 80 | submit(() -> { 81 | mSensorManager.registerListener(this, mSensor, 82 | SensorManager.SENSOR_DELAY_NORMAL); 83 | mEntryTimestamp = SystemClock.elapsedRealtime(); 84 | }); 85 | } 86 | 87 | protected void disable() { 88 | if (DEBUG) Log.d(TAG, "Disabling"); 89 | submit(() -> { 90 | mSensorManager.unregisterListener(this, mSensor); 91 | }); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /parts/res/values-ar-rSA/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | محسن صوت Mi 21 | تحسين جودة الصوت 22 | اختيار نوع سماعة الرأس 23 | اختر إعداد 24 | 25 | الافتراضي 26 | Mi Earbuds 27 | Mi In-Ear (2013) 28 | Mi Piston-1 29 | عام 30 | عامة In-Ear 31 | إصدار رئيسي 32 | Mi Piston-2 33 | إصدار قياسي 34 | سماعات رأس Mi 35 | إصدار شبابي 36 | إصدار اللون 37 | Mi In-Ear 38 | Mi Capsule 39 | Mi In-Ear Pro 40 | Mi Comfort 41 | إلغاء الضوضاء Mi Type-C 42 | إلغاء الضوضاء Mi 3.5mm 43 | Mi Half In-Ear 44 | Mi In-Ear 2 45 | Mi Earphones Basic 46 | Mi Earphones 47 | 48 | الافتراضي 49 | روك 50 | جاز 51 | بوب 52 | كلاسيك 53 | هيب هوب 54 | إيقاع 55 | الكتروني 56 | الريف 57 | رقص 58 | معدن 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-iw-rIL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | מגבר צלילים Mi 21 | ייעול איכות השמע 22 | בחר סוג אוזניות 23 | בחירת הגדרה 24 | 25 | ברירת מחדל 26 | Mi Earbuds 27 | Mi In-Ear (2013) 28 | Mi Piston-1 29 | כללי 30 | In-Ear כללי 31 | מהדורה בסיסית 32 | Mi Piston-2 33 | מהודרה רגילה 34 | אוזניות Mi 35 | מהדורת נוער 36 | מהדורת צבע 37 | Mi In-Ear 38 | קפסולת Mi 39 | Mi In-Ear Pro 40 | Mi Comfort 41 | ביטול רעשים של Mi Type-C 42 | ביטול רעשים של Mi 3.5 מ\"מ 43 | Mi Half in Ear 44 | Mi In-Ear 2 45 | Mi מיקרופון בסיסי 46 | אוזניות Mi 47 | 48 | ברירת מחדל 49 | רוק 50 | ג\'אז 51 | פופ 52 | קלאסית 53 | היפ הופ 54 | בלוז 55 | אלקטרונית 56 | קאנטרי 57 | דאנס 58 | מטאל 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-ur-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi ساؤنڈ انہینسر 21 | آڈیو کے معیار کو بہتر بنائيں 22 | ہیڈفون ی؛قسم منتخب کریں 23 | پری سیٹ منتخب کریں 24 | 25 | ڈیفالٹ 26 | Mi ایربڈز 27 | Mi ان-ایئر (2013) 28 | Mi پسٹن -1 29 | عمومی 30 | عمومی ان-ایر 31 | بنیادی ایڈیشن 32 | Mi پسٹن -2 33 | معیاری ایڈیشن 34 | Mi ہیڈ فونز 35 | یوتھ ایڈیشن 36 | کلر ایڈشن 37 | Mi اِن-ایر 38 | Mi کیپسول 39 | Mi ان-ایر پرو 40 | Mi Comfort 41 | Mi شور منسوخی ٹائپ-C 42 | Mi شور منسوخی 3.5mm 43 | Mi ہاف ان ایئر 44 | Mi ان-ایئر 2 45 | Mi ایئرفون بیسک 46 | Mi ایئر فونز 47 | 48 | ڈیفالٹ 49 | راک 50 | جاز 51 | پاپ 52 | کلاسیکی 53 | ہِپ ہاپ 54 | بلیوز 55 | الیکٹرونک 56 | ملک 57 | رقص 58 | دھات 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-ur-rPK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi ساؤنڈ انہینسر 21 | آڈیو کے معیار کو بہتر بنائيں 22 | ہیڈفون ی؛قسم منتخب کریں 23 | پری سیٹ منتخب کریں 24 | 25 | ڈیفالٹ 26 | Mi ایربڈز 27 | Mi ان-ایئر (2013) 28 | Mi پسٹن -1 29 | عمومی 30 | عمومی ان-ایر 31 | بنیادی ایڈیشن 32 | Mi پسٹن -2 33 | معیاری ایڈیشن 34 | Mi ہیڈ فونز 35 | یوتھ ایڈیشن 36 | کلر ایڈشن 37 | Mi اِن-ایر 38 | Mi کیپسول 39 | Mi ان-ایر پرو 40 | Mi Comfort 41 | Mi شور منسوخی ٹائپ-C 42 | Mi شور منسوخی 3.5mm 43 | Mi ہاف ان ایئر 44 | Mi ان-ایئر 2 45 | Mi ایئرفون بیسک 46 | Mi ایئر فونز 47 | 48 | ڈیفالٹ 49 | راک 50 | جاز 51 | پاپ 52 | کلاسیکی 53 | ہِپ ہاپ 54 | بلیوز 55 | الیکٹرونک 56 | ملک 57 | رقص 58 | دھات 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | Mi Sound Enhancer 20 | Optimize audio quality 21 | Choose headphones type 22 | Choose a preset 23 | 24 | 25 | Default 26 | Mi Earbuds 27 | Mi In-Ear (2013) 28 | Mi Piston-1 29 | General 30 | General In-Ear 31 | Basic Edition 32 | Mi Piston-2 33 | Standard Edition 34 | Mi Headphones 35 | Youth Edition 36 | Color Edition 37 | Mi In-Ear 38 | Mi Capsule 39 | Mi In-Ear Pro 40 | Mi Comfort 41 | Mi Noise Cancelling Type-C 42 | Mi Noise Cancelling 3.5mm 43 | Mi Half In-Ear 44 | Mi In-Ear 2 45 | Mi Earphones Basic 46 | Mi Earphones 47 | 48 | 49 | Default 50 | Rock 51 | Jazz 52 | Pop 53 | Classical 54 | Hip Hop 55 | Blues 56 | Electronic 57 | Country 58 | Dance 59 | Metal 60 | 61 | -------------------------------------------------------------------------------- /ThermalController/src/org/pixelexperience/thermalcontroller/PreferencesProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 The PixelExperience 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 org.pixelexperience.thermalcontroller; 18 | 19 | import android.content.ContentProvider; 20 | import android.content.ContentValues; 21 | import android.content.UriMatcher; 22 | import android.database.Cursor; 23 | import android.database.MatrixCursor; 24 | import android.net.Uri; 25 | import android.text.TextUtils; 26 | 27 | import static com.android.internal.util.custom.thermal.ThermalController.*; 28 | 29 | public class PreferencesProvider extends ContentProvider { 30 | private static final int PREFERENCES = 1; 31 | private static final UriMatcher uriMatcher; 32 | 33 | static { 34 | uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 35 | uriMatcher.addURI(AUTHORITY, "preferences/*", PREFERENCES); 36 | } 37 | 38 | @Override 39 | public boolean onCreate() { 40 | return false; 41 | } 42 | 43 | @Override 44 | public String getType(Uri uri) { 45 | return null; 46 | } 47 | 48 | @Override 49 | public Uri insert(Uri uri, ContentValues values) { 50 | if (uriMatcher.match(uri) != PREFERENCES) { 51 | throw new IllegalArgumentException("Unsupported URI: " + uri); 52 | } 53 | String packageName = uri.getPathSegments().get(1); 54 | if (TextUtils.isEmpty(packageName)){ 55 | return null; 56 | } 57 | int profile = (int) values.get(COLUMN_PROFILE); 58 | Preferences.setProfileId(getContext(), packageName, profile); 59 | return Uri.parse(CONTENT_URI + "/" + packageName); 60 | } 61 | 62 | @Override 63 | public Cursor query(Uri uri, String[] projection, String selection, 64 | String[] selectionArgs, String sortOrder) { 65 | if (uriMatcher.match(uri) != PREFERENCES) { 66 | throw new IllegalArgumentException("Unsupported URI: " + uri); 67 | } 68 | String packageName = uri.getPathSegments().get(1); 69 | if (TextUtils.isEmpty(packageName)){ 70 | return null; 71 | } 72 | MatrixCursor result = new MatrixCursor(PROJECTION_DEFAULT); 73 | result.newRow().add(COLUMN_PROFILE, Preferences.getProfileId(getContext(), packageName)); 74 | return result; 75 | } 76 | 77 | @Override 78 | public int delete(Uri uri, String selection, String[] selectionArgs) { 79 | return 0; 80 | } 81 | 82 | @Override 83 | public int update(Uri uri, ContentValues values, String selection, 84 | String[] selectionArgs) { 85 | return 0; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /parts/res/values-in-rID/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi Sound Enhancer 21 | Optimalkan kualitas audio 22 | Pilih tipe headphone 23 | Pilih preset 24 | 25 | Bawaan 26 | Mi Earbuds 27 | Mi In-Ear (2013) 28 | Mi Piston-1 29 | Umum 30 | In-Ear umum 31 | Edisi Basic 32 | Mi Piston-2 33 | Edisi standar 34 | Mi Headphone 35 | Edisi Youth 36 | Edisi Warna 37 | Mi In-Ear 38 | Mi Capsule 39 | Mi In-Ear Pro 40 | Mi Comfort 41 | Mi Noise Cancelling Type-C 42 | Mi Noise Cancelling 3.5mm 43 | Mi Half In-Ear 44 | Mi In-Ear 2 45 | Mi Earphones Basic 46 | Mi Earphone 47 | 48 | Bawaan 49 | Rock 50 | Jazz 51 | Pop 52 | Klasik 53 | Hip Hop 54 | Blues 55 | Elektronik 56 | Country 57 | Dance 58 | Metal 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-cs-rCZ/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Vylepšení Mi Sound 21 | Optimalizovat kvalitu zvuku 22 | Typ sluchátek 23 | Zvolit přednastavené 24 | 25 | Výchozí 26 | Mi pecky 27 | Mi špunty (2013) 28 | Mi Piston-1 29 | Obyčejná 30 | Běžné špunty 31 | Základní edice 32 | Mi Piston-2 33 | Standardní edice 34 | Mi sluchátka 35 | Pro mladé 36 | Barevná edice 37 | Mi špunty 38 | Mi kapsle 39 | Mi špunty Pro 40 | Mi Komfort 41 | Mi Rušení hluku Typ-C 42 | Mi Rušení hluku 3,5 mm 43 | Mi Half In-Ear 44 | Mi In-Ear 2 45 | Mi Earphones Basic 46 | Mi Earphones 47 | 48 | Výchozí 49 | Rock 50 | Jazz 51 | Pop 52 | Klasická 53 | Hip Hop 54 | Blues 55 | Elektronická 56 | Country 57 | Taneční 58 | Metal 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-fi-rFI/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi Sound Enhancer 21 | Optimoi äänenlaatua 22 | Valitse kuuloke tyyppi 23 | Valitse esiasetus 24 | 25 | Oletus 26 | Mi Earbuds 27 | Mi In-Ear (2013) 28 | Mi Piston-1 29 | Yleinen 30 | Yleinen kuuloke 31 | Perusversio 32 | Mi Piston-2 33 | Vakioversio 34 | Mi-kuulokkeet 35 | Youth Edition 36 | Color Edition 37 | Mi In-Ear 38 | Mi Capsule 39 | Mi In-Ear Pro 40 | Mi Comfort 41 | Mi Melunvaimennus Type-C 42 | Mi Melunvaimennus 3,5 mm 43 | Mi Half In-Ear 44 | Mi In-Ear 2 45 | Mi Earphones Basic 46 | Mi Earphones 47 | 48 | Oletus 49 | Rock 50 | Jazz 51 | Pop 52 | Klassinen 53 | Hip Hop 54 | Blues 55 | Electronic 56 | Kantri 57 | Dance 58 | Metalli 59 | 60 | -------------------------------------------------------------------------------- /parts/res/values-hi-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Mi ध्वनि एन्हांसर 21 | ऑडियो गुणवत्ता ऑप्टिमाइज़ करें 22 | हेडफोन प्रकार चुनें 23 | पूर्व निर्धारित चुनें 24 | 25 | डिफ़ॉल्ट 26 | Mi इयरबड्स 27 | Mi इन-ईयर (2013) 28 | Mi पिस्टन-1 29 | सामान्य 30 | सामान्य इन-इयर 31 | मूल संस्करण 32 | Mi पिस्टन-2 33 | मानक संस्करण 34 | Mi हेडफोन्स 35 | युवा संस्करण 36 | रंग संस्करण 37 | Mi इन-इयर 38 | Mi कैपसूल 39 | Mi इन-ईयर प्रो 40 | Mi आराम 41 | Mi नॉइज कैंसलिंग टाइप-C 42 | Mi नॉइज कैंसलिंग 3.5mm 43 | Mi हाल्फ इन ईयर 44 | Mi इन-ईयर 2 45 | Mi ईयरफ़ोन बेसिक 46 | Mi ईयरफ़ोन्स 47 | 48 | डिफ़ॉल्ट 49 | रॉक 50 | जैज़ 51 | पॉप 52 | क्लॅसिकल 53 | हिप हॉप 54 | ब्लूज़ 55 | इलेक्ट्रॉनिक 56 | कंट्री 57 | डांस 58 | मेटल 59 | 60 | --------------------------------------------------------------------------------