[daemon] Only package needed resources (#1508)
* [skip ci] Fix reRunDaemon task * [daemon] Only package needed resources * Shrink resources
This commit is contained in:
parent
16e1de76ff
commit
1f5dfbc1b9
|
|
@ -6,6 +6,7 @@ on:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
paths:
|
paths:
|
||||||
- app/src/main/res/values/strings.xml
|
- app/src/main/res/values/strings.xml
|
||||||
|
- daemon/src/main/res/values/strings.xml
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
synchronize-with-crowdin:
|
synchronize-with-crowdin:
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,6 @@
|
||||||
<string name="enabled_verbose_log">Verbose log enabled</string>
|
<string name="enabled_verbose_log">Verbose log enabled</string>
|
||||||
<string name="disabled_verbose_log">Verbose log disabled</string>
|
<string name="disabled_verbose_log">Verbose log disabled</string>
|
||||||
|
|
||||||
<!-- Notification -->
|
|
||||||
<string name="module_is_not_activated_yet">Xposed module is not activated yet</string>
|
|
||||||
<string name="module_is_not_activated_yet_detailed">%s has been installed, but is not activated yet</string>
|
|
||||||
<string name="xposed_module_updated_notification_title">Xposed module updated</string>
|
|
||||||
<string name="xposed_module_updated_notification_content">%s has been updated, please force stop and restart apps in its scope</string>
|
|
||||||
<string name="xposed_module_updated_notification_title_system">Xposed module updated, system reboot required</string>
|
|
||||||
<string name="xposed_module_updated_notification_content_system">%s has been updated, since the scope contains System Framework, required reboot to apply changes</string>
|
|
||||||
|
|
||||||
<!-- ModulesActivity -->
|
<!-- ModulesActivity -->
|
||||||
<string name="module_empty_description">(no description provided)</string>
|
<string name="module_empty_description">(no description provided)</string>
|
||||||
<string name="warning_xposed_min_version">This module requires a newer Xposed version (%d) and thus cannot be activated</string>
|
<string name="warning_xposed_min_version">This module requires a newer Xposed version (%d) and thus cannot be activated</string>
|
||||||
|
|
@ -138,6 +130,7 @@
|
||||||
<string name="use_recommended">Recommended</string>
|
<string name="use_recommended">Recommended</string>
|
||||||
<string name="no_scope_selected_has_recommended">You did not select any app. Select recommended apps?</string>
|
<string name="no_scope_selected_has_recommended">You did not select any app. Select recommended apps?</string>
|
||||||
<string name="use_recommended_message">Select recommended apps?</string>
|
<string name="use_recommended_message">Select recommended apps?</string>
|
||||||
|
<string name="module_is_not_activated_yet">Xposed module is not activated yet</string>
|
||||||
<string name="requested_by_module">Recommended</string>
|
<string name="requested_by_module">Recommended</string>
|
||||||
<string name="update_available">Update available: %1$s</string>
|
<string name="update_available">Update available: %1$s</string>
|
||||||
<string name="module_disabled_no_selection">Module %s has been disabled since no app selected.</string>
|
<string name="module_disabled_no_selection">Module %s has been disabled since no app selected.</string>
|
||||||
|
|
|
||||||
|
|
@ -303,12 +303,12 @@ val killLspd = task<Exec>("killLspd") {
|
||||||
isIgnoreExitValue = true
|
isIgnoreExitValue = true
|
||||||
}
|
}
|
||||||
val pushDaemon = task<Exec>("pushDaemon") {
|
val pushDaemon = task<Exec>("pushDaemon") {
|
||||||
dependsOn(":daemon:assembleRiruDebug")
|
dependsOn(":daemon:assembleDebug")
|
||||||
workingDir("${project(":daemon").buildDir}/outputs/apk/debug")
|
workingDir("${project(":daemon").buildDir}/outputs/apk/debug")
|
||||||
commandLine(adb, "push", "daemon-Zygisk-debug.apk", "/data/local/tmp/daemon.apk")
|
commandLine(adb, "push", "daemon-debug.apk", "/data/local/tmp/daemon.apk")
|
||||||
}
|
}
|
||||||
val pushDaemonNative = task<Exec>("pushDaemonNative") {
|
val pushDaemonNative = task<Exec>("pushDaemonNative") {
|
||||||
dependsOn("mergeRiruDebugNativeLibs")
|
dependsOn(":daemon:assembleDebug")
|
||||||
doFirst {
|
doFirst {
|
||||||
val abi: String = ByteArrayOutputStream().use { outputStream ->
|
val abi: String = ByteArrayOutputStream().use { outputStream ->
|
||||||
exec {
|
exec {
|
||||||
|
|
@ -323,7 +323,7 @@ val pushDaemonNative = task<Exec>("pushDaemonNative") {
|
||||||
}
|
}
|
||||||
val reRunDaemon = task<Exec>("reRunDaemon") {
|
val reRunDaemon = task<Exec>("reRunDaemon") {
|
||||||
dependsOn(pushDaemon, pushDaemonNative, killLspd)
|
dependsOn(pushDaemon, pushDaemonNative, killLspd)
|
||||||
commandLine(adb, "shell", "su", "-c", "sh /data/adb/modules/*_lsposed/service.sh&")
|
commandLine(adb, "shell", "su", "-c", "sh `su -c magisk --path`/.magisk/modules/*_lsposed/service.sh&")
|
||||||
isIgnoreExitValue = true
|
isIgnoreExitValue = true
|
||||||
}
|
}
|
||||||
val tmpApk = "/data/local/tmp/lsp.apk"
|
val tmpApk = "/data/local/tmp/lsp.apk"
|
||||||
|
|
|
||||||
31
crowdin.yml
31
crowdin.yml
|
|
@ -1,11 +1,11 @@
|
||||||
#
|
#
|
||||||
# Your Crowdin credentials
|
# Your Crowdin credentials
|
||||||
#
|
#
|
||||||
"project_id_env" : "CROWDIN_PROJECT_ID"
|
"project_id_env": "CROWDIN_PROJECT_ID"
|
||||||
"api_token_env" : "CROWDIN_API_TOKEN"
|
"api_token_env": "CROWDIN_API_TOKEN"
|
||||||
"base_path" : "."
|
"base_path": "."
|
||||||
"base_url" : "https://lsposed.crowdin.com/api/v2"
|
"base_url": "https://lsposed.crowdin.com/api/v2"
|
||||||
"pull_request_title" : "[translation] Update translation from Crowdin"
|
"pull_request_title": "[translation] Update translation from Crowdin"
|
||||||
#
|
#
|
||||||
# Choose file structure in Crowdin
|
# Choose file structure in Crowdin
|
||||||
# e.g. true or false
|
# e.g. true or false
|
||||||
|
|
@ -16,11 +16,18 @@
|
||||||
# Files configuration
|
# Files configuration
|
||||||
#
|
#
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
"source" : "/app/src/main/res/values/strings.xml",
|
"source": "/app/src/main/res/values/strings.xml",
|
||||||
"translation" : "/app/src/main/res/values-%two_letters_code%/%original_file_name%",
|
"translation": "/app/src/main/res/values-%two_letters_code%/%original_file_name%",
|
||||||
"type": "android",
|
"type": "android",
|
||||||
"dest": "/app/strings.xml",
|
"dest": "/app/strings.xml",
|
||||||
"skip_untranslated_strings": true
|
"skip_untranslated_strings": true
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"source": "/daemon/src/main/res/values/strings.xml",
|
||||||
|
"translation": "/daemon/src/main/res/values-%two_letters_code%/%original_file_name%",
|
||||||
|
"type": "android",
|
||||||
|
"dest": "/daemon/strings.xml",
|
||||||
|
"skip_untranslated_strings": true
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.ide.common.signing.KeystoreHelper
|
import com.android.ide.common.signing.KeystoreHelper
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.io.FileOutputStream
|
import java.util.*
|
||||||
import java.util.Locale
|
|
||||||
import java.util.jar.JarFile
|
|
||||||
import java.util.zip.ZipOutputStream
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
|
|
@ -123,34 +120,6 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
|
||||||
tasks["merge${variantCapped}JniLibFolders"].enabled = false
|
tasks["merge${variantCapped}JniLibFolders"].enabled = false
|
||||||
tasks["merge${variantCapped}NativeLibs"].enabled = false
|
tasks["merge${variantCapped}NativeLibs"].enabled = false
|
||||||
|
|
||||||
task<Jar>("generateApp${variantLowered}RFile") {
|
|
||||||
dependsOn(":app:process${variantCapped}Resources")
|
|
||||||
doLast {
|
|
||||||
val rFile = JarFile(
|
|
||||||
File(
|
|
||||||
project(":app").buildDir,
|
|
||||||
"intermediates/compile_and_runtime_not_namespaced_r_class_jar/${variantLowered}/R.jar"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
ZipOutputStream(
|
|
||||||
FileOutputStream(
|
|
||||||
File(
|
|
||||||
project.buildDir,
|
|
||||||
"tmp/${variantLowered}R.jar"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
).use {
|
|
||||||
for (entry in rFile.entries()) {
|
|
||||||
if (entry.name.startsWith("org/lsposed/manager")) {
|
|
||||||
it.putNextEntry(entry)
|
|
||||||
rFile.getInputStream(entry).transferTo(it)
|
|
||||||
it.closeEntry()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android")
|
val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android")
|
||||||
val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}")
|
val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}")
|
||||||
val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java")
|
val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java")
|
||||||
|
|
@ -195,9 +164,4 @@ dependencies {
|
||||||
implementation(project(":hiddenapi-bridge"))
|
implementation(project(":hiddenapi-bridge"))
|
||||||
implementation(project(":daemon-service"))
|
implementation(project(":daemon-service"))
|
||||||
implementation(project(":manager-service"))
|
implementation(project(":manager-service"))
|
||||||
android.applicationVariants.all {
|
|
||||||
"${name}Implementation"(files(File(project.buildDir, "tmp/${name}R.jar")) {
|
|
||||||
builtBy("generateApp${name}RFile")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,2 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest package="org.lsposed.daemon" />
|
||||||
package="org.lsposed.daemon">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true" />
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import hidden.HiddenApiBridge;
|
||||||
|
|
||||||
public class ConfigFileManager {
|
public class ConfigFileManager {
|
||||||
static final Path basePath = Paths.get("/data/adb/lspd");
|
static final Path basePath = Paths.get("/data/adb/lspd");
|
||||||
|
static final Path daemonApkPath = Paths.get(System.getProperty("java.class.path", null));
|
||||||
static final Path managerApkPath = basePath.resolve("manager.apk");
|
static final Path managerApkPath = basePath.resolve("manager.apk");
|
||||||
private static final Path lockPath = basePath.resolve("lock");
|
private static final Path lockPath = basePath.resolve("lock");
|
||||||
private static final Path configDirPath = basePath.resolve("config");
|
private static final Path configDirPath = basePath.resolve("config");
|
||||||
|
|
@ -96,7 +97,7 @@ public class ConfigFileManager {
|
||||||
Method addAssetPath = AssetManager.class.getDeclaredMethod("addAssetPath", String.class);
|
Method addAssetPath = AssetManager.class.getDeclaredMethod("addAssetPath", String.class);
|
||||||
addAssetPath.setAccessible(true);
|
addAssetPath.setAccessible(true);
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
if ((int) addAssetPath.invoke(am, managerApkPath.toString()) > 0)
|
if ((int) addAssetPath.invoke(am, daemonApkPath.toString()) > 0)
|
||||||
//noinspection deprecation
|
//noinspection deprecation
|
||||||
res = new Resources(am, null, null);
|
res = new Resources(am, null, null);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ import android.view.IWindowManager;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.lsposed.daemon.BuildConfig;
|
import org.lsposed.daemon.BuildConfig;
|
||||||
|
import org.lsposed.daemon.R;
|
||||||
import org.lsposed.lspd.ILSPManagerService;
|
import org.lsposed.lspd.ILSPManagerService;
|
||||||
import org.lsposed.lspd.models.Application;
|
import org.lsposed.lspd.models.Application;
|
||||||
import org.lsposed.lspd.models.UserInfo;
|
import org.lsposed.lspd.models.UserInfo;
|
||||||
|
|
@ -220,13 +221,13 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
||||||
try {
|
try {
|
||||||
var context = new FakeContext();
|
var context = new FakeContext();
|
||||||
String title = context.getString(enabled ? systemModule ?
|
String title = context.getString(enabled ? systemModule ?
|
||||||
org.lsposed.manager.R.string.xposed_module_updated_notification_title_system :
|
R.string.xposed_module_updated_notification_title_system :
|
||||||
org.lsposed.manager.R.string.xposed_module_updated_notification_title :
|
R.string.xposed_module_updated_notification_title :
|
||||||
org.lsposed.manager.R.string.module_is_not_activated_yet);
|
R.string.module_is_not_activated_yet);
|
||||||
String content = context.getString(enabled ? systemModule ?
|
String content = context.getString(enabled ? systemModule ?
|
||||||
org.lsposed.manager.R.string.xposed_module_updated_notification_content_system :
|
R.string.xposed_module_updated_notification_content_system :
|
||||||
org.lsposed.manager.R.string.xposed_module_updated_notification_content :
|
R.string.xposed_module_updated_notification_content :
|
||||||
org.lsposed.manager.R.string.module_is_not_activated_yet_detailed, modulePackageName);
|
R.string.module_is_not_activated_yet_detailed, modulePackageName);
|
||||||
|
|
||||||
var style = new Notification.BigTextStyle();
|
var style = new Notification.BigTextStyle();
|
||||||
style.bigText(content);
|
style.bigText(content);
|
||||||
|
|
@ -235,7 +236,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
||||||
.setContentTitle(title)
|
.setContentTitle(title)
|
||||||
.setContentText(content)
|
.setContentText(content)
|
||||||
.setSmallIcon(android.R.drawable.ic_dialog_info)
|
.setSmallIcon(android.R.drawable.ic_dialog_info)
|
||||||
.setColor(context.getResources().getColor(org.lsposed.manager.R.color.color_primary))
|
.setColor(context.getResources().getColor(R.color.color_primary))
|
||||||
.setContentIntent(getNotificationIntent(modulePackageName, moduleUserId))
|
.setContentIntent(getNotificationIntent(modulePackageName, moduleUserId))
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setStyle(style)
|
.setStyle(style)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ This file is part of LSPosed.
|
||||||
|
~
|
||||||
|
~ LSPosed is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ LSPosed is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
~
|
||||||
|
~ Copyright (C) 2021 LSPosed Contributors
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<color name="color_primary">@color/color_primary_dark</color>
|
||||||
|
</resources>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ This file is part of LSPosed.
|
||||||
|
~
|
||||||
|
~ LSPosed is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ LSPosed is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
~
|
||||||
|
~ Copyright (C) 2021 LSPosed Contributors
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<color name="color_primary_light">#1A73E8</color>
|
||||||
|
<color name="color_primary_dark">#8AB4F8</color>
|
||||||
|
<color name="color_primary">@color/color_primary_light</color>
|
||||||
|
</resources>
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">LSPosed</string>
|
<!-- Notification -->
|
||||||
</resources>
|
<string name="module_is_not_activated_yet">Xposed module is not activated yet</string>
|
||||||
|
<string name="module_is_not_activated_yet_detailed">%s has been installed, but is not activated yet</string>
|
||||||
|
<string name="xposed_module_updated_notification_title">Xposed module updated</string>
|
||||||
|
<string name="xposed_module_updated_notification_content">%s has been updated, please force stop and restart apps in its scope</string>
|
||||||
|
<string name="xposed_module_updated_notification_title_system">Xposed module updated, system reboot required</string>
|
||||||
|
<string name="xposed_module_updated_notification_content_system">%s has been updated, since the scope contains System Framework, required reboot to apply changes</string>
|
||||||
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,8 @@
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
# disable new resource shinker since it will change the resources id
|
android.experimental.enableNewResourceShrinker=true
|
||||||
# which will be used by the core
|
android.experimental.enableNewResourceShrinker.preciseShrinking=true
|
||||||
# android.experimental.enableNewResourceShrinker=true
|
|
||||||
# android.experimental.enableNewResourceShrinker.preciseShrinking=true
|
|
||||||
android.enableAppCompileTimeRClass=true
|
android.enableAppCompileTimeRClass=true
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
android.enableR8.fullMode=true
|
android.enableR8.fullMode=true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue