diff --git a/app/build.gradle b/app/build.gradle
index 6e93e80..a6d3eff 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,6 +8,10 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
+ buildFeatures {
+ buildConfig = true
+ }
+
signingConfigs {
AceKeystore {
keyAlias keystoreProperties['keyAlias']
@@ -16,15 +20,14 @@ android {
storePassword keystoreProperties['storePassword']
}
}
- compileSdkVersion 32
- buildToolsVersion "33.0.0-rc4"
defaultConfig {
applicationId "io.github.acedroidx.frp"
minSdkVersion 23
- targetSdkVersion 32
- versionCode 3
- versionName "1.0.2"
+ targetSdkVersion 34
+ compileSdk 34
+ versionCode 4
+ versionName "1.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -42,11 +45,11 @@ android {
}
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_11
- targetCompatibility JavaVersion.VERSION_11
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
- jvmTarget = '11'
+ jvmTarget = '17'
}
packagingOptions {
jniLibs {
@@ -57,7 +60,7 @@ android {
abi {
enable true
reset()
- include "arm64-v8a", "x86_64"
+ include "arm64-v8a", "x86_64", "armeabi-v7a"
universalApk true
}
}
@@ -66,11 +69,11 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'androidx.core:core-ktx:1.7.0'
- implementation 'androidx.appcompat:appcompat:1.4.1'
- implementation 'com.google.android.material:material:1.6.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ implementation 'androidx.core:core-ktx:1.12.0'
+ implementation 'androidx.appcompat:appcompat:1.6.1'
+ implementation 'com.google.android.material:material:1.11.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.3'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4694d12..e792e1f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,6 +6,8 @@
+
+
+ android:exported="false"
+ android:foregroundServiceType="specialUse">
+
+
+ if (isGranted) {
+ // Permission is granted. Continue the action or workflow in your
+ // app.
+ } else {
+ // Explain to the user that the feature is unavailable because the
+ // feature requires a permission that the user has denied. At the
+ // same time, respect the user's decision. Don't link to system
+ // settings in an effort to convince the user to change their
+ // decision.
+ }
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ if (ContextCompat.checkSelfPermission(
+ this, Manifest.permission.POST_NOTIFICATIONS
+ ) != PackageManager.PERMISSION_GRANTED
+ ) {
+ requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
+ }
+ }
+ }
+
private fun createBGNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
diff --git a/app/src/main/java/io/github/acedroidx/frp/ShellService.kt b/app/src/main/java/io/github/acedroidx/frp/ShellService.kt
index 132d40f..3d21da2 100644
--- a/app/src/main/java/io/github/acedroidx/frp/ShellService.kt
+++ b/app/src/main/java/io/github/acedroidx/frp/ShellService.kt
@@ -6,6 +6,7 @@ import android.app.Service
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Binder
+import android.os.Build
import android.os.IBinder
import android.util.Log
import android.widget.Toast
@@ -60,12 +61,9 @@ class ShellService : Service() {
packageManager.getApplicationInfo(packageName, PackageManager.GET_SHARED_LIBRARY_FILES)
Log.d("adx", "native library dir ${ainfo.nativeLibraryDir}")
try {
- p = Runtime.getRuntime()
- .exec(
- "${ainfo.nativeLibraryDir}/${filename} -c config.ini",
- arrayOf(""),
- this.filesDir
- )
+ p = Runtime.getRuntime().exec(
+ "${ainfo.nativeLibraryDir}/${filename} -c config.ini", arrayOf(""), this.filesDir
+ )
} catch (e: Exception) {
Log.e("adx", e.stackTraceToString())
Toast.makeText(this, e.message, Toast.LENGTH_LONG).show()
@@ -88,13 +86,16 @@ class ShellService : Service() {
Intent(this, MainActivity::class.java).let { notificationIntent ->
PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE)
}
- val notification: Notification = NotificationCompat.Builder(this, "shell_bg")
- .setSmallIcon(R.drawable.ic_launcher_foreground)
- .setContentTitle("frp后台服务")
+ val notification = NotificationCompat.Builder(this, "shell_bg")
+ .setSmallIcon(R.drawable.ic_launcher_foreground).setContentTitle("frp后台服务")
.setContentText("已启动frp")
//.setTicker("test")
.setContentIntent(pendingIntent)
- .build()
- return notification
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ return notification.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE)
+ .build()
+ } else {
+ return notification.build()
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/jniLibs/arm64-v8a/libfrpc.so b/app/src/main/jniLibs/arm64-v8a/libfrpc.so
index 8d410c6..47ab8bc 100644
Binary files a/app/src/main/jniLibs/arm64-v8a/libfrpc.so and b/app/src/main/jniLibs/arm64-v8a/libfrpc.so differ
diff --git a/app/src/main/jniLibs/armeabi-v7a/libfrpc.so b/app/src/main/jniLibs/armeabi-v7a/libfrpc.so
new file mode 100644
index 0000000..584ee53
Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libfrpc.so differ
diff --git a/app/src/main/jniLibs/x86_64/libfrpc.so b/app/src/main/jniLibs/x86_64/libfrpc.so
index 14cb87a..0653da4 100644
Binary files a/app/src/main/jniLibs/x86_64/libfrpc.so and b/app/src/main/jniLibs/x86_64/libfrpc.so differ
diff --git a/build.gradle b/build.gradle
index 8a9bf9d..b8b9959 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,9 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.6.21"
+ ext.kotlin_version = "1.9.20"
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.1'
@@ -17,10 +17,10 @@ buildscript {
allprojects {
repositories {
google()
- jcenter()
+ mavenCentral()
}
}
-task clean(type: Delete) {
- delete rootProject.buildDir
+tasks.register('clean', Delete) {
+ delete rootProject.layout.buildDirectory
}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 8145fa7..5436bb1 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -19,6 +19,5 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
-android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
\ No newline at end of file