Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Android CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="virtual.camera.app">
<!-- Android 11 需要 -->
<!-- Android 13 需要 -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<!--高危权限-->
Expand Down
44 changes: 44 additions & 0 deletions build.gradle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://jitpack.io' }
maven { url "https://raw.githubusercontent.com/andvipgroup/CameraLib/master" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
minSdkVersion = 24
compileSdkVersion = 33
targetSdkVersion = 31
buildToolsVersion = "31.0.0"
javaVersion = JavaVersion.VERSION_1_8
abiFilters = "armeabi-v7a,arm64-v8a"
localTest = false
isMasterPkg = true
hackJarName = "hack.jar"
versionCode = 100
versionName = "1.0.0"
masterPkg = "virtual.camera.app"
assistPkg = "virtual.camera.app.assist"
}
19 changes: 13 additions & 6 deletions check_env_demo/code/native-lib.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#include <jni.h>
#include <string>
#include <asm/unistd.h>
# include <stdio.h>
# include <unistd.h>
#include <fcntl.h>
#include <unistd.h>

extern "C" JNIEXPORT jint JNICALL
Java_check_env_MainActivity_isPathReallyExist(JNIEnv *env, jobject, jstring path) {
// Convert the Java string to a C-style string
const char *cpath = env->GetStringUTFChars(path, nullptr);
int result1 = syscall(__NR_faccessat,AT_FDCWD, cpath, F_OK, 0);
return result1;
if (cpath == nullptr) {
return -1; // Return error if the conversion fails
}

// Check if the path exists using access
int result = access(cpath, F_OK);

// Release the memory allocated for the C-style string
env->ReleaseStringUTFChars(path, cpath);

return result; // Return 0 if the path exists, -1 otherwise
}