diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 08b2cf7..7b89ebf 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -129,9 +129,9 @@ TARGET_ENABLE_MEDIADRM_64 := true TARGET_FS_CONFIG_GEN := $(COMMON_PATH)/config.fs # Fingerprint -SOONG_CONFIG_NAMESPACES += ONEPLUS_LAHAINA_FOD -SOONG_CONFIG_ONEPLUS_LAHAINA_FOD := POS_X POS_Y SIZE -TARGET_SURFACEFLINGER_FOD_LIB := //$(COMMON_PATH):libfod_extension.oneplus_lahaina +SOONG_CONFIG_NAMESPACES += ONEPLUS_FOD +SOONG_CONFIG_ONEPLUS_FOD := POS_X POS_Y SIZE +TARGET_SURFACEFLINGER_FOD_LIB := //hardware/oneplus:libfod_extension.oneplus # HIDL DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \ @@ -174,6 +174,11 @@ TARGET_COPY_OUT_VENDOR := vendor # Power TARGET_TAP_TO_WAKE_NODE := "/proc/touchpanel/double_tap_enable" +# PowerShare +SOONG_CONFIG_NAMESPACES += ONEPLUS_POWERSHARE +SOONG_CONFIG_ONEPLUS_POWERSHARE := WIRELESS_TX_ENABLE_PATH +SOONG_CONFIG_ONEPLUS_POWERSHARE_WIRELESS_TX_ENABLE_PATH := /sys/class/oplus_chg/wireless/trx_online + # Recovery BOARD_INCLUDE_DTB_IN_BOOTIMG := true BOARD_USES_RECOVERY_AS_BOOT := true diff --git a/KeyHandler/Android.mk b/KeyHandler/Android.mk deleted file mode 100644 index 8f7b162..0000000 --- a/KeyHandler/Android.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2018 The LineageOS Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_PACKAGE_NAME := KeyHandler - -LOCAL_CERTIFICATE := platform -LOCAL_PRIVATE_PLATFORM_APIS := true -LOCAL_PRIVILEGED_MODULE := true -LOCAL_MODULE_TAGS := optional - -LOCAL_PROGUARD_ENABLED := disabled - -include $(BUILD_PACKAGE) diff --git a/KeyHandler/src/org/lineageos/settings/device/KeyHandler.java b/KeyHandler/src/org/lineageos/settings/device/KeyHandler.java deleted file mode 100644 index 1d3a296..0000000 --- a/KeyHandler/src/org/lineageos/settings/device/KeyHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.device; - -import android.content.Context; -import android.media.AudioManager; -import android.os.VibrationEffect; -import android.os.Vibrator; -import android.view.KeyEvent; - -import com.android.internal.os.DeviceKeyHandler; - -public class KeyHandler implements DeviceKeyHandler { - private static final String TAG = KeyHandler.class.getSimpleName(); - - // Slider key codes - private static final int MODE_NORMAL = 601; - private static final int MODE_VIBRATION = 602; - private static final int MODE_SILENCE = 603; - - // Vibration effects - private static final VibrationEffect MODE_NORMAL_EFFECT = - VibrationEffect.get(VibrationEffect.EFFECT_HEAVY_CLICK); - private static final VibrationEffect MODE_VIBRATION_EFFECT = - VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK); - - private final Context mContext; - private final AudioManager mAudioManager; - private final Vibrator mVibrator; - - public KeyHandler(Context context) { - mContext = context; - - mAudioManager = mContext.getSystemService(AudioManager.class); - mVibrator = mContext.getSystemService(Vibrator.class); - } - - public KeyEvent handleKeyEvent(KeyEvent event) { - if (event.getAction() != KeyEvent.ACTION_DOWN) { - return event; - } - - int scanCode = event.getScanCode(); - - switch (scanCode) { - case MODE_NORMAL: - mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_NORMAL); - doHapticFeedback(MODE_NORMAL_EFFECT); - break; - case MODE_VIBRATION: - mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_VIBRATE); - doHapticFeedback(MODE_VIBRATION_EFFECT); - break; - case MODE_SILENCE: - mAudioManager.setRingerModeInternal(AudioManager.RINGER_MODE_SILENT); - break; - default: - return event; - } - - return null; - } - - private void doHapticFeedback(VibrationEffect effect) { - if (mVibrator != null && mVibrator.hasVibrator()) { - mVibrator.vibrate(effect); - } - } -} diff --git a/audio_amplifier/Android.mk b/audio_amplifier/Android.mk deleted file mode 100644 index c669344..0000000 --- a/audio_amplifier/Android.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 2020-2021 The LineageOS Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := audio_amplifier.$(TARGET_BOARD_PLATFORM) -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SRC_FILES := audio_amplifier.c -LOCAL_VENDOR_MODULE := true - -LOCAL_C_INCLUDES += \ - $(call include-path-for, audio-route) \ - $(call include-path-for, audio-utils) \ - $(call project-path-for, qcom-audio)/hal \ - $(call project-path-for, qcom-audio)/hal/audio_extn \ - $(call project-path-for, qcom-audio)/hal/msm8974 \ - external/tinycompress/include - -LOCAL_HEADER_LIBRARIES += \ - generated_kernel_headers \ - libhardware_headers - -LOCAL_SHARED_LIBRARIES += \ - audio.primary.$(TARGET_BOARD_PLATFORM) \ - libcutils \ - liblog \ - libtinyalsa - -include $(BUILD_SHARED_LIBRARY) diff --git a/audio_amplifier/audio_amplifier.c b/audio_amplifier/audio_amplifier.c deleted file mode 100644 index b19641f..0000000 --- a/audio_amplifier/audio_amplifier.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2015 The CyanogenMod Project - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "audio_amplifier" -//#define LOG_NDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include - -/* clang-format off */ -#include "audio_hw.h" -#include "platform.h" -#include "platform_api.h" -/* clang-format on */ - -#define UNUSED __attribute__((unused)) - -typedef struct amp_device { - amplifier_device_t amp_dev; - struct audio_device* adev; - struct audio_usecase* usecase_tx; - struct pcm* tfa98xx_out; -} tfa_t; - -static tfa_t* tfa_dev = NULL; - -static int is_speaker(uint32_t snd_device) { - int speaker = 0; - switch (snd_device) { - case SND_DEVICE_OUT_SPEAKER: - case SND_DEVICE_OUT_SPEAKER_REVERSE: - case SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES: - case SND_DEVICE_OUT_VOICE_SPEAKER: - case SND_DEVICE_OUT_VOICE_SPEAKER_2: - case SND_DEVICE_OUT_SPEAKER_AND_HDMI: - case SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET: - case SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET: - speaker = 1; - break; - } - - return speaker; -} - -int tfa98xx_start_feedback(void* adev, uint32_t snd_device) { - tfa_dev->adev = (struct audio_device*)adev; - int pcm_dev_tx_id = 0, rc = 0; - struct pcm_config pcm_config_tfa98xx = { - .channels = 2, - .rate = 48000, - .period_size = 256, - .period_count = 4, - .format = PCM_FORMAT_S16_LE, - .start_threshold = 0, - .stop_threshold = INT_MAX, - .silence_threshold = 0, - }; - - if (!tfa_dev) { - ALOGE("%d: Invalid params", __LINE__); - return -EINVAL; - } - - if (tfa_dev->tfa98xx_out || !is_speaker(snd_device)) return 0; - - tfa_dev->usecase_tx = (struct audio_usecase*)calloc(1, sizeof(struct audio_usecase)); - if (!tfa_dev->usecase_tx) { - ALOGE("%d: failed to allocate usecase", __LINE__); - return -ENOMEM; - } - tfa_dev->usecase_tx->id = USECASE_AUDIO_SPKR_CALIB_TX; - tfa_dev->usecase_tx->type = PCM_CAPTURE; - tfa_dev->usecase_tx->in_snd_device = SND_DEVICE_IN_CAPTURE_VI_FEEDBACK; - list_init(&tfa_dev->usecase_tx->device_list); - - list_add_tail(&tfa_dev->adev->usecase_list, &tfa_dev->usecase_tx->list); - enable_snd_device(tfa_dev->adev, tfa_dev->usecase_tx->in_snd_device); - enable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - - pcm_dev_tx_id = platform_get_pcm_device_id(tfa_dev->usecase_tx->id, tfa_dev->usecase_tx->type); - ALOGD("pcm_dev_tx_id = %d", pcm_dev_tx_id); - if (pcm_dev_tx_id < 0) { - ALOGE("%d: Invalid pcm device for usecase (%d)", __LINE__, tfa_dev->usecase_tx->id); - rc = -ENODEV; - goto error; - } - - tfa_dev->tfa98xx_out = - pcm_open(tfa_dev->adev->snd_card, pcm_dev_tx_id, PCM_IN, &pcm_config_tfa98xx); - if (!(tfa_dev->tfa98xx_out || pcm_is_ready(tfa_dev->tfa98xx_out))) { - ALOGE("%d: %s", __LINE__, pcm_get_error(tfa_dev->tfa98xx_out)); - rc = -EIO; - goto error; - } - - rc = pcm_start(tfa_dev->tfa98xx_out); - if (rc < 0) { - ALOGE("%d: pcm start for TX failed", __LINE__); - rc = -EINVAL; - goto error; - } - return 0; - -error: - ALOGE("%s: error case", __func__); - if (tfa_dev->tfa98xx_out != 0) { - pcm_close(tfa_dev->tfa98xx_out); - tfa_dev->tfa98xx_out = NULL; - } - list_remove(&tfa_dev->usecase_tx->list); - disable_snd_device(tfa_dev->adev, tfa_dev->usecase_tx->in_snd_device); - disable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - free(tfa_dev->usecase_tx); - - return rc; -} - -void tfa98xx_stop_feedback(void* adev, uint32_t snd_device) { - tfa_dev->adev = (struct audio_device*)adev; - if (!tfa_dev) { - ALOGE("%s: Invalid params", __func__); - return; - } - - if (!is_speaker(snd_device)) return; - - if (tfa_dev->tfa98xx_out) { - pcm_close(tfa_dev->tfa98xx_out); - tfa_dev->tfa98xx_out = NULL; - } - - disable_snd_device(tfa_dev->adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); - - tfa_dev->usecase_tx = get_usecase_from_list(tfa_dev->adev, USECASE_AUDIO_SPKR_CALIB_TX); - if (tfa_dev->usecase_tx) { - list_remove(&tfa_dev->usecase_tx->list); - disable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - free(tfa_dev->usecase_tx); - } - return; -} - -static int amp_set_feedback(UNUSED amplifier_device_t* device, void* adev, uint32_t devices, - bool enable) { - tfa_dev->adev = (struct audio_device*)adev; - if (enable) { - tfa98xx_start_feedback(tfa_dev->adev, devices); - } else { - tfa98xx_stop_feedback(tfa_dev->adev, devices); - } - return 0; -} - -static int amp_dev_close(hw_device_t* device) { - tfa_t* dev = (tfa_t*)device; - if (dev) free(dev); - - return 0; -} - -static int amp_module_open(const hw_module_t* module, const char* name, hw_device_t** device) { - if (strcmp(name, AMPLIFIER_HARDWARE_INTERFACE)) { - ALOGE("%s:%d: %s does not match amplifier hardware interface name\n", __func__, __LINE__, - name); - return -ENODEV; - } - - tfa_dev = calloc(1, sizeof(tfa_t)); - if (!tfa_dev) { - ALOGE("%s:%d: Unable to allocate memory for amplifier device\n", __func__, __LINE__); - return -ENOMEM; - } - - tfa_dev->amp_dev.common.tag = HARDWARE_DEVICE_TAG; - tfa_dev->amp_dev.common.module = (hw_module_t*)module; - tfa_dev->amp_dev.common.version = HARDWARE_DEVICE_API_VERSION(1, 0); - tfa_dev->amp_dev.common.close = amp_dev_close; - - tfa_dev->amp_dev.set_input_devices = NULL; - tfa_dev->amp_dev.set_output_devices = NULL; - tfa_dev->amp_dev.enable_output_devices = NULL; - tfa_dev->amp_dev.enable_input_devices = NULL; - tfa_dev->amp_dev.set_mode = NULL; - tfa_dev->amp_dev.output_stream_start = NULL; - tfa_dev->amp_dev.input_stream_start = NULL; - tfa_dev->amp_dev.output_stream_standby = NULL; - tfa_dev->amp_dev.input_stream_standby = NULL; - tfa_dev->amp_dev.set_parameters = NULL; - tfa_dev->amp_dev.out_set_parameters = NULL; - tfa_dev->amp_dev.in_set_parameters = NULL; - tfa_dev->amp_dev.set_feedback = amp_set_feedback; - - *device = (hw_device_t*)tfa_dev; - - return 0; -} - -static struct hw_module_methods_t hal_module_methods = { - .open = amp_module_open, -}; - -/* clang-format off */ -amplifier_module_t HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = AMPLIFIER_MODULE_API_VERSION_0_1, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = AMPLIFIER_HARDWARE_MODULE_ID, - .name = "TFA98XX audio amplifier HAL", - .author = "The LineageOS Project", - .methods = &hal_module_methods, - }, -}; diff --git a/common.mk b/common.mk index 6651e82..4be7f22 100644 --- a/common.mk +++ b/common.mk @@ -300,10 +300,8 @@ PRODUCT_PACKAGES += \ # Fingerprint PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina \ - vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina \ - vendor.oneplus.fingerprint.extension@1.0 \ - vendor.oneplus.hardware.display@1.0 + android.hardware.biometrics.fingerprint@2.1-service.oneplus \ + vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus # GPS PRODUCT_COPY_FILES += \ @@ -338,7 +336,7 @@ PRODUCT_PACKAGES += \ # LiveDisplay PRODUCT_PACKAGES += \ - vendor.lineage.livedisplay@2.1-service.oneplus_lahaina + vendor.lineage.livedisplay@2.1-service.oneplus # Media PRODUCT_COPY_FILES += \ @@ -398,10 +396,10 @@ PRODUCT_PACKAGES += \ # OnePlus PRODUCT_PACKAGES += \ - oneplus-fwk.oneplus_lahaina + oneplus-fwk PRODUCT_BOOT_JARS += \ - oneplus-fwk.oneplus_lahaina + oneplus-fwk # Power PRODUCT_PACKAGES += \ @@ -412,7 +410,7 @@ PRODUCT_PACKAGES += \ # PowerShare PRODUCT_PACKAGES += \ - vendor.lineage.powershare@1.0-service.oneplus_lahaina + vendor.lineage.powershare@1.0-service.oneplus # QMI PRODUCT_PACKAGES += \ @@ -442,7 +440,7 @@ PRODUCT_PACKAGES += \ # Soong namespaces PRODUCT_SOONG_NAMESPACES += \ $(LOCAL_PATH) \ - device/oneplus/common + hardware/oneplus # Telephony PRODUCT_PACKAGES += \ @@ -466,12 +464,12 @@ PRODUCT_PACKAGES += \ # Touch PRODUCT_PACKAGES += \ - vendor.lineage.touch@1.0-service.oneplus_lahaina + vendor.lineage.touch@1.0-service.oneplus # tri-state-key PRODUCT_PACKAGES += \ KeyHandler \ - tri-state-key_daemon + tri-state-key_daemon.vendor # Trust HAL PRODUCT_PACKAGES += \ @@ -500,7 +498,7 @@ PRODUCT_PACKAGES += \ # Vibrator PRODUCT_PACKAGES += \ - vendor.qti.hardware.vibrator.service.oneplus_lahaina + vendor.qti.hardware.vibrator.service.oneplus PRODUCT_COPY_FILES += \ vendor/qcom/opensource/vibrator/excluded-input-devices.xml:$(TARGET_COPY_OUT_VENDOR)/etc/excluded-input-devices.xml diff --git a/doze/Android.mk b/doze/Android.mk deleted file mode 100644 index 3818b6f..0000000 --- a/doze/Android.mk +++ /dev/null @@ -1,28 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := OnePlusDoze -LOCAL_CERTIFICATE := platform -LOCAL_PRIVATE_PLATFORM_APIS := true -LOCAL_PRIVILEGED_MODULE := true - -LOCAL_USE_AAPT2 := true - -LOCAL_STATIC_ANDROID_LIBRARIES := \ - androidx.core_core \ - androidx.preference_preference - -LOCAL_RESOURCE_DIR := \ - $(LOCAL_PATH)/res \ - $(TOP)/packages/resources/devicesettings/res - -LOCAL_PROGUARD_FLAG_FILES := proguard.flags - -include frameworks/base/packages/SettingsLib/common.mk - -include $(BUILD_PACKAGE) diff --git a/doze/AndroidManifest.xml b/doze/AndroidManifest.xml deleted file mode 100644 index 80f16a4..0000000 --- a/doze/AndroidManifest.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doze/proguard.flags b/doze/proguard.flags deleted file mode 100644 index b1cabdb..0000000 --- a/doze/proguard.flags +++ /dev/null @@ -1,8 +0,0 @@ --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keep class ** extends android.support.v14.preference.PreferenceFragment --keep class org.lineageos.settings.doze.* { - *; -} diff --git a/doze/res/drawable/ic_pickup.xml b/doze/res/drawable/ic_pickup.xml deleted file mode 100644 index a7d5eb7..0000000 --- a/doze/res/drawable/ic_pickup.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/doze/res/drawable/ic_pocket.xml b/doze/res/drawable/ic_pocket.xml deleted file mode 100644 index 44ae6e2..0000000 --- a/doze/res/drawable/ic_pocket.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/doze/res/layout/doze.xml b/doze/res/layout/doze.xml deleted file mode 100644 index a7ce3e0..0000000 --- a/doze/res/layout/doze.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - diff --git a/doze/res/values/arrays.xml b/doze/res/values/arrays.xml deleted file mode 100644 index 4712b8d..0000000 --- a/doze/res/values/arrays.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - @string/disabled - @string/pick_up_gesture_summary - @string/pick_up_wake_gesture_summary - - - - 0 - 1 - 2 - - diff --git a/doze/res/xml/doze_settings.xml b/doze/res/xml/doze_settings.xml deleted file mode 100644 index f8cba2b..0000000 --- a/doze/res/xml/doze_settings.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java b/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java deleted file mode 100644 index 43b4044..0000000 --- a/doze/src/org/lineageos/settings/doze/BootCompletedReceiver.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2015 The CyanogenMod Project - * 2017 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -public class BootCompletedReceiver extends BroadcastReceiver { - - private static final boolean DEBUG = false; - private static final String TAG = "OnePlusDoze"; - - @Override - public void onReceive(final Context context, Intent intent) { - if (DEBUG) Log.d(TAG, "Received boot completed intent"); - Utils.checkDozeService(context); - } -} diff --git a/doze/src/org/lineageos/settings/doze/DozeService.java b/doze/src/org/lineageos/settings/doze/DozeService.java deleted file mode 100644 index 3cfae43..0000000 --- a/doze/src/org/lineageos/settings/doze/DozeService.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2015 The CyanogenMod Project - * 2017-2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.IBinder; -import android.util.Log; - -public class DozeService extends Service { - private static final String TAG = "DozeService"; - private static final boolean DEBUG = false; - - private PickupSensor mPickupSensor; - private PocketSensor mPocketSensor; - - @Override - public void onCreate() { - if (DEBUG) Log.d(TAG, "Creating service"); - mPickupSensor = new PickupSensor(this); - mPocketSensor = new PocketSensor(this); - - IntentFilter screenStateFilter = new IntentFilter(); - screenStateFilter.addAction(Intent.ACTION_SCREEN_ON); - screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF); - registerReceiver(mScreenStateReceiver, screenStateFilter); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (DEBUG) Log.d(TAG, "Starting service"); - return START_STICKY; - } - - @Override - public void onDestroy() { - if (DEBUG) Log.d(TAG, "Destroying service"); - super.onDestroy(); - this.unregisterReceiver(mScreenStateReceiver); - mPickupSensor.disable(); - mPocketSensor.disable(); - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - private void onDisplayOn() { - if (DEBUG) Log.d(TAG, "Display on"); - if (Utils.isPickUpEnabled(this)) { - mPickupSensor.disable(); - } - if (Utils.isPocketEnabled(this)) { - mPocketSensor.disable(); - } - } - - private void onDisplayOff() { - if (DEBUG) Log.d(TAG, "Display off"); - if (Utils.isPickUpEnabled(this)) { - mPickupSensor.enable(); - } - if (Utils.isPocketEnabled(this)) { - mPocketSensor.enable(); - } - } - - private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { - onDisplayOn(); - } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { - onDisplayOff(); - } - } - }; -} diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java b/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java deleted file mode 100644 index 1591b2c..0000000 --- a/doze/src/org/lineageos/settings/doze/DozeSettingsActivity.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2015-2016 The CyanogenMod Project - * 2017 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.os.Bundle; -import android.preference.PreferenceActivity; - -public class DozeSettingsActivity extends PreferenceActivity { - - private static final String TAG_DOZE = "doze"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - getFragmentManager().beginTransaction().replace(android.R.id.content, - new DozeSettingsFragment(), TAG_DOZE).commit(); - } -} diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java deleted file mode 100644 index 31723f7..0000000 --- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2015 The CyanogenMod Project - * 2017-2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.app.ActionBar; -import android.app.Activity; -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.DialogFragment; -import android.content.Context; -import android.content.DialogInterface; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.os.Handler; -import android.view.LayoutInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.CompoundButton; -import android.widget.Switch; -import android.widget.TextView; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceFragment; -import androidx.preference.SwitchPreference; - -public class DozeSettingsFragment extends PreferenceFragment implements OnPreferenceChangeListener, - CompoundButton.OnCheckedChangeListener { - - private TextView mTextView; - private View mSwitchBar; - - private SwitchPreference mAlwaysOnDisplayPreference; - - private ListPreference mPickUpPreference; - private SwitchPreference mPocketPreference; - - private Handler mHandler = new Handler(); - - @Override - public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - addPreferencesFromResource(R.xml.doze_settings); - final ActionBar actionBar = getActivity().getActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); - - SharedPreferences prefs = getActivity().getSharedPreferences("doze_settings", - Activity.MODE_PRIVATE); - if (savedInstanceState == null && !prefs.getBoolean("first_help_shown", false)) { - showHelp(); - } - - boolean dozeEnabled = Utils.isDozeEnabled(getActivity()); - - mAlwaysOnDisplayPreference = (SwitchPreference) findPreference(Utils.ALWAYS_ON_DISPLAY); - mAlwaysOnDisplayPreference.setEnabled(dozeEnabled); - mAlwaysOnDisplayPreference.setChecked(Utils.isAlwaysOnEnabled(getActivity())); - mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this); - - PreferenceCategory pickupSensorCategory = (PreferenceCategory) getPreferenceScreen(). - findPreference(Utils.CATEG_PICKUP_SENSOR); - PreferenceCategory proximitySensorCategory = (PreferenceCategory) getPreferenceScreen(). - findPreference(Utils.CATEG_PROX_SENSOR); - - mPickUpPreference = (ListPreference) findPreference(Utils.GESTURE_PICK_UP_KEY); - mPickUpPreference.setEnabled(dozeEnabled); - mPickUpPreference.setOnPreferenceChangeListener(this); - - mPocketPreference = (SwitchPreference) findPreference(Utils.GESTURE_POCKET_KEY); - mPocketPreference.setEnabled(dozeEnabled); - mPocketPreference.setOnPreferenceChangeListener(this); - - // Hide AOD if not supported and set all its dependents otherwise - if (!Utils.alwaysOnDisplayAvailable(getActivity())) { - getPreferenceScreen().removePreference(mAlwaysOnDisplayPreference); - } else { - pickupSensorCategory.setDependency(Utils.ALWAYS_ON_DISPLAY); - proximitySensorCategory.setDependency(Utils.ALWAYS_ON_DISPLAY); - } - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - final View view = LayoutInflater.from(getContext()).inflate(R.layout.doze, container, false); - ((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState)); - return view; - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - - boolean dozeEnabled = Utils.isDozeEnabled(getActivity()); - - mTextView = view.findViewById(R.id.switch_text); - mTextView.setText(getString(dozeEnabled ? - R.string.switch_bar_on : R.string.switch_bar_off)); - - mSwitchBar = view.findViewById(R.id.switch_bar); - Switch switchWidget = mSwitchBar.findViewById(android.R.id.switch_widget); - switchWidget.setChecked(dozeEnabled); - switchWidget.setOnCheckedChangeListener(this); - mSwitchBar.setActivated(dozeEnabled); - mSwitchBar.setOnClickListener(v -> { - switchWidget.setChecked(!switchWidget.isChecked()); - mSwitchBar.setActivated(switchWidget.isChecked()); - }); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (Utils.ALWAYS_ON_DISPLAY.equals(preference.getKey())) { - Utils.enableAlwaysOn(getActivity(), (Boolean) newValue); - } - - mHandler.post(() -> Utils.checkDozeService(getActivity())); - - return true; - } - - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { - Utils.enableDoze(getActivity(), isChecked); - Utils.checkDozeService(getActivity()); - - mTextView.setText(getString(isChecked ? R.string.switch_bar_on : R.string.switch_bar_off)); - mSwitchBar.setActivated(isChecked); - - if (!isChecked) { - Utils.enableAlwaysOn(getActivity(), false); - mAlwaysOnDisplayPreference.setChecked(false); - } - mAlwaysOnDisplayPreference.setEnabled(isChecked); - - mPickUpPreference.setEnabled(isChecked); - mPocketPreference.setEnabled(isChecked); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - getActivity().onBackPressed(); - return true; - } - return false; - } - - private static class HelpDialogFragment extends DialogFragment { - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - return new AlertDialog.Builder(getActivity()) - .setTitle(R.string.doze_settings_help_title) - .setMessage(R.string.doze_settings_help_text) - .setNegativeButton(R.string.dialog_ok, (dialog, which) -> dialog.cancel()) - .create(); - } - - @Override - public void onCancel(DialogInterface dialog) { - getActivity().getSharedPreferences("doze_settings", Activity.MODE_PRIVATE) - .edit() - .putBoolean("first_help_shown", true) - .commit(); - } - } - - private void showHelp() { - HelpDialogFragment fragment = new HelpDialogFragment(); - fragment.show(getFragmentManager(), "help_dialog"); - } -} diff --git a/doze/src/org/lineageos/settings/doze/PickupSensor.java b/doze/src/org/lineageos/settings/doze/PickupSensor.java deleted file mode 100644 index a2a0c89..0000000 --- a/doze/src/org/lineageos/settings/doze/PickupSensor.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2015 The CyanogenMod Project - * 2017-2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.content.Context; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.os.PowerManager; -import android.os.PowerManager.WakeLock; -import android.os.SystemClock; -import android.util.Log; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -public class PickupSensor implements SensorEventListener { - - private static final boolean DEBUG = false; - private static final String TAG = "PickupSensor"; - - private static final int MIN_PULSE_INTERVAL_MS = 2500; - private static final int MIN_WAKEUP_INTERVAL_MS = 1000; - private static final int WAKELOCK_TIMEOUT_MS = 300; - - private PowerManager mPowerManager; - private SensorManager mSensorManager; - private Sensor mSensor; - private WakeLock mWakeLock; - private Context mContext; - private ExecutorService mExecutorService; - - private long mEntryTimestamp; - - public PickupSensor(Context context) { - mContext = context; - mPowerManager = mContext.getSystemService(PowerManager.class); - mSensorManager = mContext.getSystemService(SensorManager.class); - mSensor = Utils.getSensor(mSensorManager, "oneplus.sensor.op_motion_detect"); - mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); - mExecutorService = Executors.newSingleThreadExecutor(); - } - - private Future submit(Runnable runnable) { - return mExecutorService.submit(runnable); - } - - @Override - public void onSensorChanged(SensorEvent event) { - if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]); - - long delta = SystemClock.elapsedRealtime() - mEntryTimestamp; - if (delta < MIN_PULSE_INTERVAL_MS) { - return; - } - - mEntryTimestamp = SystemClock.elapsedRealtime(); - - if (event.values[0] == 1) { - if (Utils.isPickUpSetToWake(mContext)) { - mWakeLock.acquire(WAKELOCK_TIMEOUT_MS); - mPowerManager.wakeUpWithProximityCheck(SystemClock.uptimeMillis(), - PowerManager.WAKE_REASON_GESTURE, TAG); - } else { - Utils.launchDozePulse(mContext); - } - } - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - /* Empty */ - } - - protected void enable() { - if (DEBUG) Log.d(TAG, "Enabling"); - submit(() -> { - mEntryTimestamp = SystemClock.elapsedRealtime(); - mSensorManager.registerListener(this, mSensor, - SensorManager.SENSOR_DELAY_NORMAL); - }); - } - - protected void disable() { - if (DEBUG) Log.d(TAG, "Disabling"); - submit(() -> { - mSensorManager.unregisterListener(this, mSensor); - }); - } -} diff --git a/doze/src/org/lineageos/settings/doze/PocketSensor.java b/doze/src/org/lineageos/settings/doze/PocketSensor.java deleted file mode 100644 index a4e2208..0000000 --- a/doze/src/org/lineageos/settings/doze/PocketSensor.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016 The CyanogenMod Project - * Copyright (c) 2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.content.Context; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.os.SystemClock; -import android.util.Log; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -public class PocketSensor implements SensorEventListener { - - private static final boolean DEBUG = false; - private static final String TAG = "PocketSensor"; - - private static final int MIN_PULSE_INTERVAL_MS = 2500; - - private SensorManager mSensorManager; - private Sensor mSensor; - private Context mContext; - private ExecutorService mExecutorService; - - private long mEntryTimestamp; - - public PocketSensor(Context context) { - mContext = context; - mSensorManager = mContext.getSystemService(SensorManager.class); - mSensor = Utils.getSensor(mSensorManager, "oneplus.sensor.pocket"); - mExecutorService = Executors.newSingleThreadExecutor(); - } - - private Future submit(Runnable runnable) { - return mExecutorService.submit(runnable); - } - - @Override - public void onSensorChanged(SensorEvent event) { - if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]); - - long delta = SystemClock.elapsedRealtime() - mEntryTimestamp; - if (delta < MIN_PULSE_INTERVAL_MS) { - return; - } - - mEntryTimestamp = SystemClock.elapsedRealtime(); - - if (event.values[0] == 0.0) { - Utils.launchDozePulse(mContext); - } - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - /* Empty */ - } - - protected void enable() { - if (DEBUG) Log.d(TAG, "Enabling"); - submit(() -> { - mEntryTimestamp = SystemClock.elapsedRealtime(); - mSensorManager.registerListener(this, mSensor, - SensorManager.SENSOR_DELAY_NORMAL); - }); - } - - protected void disable() { - if (DEBUG) Log.d(TAG, "Disabling"); - submit(() -> { - mSensorManager.unregisterListener(this, mSensor); - }); - } -} diff --git a/doze/src/org/lineageos/settings/doze/Utils.java b/doze/src/org/lineageos/settings/doze/Utils.java deleted file mode 100644 index 786c824..0000000 --- a/doze/src/org/lineageos/settings/doze/Utils.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2015 The CyanogenMod Project - * 2017-2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.doze; - -import android.content.Context; -import android.content.Intent; -import android.hardware.display.AmbientDisplayConfiguration; -import android.hardware.Sensor; -import android.hardware.SensorManager; -import android.os.UserHandle; -import android.provider.Settings; -import android.util.Log; -import androidx.preference.PreferenceManager; - -import static android.provider.Settings.Secure.DOZE_ALWAYS_ON; -import static android.provider.Settings.Secure.DOZE_ENABLED; - -public final class Utils { - - private static final String TAG = "DozeUtils"; - private static final boolean DEBUG = false; - - private static final String DOZE_INTENT = "com.android.systemui.doze.pulse"; - - protected static final String ALWAYS_ON_DISPLAY = "always_on_display"; - - protected static final String CATEG_PICKUP_SENSOR = "pickup_sensor"; - protected static final String CATEG_PROX_SENSOR = "proximity_sensor"; - - protected static final String GESTURE_PICK_UP_KEY = "gesture_pick_up_type"; - protected static final String GESTURE_POCKET_KEY = "gesture_pocket"; - - protected static void startService(Context context) { - if (DEBUG) Log.d(TAG, "Starting service"); - context.startServiceAsUser(new Intent(context, DozeService.class), - UserHandle.CURRENT); - } - - protected static void stopService(Context context) { - if (DEBUG) Log.d(TAG, "Stopping service"); - context.stopServiceAsUser(new Intent(context, DozeService.class), - UserHandle.CURRENT); - } - - protected static void checkDozeService(Context context) { - if (isDozeEnabled(context) && !isAlwaysOnEnabled(context) && areGesturesEnabled(context)) { - startService(context); - } else { - stopService(context); - } - } - - protected static boolean isDozeEnabled(Context context) { - return Settings.Secure.getInt(context.getContentResolver(), - DOZE_ENABLED, 1) != 0; - } - - protected static boolean enableDoze(Context context, boolean enable) { - return Settings.Secure.putInt(context.getContentResolver(), - DOZE_ENABLED, enable ? 1 : 0); - } - - protected static void launchDozePulse(Context context) { - if (DEBUG) Log.d(TAG, "Launch doze pulse"); - context.sendBroadcastAsUser(new Intent(DOZE_INTENT), - new UserHandle(UserHandle.USER_CURRENT)); - } - - protected static boolean enableAlwaysOn(Context context, boolean enable) { - return Settings.Secure.putIntForUser(context.getContentResolver(), - DOZE_ALWAYS_ON, enable ? 1 : 0, UserHandle.USER_CURRENT); - } - - protected static boolean isAlwaysOnEnabled(Context context) { - return Settings.Secure.getIntForUser(context.getContentResolver(), - DOZE_ALWAYS_ON, 0, UserHandle.USER_CURRENT) != 0; - } - - protected static boolean alwaysOnDisplayAvailable(Context context) { - return new AmbientDisplayConfiguration(context).alwaysOnAvailable(); - } - - protected static boolean isGestureEnabled(Context context, String gesture) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(gesture, false); - } - - protected static boolean isPickUpEnabled(Context context) { - return !PreferenceManager.getDefaultSharedPreferences(context) - .getString(GESTURE_PICK_UP_KEY, "0").equals("0"); - } - - protected static boolean isPickUpSetToWake(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getString(GESTURE_PICK_UP_KEY, "0").equals("2"); - } - - protected static boolean isPocketEnabled(Context context) { - return isGestureEnabled(context, GESTURE_POCKET_KEY); - } - - public static boolean areGesturesEnabled(Context context) { - return isPickUpEnabled(context) || isPocketEnabled(context); - } - - protected static Sensor getSensor(SensorManager sm, String type) { - for (Sensor sensor : sm.getSensorList(Sensor.TYPE_ALL)) { - if (type.equals(sensor.getStringType())) { - return sensor; - } - } - return null; - } -} diff --git a/fingerprint/Android.bp b/fingerprint/Android.bp deleted file mode 100644 index 43345b0..0000000 --- a/fingerprint/Android.bp +++ /dev/null @@ -1,22 +0,0 @@ -cc_binary { - name: "android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina", - defaults: ["hidl_defaults"], - init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.rc"], - vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.xml"], - vendor: true, - relative_install_path: "hw", - srcs: [ - "BiometricsFingerprint.cpp", - "service.cpp", - ], - - shared_libs: [ - "libcutils", - "liblog", - "libhidlbase", - "libhardware", - "libutils", - "android.hardware.biometrics.fingerprint@2.1", - ], - -} diff --git a/fingerprint/BiometricsFingerprint.cpp b/fingerprint/BiometricsFingerprint.cpp deleted file mode 100644 index 7ff7681..0000000 --- a/fingerprint/BiometricsFingerprint.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service" -#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service" - -#include - -#include -#include -#include "BiometricsFingerprint.h" - -#include -#include -#include - -namespace android { -namespace hardware { -namespace biometrics { -namespace fingerprint { -namespace V2_1 { -namespace implementation { - -// Supported fingerprint HAL version -static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1); - -using RequestStatus = - android::hardware::biometrics::fingerprint::V2_1::RequestStatus; - -BiometricsFingerprint *BiometricsFingerprint::sInstance = nullptr; - -BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr) { - sInstance = this; // keep track of the most recent instance - mDevice = openHal(); - if (!mDevice) { - ALOGE("Can't open HAL module"); - } -} - -BiometricsFingerprint::~BiometricsFingerprint() { - ALOGV("~BiometricsFingerprint()"); - if (mDevice == nullptr) { - ALOGE("No valid device"); - return; - } - int err; - if (0 != (err = mDevice->common.close( - reinterpret_cast(mDevice)))) { - ALOGE("Can't close fingerprint module, error: %d", err); - return; - } - mDevice = nullptr; -} - -Return BiometricsFingerprint::ErrorFilter(int32_t error) { - switch(error) { - case 0: return RequestStatus::SYS_OK; - case -2: return RequestStatus::SYS_ENOENT; - case -4: return RequestStatus::SYS_EINTR; - case -5: return RequestStatus::SYS_EIO; - case -11: return RequestStatus::SYS_EAGAIN; - case -12: return RequestStatus::SYS_ENOMEM; - case -13: return RequestStatus::SYS_EACCES; - case -14: return RequestStatus::SYS_EFAULT; - case -16: return RequestStatus::SYS_EBUSY; - case -22: return RequestStatus::SYS_EINVAL; - case -28: return RequestStatus::SYS_ENOSPC; - case -110: return RequestStatus::SYS_ETIMEDOUT; - default: - ALOGE("An unknown error returned from fingerprint vendor library: %d", error); - return RequestStatus::SYS_UNKNOWN; - } -} - -// Translate from errors returned by traditional HAL (see fingerprint.h) to -// HIDL-compliant FingerprintError. -FingerprintError BiometricsFingerprint::VendorErrorFilter(int32_t error, - int32_t* vendorCode) { - *vendorCode = 0; - switch(error) { - case FINGERPRINT_ERROR_HW_UNAVAILABLE: - return FingerprintError::ERROR_HW_UNAVAILABLE; - case FINGERPRINT_ERROR_UNABLE_TO_PROCESS: - return FingerprintError::ERROR_UNABLE_TO_PROCESS; - case FINGERPRINT_ERROR_TIMEOUT: - return FingerprintError::ERROR_TIMEOUT; - case FINGERPRINT_ERROR_NO_SPACE: - return FingerprintError::ERROR_NO_SPACE; - case FINGERPRINT_ERROR_CANCELED: - return FingerprintError::ERROR_CANCELED; - case FINGERPRINT_ERROR_UNABLE_TO_REMOVE: - return FingerprintError::ERROR_UNABLE_TO_REMOVE; - case FINGERPRINT_ERROR_LOCKOUT: - return FingerprintError::ERROR_LOCKOUT; - default: - if (error >= FINGERPRINT_ERROR_VENDOR_BASE) { - // vendor specific code. - *vendorCode = error - FINGERPRINT_ERROR_VENDOR_BASE; - return FingerprintError::ERROR_VENDOR; - } - } - ALOGE("Unknown error from fingerprint vendor library: %d", error); - return FingerprintError::ERROR_UNABLE_TO_PROCESS; -} - -// Translate acquired messages returned by traditional HAL (see fingerprint.h) -// to HIDL-compliant FingerprintAcquiredInfo. -FingerprintAcquiredInfo BiometricsFingerprint::VendorAcquiredFilter( - int32_t info, int32_t* vendorCode) { - *vendorCode = 0; - switch(info) { - case FINGERPRINT_ACQUIRED_GOOD: - return FingerprintAcquiredInfo::ACQUIRED_GOOD; - case FINGERPRINT_ACQUIRED_PARTIAL: - return FingerprintAcquiredInfo::ACQUIRED_PARTIAL; - case FINGERPRINT_ACQUIRED_INSUFFICIENT: - return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT; - case FINGERPRINT_ACQUIRED_IMAGER_DIRTY: - return FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY; - case FINGERPRINT_ACQUIRED_TOO_SLOW: - return FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW; - case FINGERPRINT_ACQUIRED_TOO_FAST: - return FingerprintAcquiredInfo::ACQUIRED_TOO_FAST; - default: - if (info >= FINGERPRINT_ACQUIRED_VENDOR_BASE) { - // vendor specific code. - *vendorCode = info - FINGERPRINT_ACQUIRED_VENDOR_BASE; - return FingerprintAcquiredInfo::ACQUIRED_VENDOR; - } - } - ALOGE("Unknown acquiredmsg from fingerprint vendor library: %d", info); - return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT; -} - -Return BiometricsFingerprint::setNotify( - const sp& clientCallback) { - std::lock_guard lock(mClientCallbackMutex); - mClientCallback = clientCallback; - // This is here because HAL 2.1 doesn't have a way to propagate a - // unique token for its driver. Subsequent versions should send a unique - // token for each call to setNotify(). This is fine as long as there's only - // one fingerprint device on the platform. - return reinterpret_cast(mDevice); -} - -Return BiometricsFingerprint::preEnroll() { - return mDevice->pre_enroll(mDevice); -} - -Return BiometricsFingerprint::enroll(const hidl_array& hat, - uint32_t gid, uint32_t timeoutSec) { - const hw_auth_token_t* authToken = - reinterpret_cast(hat.data()); - return ErrorFilter(mDevice->enroll(mDevice, authToken, gid, timeoutSec)); -} - -Return BiometricsFingerprint::postEnroll() { - return ErrorFilter(mDevice->post_enroll(mDevice)); -} - -Return BiometricsFingerprint::getAuthenticatorId() { - return mDevice->get_authenticator_id(mDevice); -} - -Return BiometricsFingerprint::cancel() { - return ErrorFilter(mDevice->cancel(mDevice)); -} - -Return BiometricsFingerprint::enumerate() { - return ErrorFilter(mDevice->enumerate(mDevice)); -} - -Return BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) { - return ErrorFilter(mDevice->remove(mDevice, gid, fid)); -} - -Return BiometricsFingerprint::setActiveGroup(uint32_t gid, - const hidl_string& storePath) { - if (storePath.size() >= PATH_MAX || storePath.size() <= 0) { - ALOGE("Bad path length: %zd", storePath.size()); - return RequestStatus::SYS_EINVAL; - } - if (access(storePath.c_str(), W_OK)) { - return RequestStatus::SYS_EINVAL; - } - - return ErrorFilter(mDevice->set_active_group(mDevice, gid, - storePath.c_str())); -} - -Return BiometricsFingerprint::authenticate(uint64_t operationId, - uint32_t gid) { - return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid)); -} - -IBiometricsFingerprint* BiometricsFingerprint::getInstance() { - if (!sInstance) { - sInstance = new BiometricsFingerprint(); - } - return sInstance; -} - -const char* BiometricsFingerprint::getModuleId() { - int sensor_version = -1; - std::ifstream file("/sys/devices/platform/soc/soc:fingerprint_detect/sensor_version"); - file >> sensor_version; - ALOGI("fp sensor version is: 0x%x", sensor_version); - return sensor_version == 0x9638 ? "goodix.g6.fod" : "goodix.fod"; -} - -fingerprint_device_t* BiometricsFingerprint::openHal() { - int err; - const hw_module_t *hw_mdl = nullptr; - ALOGD("Opening fingerprint hal library..."); - if (0 != (err = hw_get_module(getModuleId(), &hw_mdl))) { - ALOGE("Can't open fingerprint HW Module, error: %d", err); - return nullptr; - } - - if (hw_mdl == nullptr) { - ALOGE("No valid fingerprint module"); - return nullptr; - } - - fingerprint_module_t const *module = - reinterpret_cast(hw_mdl); - if (module->common.methods->open == nullptr) { - ALOGE("No valid open method"); - return nullptr; - } - - hw_device_t *device = nullptr; - - if (0 != (err = module->common.methods->open(hw_mdl, nullptr, &device))) { - ALOGE("Can't open fingerprint methods, error: %d", err); - return nullptr; - } - - if (kVersion != device->version) { - // enforce version on new devices because of HIDL@2.1 translation layer - ALOGE("Wrong fp version. Expected %d, got %d", kVersion, device->version); - return nullptr; - } - - fingerprint_device_t* fp_device = - reinterpret_cast(device); - - if (0 != (err = - fp_device->set_notify(fp_device, BiometricsFingerprint::notify))) { - ALOGE("Can't register fingerprint module callback, error: %d", err); - return nullptr; - } - - return fp_device; -} - -void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) { - BiometricsFingerprint* thisPtr = static_cast( - BiometricsFingerprint::getInstance()); - std::lock_guard lock(thisPtr->mClientCallbackMutex); - if (thisPtr == nullptr || thisPtr->mClientCallback == nullptr) { - ALOGE("Receiving callbacks before the client callback is registered."); - return; - } - const uint64_t devId = reinterpret_cast(thisPtr->mDevice); - switch (msg->type) { - case FINGERPRINT_ERROR: { - int32_t vendorCode = 0; - FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode); - ALOGD("onError(%d)", result); - if (!thisPtr->mClientCallback->onError(devId, result, vendorCode).isOk()) { - ALOGE("failed to invoke fingerprint onError callback"); - } - } - break; - case FINGERPRINT_ACQUIRED: { - int32_t vendorCode = 0; - FingerprintAcquiredInfo result = - VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode); - ALOGD("onAcquired(%d)", result); - if (!thisPtr->mClientCallback->onAcquired(devId, result, vendorCode).isOk()) { - ALOGE("failed to invoke fingerprint onAcquired callback"); - } - } - break; - case FINGERPRINT_TEMPLATE_ENROLLING: - ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)", - msg->data.enroll.finger.fid, - msg->data.enroll.finger.gid, - msg->data.enroll.samples_remaining); - if (!thisPtr->mClientCallback->onEnrollResult(devId, - msg->data.enroll.finger.fid, - msg->data.enroll.finger.gid, - msg->data.enroll.samples_remaining).isOk()) { - ALOGE("failed to invoke fingerprint onEnrollResult callback"); - } - break; - case FINGERPRINT_TEMPLATE_REMOVED: - ALOGD("onRemove(fid=%d, gid=%d, rem=%d)", - msg->data.removed.finger.fid, - msg->data.removed.finger.gid, - msg->data.removed.remaining_templates); - if (!thisPtr->mClientCallback->onRemoved(devId, - msg->data.removed.finger.fid, - msg->data.removed.finger.gid, - msg->data.removed.remaining_templates).isOk()) { - ALOGE("failed to invoke fingerprint onRemoved callback"); - } - break; - case FINGERPRINT_AUTHENTICATED: - if (msg->data.authenticated.finger.fid != 0) { - ALOGD("onAuthenticated(fid=%d, gid=%d)", - msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid); - const uint8_t* hat = - reinterpret_cast(&msg->data.authenticated.hat); - const hidl_vec token( - std::vector(hat, hat + sizeof(msg->data.authenticated.hat))); - if (!thisPtr->mClientCallback->onAuthenticated(devId, - msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, - token).isOk()) { - ALOGE("failed to invoke fingerprint onAuthenticated callback"); - } - } else { - // Not a recognized fingerprint - if (!thisPtr->mClientCallback->onAuthenticated(devId, - msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, - hidl_vec()).isOk()) { - ALOGE("failed to invoke fingerprint onAuthenticated callback"); - } - } - break; - case FINGERPRINT_TEMPLATE_ENUMERATING: - ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)", - msg->data.enumerated.finger.fid, - msg->data.enumerated.finger.gid, - msg->data.enumerated.remaining_templates); - if (!thisPtr->mClientCallback->onEnumerate(devId, - msg->data.enumerated.finger.fid, - msg->data.enumerated.finger.gid, - msg->data.enumerated.remaining_templates).isOk()) { - ALOGE("failed to invoke fingerprint onEnumerate callback"); - } - break; - } -} - -} // namespace implementation -} // namespace V2_1 -} // namespace fingerprint -} // namespace biometrics -} // namespace hardware -} // namespace android diff --git a/fingerprint/BiometricsFingerprint.h b/fingerprint/BiometricsFingerprint.h deleted file mode 100644 index 9ff5089..0000000 --- a/fingerprint/BiometricsFingerprint.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H -#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H - -#include -#include -#include -#include -#include -#include -#include - -namespace android { -namespace hardware { -namespace biometrics { -namespace fingerprint { -namespace V2_1 { -namespace implementation { - -using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint; -using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback; -using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_string; -using ::android::sp; - -struct BiometricsFingerprint : public IBiometricsFingerprint { -public: - BiometricsFingerprint(); - ~BiometricsFingerprint(); - - // Method to wrap legacy HAL with BiometricsFingerprint class - static IBiometricsFingerprint* getInstance(); - - // Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow. - Return setNotify(const sp& clientCallback) override; - Return preEnroll() override; - Return enroll(const hidl_array& hat, uint32_t gid, uint32_t timeoutSec) override; - Return postEnroll() override; - Return getAuthenticatorId() override; - Return cancel() override; - Return enumerate() override; - Return remove(uint32_t gid, uint32_t fid) override; - Return setActiveGroup(uint32_t gid, const hidl_string& storePath) override; - Return authenticate(uint64_t operationId, uint32_t gid) override; - -private: - static const char* getModuleId(); - static fingerprint_device_t* openHal(); - static void notify(const fingerprint_msg_t *msg); /* Static callback for legacy HAL implementation */ - static Return ErrorFilter(int32_t error); - static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode); - static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode); - static BiometricsFingerprint* sInstance; - - std::mutex mClientCallbackMutex; - sp mClientCallback; - fingerprint_device_t *mDevice; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace fingerprint -} // namespace biometrics -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H diff --git a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.rc b/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.rc deleted file mode 100644 index 256fcb9..0000000 --- a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.rc +++ /dev/null @@ -1,8 +0,0 @@ -service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina - # "class hal" causes a race condition on some devices due to files created - # in /data. As a workaround, postpone startup until later in boot once - # /data is mounted. - class late_start - user system - group system input uhid - #writepid /dev/cpuset/system-background/tasks diff --git a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.xml b/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.xml deleted file mode 100644 index 115dd7b..0000000 --- a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.oneplus_lahaina.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - android.hardware.biometrics.fingerprint - hwbinder - 2.1 - - IBiometricsFingerprint - default - - - diff --git a/fingerprint/service.cpp b/fingerprint/service.cpp deleted file mode 100644 index edfaac4..0000000 --- a/fingerprint/service.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service" - -#include -#include -#include -#include -#include -#include "BiometricsFingerprint.h" - -using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint; -using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::sp; - -int main() { - android::sp bio = BiometricsFingerprint::getInstance(); - - configureRpcThreadpool(1, true /*callerWillJoin*/); - - if (bio != nullptr) { - if (::android::OK != bio->registerAsService()) { - return 1; - } - } else { - ALOGE("Can't create instance of BiometricsFingerprint, nullptr"); - } - - joinRpcThreadpool(); - - return 0; // should never get here -} diff --git a/fod/Android.bp b/fod/Android.bp deleted file mode 100644 index 6e92413..0000000 --- a/fod/Android.bp +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (C) 2019-2021 The LineageOS Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -soong_config_module_type { - name: "oneplus_lahaina_fod_hal_cc_defaults", - module_type: "cc_defaults", - config_namespace: "ONEPLUS_LAHAINA_FOD", - value_variables: ["POS_X", "POS_Y", "SIZE"], - properties: ["cppflags"], -} - -oneplus_lahaina_fod_hal_cc_defaults { - name: "oneplus_lahaina_fod_hal_defaults", - soong_config_variables: { - POS_X: { - cppflags: ["-DFOD_POS_X=%s"], - }, - POS_Y: { - cppflags: ["-DFOD_POS_Y=%s"], - }, - SIZE: { - cppflags: ["-DFOD_SIZE=%s"], - }, - }, -} - -cc_binary { - name: "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina", - defaults: [ - "hidl_defaults", - "oneplus_lahaina_fod_hal_defaults", - ], - relative_install_path: "hw", - init_rc: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc"], - vintf_fragments: ["vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml"], - srcs: ["service.cpp", "FingerprintInscreen.cpp"], - shared_libs: [ - "libbase", - "libhardware", - "libhidlbase", - "liblog", - "libutils", - "vendor.lineage.biometrics.fingerprint.inscreen@1.0", - "//device/oneplus/common:vendor.oneplus.fingerprint.extension@1.0", - "//device/oneplus/common:vendor.oneplus.hardware.display@1.0", - ], - proprietary: true, -} - -cc_library_static { - name: "libfod_extension.oneplus_lahaina", - srcs: ["FodExtension.cpp"], - include_dirs: [ - "frameworks/native/services/surfaceflinger/CompositionEngine/include" - ], -} diff --git a/fod/FingerprintInscreen.cpp b/fod/FingerprintInscreen.cpp deleted file mode 100644 index 4fe359d..0000000 --- a/fod/FingerprintInscreen.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "FingerprintInscreenService" - -#include "FingerprintInscreen.h" -#include -#include -#include - -#define FINGERPRINT_ACQUIRED_VENDOR 6 -#define FINGERPRINT_ERROR_VENDOR 8 - -#define OP_ENABLE_FP_LONGPRESS 3 -#define OP_DISABLE_FP_LONGPRESS 4 -#define OP_RESUME_FP_ENROLL 8 -#define OP_FINISH_FP_ENROLL 10 - -#define OP_DISPLAY_AOD_MODE 8 -#define OP_DISPLAY_NOTIFY_PRESS 9 -#define OP_DISPLAY_SET_DIM 10 - -namespace vendor { -namespace lineage { -namespace biometrics { -namespace fingerprint { -namespace inscreen { -namespace V1_0 { -namespace implementation { - -/* - * Write value to path and close file. - */ -template -static void set(const std::string& path, const T& value) { - std::ofstream file(path); - file << value; -} - -template -static T get(const std::string& path, const T& def) { - std::ifstream file(path); - T result; - - file >> result; - return file.fail() ? def : result; -} - -FingerprintInscreen::FingerprintInscreen() { - this->mFodCircleVisible = false; - this->mVendorFpService = IVendorFingerprintExtensions::getService(); - this->mVendorDisplayService = IOneplusDisplay::getService(); -} - -Return FingerprintInscreen::onStartEnroll() { - this->mVendorFpService->updateStatus(OP_DISABLE_FP_LONGPRESS); - this->mVendorFpService->updateStatus(OP_RESUME_FP_ENROLL); - - return Void(); -} - -Return FingerprintInscreen::onFinishEnroll() { - this->mVendorFpService->updateStatus(OP_FINISH_FP_ENROLL); - - return Void(); -} - -Return FingerprintInscreen::onPress() { - this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 1); - - return Void(); -} - -Return FingerprintInscreen::onRelease() { - this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0); - - return Void(); -} - -Return FingerprintInscreen::onShowFODView() { - this->mFodCircleVisible = true; - this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 1); - - return Void(); -} - -Return FingerprintInscreen::onHideFODView() { - this->mFodCircleVisible = false; - this->mVendorDisplayService->setMode(OP_DISPLAY_AOD_MODE, 0); - this->mVendorDisplayService->setMode(OP_DISPLAY_SET_DIM, 0); - this->mVendorDisplayService->setMode(OP_DISPLAY_NOTIFY_PRESS, 0); - - return Void(); -} - -Return FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t vendorCode) { - std::lock_guard _lock(mCallbackLock); - if (mCallback == nullptr) { - return false; - } - - if (acquiredInfo == FINGERPRINT_ACQUIRED_VENDOR) { - if (mFodCircleVisible && vendorCode == 0) { - Return ret = mCallback->onFingerDown(); - if (!ret.isOk()) { - LOG(ERROR) << "FingerDown() error: " << ret.description(); - } - return true; - } - - if (mFodCircleVisible && vendorCode == 1) { - Return ret = mCallback->onFingerUp(); - if (!ret.isOk()) { - LOG(ERROR) << "FingerUp() error: " << ret.description(); - } - return true; - } - } - - return false; -} - -Return FingerprintInscreen::handleError(int32_t error, int32_t vendorCode) { - return error == FINGERPRINT_ERROR_VENDOR && vendorCode == 6; -} - -Return FingerprintInscreen::setLongPressEnabled(bool enabled) { - this->mVendorFpService->updateStatus( - enabled ? OP_ENABLE_FP_LONGPRESS : OP_DISABLE_FP_LONGPRESS); - - return Void(); -} - -Return FingerprintInscreen::getDimAmount(int32_t) { - return 0; -} - -Return FingerprintInscreen::shouldBoostBrightness() { - return false; -} - -Return FingerprintInscreen::setCallback(const sp& callback) { - { - std::lock_guard _lock(mCallbackLock); - mCallback = callback; - } - - return Void(); -} - -Return FingerprintInscreen::getPositionX() { - return FOD_POS_X; -} - -Return FingerprintInscreen::getPositionY() { - return FOD_POS_Y; -} - -Return FingerprintInscreen::getSize() { - return FOD_SIZE; -} - -} // namespace implementation -} // namespace V1_0 -} // namespace inscreen -} // namespace fingerprint -} // namespace biometrics -} // namespace lineage -} // namespace vendor diff --git a/fod/FingerprintInscreen.h b/fod/FingerprintInscreen.h deleted file mode 100644 index 457405c..0000000 --- a/fod/FingerprintInscreen.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef VENDOR_LINEAGE_BIOMETRICS_FINGERPRINT_INSCREEN_V1_0_FINGERPRINTINSCREEN_H -#define VENDOR_LINEAGE_BIOMETRICS_FINGERPRINT_INSCREEN_V1_0_FINGERPRINTINSCREEN_H - -#include -#include -#include - -namespace vendor { -namespace lineage { -namespace biometrics { -namespace fingerprint { -namespace inscreen { -namespace V1_0 { -namespace implementation { - -using ::android::sp; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::vendor::oneplus::fingerprint::extension::V1_0::IVendorFingerprintExtensions; -using ::vendor::oneplus::hardware::display::V1_0::IOneplusDisplay; - -class FingerprintInscreen : public IFingerprintInscreen { - public: - FingerprintInscreen(); - - Return onStartEnroll() override; - Return onFinishEnroll() override; - Return onPress() override; - Return onRelease() override; - Return onShowFODView() override; - Return onHideFODView() override; - Return handleAcquired(int32_t acquiredInfo, int32_t vendorCode) override; - Return handleError(int32_t error, int32_t vendorCode) override; - Return setLongPressEnabled(bool enabled) override; - Return getDimAmount(int32_t cur_brightness) override; - Return shouldBoostBrightness() override; - Return setCallback(const sp& callback) override; - Return getPositionX() override; - Return getPositionY() override; - Return getSize() override; - - private: - bool mFodCircleVisible; - - sp mVendorDisplayService; - sp mVendorFpService; - - std::mutex mCallbackLock; - sp mCallback; -}; - -} // namespace implementation -} // namespace V1_0 -} // namespace inscreen -} // namespace fingerprint -} // namespace biometrics -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_BIOMETRICS_FINGERPRINT_INSCREEN_V1_0_FINGERPRINTINSCREEN_H diff --git a/fod/FodExtension.cpp b/fod/FodExtension.cpp deleted file mode 100644 index b8f7291..0000000 --- a/fod/FodExtension.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -uint32_t getFodZOrder(uint32_t z, bool touched) { - return touched ? 0xfc8 : z; -} - -uint64_t getFodUsageBits(uint64_t usageBits, bool) { - return usageBits; -} diff --git a/fod/service.cpp b/fod/service.cpp deleted file mode 100644 index 83fd7ad..0000000 --- a/fod/service.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina" - -#include -#include - -#include "FingerprintInscreen.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -using vendor::lineage::biometrics::fingerprint::inscreen::V1_0::IFingerprintInscreen; -using vendor::lineage::biometrics::fingerprint::inscreen::V1_0::implementation::FingerprintInscreen; - -using android::OK; -using android::status_t; - -int main() { - android::sp service = new FingerprintInscreen(); - - configureRpcThreadpool(1, true); - - status_t status = service->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Cannot register FOD HAL service."; - return 1; - } - - LOG(INFO) << "FOD HAL service ready."; - - joinRpcThreadpool(); - - LOG(ERROR) << "FOD HAL service failed to join thread pool."; - return 1; -} diff --git a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc b/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc deleted file mode 100644 index 4480a6c..0000000 --- a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.rc +++ /dev/null @@ -1,6 +0,0 @@ -service vendor.fingerprint-inscreen-1-0 /vendor/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina - interface vendor.lineage.biometrics.fingerprint.inscreen@1.0::IFingerprintInscreen default - class hal - user system - group system - shutdown critical diff --git a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml b/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml deleted file mode 100644 index e03c70c..0000000 --- a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_lahaina.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.lineage.biometrics.fingerprint.inscreen - hwbinder - 1.0 - - IFingerprintInscreen - default - - - diff --git a/lineage.dependencies b/lineage.dependencies index f2f83de..b18d598 100644 --- a/lineage.dependencies +++ b/lineage.dependencies @@ -1,7 +1,7 @@ [ { - "repository": "android_device_oneplus_common", - "target_path": "device/oneplus/common" + "repository": "android_hardware_oneplus", + "target_path": "hardware/oneplus" }, { "repository": "android_kernel_oneplus_sm8350", diff --git a/livedisplay/.clang-format b/livedisplay/.clang-format deleted file mode 100644 index ae4a451..0000000 --- a/livedisplay/.clang-format +++ /dev/null @@ -1,11 +0,0 @@ -BasedOnStyle: Google -AccessModifierOffset: -2 -AllowShortFunctionsOnASingleLine: Inline -ColumnLimit: 100 -CommentPragmas: NOLINT:.* -DerivePointerAlignment: false -IndentWidth: 4 -PointerAlignment: Left -TabWidth: 4 -UseTab: Never -PenaltyExcessCharacter: 32 diff --git a/livedisplay/Android.bp b/livedisplay/Android.bp deleted file mode 100644 index d29f7b8..0000000 --- a/livedisplay/Android.bp +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (C) 2019 The LineageOS Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_binary { - name: "vendor.lineage.livedisplay@2.1-service.oneplus_lahaina", - init_rc: ["vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.rc"], - vintf_fragments: ["vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.xml"], - defaults: ["hidl_defaults"], - relative_install_path: "hw", - srcs: [ - ":vendor.lineage.livedisplay@2.0-sdm-pa", - ":vendor.lineage.livedisplay@2.0-sdm-utils", - "AntiFlicker.cpp", - "SunlightEnhancement.cpp", - "service.cpp", - ], - shared_libs: [ - "libbase", - "libbinder", - "libhidlbase", - "libutils", - "vendor.lineage.livedisplay@2.0", - "vendor.lineage.livedisplay@2.1", - ], - header_libs: [ - "vendor.lineage.livedisplay@2.0-sdm-headers", - ], - proprietary: true, -} diff --git a/livedisplay/AntiFlicker.cpp b/livedisplay/AntiFlicker.cpp deleted file mode 100644 index 17bbf85..0000000 --- a/livedisplay/AntiFlicker.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2021 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "AntiFlickerService" - -#include "AntiFlicker.h" -#include -#include - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -static constexpr const char* kDcDimmingPath = - "/sys/devices/platform/soc/ae00000.qcom,mdss_mdp/drm/card0/card0-DSI-1/dimlayer_bl_en"; - -Return AntiFlicker::isEnabled() { - std::ifstream file(kDcDimmingPath); - int result = -1; - file >> result; - LOG(DEBUG) << "Got result " << result << " fail " << file.fail(); - return !file.fail() && result > 0; -} - -Return AntiFlicker::setEnabled(bool enabled) { - std::ofstream file(kDcDimmingPath); - file << (enabled ? "1" : "0"); - LOG(DEBUG) << "setEnabled fail " << file.fail(); - return !file.fail(); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/AntiFlicker.h b/livedisplay/AntiFlicker.h deleted file mode 100644 index aab7edf..0000000 --- a/livedisplay/AntiFlicker.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2021 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H -#define VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H - -#include -#include -#include - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; - -class AntiFlicker : public IAntiFlicker { - public: - // Methods from ::vendor::lineage::livedisplay::V2_1::IAntiFlicker follow. - Return isEnabled() override; - Return setEnabled(bool enabled) override; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H diff --git a/livedisplay/SunlightEnhancement.cpp b/livedisplay/SunlightEnhancement.cpp deleted file mode 100644 index f773732..0000000 --- a/livedisplay/SunlightEnhancement.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "SunlightEnhancementService" - -#include "SunlightEnhancement.h" -#include -#include - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -static constexpr const char* kHbmPath = - "/sys/class/drm/card0-DSI-1/hbm"; - -Return SunlightEnhancement::isEnabled() { - std::ifstream file(kHbmPath); - int result = -1; - file >> result; - LOG(DEBUG) << "Got result " << result << " fail " << file.fail(); - return !file.fail() && result > 0; -} - -Return SunlightEnhancement::setEnabled(bool enabled) { - std::ofstream file(kHbmPath); - file << (enabled ? "5" : "0"); - LOG(DEBUG) << "setEnabled fail " << file.fail(); - return !file.fail(); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/SunlightEnhancement.h b/livedisplay/SunlightEnhancement.h deleted file mode 100644 index 80d361a..0000000 --- a/livedisplay/SunlightEnhancement.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H -#define VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H - -#include -#include -#include - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; - -class SunlightEnhancement : public ISunlightEnhancement { - public: - // Methods from ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement follow. - Return isEnabled() override; - Return setEnabled(bool enabled) override; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H diff --git a/livedisplay/service.cpp b/livedisplay/service.cpp deleted file mode 100644 index cfd63d1..0000000 --- a/livedisplay/service.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "vendor.lineage.livedisplay@2.1-service.oneplus_lahaina" - -#include -#include -#include -#include -#include - -#include "AntiFlicker.h" -#include "SunlightEnhancement.h" - -using android::OK; -using android::sp; -using android::status_t; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -using ::vendor::lineage::livedisplay::V2_0::sdm::PictureAdjustment; -using ::vendor::lineage::livedisplay::V2_0::sdm::SDMController; -using ::vendor::lineage::livedisplay::V2_1::IAntiFlicker; -using ::vendor::lineage::livedisplay::V2_1::IPictureAdjustment; -using ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement; -using ::vendor::lineage::livedisplay::V2_1::implementation::AntiFlicker; -using ::vendor::lineage::livedisplay::V2_1::implementation::SunlightEnhancement; - -int main() { - status_t status = OK; - - android::ProcessState::initWithDriver("/dev/vndbinder"); - - LOG(INFO) << "LiveDisplay HAL service is starting."; - - std::shared_ptr controller = std::make_shared(); - sp af = new AntiFlicker(); - sp pa = new PictureAdjustment(controller); - sp se = new SunlightEnhancement(); - - configureRpcThreadpool(1, true /*callerWillJoin*/); - - status = af->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL AntiFlicker Iface (" - << status << ")"; - goto shutdown; - } - - status = pa->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL PictureAdjustment Iface (" - << status << ")"; - goto shutdown; - } - - status = se->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL SunlightEnhancement Iface (" - << status << ")"; - goto shutdown; - } - - LOG(INFO) << "LiveDisplay HAL service is ready."; - joinRpcThreadpool(); - // Should not pass this line - -shutdown: - // In normal operation, we don't expect the thread pool to shutdown - LOG(ERROR) << "LiveDisplay HAL service is shutting down."; - return 1; -} diff --git a/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.rc b/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.rc deleted file mode 100644 index d43577c..0000000 --- a/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.rc +++ /dev/null @@ -1,10 +0,0 @@ -on init - chown system graphics /sys/class/drm/card0-DSI-1/dimlayer_bl_en - chown system graphics /sys/class/drm/card0-DSI-1/hbm - chmod 0666 /sys/class/drm/card0-DSI-1/dimlayer_bl_en - chmod 0666 /sys/class/drm/card0-DSI-1/hbm - -service vendor.livedisplay-hal-2-1 /vendor/bin/hw/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina - class hal - user system - group system diff --git a/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.xml b/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.xml deleted file mode 100644 index 22dcf43..0000000 --- a/livedisplay/vendor.lineage.livedisplay@2.1-service.oneplus_lahaina.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - vendor.lineage.livedisplay - hwbinder - 2.1 - - IAntiFlicker - default - - - ISunlightEnhancement - default - - @2.0::IPictureAdjustment/default - - diff --git a/oneplus-fwk/Android.bp b/oneplus-fwk/Android.bp deleted file mode 100644 index 4f2b4b5..0000000 --- a/oneplus-fwk/Android.bp +++ /dev/null @@ -1,8 +0,0 @@ -java_library { - name: "oneplus-fwk.oneplus_lahaina", - installable: true, - - srcs: [ - "src/**/*.java", - ], -} diff --git a/oneplus-fwk/src/android/util/OpFeatures.java b/oneplus-fwk/src/android/util/OpFeatures.java deleted file mode 100644 index 2ed55cf..0000000 --- a/oneplus-fwk/src/android/util/OpFeatures.java +++ /dev/null @@ -1,418 +0,0 @@ -package android.util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.BitSet; - -public final class OpFeatures { - - private static String LOG_TAG = OpFeatures.class.getSimpleName(); - - public static final int OP_FEATURE_SKU_CHINA = 0; - public static final int OP_FEATURE_SKU_GLOBAL = 1; - public static final int OP_FEATURE_MDM = 2; - public static final int OP_FEATURE_AUTO_STARTUP = 3; - public static final int OP_FEATURE_SUPPORT_LTM = 4; - public static final int OP_FEATURE_OP_KEYGUARD = 5; - public static final int OP_FEATURE_FASTPAIR = 6; - public static final int OP_FEATURE_TURNOFF_LOADING = 7; - public static final int OP_FEATURE_MM_DISPLAY_COLOR_SCREEN_MODE = 8; - public static final int OP_FEATURE_SWAP_KEYS = 9; - public static final int OP_FEATURE_KEY_LOCK = 10; - public static final int OP_FEATURE_CTA_PERMISSION_CONTROL = 11; - public static final int OP_FEATURE_GESTURE_SCREENSHOT = 12; - public static final int OP_FEATURE_BG_DETECTION = 13; - public static final int OP_FEATURE_BLACK_GESTURE = 14; - public static final int OP_FEATURE_RESERVE_APP = 15; - public static final int OP_FEATURE_OPEN_ID = 16; - public static final int OP_FEATURE_URL_INSTANT_APP_AND_HEYTAP_BUSINESS = 17; - public static final int OP_FEATURE_CHANGE_PACKAGE_NAME = 18; - public static final int OP_FEATURE_APP_BOOT_MANAGER = 19; - public static final int OP_FEATURE_MEMORY_TRACKER = 20; - public static final int OP_FEATURE_APPRECORD = 21; - public static final int OP_FEATURE_APP_LOCKER = 22; - public static final int OP_FEATURE_LONG_SCREENSHOT = 23; - public static final int OP_FEATURE_SCENE_MODES = 24; - public static final int OP_FEATURE_QUICK_PAY = 25; - public static final int OP_FEATURE_PARALLEL_APP = 26; - public static final int OP_FEATURE_ONEPLUS_BOOTANIMATION = 27; - public static final int OP_FEATURE_UXREALM = 28; - public static final int OP_FEATURE_HIDE_NAVBAR = 29; - public static final int OP_FEATURE_APP_USAGE_CLASSIFICATION = 30; - public static final int OP_FEATURE_SCREEN_COMPAT = 31; - public static final int OP_FEATURE_QUICK_REPLY = 32; - public static final int OP_FEATURE_OTG_AUTO_SHUTDOWN = 33; - public static final int OP_FEATURE_FACE_UNLOCK = 34; - public static final int OP_FEATURE_BOOT_ENTER_BOUNCER = 35; - public static final int OP_FEATURE_VIBRATION_INTENSITY = 36; - public static final int OP_FEATURE_CUSTOM_STATUS_BAR = 37; - public static final int OP_FEATURE_NEW_PLAN_POWEWR_OFF_ALARM = 38; - public static final int OP_FEATURE_PCB_WATER_MARK = 39; - public static final int OP_FEATURE_SYSTEM_UPDATE_BY_AB = 40; - public static final int OP_FEATURE_ENABLE_AD = 41; - public static final int OP_FEATURE_ENABLE_EU = 42; - public static final int OP_FEATURE_ALWAYS_ON_DISPLAY = 43; - public static final int OP_FEATURE_SHOW_MULTI_VOLTE = 44; - public static final int OP_FEATURE_GESTURE_BUTTON = 45; - public static final int OP_FEATURE_HEARING_AID = 46; - public static final int OP_FEATURE_MM_AUDIO_OZO = 47; - public static final int OP_FEATURE_BLUETOOTH_HEADSET = 48; - public static final int OP_FEATURE_CAMERA_NOTCH = 49; - public static final int OP_FEATURE_HIDE_CAMERA_NOTCH = 50; - public static final int OP_FEATURE_CUSTOM_NAVBAR = 51; - public static final int OP_FEATURE_SHOW_HD_FOR_CT = 52; - public static final int OP_FEATURE_OPDIAGNOSE = 53; - public static final int OP_FEATURE_SETTINGS_QUICKPAY_ANIM_FOR_ENCHILADA = 54; - public static final int OP_FEATURE_ENABLE_FALSINGTOUCH = 55; - public static final int OP_FEATURE_GAMEMODE_NETBOOST = 56; - public static final int OP_FEATURE_GAMEMODE_POWERSAVER = 57; - public static final int OP_FEATURE_ENABLE_FINGERPRINT_VENDOR_MOUDLE = 58; - public static final int OP_FEATURE_SMALL_BOARD_CHECK_FAJITA = 59; - public static final int OP_FEATURE_SUPPORT_CUSTOM_FINGERPRINT = 60; - public static final int OP_FEATURE_ENABLE_FINGERPRINT_POCKET = 61; - public static final int OP_FEATURE_SHUTDOWN_ANIMATION = 62; - public static final int OP_FEATURE_NETWORK_MODE_DISABLE_2G = 63; - public static final int OP_FEATURE_HEADSET_IMPEDANCE_DETECTION = 64; - public static final int OP_FEATURE_REMOVE_ROAMING_ICON = 65; - public static final int OP_FEATURE_DATA_ROAMING_ENABLE_MESSAGE = 66; - public static final int OP_FEATURE_OIMC = 67; - public static final int OP_FEATURE_APP_STATE_BROADCAST = 68; - public static final int OP_FEATURE_OPSM = 69; - public static final int OP_FEATURE_SHOW_4G_LTE = 70; - public static final int OP_FEATURE_RTT = 71; - public static final int OP_FEATURE_ANT_MODE_1X1 = 72; - public static final int OP_FEATURE_UST_MODE = 73; - public static final int OP_FEATURE_CUSTOM_BLINK_LIGHT = 74; - public static final int OP_FEATURE_AGGRESSIVE_DOZE = 75; - public static final int OP_FEATURE_SMART_POWER_CONTROL = 76; - public static final int OP_FEATURE_ALARM_ALIGNMENT = 77; - public static final int OP_FEATURE_BACKGROUND_PROCESS_FROZEN = 78; - public static final int OP_FEATURE_DEEP_TASK_CLEANER = 79; - public static final int OP_FEATURE_BGC = 80; - public static final int OP_FEATURE_OPCS_RECORD_SCREENON_TIME = 81; - public static final int OP_FEATURE_OHPD = 82; - public static final int OP_FEATURE_OHPD_CLEAN_LOW = 83; - public static final int OP_FEATURE_MM_SCREENOFF_WAKEUP = 84; - public static final int OP_FEATURE_FROZEN = 85; - public static final int OP_FEATURE_QUICK_LAUNCH = 86; - public static final int OP_FEATURE_SWEET_MOMENTS = 87; - public static final int OP_FEATURE_COLOR_MODE_FB0 = 88; - public static final int OP_FEATURE_MAX_BACKLIGHT = 89; - public static final int OP_FEATURE_CUSTOME_ANIMATION = 90; - public static final int OP_FEATURE_MOTOR_CONTROL = 91; - public static final int OP_FEATURE_SHOW_NOTIFICATION_BAR_BY_FINGERPRINT_SENSOR = 92; - public static final int OP_FEATURE_PROCESS_RESIDENT = 93; - public static final int OP_FEATURE_PARAM_BUILD_SERVICE = 94; - public static final int OP_FEATURE_OPERATOR_GPS_E911 = 95; - public static final int OP_FEATURE_SCREEN_REFRESH_RATE = 96; - public static final int OP_FEATURE_X_LINEAR_VIBRATION_MOTOR = 97; - public static final int OP_FEATURE_HBM_AUTO_ADJUST = 98; - public static final int OP_FEATURE_BOOST_BRIGHTNESS = 99; - public static final int OP_FEATURE_EN_P_SENSOR_IN_AB = 100; - public static final int OP_FEATURE_CN_GOOGLEPLAY_SERVICE = 101; - public static final int OP_FEATURE_FAKE_PROXIMITY = 102; - public static final int OP_FEATURE_SUPPORT_5G = 103; - public static final int OP_FEATURE_PRELOAD_APP_TO_DATA = 104; - public static final int OP_FEATURE_SMART_BOOST = 105; - public static final int OP_FEATURE_NOTIFICATION_LIGHT = 106; - public static final int OP_FEATURE_IME_LAND_PADDING = 107; - public static final int OP_FEATURE_AD_MODE = 108; - public static final int OP_FEATURE_INSTALL_FROM_MARKET = 109; - public static final int OP_FEATURE_APP_PREDICTION = 110; - public static final int OP_FEATURE_MISTOUCH_PREVENTION = 111; - public static final int OP_FEATURE_READING_MODE_INTERPOLATER = 112; - public static final int OP_FEATURE_UPDATE_RESERVE = 113; - public static final int OP_FEATURE_SYSTEM_OVERLAY = 114; - public static final int OP_FEATURE_EARPHONE_MODE = 115; - public static final int OP_FEATURE_ENABLE_POCKETMODE_SWITCH = 116; - public static final int OP_FEATURE_RESRTICT_PKG_BASE_ON_NETWORK = 117; - public static final int OP_FEATURE_PREBUILD_NETFLIX = 118; - public static final int OP_FEATURE_APPS_DISPLAY_IN_FULLSCREEN = 119; - public static final int OP_FEATURE_CTA_USE_PACKAGEINSTALLER_PERMISSION = 120; - public static final int OP_FEATURE_WARP_CHARGE_5V6A = 121; - public static final int OP_FEATURE_SPRINT = 122; - public static final int OP_FEATURE_SPRINT_HIDDENMENU = 123; - public static final int OP_FEATURE_SUPPORT_CUSTOMIZE_CLIENTID_MS = 124; - public static final int OP_FEATURE_OVERHEAT_ENABLE = 125; - public static final int OP_FEATURE_OVERHEAT_SKIN = 126; - public static final int OP_FEATURE_HIGH_VSYNC = 127; - public static final int OP_FEATURE_USS = 128; - public static final int OP_FEATURE_USS_HIDDENMENU = 129; - public static final int OP_FEATURE_POWER_CONSUMPTION_STATISTICS = 130; - public static final int OP_FEATURE_POWER_CONTROLLER = 131; - public static final int OP_FEATURE_COLOR_DISPLAY = 132; - public static final int OP_FEATURE_OVERHEAT_DIAGNOSIS = 133; - public static final int OP_FEATURE_OEMEX_SERVICE = 134; - public static final int OP_FEATURE_STANDBY_DETECTION = 135; - public static final int OP_FEATURE_ONEPLUS_SERVICE = 136; - public static final int OP_FEATURE_FAST_CHARGE = 137; - public static final int OP_FEATURE_MM_ALERTSLIDER = 138; - public static final int OP_FEATURE_MM_LOG = 139; - public static final int OP_FEATURE_MM_RESTORE_MODE = 140; - public static final int OP_FEATURE_MM_HEADSET_PROFILE = 141; - public static final int OP_FEATURE_MM_REDUCE_SAR = 142; - public static final int OP_FEATURE_MM_TA = 143; - public static final int OP_FEATURE_MM_SPECIAL_APP_SOUND_REDUCE = 144; - public static final int OP_FEATURE_MM_WIDEVINE_DRM_L1 = 145; - public static final int OP_FEATURE_MM_ULTRASOUND = 146; - public static final int OP_FEATURE_MM_EU_ACDB_LOADER = 147; - public static final int OP_FEATURE_MM_ENGINEERING_MODE = 148; - public static final int OP_FEATURE_DEVICE_DEFAULT_WALLPAPER = 149; - public static final int OP_FEATURE_WIFI_SERVICE = 150; - public static final int OP_FEATURE_MM_AW = 151; - public static final int OP_FEATURE_MM_CH_SWITCH = 152; - public static final int OP_FEATURE_MM_AUDIO_DIAGNOSIS = 153; - public static final int OP_FEATURE_PERF_MANAGER = 154; - public static final int OP_FEATURE_NEW_MEMORY_OPTIMIZATION = 155; - public static final int OP_FEATURE_OPUTIL = 156; - public static final int OP_FEATURE_SKIP_UIDIDLE = 157; - public static final int OP_FEATURE_SCREENSHOT_IMPROVEMENT = 158; - public static final int OP_FEATURE_GPS_NOTIFICATION = 159; - public static final int OP_FEATURE_ZEN_MODE = 160; - public static final int OP_FEATURE_TCP_CONTROL = 161; - public static final int OP_FEATURE_LOD_SWITCH = 162; - public static final int OP_FEATURE_TCS3701_HBR_ENABLED = 163; - public static final int OP_FEATURE_MM_HAC = 164; - public static final int OP_FEATURE_MM_MODECLIENT = 165; - public static final int OP_FEATURE_MM_RECODER_CH_SWITCH = 166; - public static final int OP_FEATURE_MM_RECORDING_SCREEN = 167; - public static final int OP_FEATURE_MM_AUDIO_CGROUP = 168; - public static final int OP_FEATURE_MM_WECHAT_NS = 169; - public static final int OP_FEATURE_MM_NS_AEC = 170; - public static final int OP_FEATURE_DEXOPT = 171; - public static final int OP_FEATURE_SKIP_DOFRAME = 172; - public static final int OP_FEATURE_PROCESS_ADJ_CONTROL = 173; - public static final int OP_FEATURE_SCREEN_ROTATION_IMPROVEMENT = 174; - public static final int OP_FEATURE_JANKMANAGER = 175; - public static final int OP_FEATURE_LANDSCAPE_APP_ANIMATION_IMPROVEMENT = 176; - public static final int OP_FEATURE_HWUI_SKIA_REDUCE_OVERDRAW = 177; - public static final int OP_FEATURE_MM_MDM = 178; - public static final int OP_FEATURE_MM_AUDIO_ELEVOC_ECNS = 179; - public static final int OP_FEATURE_MM_LOW_KING_VOLUME = 180; - public static final int OP_FEATURE_AI_GESTURE = 181; - public static final int OP_FEATURE_MM_VIDEO_ENHANCEMENT = 182; - public static final int OP_FEATURE_UNIFIED_DEVICE = 183; - public static final int OP_FEATURE_REDSCREEN_ASSERTION = 184; - public static final int OP_FEATURE_INFRARED_POWER_CONTROL = 185; - public static final int OP_FEATURE_OPSLA = 186; - public static final int OP_FEATURE_OPSLM = 187; - public static final int OP_FEATURE_SYNTHETIC_PASSWORD_DISABLED = 188; - public static final int OP_FEATURE_SYSTEM_PRODUCTION_RINGTONE = 189; - public static final int OP_FEATURE_APP_PRELOAD = 190; - public static final int OP_FEATURE_VERIFICATION_BUBBLE = 191; - public static final int OP_FEATURE_Z_VIBRATION_MOTOR = 192; - public static final int OP_FEATURE_DUAL_CAMERA = 193; - public static final int OP_FEATURE_TRIPLE_CAMERA = 194; - public static final int OP_FEATURE_QUAD_CAMERA = 195; - public static final int OP_FEATURE_FRONT_DUAL_CAMERA = 196; - public static final int OP_FEATURE_REPORT_WIFI_GENERATION_INFO = 197; - public static final int OP_FEATURE_BAS_WHITELIST = 198; - public static final int OP_FEATURE_ENABLE_UNDERSCREEN_SENSOR = 199; - public static final int OP_FEATURE_CUSTOM_GAME_CENTER = 200; - public static final int OP_FEATURE_CUSTOM_ONEPLUS_WALLET = 201; - public static final int OP_FEATURE_ENABLE_GAMUT_MAPPING = 202; - public static final int OP_FEATURE_ENABLE_GAME_VIBRATE = 203; - public static final int OP_FEATURE_ENABLE_ICON_DETECTION = 204; - public static final int OP_FEATURE_ENABLE_ANTI_BURN = 205; - public static final int OP_FEATURE_DIM_MODE_GESTURE = 206; - public static final int OP_FEATURE_UPDATE_INDIA = 207; - public static final int OP_FEATURE_USE_AUDIO_STATE = 208; - public static final int OP_FEATURE_SCREEN_ON_USE_INFRARED = 209; - public static final int OP_FEATURE_SUPPORT_COLOR_READ_MODE = 210; - public static final int OP_FEATURE_SCREEN_AOD_USE_ULTRASOUND = 211; - public static final int OP_FEATURE_SCREEN_OFF_USE_ULTRASOUND = 212; - public static final int OP_FEATURE_SCREEN_OFF_USE_INFRARED = 213; - public static final int OP_FEATURE_INFRARED_PROXIMITY_SUPPORT = 214; - public static final int OP_FEATURE_SAR_TEST_SUPPORT = 215; - public static final int OP_FEATURE_COLOR_ADS = 216; - public static final int OP_FEATURE_PWM_UNDER_SCREEN_LIGHT = 217; - public static final int OP_FEATURE_MM_LIMIT_SVA_BARGIN = 218; - public static final int OP_FEATURE_MM_CLOSE_PA = 219; - public static final int OP_FEATURE_GESTURE_DEPRECATED = 220; - public static final int OP_FEATURE_ONE_HAND_MODE = 221; - public static final int OP_FEATURE_DAILY_PROTO_REPORTING = 222; - public static final int OP_FEATURE_MCL_FONT = 223; - public static final int OP_FEATURE_CUSTOM_BROWSER_APP_INFO = 224; - public static final int OP_FEATURE_DECR_BL_CJ = 225; - public static final int OP_FEATURE_OPRECOVERY_BOOT_REASON = 226; - public static final int OP_FEATURE_KTV_LOOPBACK = 227; - public static final int OP_FEATURE_DYNAMIC_RESOLUTION = 228; - public static final int OP_FEATURE_SUPPORT_5G_LTE = 229; - public static final int OP_FEATURE_HOLE_PUNCH_FRONT_CAM = 230; - public static final int OP_FEATURE_USV_MODE = 231; - public static final int OP_FEATURE_USVIS_MODE = 232; - public static final int OP_FEATURE_MM_ABANDON_DELAY = 233; - public static final int OP_FEATURE_GPS_NFW_OTA_PATCH = 234; - public static final int OP_FEATURE_PIXELWORKS_BRIGHTNESS_SMOOTH = 235; - public static final int OP_FEATURE_FORCE_DARK = 236; - public static final int OP_FEATURE_WIRELESS_CHARGE = 237; - public static final int OP_FEATURE_SWARP_CHARGE = 238; - public static final int OP_FEATURE_MM_FAST_WHITELIST = 239; - public static final int OP_FEATURE_AI_BOOST_PACKAGE = 240; - public static final int OP_FEATURE_CARRIER_3_BROADCAST_CUST = 241; - public static final int OP_FEATURE_CARRIER_3_DEMO_MODE_CUST = 242; - public static final int OP_FEATURE_CARRIER_3_SAFEMODE_CUST = 243; - public static final int OP_FEATURE_APPDIED_STATISTICE = 244; - public static final int OP_FEATURE_SECOND_PRIVATE_PASSWORD = 245; - public static final int OP_FEATURE_OMM = 246; - public static final int OP_FEATURE_ORM = 247; - public static final int OP_FEATURE_OMM_KILL = 248; - public static final int OP_FEATURE_OMM_RECLAIM = 249; - public static final int OP_FEATURE_CARRIER_3_TALKBACK_CUST = 250; - public static final int OP_FEATURE_UST_MAAP = 251; - public static final int OP_FEATURE_CARRIER_3_UNIFIED_SETTINGS_CUST = 252; - public static final int OP_FEATURE_CARRIER_3_LLK_AGENT_CUST = 253; - public static final int OP_FEATURE_STA_SAP = 254; - public static final int OP_FEATURE_ONEPLUS_SHARE = 255; - public static final int OP_FEATURE_SAP_WPA3_SUPPORT = 256; - public static final int OP_FEATURE_SUPPORT_RELLOADSPLASH = 257; - public static final int OP_FEATURE_STARTING_WINDOW = 258; - public static final int OP_FEATURE_SUPPORT_REDEFINE_POWER_BUTTON = 259; - public static final int OP_FEATURE_AER_ZEROTOUCH = 260; - public static final int OP_FEATURE_FACE_UNLOCK_SUPPORT_PASSIVE_WAKEUP = 261; - public static final int OP_FEATURE_SMART_DOZE = 262; - public static final int OP_FEATURE_WEAK_FACE_UNLOCK = 263; - public static final int OP_FEATURE_SUPPORT_GCP = 264; - public static final int OP_FEATURE_UIFIRST = 265; - public static final int OP_FEATURE_GPS_SPRINT_SUPL = 266; - public static final int OP_FEATURE_GAME_TP = 267; - public static final int OP_FEATURE_TGPA = 268; - public static final int OP_FEATURE_CHARGE_OPTIMIZATED = 269; - public static final int OP_FEATURE_CARRIER_3_OVERHEAT_CUST = 270; - public static final int OP_FEATURE_BOOTANIMATION_CUST_INSET = 271; - public static final int OP_FEATURE_WARP_CHARGING_ANIM = 272; - public static final int OP_FEATURE_DOUBLE_TAP_POWER_KEY_ALEXA = 273; - public static final int OP_FEATURE_MM_GAME_DOLBY_WHITELIST = 274; - public static final int OP_FEATURE_QPOWER = 275; - public static final int OP_FEATURE_ENABLE_TAP_COEXIST = 276; - public static final int OP_FEATURE_CUST_FAILED_PW_WIPE = 277; - public static final int OP_FEATURE_COLLECT_BATTERYSTATS = 278; - public static final int OP_FEATURE_NOMEDIA_WHITELIST = 279; - public static final int OP_FEATURE_EXTREME_VSYNC = 280; - public static final int OP_FEATURE_PROXIMITY_CONTROLLER = 281; - public static final int OP_FEATURE_GAMEMODE_BOOST = 282; - public static final int OP_FEATURE_QUICK_REPLY_BUBBLE = 283; - public static final int OP_FEATURE_BLUETOOTH_UART_LOG = 284; - public static final int OP_FEATURE_FUSIONLIGHT_SCREENSHOT_DISABLED = 285; - public static final int OP_FEATURE_RECOVERY_FORMAT_WARNING = 286; - public static final int OP_FEATURE_BUILDING_CUSTOM_PRODUCT_IMAGE = 287; - public static final int OP_FEATURE_WIRELESS_CHARGE_DISCONNECT_DETECTOR = 288; - public static final int OP_FEATURE_DYNAMIC_FONT = 289; - public static final int OP_FEATURE_PERF_LOG = 290; - public static final int OP_FEATURE_ENABLE_EMERGENCY_PANEL = 291; - public static final int OP_FEATURE_MM_IRIS_CHIP_SUPPORT = 292; - public static final int OP_FEATURE_MM_SOFT_IRIS_SUPPORT = 293; - public static final int OP_FEATURE_ENABLE_HEACTE_SCREEN = 294; - public static final int OP_FEATURE_PERF_MEMEX = 295; - public static final int OP_FEATURE_SUPPORT_MIPI = 296; - public static final int OP_FEATURE_SUPPORT_OSC = 297; - public static final int OP_FEATURE_MM_DISPLAY_COLORTEMPRATURE_6000K_8000K = 298; - public static final int OP_FEATURE_LITE_OOS = 299; - public static final int OP_FEATURE_AOD_ALWAYS_ON = 300; - public static final int OP_FEATURE_VIP_BROADCAST = 301; - public static final int OP_FEATURE_SUPPORT_REAL_AOD = 302; - public static final int OP_FEATURE_UST_NVVM = 303; - public static final int OP_FEATURE_UST_EC = 304; - public static final int OP_FEATURE_CHARGING_ANIM = 305; - public static final int OP_FEATURE_OD_OPDMC = 306; - public static final int OP_FEATURE_DISPLAY_DYNAMIC_RESOLUTION = 307; - public static final int OP_FEATURE_WIRELESS_FAST_CHARGE = 308; - public static final int OP_FEATURE_COTA = 309; - public static final int OP_FEATURE_FLASH_BACK = 310; - public static final int OP_FEATURE_GOOGLE_COMM_SUIT = 311; - public static final int OP_FEATURE_SUPPORT_5G_5G = 312; - public static final int OP_FEATURE_INPUTMETHOD_SHOWANIMATION = 313; - public static final int OP_FEATURE_GOTA = 314; - public static final int OP_FEATURE_MM_DC_SUPPORT = 315; - public static final int OP_FEATURE_MM_DIRAC_SUPPORT = 316; - public static final int OP_FEATURE_MM_AUDIO_BOOTANIMATION = 317; - public static final int OP_FEATURE_MM_VZW_CUSTOMIZATION = 318; - public static final int OP_FEATURE_MAX_BACKLIGHT_2047 = 319; - public static final int OP_FEATURE_MM_DOLBY = 320; - public static final int OP_FEATURE_MM_DIMMING = 321; - public static final int OP_FEATURE_MM_DITHER_CONTROLLER = 322; - public static final int OP_FEATURE_CANVAS_AOD_ENABLED = 323; - public static final int OP_FEATURE_CURVED_DISPLAY_SCREEN = 324; - public static final int OP_FEATURE_MM_WIDEVINE_OTA = 325; - public static final int OP_FEATURE_MM_ADAPTIVE_COLOR_GAMUT_WHITELIST = 326; - public static final int OP_FEATURE_MM_ADFR = 327; - public static final int OP_FEATURE_MM_COLOR_SATURATION_ADJUSTMENT = 328; - public static final int OP_FEATURE_ZOOM_WINDOW = 329; - public static final int OP_FEATURE_MM_LOADINGEFFECT = 330; - public static final int OP_FEATURE_MM_COLOR_TONE_ADJUSTMENT = 331; - public static final int OP_FEATURE_MM_COLOR_MODE_SET_MODEID = 332; - public static final int OP_FEATURE_RPM_SUB_SYSTEM_NEW_FORMAT = 333; - public static final int OP_FEATURE_SUPPORT_ICHARGER_SERVICE = 334; - public static final int OP_FEATURE_UFSTW = 335; - public static final int OP_FEATURE_UST_ECHOLOCATE = 336; - public static final int OP_FEATURE_LDEV = 337; - public static final int OP_FEATURE_SUPPORT_5G_SA = 338; - public static final int OP_FEATURE_UPDATE_AB_STANVBK = 339; - public static final int OP_FEATURE_DISABLE_WAKINGUP_ANIMATION = 340; - public static final int OP_FEATURE_NFW_LOCATION_NOTIFICATION = 341; - public static final int OP_FEATURE_RICHTAP_SUPPORT = 342; - public static final int OP_FEATURE_SES_AUTH = 343; - public static final int OP_FEATURE_MBN_RESET = 344; - public static final int OP_FEATURE_MM_OFFLOAD_BLACKLIST = 345; - public static final int OP_FEATURE_TELEPHONY_SCENE_DETECT = 346; - public static final int OP_FEATURE_COTA_CONFIG_CONTROLLER = 347; - public static final int OP_FEATURE_MM_VIDEO_SR = 348; - public static final int OP_FEATURE_RECOVERY_WARNING_SCREEN = 349; - public static final int OP_FEATURE_IRIS_HQV = 350; - public static final int OP_FEATURE_ANTENNA_REPORT = 351; - public static final int OP_FEATURE_TGPA_GAME_LATENCY = 352; - public static final int OP_FEATURE_CAMERA_CPUSET = 353; - public static final int OP_FEATURE_SUPPORT_MSD_AOD_INFO = 354; - public static final int OP_FEATURE_HYPNUS = 355; - public static final int OP_FEATURE_OPEN_ID_NEW = 356; - public static final int OP_FEATURE_HIGH_TEMPERATURE = 357; - public static final int OP_FEATURE_NRCA_SUPPORT = 358; - public static final int OP_FEATURE_IMS_RECOVERY = 359; - public static final int OP_FEATURE_SMART_WIFI_CALLING_MODE = 360; - public static final int OP_FEATURE_AOD_ALWAYS_ON_IN_LABORATORY = 361; - public static final int OP_FEATURE_USKU = 362; - public static final int OP_FEATURE_DEFAULT_HIDE_VOLTE_FOR_EU = 363; - public static final int OP_FEATURE_GPS_ENABLE_LPP_UP_FOR_TMO = 364; - public static final int OP_FEATURE_CHARGING_ANIM_P3_REPEAT_MAX_COUNT_4 = 365; - public static final int OP_FEATURE_DISPLAY_LCD = 366; - public static final int OP_FEATURE_NEW_BATTERY_FILE_NODE_PATH = 367; - public static final int OP_FEATURE_MM_MUTE_DELAY_SWITCH = 368; - public static final int OP_FEATURE_ONLINE_CONFIG_NETWORK = 369; - public static final int OP_FEATURE_KEEP_HIGH_VSYNC = 370; - public static final int OP_FEATURE_MM_SYNC_ACDB_ID_FROM_Q = 371; - public static final int OP_FEATURE_BITMOJI_AOD_ENABLED = 372; - - private static final BitSet sFeatures = new BitSet(374); - - static { - File file = new File("/odm/etc/odm_feature_list"); - - try (BufferedReader br = new BufferedReader(new FileReader(file))) { - for (String line = br.readLine(); line != null; line = br.readLine()) { - String[] values = line.split(" "); - if (values.length == 4 && values[3].equals("true")) { - String id = values[0].replaceAll("[^0-9]", ""); - if (id.length() != 0) { - sFeatures.set(Integer.parseInt(id)); - } - } - } - } catch (IOException e) { - Log.e(LOG_TAG, "Failed to read odm feature list file", e); - } - } - - public static boolean isSupport(int... features) { - for (int feature : features) { - if (feature < 0 || feature > sFeatures.length()) { - return false; - } - if (!sFeatures.get(feature)) { - return false; - } - } - return true; - } -} diff --git a/KeyHandler/AndroidManifest.xml b/overlay-lineage/hardware/oneplus/doze/res/values/config.xml similarity index 67% rename from KeyHandler/AndroidManifest.xml rename to overlay-lineage/hardware/oneplus/doze/res/values/config.xml index ea8e344..1fcf008 100644 --- a/KeyHandler/AndroidManifest.xml +++ b/overlay-lineage/hardware/oneplus/doze/res/values/config.xml @@ -1,8 +1,8 @@ - - - + + + oneplus.sensor.op_motion_detect + diff --git a/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml index 08f6ab0..56197ea 100644 --- a/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml +++ b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml @@ -25,7 +25,7 @@ /system/priv-app/LineageParts/LineageParts.apk - /system/priv-app/KeyHandler/KeyHandler.apk + /system_ext/app/KeyHandler/KeyHandler.apk diff --git a/powershare/Android.bp b/powershare/Android.bp deleted file mode 100644 index 05dbfc2..0000000 --- a/powershare/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (C) 2020 The LineageOS Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_binary { - relative_install_path: "hw", - defaults: ["hidl_defaults"], - name: "vendor.lineage.powershare@1.0-service.oneplus_lahaina", - init_rc: ["vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc"], - vintf_fragments: ["vendor.lineage.powershare@1.0-service.oneplus_lahaina.xml"], - srcs: ["service.cpp", "PowerShare.cpp"], - shared_libs: [ - "libbase", - "libhardware", - "libhidlbase", - "liblog", - "libutils", - "vendor.lineage.powershare@1.0", - ], - proprietary: true, -} diff --git a/powershare/PowerShare.cpp b/powershare/PowerShare.cpp deleted file mode 100644 index 9eadc77..0000000 --- a/powershare/PowerShare.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "PowerShareService" - -#include "PowerShare.h" -#include -#include - -namespace vendor { -namespace lineage { -namespace powershare { -namespace V1_0 { -namespace implementation { - -#define WIRELESS_TX_ENABLE_PATH "/sys/class/oplus_chg/wireless/trx_online" - -/* - * Write value to path and close file. - */ -template -static void set(const std::string& path, const T& value) { - std::ofstream file(path); - file << value; -} - -template -static T get(const std::string& path, const T& def) { - std::ifstream file(path); - T result; - - file >> result; - return file.fail() ? def : result; -} - -Return PowerShare::isEnabled() { - return get(WIRELESS_TX_ENABLE_PATH, 0) >= 1; -} - -Return PowerShare::setEnabled(bool enable) { - set(WIRELESS_TX_ENABLE_PATH, enable ? 1 : 0); - - return isEnabled(); -} - -Return PowerShare::getMinBattery() { - return 0; -} - -Return PowerShare::setMinBattery(uint32_t) { - return getMinBattery(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace powershare -} // namespace lineage -} // namespace vendor diff --git a/powershare/PowerShare.h b/powershare/PowerShare.h deleted file mode 100644 index f1ab807..0000000 --- a/powershare/PowerShare.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H -#define VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H - -#include - -namespace vendor { -namespace lineage { -namespace powershare { -namespace V1_0 { -namespace implementation { - -using ::android::sp; -using ::android::hardware::Return; -using ::android::hardware::Void; - -class PowerShare : public IPowerShare { - public: - Return isEnabled() override; - Return setEnabled(bool enable) override; - Return getMinBattery() override; - Return setMinBattery(uint32_t minBattery) override; -}; - -} // namespace implementation -} // namespace V1_0 -} // namespace powershare -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_POWERSHARE_V1_0_POWERSHARE_H diff --git a/powershare/service.cpp b/powershare/service.cpp deleted file mode 100644 index 88e0062..0000000 --- a/powershare/service.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "vendor.lineage.powershare@1.0-service.oneplus_lahaina" - -#include -#include - -#include "PowerShare.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -using vendor::lineage::powershare::V1_0::IPowerShare; -using vendor::lineage::powershare::V1_0::implementation::PowerShare; - -using android::OK; -using android::status_t; - -int main() { - android::sp service = new PowerShare(); - - configureRpcThreadpool(1, true); - - status_t status = service->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Cannot register PowerShare HAL service."; - return 1; - } - - LOG(INFO) << "PowerShare HAL service ready."; - - joinRpcThreadpool(); - - LOG(ERROR) << "PowerShare HAL service failed to join thread pool."; - return 1; -} diff --git a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc b/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc deleted file mode 100644 index ede2f21..0000000 --- a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc +++ /dev/null @@ -1,8 +0,0 @@ -on init - chown system system /sys/class/oplus_chg/wireless/trx_online - chmod 0644 /sys/class/oplus_chg/wireless/trx_online - -service vendor.powershare-hal-1-0 /vendor/bin/hw/vendor.lineage.powershare@1.0-service.oneplus_lahaina - class hal - user system - group system diff --git a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.xml b/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.xml deleted file mode 100644 index b4af2cd..0000000 --- a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.lineage.powershare - hwbinder - 1.0 - - IPowerShare - default - - - diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index a0597b5..933ba15 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -33,18 +33,19 @@ /dev/skin_thermal u:object_r:therm_device:s0 # HALs -/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.oneplus_lahaina u:object_r:hal_fingerprint_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.lineage\.biometrics\.fingerprint\.inscreen@1\.0-service\.oneplus_lahaina u:object_r:hal_lineage_fod_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.1-service\.oneplus_lahaina u:object_r:hal_lineage_livedisplay_qti_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.lineage\.powershare@1\.0-service\.oneplus_lahaina u:object_r:hal_lineage_powershare_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.oneplus_lahaina u:object_r:hal_lineage_touch_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.camera@1\.0-service u:object_r:hal_cameraHIDL_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.CameraMDMHIDL@1\.0-service u:object_r:hal_cameraHIDL_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.charger@1\.0-service u:object_r:hal_charger_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.display@1\.0-service u:object_r:hal_display_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.param@1\.0-service u:object_r:hal_param_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.pixelworks\.hardware\.display\.iris-service u:object_r:hal_graphics_composer_default_exec:s0 -/(vendor|system/vendor)/bin/hw/vendor\.pixelworks\.hardware\.feature\.irisfeature-service u:object_r:hal_graphics_composer_default_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.oneplus u:object_r:hal_fingerprint_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.biometrics\.fingerprint\.inscreen@1\.0-service\.oneplus u:object_r:hal_lineage_fod_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.1-service\.oneplus u:object_r:hal_lineage_livedisplay_qti_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.powershare@1\.0-service\.oneplus u:object_r:hal_lineage_powershare_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.oneplus u:object_r:hal_lineage_touch_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.camera@1\.0-service u:object_r:hal_cameraHIDL_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.CameraMDMHIDL@1\.0-service u:object_r:hal_cameraHIDL_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.charger@1\.0-service u:object_r:hal_charger_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.display@1\.0-service u:object_r:hal_display_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.oneplus\.hardware\.param@1\.0-service u:object_r:hal_param_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.pixelworks\.hardware\.display\.iris-service u:object_r:hal_graphics_composer_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.pixelworks\.hardware\.feature\.irisfeature-service u:object_r:hal_graphics_composer_default_exec:s0 +/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.vibrator\.service\.oneplus u:object_r:hal_vibrator_default_exec:s0 # Init scripts /vendor/bin/init.oplus_chg.sh u:object_r:vendor_qti_init_shell_exec:s0 diff --git a/touch/.clang-format b/touch/.clang-format deleted file mode 100644 index ae4a451..0000000 --- a/touch/.clang-format +++ /dev/null @@ -1,11 +0,0 @@ -BasedOnStyle: Google -AccessModifierOffset: -2 -AllowShortFunctionsOnASingleLine: Inline -ColumnLimit: 100 -CommentPragmas: NOLINT:.* -DerivePointerAlignment: false -IndentWidth: 4 -PointerAlignment: Left -TabWidth: 4 -UseTab: Never -PenaltyExcessCharacter: 32 diff --git a/touch/Android.bp b/touch/Android.bp deleted file mode 100644 index 1538283..0000000 --- a/touch/Android.bp +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (C) 2019 The LineageOS Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_binary { - name: "vendor.lineage.touch@1.0-service.oneplus_lahaina", - init_rc: ["vendor.lineage.touch@1.0-service.oneplus_lahaina.rc"], - vintf_fragments: ["vendor.lineage.touch@1.0-service.oneplus_lahaina.xml"], - defaults: ["hidl_defaults"], - relative_install_path: "hw", - srcs: [ - "TouchscreenGesture.cpp", - "service.cpp", - ], - shared_libs: [ - "libbase", - "libbinder", - "libhidlbase", - "libutils", - "vendor.lineage.touch@1.0", - ], - proprietary: true, -} diff --git a/touch/TouchscreenGesture.cpp b/touch/TouchscreenGesture.cpp deleted file mode 100644 index 790fb05..0000000 --- a/touch/TouchscreenGesture.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "TouchscreenGestureService" - -#include "TouchscreenGesture.h" -#include -#include - -namespace vendor { -namespace lineage { -namespace touch { -namespace V1_0 { -namespace implementation { - -const std::map TouchscreenGesture::kGestureInfoMap = { - {0, {251, "Two fingers down swipe", "/proc/touchpanel/double_swipe_enable"}}, - {1, {252, "Down arrow", "/proc/touchpanel/down_arrow_enable"}}, - {2, {253, "Left arrow", "/proc/touchpanel/left_arrow_enable"}}, - {3, {254, "Right arrow", "/proc/touchpanel/right_arrow_enable"}}, - {4, {247, "Letter M", "/proc/touchpanel/letter_m_enable"}}, - {5, {250, "Letter O", "/proc/touchpanel/letter_o_enable"}}, - {6, {248, "Letter S", "/proc/touchpanel/letter_s_enable"}}, - {7, {246, "Letter W", "/proc/touchpanel/letter_w_enable"}}, - {8, {255, "Single Tap", "/proc/touchpanel/single_tap_enable"}}, -}; - -Return TouchscreenGesture::getSupportedGestures(getSupportedGestures_cb resultCb) { - std::vector gestures; - - for (const auto& entry : kGestureInfoMap) { - gestures.push_back({entry.first, entry.second.name, entry.second.keycode}); - } - resultCb(gestures); - - return Void(); -} - -Return TouchscreenGesture::setGestureEnabled( - const ::vendor::lineage::touch::V1_0::Gesture& gesture, bool enabled) { - const auto entry = kGestureInfoMap.find(gesture.id); - if (entry == kGestureInfoMap.end()) { - return false; - } - - std::ofstream file(entry->second.path); - file << (enabled ? "1" : "0"); - LOG(DEBUG) << "Wrote file " << entry->second.path << " fail " << file.fail(); - return !file.fail(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace touch -} // namespace lineage -} // namespace vendor diff --git a/touch/TouchscreenGesture.h b/touch/TouchscreenGesture.h deleted file mode 100644 index 47980da..0000000 --- a/touch/TouchscreenGesture.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H -#define VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H - -#include -#include -#include -#include - -namespace vendor { -namespace lineage { -namespace touch { -namespace V1_0 { -namespace implementation { - -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; - -class TouchscreenGesture : public ITouchscreenGesture { - public: - // Methods from ::vendor::lineage::touch::V1_0::ITouchscreenGesture follow. - Return getSupportedGestures(getSupportedGestures_cb resultCb) override; - Return setGestureEnabled(const ::vendor::lineage::touch::V1_0::Gesture& gesture, - bool enabled) override; - - private: - typedef struct { - int32_t keycode; - const char* name; - const char* path; - } GestureInfo; - static const std::map kGestureInfoMap; // id -> info -}; - -} // namespace implementation -} // namespace V1_0 -} // namespace touch -} // namespace lineage -} // namespace vendor - -#endif // VENDOR_LINEAGE_TOUCH_V1_0_TOUCHSCREENGESTURE_H diff --git a/touch/service.cpp b/touch/service.cpp deleted file mode 100644 index d3bdf04..0000000 --- a/touch/service.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "vendor.lineage.touch@1.0-service.oneplus_lahaina" - -#include -#include -#include -#include "TouchscreenGesture.h" - -using ::vendor::lineage::touch::V1_0::ITouchscreenGesture; -using ::vendor::lineage::touch::V1_0::implementation::TouchscreenGesture; - -int main() { - android::sp gestureService = new TouchscreenGesture(); - - android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/); - - if (gestureService->registerAsService() != android::OK) { - LOG(ERROR) << "Cannot register touchscreen gesture HAL service."; - return 1; - } - - LOG(INFO) << "Touchscreen HAL service ready."; - - android::hardware::joinRpcThreadpool(); - - LOG(ERROR) << "Touchscreen HAL service failed to join thread pool."; - return 1; -} diff --git a/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.rc b/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.rc deleted file mode 100644 index 1276706..0000000 --- a/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.rc +++ /dev/null @@ -1,24 +0,0 @@ -on boot - chmod 0660 /proc/touchpanel/double_swipe_enable - chmod 0660 /proc/touchpanel/down_arrow_enable - chmod 0660 /proc/touchpanel/left_arrow_enable - chmod 0660 /proc/touchpanel/letter_m_enable - chmod 0660 /proc/touchpanel/letter_o_enable - chmod 0660 /proc/touchpanel/letter_s_enable - chmod 0660 /proc/touchpanel/letter_w_enable - chmod 0660 /proc/touchpanel/right_arrow_enable - chmod 0660 /proc/touchpanel/single_tap_enable - chown system system /proc/touchpanel/double_swipe_enable - chown system system /proc/touchpanel/down_arrow_enable - chown system system /proc/touchpanel/left_arrow_enable - chown system system /proc/touchpanel/letter_m_enable - chown system system /proc/touchpanel/letter_o_enable - chown system system /proc/touchpanel/letter_s_enable - chown system system /proc/touchpanel/letter_w_enable - chown system system /proc/touchpanel/right_arrow_enable - chown system system /proc/touchpanel/single_tap_enable - -service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.oneplus_lahaina - class hal - user system - group system diff --git a/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.xml b/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.xml deleted file mode 100644 index fb862bb..0000000 --- a/touch/vendor.lineage.touch@1.0-service.oneplus_lahaina.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - vendor.lineage.touch - hwbinder - 1.0 - - ITouchscreenGesture - default - - - diff --git a/tri-state-key/.clang-format b/tri-state-key/.clang-format deleted file mode 100644 index ae4a451..0000000 --- a/tri-state-key/.clang-format +++ /dev/null @@ -1,11 +0,0 @@ -BasedOnStyle: Google -AccessModifierOffset: -2 -AllowShortFunctionsOnASingleLine: Inline -ColumnLimit: 100 -CommentPragmas: NOLINT:.* -DerivePointerAlignment: false -IndentWidth: 4 -PointerAlignment: Left -TabWidth: 4 -UseTab: Never -PenaltyExcessCharacter: 32 diff --git a/tri-state-key/Android.bp b/tri-state-key/Android.bp deleted file mode 100644 index 687199e..0000000 --- a/tri-state-key/Android.bp +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (C) 2018 The LineageOS Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_binary { - name: "tri-state-key_daemon", - init_rc: ["tri-state-key_daemon.rc"], - srcs: [ - "main.cpp", - "uevent_listener.cpp", - ], - cppflags: [ - "-Wall", - "-Werror", - ], - vendor: true, - shared_libs: [ - "libbase", - "liblog", - "libcutils", - "libutils", - ], -} diff --git a/tri-state-key/main.cpp b/tri-state-key/main.cpp deleted file mode 100644 index 70b9ae5..0000000 --- a/tri-state-key/main.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "tri-state-key_daemon" - -#include -#include -#include -#include -#include -#include - -#include "uevent_listener.h" - -#define HALL_CALIBRATION_DATA "/sys/devices/platform/soc/soc:tri_state_key/hall_data_calib" -#define HALL_PERSIST_CALIBRATION_DATA "/mnt/vendor/persist/engineermode/tri_state_hall_data" - -#define KEY_MODE_NORMAL 601 -#define KEY_MODE_VIBRATION 602 -#define KEY_MODE_SILENCE 603 - -using android::base::ReadFileToString; -using android::base::WriteStringToFile; -using android::Uevent; -using android::UeventListener; - -int main() { - int err; - int uinputFd; - struct uinput_user_dev uidev {}; - UeventListener uevent_listener; - - LOG(INFO) << "Started"; - - if (std::string hallData; ReadFileToString(HALL_PERSIST_CALIBRATION_DATA, &hallData)) { - std::replace(hallData.begin(), hallData.end(), ';', ','); - WriteStringToFile(hallData, HALL_CALIBRATION_DATA); - } - - uinputFd = open("/dev/uinput", O_WRONLY | O_NONBLOCK); - if (uinputFd < 0) { - LOG(ERROR) << "Unable to open uinput node"; - return 1; - } - - err = ioctl(uinputFd, UI_SET_EVBIT, EV_KEY) | - ioctl(uinputFd, UI_SET_KEYBIT, KEY_MODE_NORMAL) | - ioctl(uinputFd, UI_SET_KEYBIT, KEY_MODE_VIBRATION) | - ioctl(uinputFd, UI_SET_KEYBIT, KEY_MODE_SILENCE); - if (err != 0) { - LOG(ERROR) << "Unable to enable KEY events"; - goto out; - } - - sprintf(uidev.name, "uinput-tri-state-key"); - uidev.id.bustype = BUS_VIRTUAL; - - err = write(uinputFd, &uidev, sizeof(uidev)); - if (err < 0) { - LOG(ERROR) << "Write user device to uinput node failed"; - goto out; - } - - err = ioctl(uinputFd, UI_DEV_CREATE); - if (err < 0) { - LOG(ERROR) << "Unable to create uinput device"; - goto out; - } - - LOG(INFO) << "Successfully registered uinput-tri-state-key for KEY events"; - - uevent_listener.Poll([&uinputFd](const Uevent& uevent) { - int err; - struct input_event event {}; - - if (uevent.action != "change" || uevent.name != "soc:tri_state_key") { - return; - } - - bool none = uevent.state.find("USB=0") != std::string::npos; - bool vibration = uevent.state.find("USB-HOST=0") != std::string::npos; - bool silent = uevent.state.find("null)=0") != std::string::npos; - - int keyCode; - if (none && !vibration && !silent) { - keyCode = KEY_MODE_NORMAL; - } else if (!none && vibration && !silent) { - keyCode = KEY_MODE_VIBRATION; - } else if (!none && !vibration && silent) { - keyCode = KEY_MODE_SILENCE; - } else { - // Ignore intermediate states - return; - } - - // Report the key - event.type = EV_KEY; - event.code = keyCode; - event.value = 1; - err = write(uinputFd, &event, sizeof(event)); - if (err < 0) { - LOG(ERROR) << "Write EV_KEY to uinput node failed"; - return; - } - - // Force a flush with an EV_SYN - event.type = EV_SYN; - event.code = SYN_REPORT; - event.value = 0; - err = write(uinputFd, &event, sizeof(event)); - if (err < 0) { - LOG(ERROR) << "Write EV_SYN to uinput node failed"; - return; - } - - // Report the key - event.type = EV_KEY; - event.code = keyCode; - event.value = 0; - err = write(uinputFd, &event, sizeof(event)); - if (err < 0) { - LOG(ERROR) << "Write EV_KEY to uinput node failed"; - return; - } - - // Force a flush with an EV_SYN - event.type = EV_SYN; - event.code = SYN_REPORT; - event.value = 0; - err = write(uinputFd, &event, sizeof(event)); - if (err < 0) { - LOG(ERROR) << "Write EV_SYN to uinput node failed"; - return; - } - - return; - }); - -out: - // Clean up - close(uinputFd); - - // The loop can only be exited via failure or signal - return 1; -} diff --git a/tri-state-key/tri-state-key_daemon.rc b/tri-state-key/tri-state-key_daemon.rc deleted file mode 100644 index c29dbc1..0000000 --- a/tri-state-key/tri-state-key_daemon.rc +++ /dev/null @@ -1,10 +0,0 @@ -on fs - chown system system /sys/devices/platform/soc/soc:tri_state_key/hall_data_calib - chown system system /mnt/vendor/persist/engineermode/tri_state_hall_data - - start vendor.tri-state-key_daemon - -service vendor.tri-state-key_daemon /vendor/bin/tri-state-key_daemon - class late_start - user system - group system uhid diff --git a/tri-state-key/uevent.h b/tri-state-key/uevent.h deleted file mode 100644 index ac30ee1..0000000 --- a/tri-state-key/uevent.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _INIT_UEVENT_H -#define _INIT_UEVENT_H - -#include - -namespace android { - -struct Uevent { - std::string action; - std::string name; - std::string state; -}; - -} // namespace android - -#endif diff --git a/tri-state-key/uevent_listener.cpp b/tri-state-key/uevent_listener.cpp deleted file mode 100644 index 46b77c8..0000000 --- a/tri-state-key/uevent_listener.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "uevent_listener.h" - -#include -#include -#include -#include - -#include - -#include -#include - -namespace android { - -static void ParseEvent(const char* msg, Uevent* uevent) { - uevent->action.clear(); - uevent->name.clear(); - uevent->state.clear(); - - while (*msg) { - if (!strncmp(msg, "ACTION=", 7)) { - msg += 7; - uevent->action = msg; - } else if (!strncmp(msg, "NAME=", 5)) { - msg += 5; - uevent->name = msg; - } else if (!strncmp(msg, "STATE=", 6)) { - msg += 6; - uevent->state = msg; - } - // advance to after the next \0 - while (*msg++); - } - - LOG(DEBUG) << "ACTION=" << uevent->action << " NAME=" << uevent->name - << " STATE=" << uevent->state; -} - -UeventListener::UeventListener() { - // is 256K enough? udev uses 16MB! - device_fd_.reset(uevent_open_socket(256 * 1024, true)); - if (device_fd_ == -1) { - LOG(FATAL) << "Could not open uevent socket"; - } - - fcntl(device_fd_, F_SETFL, O_NONBLOCK); -} - -bool UeventListener::ReadUevent(Uevent* uevent) const { - char msg[UEVENT_MSG_LEN + 2]; - int n = uevent_kernel_multicast_recv(device_fd_, msg, UEVENT_MSG_LEN); - if (n <= 0) { - if (errno != EAGAIN && errno != EWOULDBLOCK) { - LOG(ERROR) << "Error reading from Uevent Fd"; - } - return false; - } - if (n >= UEVENT_MSG_LEN) { - LOG(ERROR) << "Uevent overflowed buffer, discarding"; - // Return true here even if we discard as we may have more uevents pending and we - // want to keep processing them. - return true; - } - - msg[n] = '\0'; - msg[n + 1] = '\0'; - - ParseEvent(msg, uevent); - - return true; -} - -void UeventListener::Poll(const ListenerCallback& callback) const { - pollfd ufd; - ufd.events = POLLIN; - ufd.fd = device_fd_; - - while (true) { - ufd.revents = 0; - - int nr = poll(&ufd, 1, -1); - if (nr == 0) return; - if (nr < 0) { - PLOG(ERROR) << "poll() of uevent socket failed, continuing"; - continue; - } - if (ufd.revents & POLLIN) { - // We're non-blocking, so if we receive a poll event keep processing until - // we have exhausted all uevent messages. - Uevent uevent; - while (ReadUevent(&uevent)) { - callback(uevent); - } - } - } -} - -} // namespace android diff --git a/tri-state-key/uevent_listener.h b/tri-state-key/uevent_listener.h deleted file mode 100644 index e606e7f..0000000 --- a/tri-state-key/uevent_listener.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _INIT_UEVENT_LISTENER_H -#define _INIT_UEVENT_LISTENER_H - -#include - -#include - -#include "uevent.h" - -#define UEVENT_MSG_LEN 2048 - -namespace android { - -using ListenerCallback = std::function; - -class UeventListener { - public: - UeventListener(); - - void Poll(const ListenerCallback& callback) const; - - private: - bool ReadUevent(Uevent* uevent) const; - - android::base::unique_fd device_fd_; -}; - -} // namespace android - -#endif diff --git a/vibrator/Android.bp b/vibrator/Android.bp deleted file mode 100644 index c3425ac..0000000 --- a/vibrator/Android.bp +++ /dev/null @@ -1,44 +0,0 @@ -Common_CFlags = ["-Wall"] -Common_CFlags += ["-Werror"] - -cc_library_shared { - name: "vendor.qti.hardware.vibrator.impl.oneplus_lahaina", - stem: "vendor.qti.hardware.vibrator.impl", - vendor: true, - cflags: Common_CFlags, - srcs: [ - "Vibrator.cpp", - ], - shared_libs: [ - "libcutils", - "libutils", - "liblog", - "libqtivibratoreffect", - "libbinder_ndk", - "android.hardware.vibrator-ndk_platform", - ], - export_include_dirs: ["include"] -} - -cc_binary { - name: "vendor.qti.hardware.vibrator.service.oneplus_lahaina", - stem: "vendor.qti.hardware.vibrator.service", - vendor: true, - relative_install_path: "hw", - init_rc: ["vendor.qti.hardware.vibrator.service.rc"], - vintf_fragments: [ - "vendor.qti.hardware.vibrator.service.xml", - ], - cflags: Common_CFlags, - srcs: [ - "service.cpp", - ], - shared_libs: [ - "libcutils", - "libutils", - "libbase", - "libbinder_ndk", - "android.hardware.vibrator-ndk_platform", - "vendor.qti.hardware.vibrator.impl", - ], -} diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp deleted file mode 100644 index 661142d..0000000 --- a/vibrator/Vibrator.cpp +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_TAG "vendor.qti.vibrator" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "include/Vibrator.h" -#ifdef USE_EFFECT_STREAM -#include "effect.h" -#endif - -namespace aidl { -namespace android { -namespace hardware { -namespace vibrator { - -#define STRONG_MAGNITUDE 0x7fff -#define MEDIUM_MAGNITUDE 0x5fff -#define LIGHT_MAGNITUDE 0x3fff -#define INVALID_VALUE -1 -#define CUSTOM_DATA_LEN 3 -#define NAME_BUF_SIZE 32 - -#define MSM_CPU_LAHAINA 415 -#define APQ_CPU_LAHAINA 439 -#define MSM_CPU_SHIMA 450 -#define MSM_CPU_SM8325 501 -#define APQ_CPU_SM8325P 502 -#define MSM_CPU_YUPIK 475 - -#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8))) - -static const char LED_DEVICE[] = "/sys/class/leds/vibrator"; - -static std::map>> LED_EFFECTS{ - { Effect::CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "10" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::DOUBLE_CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - { "SLEEP", "150" }, - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::TICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::HEAVY_CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "10" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }} -}; - -InputFFDevice::InputFFDevice() -{ - DIR *dp; - FILE *fp = NULL; - struct dirent *dir; - uint8_t ffBitmask[FF_CNT / 8]; - char devicename[PATH_MAX]; - const char *INPUT_DIR = "/dev/input/"; - char name[NAME_BUF_SIZE]; - int fd, ret; - int soc = property_get_int32("ro.vendor.qti.soc_id", -1); - - mVibraFd = INVALID_VALUE; - mSupportGain = false; - mSupportEffects = false; - mSupportExternalControl = false; - mCurrAppId = INVALID_VALUE; - mCurrMagnitude = 0x7fff; - mInExternalControl = false; - - dp = opendir(INPUT_DIR); - if (!dp) { - ALOGE("open %s failed, errno = %d", INPUT_DIR, errno); - return; - } - - memset(ffBitmask, 0, sizeof(ffBitmask)); - while ((dir = readdir(dp)) != NULL){ - if (dir->d_name[0] == '.' && - (dir->d_name[1] == '\0' || - (dir->d_name[1] == '.' && dir->d_name[2] == '\0'))) - continue; - - snprintf(devicename, PATH_MAX, "%s%s", INPUT_DIR, dir->d_name); - fd = TEMP_FAILURE_RETRY(open(devicename, O_RDWR)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", devicename, errno); - continue; - } - - ret = TEMP_FAILURE_RETRY(ioctl(fd, EVIOCGNAME(sizeof(name)), name)); - if (ret == -1) { - ALOGE("get input device name %s failed, errno = %d\n", devicename, errno); - close(fd); - continue; - } - - if (strcmp(name, "qcom-hv-haptics") && strcmp(name, "qti-haptics")) { - ALOGD("not a qcom/qti haptics device\n"); - close(fd); - continue; - } - - ALOGI("%s is detected at %s\n", name, devicename); - ret = TEMP_FAILURE_RETRY(ioctl(fd, EVIOCGBIT(EV_FF, sizeof(ffBitmask)), ffBitmask)); - if (ret == -1) { - ALOGE("ioctl failed, errno = %d", errno); - close(fd); - continue; - } - - if (test_bit(FF_CONSTANT, ffBitmask) || - test_bit(FF_PERIODIC, ffBitmask)) { - mVibraFd = fd; - if (test_bit(FF_CUSTOM, ffBitmask)) - mSupportEffects = true; - if (test_bit(FF_GAIN, ffBitmask)) - mSupportGain = true; - - if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) { - fscanf(fp, "%u", &soc); - fclose(fp); - } - switch (soc) { - case MSM_CPU_LAHAINA: - case APQ_CPU_LAHAINA: - case MSM_CPU_SHIMA: - case MSM_CPU_SM8325: - case APQ_CPU_SM8325P: - case MSM_CPU_YUPIK: - mSupportExternalControl = true; - break; - default: - mSupportExternalControl = false; - break; - } - break; - } - - close(fd); - } - - closedir(dp); -} - -/** Play vibration - * - * @param effectId: ID of the predefined effect will be played. If effectId is valid - * (non-negative value), the timeoutMs value will be ignored, and the - * real playing length will be set in param@playLengtMs and returned - * to VibratorService. If effectId is invalid, value in param@timeoutMs - * will be used as the play length for playing a constant effect. - * @param timeoutMs: playing length, non-zero means playing, zero means stop playing. - * @param playLengthMs: the playing length in ms unit which will be returned to - * VibratorService if the request is playing a predefined effect. - * The custom_data in periodic is reused for returning the playLengthMs - * from kernel space to userspace if the pattern is defined in kernel - * driver. It's been defined with following format: - * . - * The effect-ID is used for passing down the predefined effect to - * kernel driver, and the rest two parameters are used for returning - * back the real playing length from kernel driver. - */ -int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) { - struct ff_effect effect; - struct input_event play; - int16_t data[CUSTOM_DATA_LEN] = {0, 0, 0}; - int ret; -#ifdef USE_EFFECT_STREAM - const struct effect_stream *stream; -#endif - - /* For QMAA compliance, return OK even if vibrator device doesn't exist */ - if (mVibraFd == INVALID_VALUE) { - if (playLengthMs != NULL) - *playLengthMs = 0; - return 0; - } - - if (timeoutMs != 0) { - if (mCurrAppId != INVALID_VALUE) { - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) { - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - mCurrAppId = INVALID_VALUE; - } - - memset(&effect, 0, sizeof(effect)); - if (effectId != INVALID_VALUE) { - data[0] = effectId; - effect.type = FF_PERIODIC; - effect.u.periodic.waveform = FF_CUSTOM; - effect.u.periodic.magnitude = mCurrMagnitude; - effect.u.periodic.custom_data = data; - effect.u.periodic.custom_len = sizeof(int16_t) * CUSTOM_DATA_LEN; -#ifdef USE_EFFECT_STREAM - stream = get_effect_stream(effectId); - if (stream != NULL) { - effect.u.periodic.custom_data = (int16_t *)stream; - effect.u.periodic.custom_len = sizeof(*stream); - } -#endif - } else { - effect.type = FF_CONSTANT; - effect.u.constant.level = mCurrMagnitude; - effect.replay.length = timeoutMs; - } - - effect.id = mCurrAppId; - effect.replay.delay = 0; - - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCSFF, &effect)); - if (ret == -1) { - ALOGE("ioctl EVIOCSFF failed, errno = %d", -errno); - goto errout; - } - - mCurrAppId = effect.id; - if (effectId != INVALID_VALUE && playLengthMs != NULL) { - *playLengthMs = data[1] * 1000 + data[2]; -#ifdef USE_EFFECT_STREAM - if (stream != NULL && stream->play_rate_hz != 0) - *playLengthMs = ((stream->length * 1000) / stream->play_rate_hz) + 1; -#endif - } - - play.value = 1; - play.type = EV_FF; - play.code = mCurrAppId; - play.time.tv_sec = 0; - play.time.tv_usec = 0; - ret = TEMP_FAILURE_RETRY(write(mVibraFd, (const void*)&play, sizeof(play))); - if (ret == -1) { - ALOGE("write failed, errno = %d\n", -errno); - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - } else if (mCurrAppId != INVALID_VALUE) { - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) { - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - mCurrAppId = INVALID_VALUE; - } - return 0; - -errout: - mCurrAppId = INVALID_VALUE; - return ret; -} - -int InputFFDevice::on(int32_t timeoutMs) { - return play(INVALID_VALUE, timeoutMs, NULL); -} - -int InputFFDevice::off() { - return play(INVALID_VALUE, 0, NULL); -} - -int InputFFDevice::setAmplitude(uint8_t amplitude) { - int tmp, ret; - struct input_event ie; - - /* For QMAA compliance, return OK even if vibrator device doesn't exist */ - if (mVibraFd == INVALID_VALUE) - return 0; - - tmp = amplitude * (STRONG_MAGNITUDE - LIGHT_MAGNITUDE) / 255; - tmp += LIGHT_MAGNITUDE; - ie.type = EV_FF; - ie.code = FF_GAIN; - ie.value = tmp; - - ret = TEMP_FAILURE_RETRY(write(mVibraFd, &ie, sizeof(ie))); - if (ret == -1) { - ALOGE("write FF_GAIN failed, errno = %d", -errno); - return ret; - } - - mCurrMagnitude = tmp; - return 0; -} - -int InputFFDevice::playEffect(int effectId, EffectStrength es, long *playLengthMs) { - switch (es) { - case EffectStrength::LIGHT: - mCurrMagnitude = LIGHT_MAGNITUDE; - break; - case EffectStrength::MEDIUM: - mCurrMagnitude = MEDIUM_MAGNITUDE; - break; - case EffectStrength::STRONG: - mCurrMagnitude = STRONG_MAGNITUDE; - break; - default: - return -1; - } - - return play(effectId, INVALID_VALUE, playLengthMs); -} - -LedVibratorDevice::LedVibratorDevice() { - char devicename[PATH_MAX]; - int fd; - - mDetected = false; - - snprintf(devicename, sizeof(devicename), "%s/%s", LED_DEVICE, "activate"); - fd = TEMP_FAILURE_RETRY(open(devicename, O_RDWR)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", devicename, errno); - return; - } - - mDetected = true; -} - -int LedVibratorDevice::write_value(const char *file, const char *value) { - int fd; - int ret; - - fd = TEMP_FAILURE_RETRY(open(file, O_WRONLY)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", file, errno); - return -errno; - } - - ret = TEMP_FAILURE_RETRY(write(fd, value, strlen(value) + 1)); - if (ret == -1) { - ret = -errno; - } else if (ret != strlen(value) + 1) { - /* even though EAGAIN is an errno value that could be set - by write() in some cases, none of them apply here. So, this return - value can be clearly identified when debugging and suggests the - caller that it may try to call vibrator_on() again */ - ret = -EAGAIN; - } else { - ret = 0; - } - - errno = 0; - close(fd); - - return ret; -} - -int LedVibratorDevice::on(int32_t timeoutMs) { - char file[PATH_MAX]; - char value[32]; - int ret; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "state"); - ret = write_value(file, "1"); - if (ret < 0) - goto error; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "duration"); - snprintf(value, sizeof(value), "%u\n", timeoutMs); - ret = write_value(file, value); - if (ret < 0) - goto error; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate"); - ret = write_value(file, "1"); - if (ret < 0) - goto error; - - return 0; - -error: - ALOGE("Failed to turn on vibrator ret: %d\n", ret); - return ret; -} - -int LedVibratorDevice::off() -{ - char file[PATH_MAX]; - int ret; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate"); - ret = write_value(file, "0"); - return ret; -} - -ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) { - *_aidl_return = IVibrator::CAP_ON_CALLBACK; - - if (ledVib.mDetected) { - *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK; - ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return); - return ndk::ScopedAStatus::ok(); - } - - if (ff.mSupportGain) - *_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL; - if (ff.mSupportEffects) - *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK; - if (ff.mSupportExternalControl) - *_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL; - - ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::off() { - int ret; - - ALOGD("QTI Vibrator off"); - if (ledVib.mDetected) - ret = ledVib.off(); - else - ret = ff.off(); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs, - const std::shared_ptr& callback) { - int ret; - - ALOGD("Vibrator on for timeoutMs: %d", timeoutMs); - if (ledVib.mDetected) - ret = ledVib.on(timeoutMs); - else - ret = ff.on(timeoutMs); - - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - if (callback != nullptr) { - std::thread([=] { - ALOGD("Starting on on another thread"); - usleep(timeoutMs * 1000); - ALOGD("Notifying on complete"); - if (!callback->onComplete().isOk()) { - ALOGE("Failed to call onComplete"); - } - }).detach(); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std::shared_ptr& callback, int32_t* _aidl_return) { - long playLengthMs; - int ret; - - ALOGD("Vibrator perform effect %d", effect); - - if (ledVib.mDetected) { - if (const auto it = LED_EFFECTS.find(effect); it != LED_EFFECTS.end()) { - for (const auto &[path, value] : it->second) { - if (path == "SLEEP") { - usleep(atoi(value.c_str()) * 1000); - } else { - ledVib.write_value(path.c_str(), value.c_str()); - } - } - - // Restore gain from persist prop - char gain[PROPERTY_VALUE_MAX]{}; - property_get("persist.vendor.vib.gain", gain, "0x55"); - ledVib.write_value("/sys/class/leds/vibrator/gain", gain); - - // Return magic value for play length so that we won't end up calling on() / off() - playLengthMs = 150; - } else { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - } - } else { - if (effect < Effect::CLICK || - effect > Effect::HEAVY_CLICK) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - if (es != EffectStrength::LIGHT && es != EffectStrength::MEDIUM && - es != EffectStrength::STRONG) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ret = ff.playEffect((static_cast(effect)), es, &playLengthMs); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - } - - if (callback != nullptr) { - std::thread([=] { - ALOGD("Starting perform on another thread"); - usleep(playLengthMs * 1000); - ALOGD("Notifying perform complete"); - callback->onComplete(); - }).detach(); - } - - *_aidl_return = playLengthMs; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector* _aidl_return) { - if (ledVib.mDetected) { - *_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::HEAVY_CLICK}; - } else { - *_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD, - Effect::POP, Effect::HEAVY_CLICK}; - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::setAmplitude(float amplitude) { - uint8_t tmp; - int ret; - - if (ledVib.mDetected) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ALOGD("Vibrator set amplitude: %f", amplitude); - - if (amplitude <= 0.0f || amplitude > 1.0f) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); - - if (ff.mInExternalControl) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - tmp = (uint8_t)(amplitude * 0xff); - ret = ff.setAmplitude(tmp); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::setExternalControl(bool enabled) { - if (ledVib.mDetected) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ALOGD("Vibrator set external control: %d", enabled); - if (!ff.mSupportExternalControl) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ff.mInExternalControl = enabled; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector* supported __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive __unused, - int32_t* durationMs __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::compose(const std::vector& composite __unused, - const std::shared_ptr& callback __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector* _aidl_return __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::alwaysOnEnable(int32_t id __unused, Effect effect __unused, - EffectStrength strength __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -} // namespace vibrator -} // namespace hardware -} // namespace android -} // namespace aidl - diff --git a/vibrator/include/Vibrator.h b/vibrator/include/Vibrator.h deleted file mode 100644 index 826261b..0000000 --- a/vibrator/include/Vibrator.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018,2020, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace vibrator { - -class InputFFDevice { -public: - InputFFDevice(); - int playEffect(int effectId, EffectStrength es, long *playLengthMs); - int on(int32_t timeoutMs); - int off(); - int setAmplitude(uint8_t amplitude); - bool mSupportGain; - bool mSupportEffects; - bool mSupportExternalControl; - bool mInExternalControl; -private: - int play(int effectId, uint32_t timeoutMs, long *playLengthMs); - int mVibraFd; - int16_t mCurrAppId; - int16_t mCurrMagnitude; -}; - -class LedVibratorDevice { -public: - LedVibratorDevice(); - int on(int32_t timeoutMs); - int off(); - bool mDetected; - int write_value(const char *file, const char *value); -}; - -class Vibrator : public BnVibrator { -public: - class InputFFDevice ff; - class LedVibratorDevice ledVib; - ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; - ndk::ScopedAStatus off() override; - ndk::ScopedAStatus on(int32_t timeoutMs, - const std::shared_ptr& callback) override; - ndk::ScopedAStatus perform(Effect effect, EffectStrength strength, - const std::shared_ptr& callback, - int32_t* _aidl_return) override; - ndk::ScopedAStatus getSupportedEffects(std::vector* _aidl_return) override; - ndk::ScopedAStatus setAmplitude(float amplitude) override; - ndk::ScopedAStatus setExternalControl(bool enabled) override; - ndk::ScopedAStatus getCompositionDelayMax(int32_t* maxDelayMs); - ndk::ScopedAStatus getCompositionSizeMax(int32_t* maxSize); - ndk::ScopedAStatus getSupportedPrimitives(std::vector* supported) override; - ndk::ScopedAStatus getPrimitiveDuration(CompositePrimitive primitive, - int32_t* durationMs) override; - ndk::ScopedAStatus compose(const std::vector& composite, - const std::shared_ptr& callback) override; - ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector* _aidl_return) override; - ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; - ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; -}; - -} // namespace vibrator -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/vibrator/service.cpp b/vibrator/service.cpp deleted file mode 100644 index 4fe3118..0000000 --- a/vibrator/service.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_TAG "vendor.qti.hardware.vibrator.service" - -#include -#include -#include - -#include "Vibrator.h" - -using aidl::android::hardware::vibrator::Vibrator; - -int main() { - ABinderProcess_setThreadPoolMaxThreadCount(0); - std::shared_ptr vib = ndk::SharedRefBase::make(); - - const std::string instance = std::string() + Vibrator::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str()); - CHECK(status == STATUS_OK); - - ABinderProcess_joinThreadPool(); - return EXIT_FAILURE; // should not reach -} diff --git a/vibrator/vendor.qti.hardware.vibrator.service.rc b/vibrator/vendor.qti.hardware.vibrator.service.rc deleted file mode 100644 index ffa8ce9..0000000 --- a/vibrator/vendor.qti.hardware.vibrator.service.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.qti.vibrator /vendor/bin/hw/vendor.qti.hardware.vibrator.service - class hal - user system - group system input diff --git a/vibrator/vendor.qti.hardware.vibrator.service.xml b/vibrator/vendor.qti.hardware.vibrator.service.xml deleted file mode 100644 index df29ada..0000000 --- a/vibrator/vendor.qti.hardware.vibrator.service.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - android.hardware.vibrator - IVibrator/default - - diff --git a/wifi-mac-generator/Android.mk b/wifi-mac-generator/Android.mk deleted file mode 100644 index 164a3c3..0000000 --- a/wifi-mac-generator/Android.mk +++ /dev/null @@ -1,9 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := wifi-mac-generator -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) -LOCAL_SRC_FILES := wifi-mac-generator.sh -LOCAL_INIT_RC := wifi-mac-generator.rc -include $(BUILD_PREBUILT) diff --git a/wifi-mac-generator/wifi-mac-generator.rc b/wifi-mac-generator/wifi-mac-generator.rc deleted file mode 100644 index 0defe7f..0000000 --- a/wifi-mac-generator/wifi-mac-generator.rc +++ /dev/null @@ -1,9 +0,0 @@ -service vendor.wifi-mac-generator /vendor/bin/wifi-mac-generator - class main - user wifi - group wifi - oneshot - disabled - -on post-fs-data - start vendor.wifi-mac-generator diff --git a/wifi-mac-generator/wifi-mac-generator.sh b/wifi-mac-generator/wifi-mac-generator.sh deleted file mode 100644 index cb8cf0d..0000000 --- a/wifi-mac-generator/wifi-mac-generator.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/vendor/bin/sh -WLAN_MAC_VENDOR_PREFIX="C0EEFB" -WLAN_MAC_PERSIST_PATH="/mnt/vendor/persist/wlan_mac.bin" - -function wait_for_file() { - retries=0 - - while [ ! -f "${1}" ]; do - retries=$((retries + 1)) - - if [ "${retries}" -eq 10 ]; then - return 1 - fi - - sleep 1 - done - - return 0 -} - -if [[ ! -f "${WLAN_MAC_PERSIST_PATH}" ]] || [[ ! -s "${WLAN_MAC_PERSIST_PATH}" ]]; then - MAC_0_PATH="/data/vendor/oemnvitems/4678_0" - - if ! wait_for_file "${MAC_0_PATH}"; then - MAC_0="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`" - else - MAC_0=`xxd -p "${MAC_0_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'` - fi - - MAC_1_PATH="/data/vendor/oemnvitems/4678_1" - - if ! wait_for_file "${MAC_1_PATH}"; then - MAC_1="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`" - else - MAC_1=`xxd -p "${MAC_1_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'` - fi - - echo "Intf0MacAddress=${MAC_0}" > "${WLAN_MAC_PERSIST_PATH}" - echo "Intf1MacAddress=${MAC_1}" >> "${WLAN_MAC_PERSIST_PATH}" - echo "Intf2MacAddress=000AF58989FD" >> "${WLAN_MAC_PERSIST_PATH}" - echo "Intf3MacAddress=000AF58989FC" >> "${WLAN_MAC_PERSIST_PATH}" - echo "END" >> "${WLAN_MAC_PERSIST_PATH}" -fi