Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17240015 authored by LuK1337's avatar LuK1337
Browse files

sm8150-common: Switch to hardware/oneplus components

Change-Id: Ie659085128184dc02e0d39ba151668f0a998ef14
parent 224090bf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
soong_namespace {
    imports: ["hardware/qcom/bootctrl"],
    imports: ["hardware/oneplus", "hardware/qcom/bootctrl"],
}
+3 −3
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ TARGET_USES_QTI_CAMERA_DEVICE := true
USE_DEVICE_SPECIFIC_CAMERA := true

# FOD
TARGET_SURFACEFLINGER_FOD_LIB := //$(VENDOR_PATH):libfod_extension.oneplus_msmnile
TARGET_SURFACEFLINGER_FOD_LIB := //hardware/oneplus:libfod_extension.oneplus

# Display
MAX_VIRTUAL_DISPLAY_DIMENSION := 4096
@@ -105,8 +105,8 @@ TARGET_ENABLE_MEDIADRM_64 := true
TARGET_FS_CONFIG_GEN := $(VENDOR_PATH)/config.fs

# Fingerprint
SOONG_CONFIG_NAMESPACES += ONEPLUS_MSMNILE_FOD
SOONG_CONFIG_ONEPLUS_MSMNILE_FOD := POS_X POS_Y SIZE
SOONG_CONFIG_NAMESPACES += ONEPLUS_FOD
SOONG_CONFIG_ONEPLUS_FOD := POS_X POS_Y SIZE

# HIDL
DEVICE_MATRIX_FILE := $(VENDOR_PATH)/compatibility_matrix.xml

KeyHandler/Android.mk

deleted100644 → 0
+0 −31
Original line number Diff line number Diff line
#
# 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)
+0 −83
Original line number Diff line number Diff line
/*
 * 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);
        }
    }
}
+8 −10
Original line number Diff line number Diff line
@@ -242,10 +242,8 @@ PRODUCT_PACKAGES += \

# Fingerprint
PRODUCT_PACKAGES += \
    android.hardware.biometrics.fingerprint@2.1-service.oneplus_msmnile \
    vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus_msmnile \
    vendor.oneplus.fingerprint.extension@1.0.vendor \
    vendor.oneplus.hardware.display@1.0.vendor
    android.hardware.biometrics.fingerprint@2.1-service.oneplus \
    vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.oneplus

# GPS
PRODUCT_COPY_FILES += \
@@ -348,10 +346,10 @@ PRODUCT_PACKAGES += \

# OnePlus
PRODUCT_PACKAGES += \
    oneplus-fwk.oneplus_msmnile
    oneplus-fwk

PRODUCT_BOOT_JARS += \
    oneplus-fwk.oneplus_msmnile
    oneplus-fwk

# Power
PRODUCT_PACKAGES += \
@@ -380,7 +378,7 @@ PRODUCT_PACKAGES += \

# Vibrator
PRODUCT_PACKAGES += \
    vendor.qti.hardware.vibrator.service.oneplus_msmnile
    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
@@ -402,7 +400,7 @@ PRODUCT_PACKAGES += \
# Soong namespaces
PRODUCT_SOONG_NAMESPACES += \
    $(LOCAL_PATH) \
    device/oneplus/common
    hardware/oneplus

# Telephony
PRODUCT_PACKAGES += \
@@ -422,12 +420,12 @@ PRODUCT_COPY_FILES += \

# Touch
PRODUCT_PACKAGES += \
    vendor.lineage.touch@1.0-service.oneplus_msmnile
    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 += \
Loading