Skip to content

Commit

Permalink
vince: Use pixel fingerprint to bypass safetynet
Browse files Browse the repository at this point in the history
  • Loading branch information
waiser86 committed Apr 4, 2019
1 parent 340a065 commit d164351
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 10 deletions.
7 changes: 3 additions & 4 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,9 @@ DEVICE_MATRIX_FILE := $(DEVICE_PATH)/compatibility_matrix.xml
# Compile libhwui in performance mode
HWUI_COMPILE_FOR_PERF := true

# Init
TARGET_INIT_VENDOR_LIB := libinit_msm8953
TARGET_PLATFORM_DEVICE_BASE := /devices/soc/
TARGET_RECOVERY_DEVICE_MODULES := libinit_msm8953
# Vendor init
TARGET_INIT_VENDOR_LIB := libinit_vince
TARGET_RECOVERY_DEVICE_MODULES := libinit_vince

# Media
TARGET_USES_MEDIA_EXTENSIONS := true
Expand Down
10 changes: 6 additions & 4 deletions init/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := system/core/init
LOCAL_MODULE := libinit_msm8953
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := init_msm8953.cpp
LOCAL_STATIC_LIBRARIES := libbase libselinux
LOCAL_C_INCLUDES := system/core/init
LOCAL_CPPFLAGS := -Wall -DANDROID_TARGET=\"msm8953\"
LOCAL_SRC_FILES := init_vince.cpp
LOCAL_MODULE := libinit_vince
LOCAL_STATIC_LIBRARIES := \
libbase libselinux

include $(BUILD_STATIC_LIBRARY)
66 changes: 64 additions & 2 deletions init/init_msm8953.cpp → init/init_vince.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright (c) 2016, The CyanogenMod Project
Copyright (C) 2017-2018 The LineageOS Project.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Expand All @@ -27,8 +26,12 @@
*/

#include <fcntl.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <stdlib.h>
#include <sys/sysinfo.h>
#include <sys/_system_properties.h>

#include <android-base/properties.h>
#include "vendor_init.h"
#include "property_service.h"
#include "log.h"
Expand All @@ -38,6 +41,37 @@ char const *heapminfree;

using android::init::property_set;

static void init_alarm_boot_properties()
{
int boot_reason;
FILE *fp;

fp = fopen("/proc/sys/kernel/boot_reason", "r");
fscanf(fp, "%d", &boot_reason);
fclose(fp);

/*
* Setup ro.alarm_boot value to true when it is RTC triggered boot up
* For existing PMIC chips, the following mapping applies
* for the value of boot_reason:
*
* 0 -> unknown
* 1 -> hard reset
* 2 -> sudden momentary power loss (SMPL)
* 3 -> real time clock (RTC)
* 4 -> DC charger inserted
* 5 -> USB charger inserted
* 6 -> PON1 pin toggled (for secondary PMICs)
* 7 -> CBLPWR_N pin toggled (for external power supply)
* 8 -> KPDPWR_N pin toggled (power key pressed)
*/
if (boot_reason == 3) {
property_set("ro.alarm_boot", "true");
} else {
property_set("ro.alarm_boot", "false");
}
}

void check_device()
{
struct sysinfo sys;
Expand All @@ -55,8 +89,27 @@ void check_device()
}
}

void property_override(char const prop[], char const value[])
{
prop_info *pi;

pi = (prop_info*) __system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else
__system_property_add(prop, strlen(prop), value, strlen(value));
}

void property_override_dual(char const system_prop[], char const vendor_prop[],
char const value[])
{
property_override(system_prop, value);
property_override(vendor_prop, value);
}

void vendor_load_properties()
{
init_alarm_boot_properties();
check_device();

property_set("dalvik.vm.heapstartsize", "16m");
Expand All @@ -65,4 +118,13 @@ void vendor_load_properties()
property_set("dalvik.vm.heaptargetutilization", "0.75");
property_set("dalvik.vm.heapminfree", heapminfree);
property_set("dalvik.vm.heapmaxfree", "8m");
}

std::string platform = android::base::GetProperty("ro.board.platform", "");

if (platform != ANDROID_TARGET)
return;

// fingerprint
property_override("ro.build.description", "vince-user 8.1.0 OPM1.171019.011 V9.6.18.0.OEJMIFD release-keys");
property_override_dual("ro.build.fingerprint", "ro.vendor.build.fingerprint", "google/walleye/walleye:8.1.0/OPM1.171019.011/4448085:user/release-keys");
}

0 comments on commit d164351

Please sign in to comment.