Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ac5c24028d
|
|
@ -33,8 +33,8 @@ jobs:
|
||||||
run: bash ./gradlew zipRelease zipDebug :app:assembleRelease
|
run: bash ./gradlew zipRelease zipDebug :app:assembleRelease
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
if: success()
|
if: success()
|
||||||
run: unzip lspd-core/release/LSPosed-v*-release.zip -d LSPosed-release;
|
run: unzip core/release/LSPosed-v*-release.zip -d LSPosed-release;
|
||||||
unzip lspd-core/release/LSPosed-v*-debug.zip -d LSPosed-debug;
|
unzip core/release/LSPosed-v*-debug.zip -d LSPosed-debug;
|
||||||
- name: Upload release
|
- name: Upload release
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
@ -51,7 +51,7 @@ jobs:
|
||||||
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
|
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
|
||||||
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
OUTPUT="lspd-core/release/"
|
OUTPUT="core/release/"
|
||||||
export release=$(find $OUTPUT -name "LSPosed-v*-release.zip")
|
export release=$(find $OUTPUT -name "LSPosed-v*-release.zip")
|
||||||
export debug=$(find $OUTPUT -name "LSPosed-v*-debug.zip")
|
export debug=$(find $OUTPUT -name "LSPosed-v*-debug.zip")
|
||||||
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://release%22%7D,%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug%22%7D%5D" -F release="@$release" -F debug="@$debug"
|
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://release%22%7D,%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug%22%7D%5D" -F release="@$release" -F debug="@$debug"
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ LANG_CUST_INST_EXT_LIB_ARM64="Extracting arm64 libraries"
|
||||||
LANG_CUST_INST_STUB="Installing stub manager"
|
LANG_CUST_INST_STUB="Installing stub manager"
|
||||||
LANG_CUST_INST_CONF_CREATE="Creating configuration directories"
|
LANG_CUST_INST_CONF_CREATE="Creating configuration directories"
|
||||||
LANG_CUST_INST_CONF_OLD="Use previous path"
|
LANG_CUST_INST_CONF_OLD="Use previous path"
|
||||||
|
LANG_CUST_DISABLE_EDXP="**WARNING**: This installation will disable edxposed because of incompatibility"
|
||||||
LANG_CUST_INST_CONF_NEW="Use new path"
|
LANG_CUST_INST_CONF_NEW="Use new path"
|
||||||
LANG_CUST_INST_COPY_LIB="Copying framework libraries"
|
LANG_CUST_INST_COPY_LIB="Copying framework libraries"
|
||||||
LANG_CUST_INST_REM_OLDCONF="Removing old configuration"
|
LANG_CUST_INST_REM_OLDCONF="Removing old configuration"
|
||||||
|
|
@ -216,6 +217,15 @@ if [[ -f /data/adb/lspd/misc_path ]]; then
|
||||||
# read current MISC_PATH
|
# read current MISC_PATH
|
||||||
MISC_PATH=$(cat /data/adb/lspd/misc_path)
|
MISC_PATH=$(cat /data/adb/lspd/misc_path)
|
||||||
ui_print " - ${LANG_CUST_INST_CONF_OLD} $MISC_PATH"
|
ui_print " - ${LANG_CUST_INST_CONF_OLD} $MISC_PATH"
|
||||||
|
elif [[ -f /data/adb/edxp/misc_path ]]; then
|
||||||
|
mkdir -p /data/adb/lspd || abortC "! ${LANG_CUST_ERR_CONF_CREATE}"
|
||||||
|
MISC_PATH=$(cat /data/adb/edxp/misc_path | sed "s/edxp/lspd/")
|
||||||
|
echo $MISC_PATH > /data/adb/lspd/misc_path
|
||||||
|
ui_print " - ${LANG_CUST_INST_CONF_OLD} $MISC_PATH"
|
||||||
|
cp -r /data/misc/$(cat /data/adb/edxp/misc_path) /data/misc/$MISC_PATH
|
||||||
|
ui_print " - ${LANG_CUST_DISABLE_EDXP} $MISC_PATH"
|
||||||
|
touch $(magisk --path)/.magisk/modules/riru_edxposed/disable
|
||||||
|
touch $(magisk --path)/.magisk/modules/riru_edxposed_sandhook/disable
|
||||||
else
|
else
|
||||||
# generate random MISC_PATH
|
# generate random MISC_PATH
|
||||||
MISC_RAND=$(tr -cd 'A-Za-z0-9' < /dev/urandom | head -c16)
|
MISC_RAND=$(tr -cd 'A-Za-z0-9' < /dev/urandom | head -c16)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ LANG_CUST_INST_EXT_LIB_ARM64="正在解压 arm64 运行库"
|
||||||
LANG_CUST_INST_STUB="正在预装管理器"
|
LANG_CUST_INST_STUB="正在预装管理器"
|
||||||
LANG_CUST_INST_CONF_CREATE="正在创建配置目录"
|
LANG_CUST_INST_CONF_CREATE="正在创建配置目录"
|
||||||
LANG_CUST_INST_CONF_OLD="使用旧目录"
|
LANG_CUST_INST_CONF_OLD="使用旧目录"
|
||||||
|
LANG_CUST_DISABLE_EDXP="**警告**: 由于不兼容,此次安装会自动禁用EdXposed"
|
||||||
LANG_CUST_INST_CONF_NEW="使用新目录"
|
LANG_CUST_INST_CONF_NEW="使用新目录"
|
||||||
LANG_CUST_INST_COPY_LIB="正在复制框架运行库"
|
LANG_CUST_INST_COPY_LIB="正在复制框架运行库"
|
||||||
LANG_CUST_INST_REM_OLDCONF="正在移除老旧配置"
|
LANG_CUST_INST_REM_OLDCONF="正在移除老旧配置"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ android {
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
||||||
cppFlags "-std=c++17"
|
cppFlags "-std=c++20"
|
||||||
cFlags "-std=gnu99"
|
cFlags "-std=gnu99"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,8 +28,8 @@ android {
|
||||||
release {
|
release {
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
cppFlags "-fvisibility=hidden -fvisibility-inlines-hidden -O2 -s -Wno-unused-value"
|
cppFlags "-fvisibility=hidden -fvisibility-inlines-hidden -Os -s -Wno-unused-value"
|
||||||
cFlags "-fvisibility=hidden -fvisibility-inlines-hidden -O2 -s -Wno-unused-value"
|
cFlags "-fvisibility=hidden -fvisibility-inlines-hidden -Os -s -Wno-unused-value"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ public:
|
||||||
virtual const std::string desc_line_1() {
|
virtual const std::string desc_line_1() {
|
||||||
return "Select variant. Use Volume Down to move and Volume Up to confirm.";
|
return "Select variant. Use Volume Down to move and Volume Up to confirm.";
|
||||||
}
|
}
|
||||||
virtual const std::string desc_line_2(int seconds) {
|
virtual const std::string desc_line_2(uint16_t seconds) {
|
||||||
const char base[] = "The program will select YAHFA for you in %d seconds if you don't \nhave a physical volume button. ";
|
const char base[] = "The program will select YAHFA for you in %hu seconds if you don't \nhave a physical volume button. ";
|
||||||
std::string out;
|
std::string out;
|
||||||
out.resize(sizeof(base) + 20);
|
out.resize(sizeof(base) + 20);
|
||||||
sprintf(out.data(), base, seconds);
|
sprintf(out.data(), base, seconds);
|
||||||
|
|
@ -25,8 +25,8 @@ public:
|
||||||
const std::string desc_line_1() override {
|
const std::string desc_line_1() override {
|
||||||
return "请选择变种。使用音量减切换,音量加确定。";
|
return "请选择变种。使用音量减切换,音量加确定。";
|
||||||
}
|
}
|
||||||
const std::string desc_line_2(int seconds) override {
|
const std::string desc_line_2(uint16_t seconds) override {
|
||||||
const char base[] = "如果您的设备没有音量键,本程序将会在 %d 秒后自动选择 YAHFA 。";
|
const char base[] = "如果您的设备没有音量键,本程序将会在 %hu 秒后自动选择 YAHFA 。";
|
||||||
std::string out;
|
std::string out;
|
||||||
out.resize(sizeof(base) + 20);
|
out.resize(sizeof(base) + 20);
|
||||||
sprintf(out.data(), base, seconds);
|
sprintf(out.data(), base, seconds);
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,20 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <cerrno>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <cstring>
|
#include <filesystem>
|
||||||
|
#include <iostream>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <sstream>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <linux/input.h>
|
|
||||||
#include <cerrno>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "Languages.h"
|
#include "Languages.h"
|
||||||
#include "key_selector.h"
|
#include "key_selector.h"
|
||||||
|
|
@ -48,7 +49,7 @@ static int open_device(const char *device)
|
||||||
char name[80];
|
char name[80];
|
||||||
char location[80];
|
char location[80];
|
||||||
char idstr[80];
|
char idstr[80];
|
||||||
struct input_id id;
|
input_id id{};
|
||||||
|
|
||||||
fd = open(device, O_RDWR);
|
fd = open(device, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
|
@ -128,7 +129,7 @@ static int read_notify(const char *dirname, int nfd)
|
||||||
char devname[PATH_MAX];
|
char devname[PATH_MAX];
|
||||||
char *filename;
|
char *filename;
|
||||||
char event_buf[512];
|
char event_buf[512];
|
||||||
int event_size;
|
uint32_t event_size;
|
||||||
int event_pos = 0;
|
int event_pos = 0;
|
||||||
struct inotify_event *event;
|
struct inotify_event *event;
|
||||||
|
|
||||||
|
|
@ -163,30 +164,15 @@ static int read_notify(const char *dirname, int nfd)
|
||||||
|
|
||||||
static int scan_dir(const char *dirname)
|
static int scan_dir(const char *dirname)
|
||||||
{
|
{
|
||||||
char devname[PATH_MAX];
|
namespace fs = std::filesystem;
|
||||||
char *filename;
|
try {
|
||||||
DIR *dir;
|
for (auto &item: fs::directory_iterator(dirname)) {
|
||||||
struct dirent *de;
|
open_device(item.path().c_str());
|
||||||
|
}
|
||||||
dir = opendir(dirname);
|
} catch (const fs::filesystem_error &e) {
|
||||||
if (dir == NULL) {
|
std::cerr << e.what();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(devname, dirname);
|
|
||||||
filename = devname + strlen(devname);
|
|
||||||
*filename++ = '/';
|
|
||||||
|
|
||||||
while ((de = readdir(dir))) {
|
|
||||||
if (de->d_name[0] == '.' && (de->d_name[1] == '\0' ||
|
|
||||||
(de->d_name[1] == '.' && de->d_name[2] == '\0'))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(filename, de->d_name);
|
|
||||||
open_device(devname);
|
|
||||||
}
|
|
||||||
closedir(dir);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,7 +180,7 @@ static int scan_dir(const char *dirname)
|
||||||
uint32_t get_event() {
|
uint32_t get_event() {
|
||||||
int i;
|
int i;
|
||||||
int res;
|
int res;
|
||||||
struct input_event event;
|
input_event event{};
|
||||||
const char *device_path = "/dev/input";
|
const char *device_path = "/dev/input";
|
||||||
unsigned char keys;
|
unsigned char keys;
|
||||||
|
|
||||||
|
|
@ -206,12 +192,14 @@ uint32_t get_event() {
|
||||||
|
|
||||||
res = inotify_add_watch(ufds[0].fd, device_path, IN_DELETE | IN_CREATE);
|
res = inotify_add_watch(ufds[0].fd, device_path, IN_DELETE | IN_CREATE);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
throw std::logic_error("inotify_add_watch failed");
|
std::cerr << "inotify_add_watch failed" << std::endl;
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = scan_dir(device_path);
|
res = scan_dir(device_path);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
throw std::logic_error("scan dev failed");
|
std::cerr << "scan dev failed" << std::endl;
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
@ -245,7 +233,7 @@ uint32_t get_event() {
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
if (getuid() != 0) {
|
if (getuid() != 0) {
|
||||||
std::cout << "Root required" << std::endl;
|
std::cerr << "Root required" << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,20 +242,57 @@ int main() {
|
||||||
alarm(timeout);
|
alarm(timeout);
|
||||||
auto sig_handler = [](int){
|
auto sig_handler = [](int){
|
||||||
std::cout << "No operation after " << timeout << " seconds" << std::endl;
|
std::cout << "No operation after " << timeout << " seconds" << std::endl;
|
||||||
exit(YAHFA);
|
exit(static_cast<int>(Variant::YAHFA));
|
||||||
};
|
};
|
||||||
signal(SIGALRM, sig_handler);
|
signal(SIGALRM, sig_handler);
|
||||||
|
|
||||||
int cursor = YAHFA;
|
// get current arch
|
||||||
const int cursor_max = SandHook;
|
#if defined(__arm__)
|
||||||
|
const Arch arch = ARM;
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
const Arch arch = ARM64;
|
||||||
|
#elif defined(__i386__)
|
||||||
|
const Arch arch = x86;
|
||||||
|
#elif defined(__x86_64__)
|
||||||
|
const Arch arch = x86_64;
|
||||||
|
#else
|
||||||
|
#error "Unsupported arch"
|
||||||
|
#endif
|
||||||
|
|
||||||
auto print_status = [&cursor](){
|
std::unordered_map<Variant, VariantDetail> variants;
|
||||||
|
for (const auto i: AllVariants) {
|
||||||
|
switch (i) {
|
||||||
|
case Variant::YAHFA:
|
||||||
|
variants[i] = {
|
||||||
|
.expression = "YAHFA",
|
||||||
|
.supported_arch = {ARM, ARM64, x86, x86_64}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case Variant::SandHook:
|
||||||
|
variants[i] = {
|
||||||
|
.expression = "SandHook",
|
||||||
|
.supported_arch = {ARM, ARM64}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant cursor = Variant::YAHFA;
|
||||||
|
|
||||||
|
auto print_status = [&cursor, variants, arch](){
|
||||||
//std::cout << "\33[2K\r"; // clear this line
|
//std::cout << "\33[2K\r"; // clear this line
|
||||||
std::cout << "[";
|
std::stringstream ss;
|
||||||
std::cout << (cursor == YAHFA ? "x" : " ");
|
for (const auto &i: variants) {
|
||||||
std::cout << "] YAHFA [";
|
if (!i.second.supported_arch.contains(arch)) {
|
||||||
std::cout << (cursor == SandHook ? "x" : " ");
|
continue;
|
||||||
std::cout << "] SandHook" << std::endl;
|
}
|
||||||
|
ss << "[";
|
||||||
|
ss << (cursor == i.first ? "x" : " ");
|
||||||
|
ss << "] ";
|
||||||
|
ss << i.second.expression;
|
||||||
|
ss << " ";
|
||||||
|
}
|
||||||
|
std::cout << ss.str() << std::endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
// languages
|
// languages
|
||||||
|
|
@ -292,9 +317,6 @@ int main() {
|
||||||
break;
|
break;
|
||||||
case KEYCHECK_PRESSED_VOLUMEDOWN:
|
case KEYCHECK_PRESSED_VOLUMEDOWN:
|
||||||
cursor++;
|
cursor++;
|
||||||
if (cursor > cursor_max) {
|
|
||||||
cursor = YAHFA;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout << "ERROR\n";
|
std::cout << "ERROR\n";
|
||||||
|
|
@ -307,5 +329,5 @@ int main() {
|
||||||
|
|
||||||
// std::cout << std::endl << cursor << std::endl;
|
// std::cout << std::endl << cursor << std::endl;
|
||||||
delete l;
|
delete l;
|
||||||
return cursor;
|
return static_cast<int>(cursor);
|
||||||
}
|
}
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#ifndef __KEYCHECK_H__
|
#ifndef __KEYCHECK_H__
|
||||||
#define __KEYCHECK_H__
|
#define __KEYCHECK_H__
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
// Constants: pressed keys
|
// Constants: pressed keys
|
||||||
#define KEYCHECK_CHECK_VOLUMEDOWN 0x01u
|
#define KEYCHECK_CHECK_VOLUMEDOWN 0x01u
|
||||||
|
|
@ -24,9 +26,37 @@
|
||||||
#define KEYCHECK_PRESSED_VOLUMEDOWN 41u
|
#define KEYCHECK_PRESSED_VOLUMEDOWN 41u
|
||||||
#define KEYCHECK_PRESSED_VOLUMEUP 42u
|
#define KEYCHECK_PRESSED_VOLUMEUP 42u
|
||||||
|
|
||||||
enum Variant {
|
enum class Variant {
|
||||||
YAHFA = 0x11,
|
YAHFA = 0x11,
|
||||||
SandHook = 0x12,
|
SandHook = 0x12,
|
||||||
|
End = SandHook,
|
||||||
|
};
|
||||||
|
const auto AllVariants = { Variant::YAHFA, Variant::SandHook };
|
||||||
|
|
||||||
|
Variant& operator++( Variant &c ) {
|
||||||
|
using IntType = typename std::underlying_type<Variant>::type;
|
||||||
|
c = static_cast<Variant>( static_cast<IntType>(c) + 1 );
|
||||||
|
if ( c > Variant::End )
|
||||||
|
c = Variant::YAHFA;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant operator++( Variant &c, int ) {
|
||||||
|
Variant result = c;
|
||||||
|
++c;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Arch {
|
||||||
|
ARM,
|
||||||
|
ARM64,
|
||||||
|
x86,
|
||||||
|
x86_64
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VariantDetail {
|
||||||
|
const char* expression;
|
||||||
|
std::unordered_set<Arch> supported_arch;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __KEYCHECK_H__
|
#endif // __KEYCHECK_H__
|
||||||
Loading…
Reference in New Issue