diff --git a/Android.mk b/Android.mk index ca65f8d..5c307c9 100644 --- a/Android.mk +++ b/Android.mk @@ -124,4 +124,4 @@ $(RFS_MSM_SLPI_SYMLINKS): $(LOCAL_INSTALLED_MODULE) ALL_DEFAULT_INSTALLED_MODULES += $(RFS_MSM_ADSP_SYMLINKS) $(RFS_MSM_MPSS_SYMLINKS) $(RFS_MSM_SLPI_SYMLINKS) -endif +endif \ No newline at end of file diff --git a/beast_vince.mk b/aosp_vince.mk similarity index 62% rename from beast_vince.mk rename to aosp_vince.mk index 8bbb023..3e8b42b 100644 --- a/beast_vince.mk +++ b/aosp_vince.mk @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 The LineageOS Project +# Copyright (C) 2017 The aospOS Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,20 +16,32 @@ # Inherit from those products. Most specific first. $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) -$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) # Inherit from vince device $(call inherit-product, device/xiaomi/vince/device.mk) -# Inherit some common BeastROMs stuff. -$(call inherit-product, vendor/beast/config/common.mk) -$(call inherit-product, vendor/MiuiCamera/config.mk) +#all +IS_GO_VERSION := true +TARGET_INCLUDE_STOCK_ARCORE := true +# On for(PE) +$(call inherit-product, vendor/aosp/config/common_full_phone.mk) TARGET_BOOT_ANIMATION_RES := 1080 +TARGET_GAPPS_ARCH := arm64 +TARGET_MINIMAL_APPS := false +CUSTOM_BUILD_TYPE := OFFICIAL -# Device identifier +# On for(AEX) +#$(call inherit-product, vendor/aosp/common.mk) +#TARGET_BOOT_ANIMATION_RES := 2140 +#EXTENDED_BUILD_TYPE := OFFICIAL + +# Inherit from custom vendor + +#Device identifier. This must come after all inclusions PRODUCT_DEVICE := vince -PRODUCT_NAME := beast_vince +PRODUCT_NAME := aosp_vince PRODUCT_BRAND := Xiaomi PRODUCT_MODEL := Redmi 5 Plus PRODUCT_MANUFACTURER := Xiaomi @@ -39,10 +51,7 @@ BOARD_VENDOR := Xiaomi PRODUCT_GMS_CLIENTID_BASE := android-xiaomi PRODUCT_BUILD_PROP_OVERRIDES += \ - PRIVATE_BUILD_DESC="vince-user 8.1.0 OPM1.171019.019 V10.0.4.0.OEGMIFH release-keys" - -# Set BUILD_FINGERPRINT variable to be picked up by both system and vendor build.prop -BUILD_FINGERPRINT := "xiaomi/vince/vince:8.1.0/OPM1.171019.019/V10.0.4.0.OEGMIFH:user/release-keys" + PRODUCT_NAME="vince" \ + TARGET_DEVICE="vince" -BEAST_BUILD_TYPE := OFFICIAL diff --git a/keyhandler/Android.mk b/keyhandler/Android.mk new file mode 100644 index 0000000..0190385 --- /dev/null +++ b/keyhandler/Android.mk @@ -0,0 +1,8 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE := org.pixelexperience.keyhandler +LOCAL_SRC_FILES := $(call all-java-files-under,src) +LOCAL_MODULE_TAGS := optional +LOCAL_DEX_PREOPT := false +include $(BUILD_JAVA_LIBRARY) \ No newline at end of file diff --git a/keyhandler/src/org/pixelexperience/settings/device/KeyHandler.java b/keyhandler/src/org/pixelexperience/settings/device/KeyHandler.java new file mode 100644 index 0000000..42a9422 --- /dev/null +++ b/keyhandler/src/org/pixelexperience/settings/device/KeyHandler.java @@ -0,0 +1,76 @@ +package org.pixelexperience.settings.device; + +import android.app.ActivityManager; +import android.provider.Settings; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.Context; +import android.content.ContentResolver; +import android.view.KeyEvent; +import android.view.InputDevice; + +import java.util.List; + +import com.android.internal.os.DeviceKeyHandler; +import com.android.internal.util.ArrayUtils; + +public class KeyHandler implements DeviceKeyHandler { + + private static final int FP_KEYCODE = KeyEvent.KEYCODE_DPAD_CENTER; + private static final int FP_SCANCODE = 96; + private static final String[] FP_EVENTS = new String[]{"fpc_irq_wakeup", "fp-keys", "uinput-fpc", "uinput-goodix"}; + + private static final String FP_SHUTTER_PREF_KEY = "pref_fingerprint_capture_key"; + private static final String[] ALLOWED_CAMERA_PACKAGES = new String[]{"com.android.camera"}; + + private static ActivityManager am; + private static PackageManager pm; + private static ContentResolver resolver; + + public KeyHandler(Context context) { + am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + pm = context.getPackageManager(); + resolver = context.getContentResolver(); + } + + public KeyEvent handleKeyEvent(KeyEvent event) { + String deviceName = ""; + int keyCode = event.getKeyCode(); + int scanCode = event.getScanCode(); + int action = event.getAction(); + + if (event.getDeviceId() != -1){ + InputDevice device = InputDevice.getDevice(event.getDeviceId()); + if (device != null){ + deviceName = device.getName(); + } + } + + if (keyCode == FP_KEYCODE && scanCode == FP_SCANCODE && ArrayUtils.contains(FP_EVENTS, deviceName)){ + if (action != KeyEvent.ACTION_DOWN) { + return null; + } + ActivityInfo runningActivity = getRunningActivityInfo(); + if (runningActivity != null && ArrayUtils.contains(ALLOWED_CAMERA_PACKAGES, runningActivity.packageName)){ + return Settings.Secure.getInt(resolver, FP_SHUTTER_PREF_KEY, 0) == 1 ? event : null; + }else{ + return null; + } + } + + return event; + } + + private static ActivityInfo getRunningActivityInfo() { + List tasks = am.getRunningTasks(1); + if (tasks != null && !tasks.isEmpty()) { + ActivityManager.RunningTaskInfo top = tasks.get(0); + try { + return pm.getActivityInfo(top.topActivity, 0); + } catch (PackageManager.NameNotFoundException e) { + } + } + return null; + } + +} \ No newline at end of file diff --git a/permissions/google-hiddenapi-package-whitelist.xml b/permissions/google-hiddenapi-package-whitelist.xml new file mode 100644 index 0000000..434da09 --- /dev/null +++ b/permissions/google-hiddenapi-package-whitelist.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permissions/google_build.xml b/permissions/google_build.xml new file mode 100644 index 0000000..076061f --- /dev/null +++ b/permissions/google_build.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/permissions/nexus.xml b/permissions/nexus.xml new file mode 100644 index 0000000..d3521f7 --- /dev/null +++ b/permissions/nexus.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permissions/pixel_2017.xml b/permissions/pixel_2017.xml new file mode 100644 index 0000000..48f2b87 --- /dev/null +++ b/permissions/pixel_2017.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/permissions/pixel_2017_exclusive.xml b/permissions/pixel_2017_exclusive.xml new file mode 100644 index 0000000..e07ab6d --- /dev/null +++ b/permissions/pixel_2017_exclusive.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vendorsetup.sh b/vendorsetup.sh index de20c74..17c5e37 100644 --- a/vendorsetup.sh +++ b/vendorsetup.sh @@ -1 +1 @@ -add_lunch_combo beast_vince-userdebug +add_lunch_combo aosp_vince-userdebug \ No newline at end of file