This commit is contained in:
AceDroidX 2022-05-19 01:51:34 +08:00
parent e571590b5c
commit db9d92c976
7 changed files with 43 additions and 19 deletions

View File

@ -16,15 +16,15 @@ android {
storePassword keystoreProperties['storePassword']
}
}
compileSdkVersion 31
buildToolsVersion "32.1.0-rc1"
compileSdkVersion 32
buildToolsVersion "33.0.0-rc4"
defaultConfig {
applicationId "io.github.acedroidx.frp"
minSdkVersion 22
targetSdkVersion 31
versionCode 2
versionName "1.0.1"
minSdkVersion 23
targetSdkVersion 32
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -48,15 +48,28 @@ android {
kotlinOptions {
jvmTarget = '11'
}
packagingOptions {
jniLibs {
useLegacyPackaging true
}
}
splits {
abi {
enable true
reset()
include "arm64-v8a", "x86_64"
universalApk true
}
}
}
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.5.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@ -18,17 +18,17 @@
<meta-data
android:name="Website"
android:value="https://acedroidx.github.io/?a=frp"/>
android:value="https://acedroidx.github.io/?a=frp" />
<service
android:name=".ShellService"
android:enabled="true"
android:exported="true" />
android:exported="false" />
<activity
android:name=".MainActivity"
android:launchMode="singleInstance"
android:exported="true">
android:exported="true"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -17,8 +17,8 @@ import java.io.File
class MainActivity : AppCompatActivity() {
val filename = "frpc"
val frpver = "0.41.0"
val filename = "libfrpc.so"
val frpver = "0.42.0"
val logname = "frpc.log"
val configname = "config.ini"

View File

@ -59,8 +59,19 @@ class ShellService : Service() {
val ainfo =
packageManager.getApplicationInfo(packageName, PackageManager.GET_SHARED_LIBRARY_FILES)
Log.d("adx", "native library dir ${ainfo.nativeLibraryDir}")
p = Runtime.getRuntime()
.exec("${ainfo.nativeLibraryDir}/${filename} -c config.ini", arrayOf(""), this.filesDir)
try {
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()
stopSelf()
return START_NOT_STICKY
}
Toast.makeText(this, "已启动服务", Toast.LENGTH_SHORT).show()
startForeground(1, showMotification());
return START_NOT_STICKY
@ -75,7 +86,7 @@ class ShellService : Service() {
private fun showMotification(): Notification {
val pendingIntent: PendingIntent =
Intent(this, MainActivity::class.java).let { notificationIntent ->
PendingIntent.getActivity(this, 0, notificationIntent, 0)
PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE)
}
val notification: Notification = NotificationCompat.Builder(this, "shell_bg")
.setSmallIcon(R.drawable.ic_launcher_foreground)

View File

@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.10"
ext.kotlin_version = "1.6.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong