Skip to content

Commit

Permalink
go aosp way
Browse files Browse the repository at this point in the history
  • Loading branch information
waiser86 committed Apr 4, 2019
1 parent 387c879 commit c9b02db
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 21 additions & 12 deletions beast_vince.mk → aosp_vince.mk
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand All @@ -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

8 changes: 8 additions & 0 deletions keyhandler/Android.mk
Original file line number Diff line number Diff line change
@@ -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)
76 changes: 76 additions & 0 deletions keyhandler/src/org/pixelexperience/settings/device/KeyHandler.java
Original file line number Diff line number Diff line change
@@ -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<ActivityManager.RunningTaskInfo> 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;
}

}
112 changes: 112 additions & 0 deletions permissions/google-hiddenapi-package-whitelist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 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
-->

<!--
This XML file declares which platform apps that need to access internal APIs.
-->
<config>
<hidden-api-whitelisted-app package="android.car.cluster.maserati" />
<hidden-api-whitelisted-app package="com.android.apps.tag" />
<hidden-api-whitelisted-app package="com.android.auto.embedded.cts.verifier" />
<hidden-api-whitelisted-app package="com.android.car.carlauncher" />
<hidden-api-whitelisted-app package="com.android.car.home" />
<hidden-api-whitelisted-app package="com.android.car.retaildemo" />
<hidden-api-whitelisted-app package="com.android.car.settingslib.robotests" />
<hidden-api-whitelisted-app package="com.android.car.setupwizardlib.robotests" />
<hidden-api-whitelisted-app package="com.android.cardock" />
<hidden-api-whitelisted-app package="com.android.connectivity.metrics" />
<hidden-api-whitelisted-app package="com.android.facelock" />
<hidden-api-whitelisted-app package="com.android.google.gce.gceservice" />
<hidden-api-whitelisted-app package="com.android.hotwordenrollment.okgoogle" />
<hidden-api-whitelisted-app package="com.android.hotwordenrollment.tgoogle" />
<hidden-api-whitelisted-app package="com.android.hotwordenrollment.xgoogle" />
<hidden-api-whitelisted-app package="com.android.inputmethod.latin" />
<hidden-api-whitelisted-app package="com.android.media.update" />
<hidden-api-whitelisted-app package="com.android.netspeed" />
<hidden-api-whitelisted-app package="com.android.onemedia" />
<hidden-api-whitelisted-app package="com.android.pixellogger" />
<hidden-api-whitelisted-app package="com.android.ramdump" />
<hidden-api-whitelisted-app package="com.android.settingslib.robotests" />
<hidden-api-whitelisted-app package="com.android.simappdialog" />
<hidden-api-whitelisted-app package="com.android.statsd.dogfood" />
<hidden-api-whitelisted-app package="com.android.statsd.loadtest" />
<hidden-api-whitelisted-app package="com.android.systemui.shared" />
<hidden-api-whitelisted-app package="com.android.test.power" />
<hidden-api-whitelisted-app package="com.android.test.voiceenrollment" />
<hidden-api-whitelisted-app package="com.android.tv.provision" />
<hidden-api-whitelisted-app package="com.google.SSRestartDetector" />
<hidden-api-whitelisted-app package="com.google.android.apps.nexuslauncher" />
<hidden-api-whitelisted-app package="com.google.android.asdiv" />
<hidden-api-whitelisted-app package="com.google.android.athome.globalkeyinterceptor" />
<hidden-api-whitelisted-app package="com.google.android.car.bugreport" />
<hidden-api-whitelisted-app package="com.google.android.car.defaultstoragemonitoringcompanionapp" />
<hidden-api-whitelisted-app package="com.google.android.car.diagnosticrecorder" />
<hidden-api-whitelisted-app package="com.google.android.car.diagnosticverifier" />
<hidden-api-whitelisted-app package="com.google.android.car.diskwriteapp" />
<hidden-api-whitelisted-app package="com.google.android.car.flashapp" />
<hidden-api-whitelisted-app package="com.google.android.car.kitchensink" />
<hidden-api-whitelisted-app package="com.google.android.car.obd2app" />
<hidden-api-whitelisted-app package="com.google.android.car.setupwizard" />
<hidden-api-whitelisted-app package="com.google.android.car.usb.aoap.host" />
<hidden-api-whitelisted-app package="com.google.android.car.vms.subscriber" />
<hidden-api-whitelisted-app package="com.google.android.carrier" />
<hidden-api-whitelisted-app package="com.google.android.carriersetup" />
<hidden-api-whitelisted-app package="com.google.android.connectivitymonitor" />
<hidden-api-whitelisted-app package="com.google.android.edu.harnesssettings" />
<hidden-api-whitelisted-app package="com.google.android.ext.services" />
<hidden-api-whitelisted-app package="com.google.android.factoryota" />
<hidden-api-whitelisted-app package="com.google.android.feedback" />
<hidden-api-whitelisted-app package="com.google.android.gsf" />
<hidden-api-whitelisted-app package="com.google.android.hardwareinfo" />
<hidden-api-whitelisted-app package="com.google.android.hiddenmenu" />
<hidden-api-whitelisted-app package="com.google.android.onetimeinitializer" />
<hidden-api-whitelisted-app package="com.google.android.packageinstaller" />
<hidden-api-whitelisted-app package="com.google.android.partner.provisioning" />
<hidden-api-whitelisted-app package="com.google.android.partnersetup" />
<hidden-api-whitelisted-app package="com.google.android.preloaded_drawable_viewer" />
<hidden-api-whitelisted-app package="com.google.android.printservice.recommendation" />
<hidden-api-whitelisted-app package="com.google.android.sampledeviceowner" />
<hidden-api-whitelisted-app package="com.google.android.apps.scone" />
<hidden-api-whitelisted-app package="com.google.android.sdksetup" />
<hidden-api-whitelisted-app package="com.google.android.setupwizard" />
<hidden-api-whitelisted-app package="com.google.android.storagemanager" />
<hidden-api-whitelisted-app package="com.google.android.tag" />
<hidden-api-whitelisted-app package="com.google.android.tungsten.overscan" />
<hidden-api-whitelisted-app package="com.google.android.tungsten.setupwraith" />
<hidden-api-whitelisted-app package="com.google.android.tv.bugreportsender" />
<hidden-api-whitelisted-app package="com.google.android.tv.frameworkpackagestubs" />
<hidden-api-whitelisted-app package="com.google.android.tv.pairedsetup" />
<hidden-api-whitelisted-app package="com.google.android.vendorloggingservice" />
<hidden-api-whitelisted-app package="com.google.android.volta" />
<hidden-api-whitelisted-app package="com.google.android.wfcactivation" />
<hidden-api-whitelisted-app package="com.google.mds" />
<hidden-api-whitelisted-app package="com.google.modemservice" />
<hidden-api-whitelisted-app package="com.htc.omadm.trigger" />
<hidden-api-whitelisted-app package="com.qualcomm.qcrilmsgtunnel" />
<hidden-api-whitelisted-app package="org.chromium.arc.accessibilityhelper" />
<hidden-api-whitelisted-app package="org.chromium.arc.apkcacheprovider" />
<hidden-api-whitelisted-app package="org.chromium.arc.applauncher" />
<hidden-api-whitelisted-app package="org.chromium.arc.backup_settings" />
<hidden-api-whitelisted-app package="org.chromium.arc.cast_receiver" />
<hidden-api-whitelisted-app package="org.chromium.arc.crash_collector" />
<hidden-api-whitelisted-app package="org.chromium.arc.file_system" />
<hidden-api-whitelisted-app package="org.chromium.arc.gms" />
<hidden-api-whitelisted-app package="org.chromium.arc.home" />
<hidden-api-whitelisted-app package="org.chromium.arc.intent_helper" />
<hidden-api-whitelisted-app package="org.chromium.arc.tts" />
</config>

24 changes: 24 additions & 0 deletions permissions/google_build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->

<!-- These are configurations that should exist on Google's own Nexus and GPe devices. -->
<config>
<feature name="com.google.android.feature.GOOGLE_BUILD" />
<!-- This should be added to all Nexus and GPe devices -->
<feature name="com.google.android.feature.GOOGLE_EXPERIENCE" />
<!-- This should declare the version of Exchange that ships -->
<feature name="com.google.android.feature.EXCHANGE_6_2" />
</config>
31 changes: 31 additions & 0 deletions permissions/nexus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- These are configurations that should exist on Google's 2016 and newer Nexus devices. -->
<config>
<!-- This is meant to be the canonical feature identifying 2016 and newer Nexus devices. -->
<feature name="com.google.android.feature.PIXEL_EXPERIENCE" />

<!-- Both versions of this string are needed due to a miscommunication. b/29978934 -->
<feature name="com.google.android.apps.photos.NEXUS_PRELOAD" />
<feature name="com.google.android.apps.photos.nexus_preload" />

<!-- Enable Zero Touch Provisioning support for 2016 and newer Nexus devices. -->
<feature name="com.google.android.feature.ZERO_TOUCH" />

<!-- Allow Google unbundled tethering entitlement app in background -->
<allow-in-power-save package="com.google.android.tetheringentitlement" />

<!-- Allow ssr detector service in background -->
<allow-in-power-save package="com.google.SSRestartDetector" />

<!-- Allow ramdump uploader service in background -->
<allow-in-power-save package="com.android.ramdump" />

<!-- These are telephony components that need to run in the background -->
<allow-in-power-save package="com.qualcomm.atfwd" />
<allow-in-power-save package="com.qualcomm.embms" />
<allow-in-power-save package="com.qualcomm.qti.telephonyservice" />
<allow-in-power-save package="com.qulacomm.qcrilmsgtunnel" />
<allow-in-power-save package="com.qualcomm.qti.ims" />
<allow-in-power-save package="com.qualcomm.qti.radioconfiginterface" />
</config>
7 changes: 7 additions & 0 deletions permissions/pixel_2017.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- These are configurations that should exist on Google's 2017 and newer Nexus devices. -->
<config>
<!-- This is meant to be the canonical feature identifying 2017 and newer Nexus devices. -->
<feature name="com.google.android.feature.PIXEL_2017_EXPERIENCE" />
</config>
7 changes: 7 additions & 0 deletions permissions/pixel_2017_exclusive.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- These are configurations that should exist on Google's 2017 devices (and not newer/older) -->
<config>
<!-- This defines the Photos preload feature for specifically the 2017 Pixel devices. -->
<feature name="com.google.android.apps.photos.PIXEL_2017_PRELOAD" />
</config>
2 changes: 1 addition & 1 deletion vendorsetup.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_lunch_combo beast_vince-userdebug
add_lunch_combo aosp_vince-userdebug

0 comments on commit c9b02db

Please sign in to comment.