Update proguard
This commit is contained in:
parent
c88e63e1ee
commit
774afca739
|
|
@ -86,6 +86,7 @@ public abstract class SigningOptions {
|
||||||
public abstract RunnablesExecutor getExecutor();
|
public abstract RunnablesExecutor getExecutor();
|
||||||
|
|
||||||
/** SDK dependencies of the APK */
|
/** SDK dependencies of the APK */
|
||||||
|
@SuppressWarnings("mutable")
|
||||||
@Nullable
|
@Nullable
|
||||||
public abstract byte[] getSdkDependencyData();
|
public abstract byte[] getSdkDependencyData();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ android {
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = true
|
||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles("proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,10 @@ androidComponents.onVariants { variant ->
|
||||||
|
|
||||||
task<Copy>("copyDex$variantCapped") {
|
task<Copy>("copyDex$variantCapped") {
|
||||||
dependsOn("assemble$variantCapped")
|
dependsOn("assemble$variantCapped")
|
||||||
from("$buildDir/intermediates/dex/$variantLowered/mergeDex$variantCapped/classes.dex")
|
val dexOutPath = if (variant.buildType == "release")
|
||||||
|
"$buildDir/intermediates/dex/$variantLowered/minify${variantCapped}WithR8" else
|
||||||
|
"$buildDir/intermediates/dex/$variantLowered/mergeDex$variantCapped"
|
||||||
|
from(dexOutPath)
|
||||||
rename("classes.dex", "loader.dex")
|
rename("classes.dex", "loader.dex")
|
||||||
into("${rootProject.projectDir}/out/assets/dex")
|
into("${rootProject.projectDir}/out/assets/dex")
|
||||||
}
|
}
|
||||||
|
|
@ -38,6 +41,4 @@ androidComponents.onVariants { variant ->
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(projects.hiddenapi.stubs)
|
compileOnly(projects.hiddenapi.stubs)
|
||||||
|
|
||||||
implementation("de.upb.cs.swt:axml:2.1.2")
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,4 @@
|
||||||
# Add project specific ProGuard rules here.
|
-keep class org.lsposed.lspatch.appstub.LSPAppComponentFactoryStub {
|
||||||
# You can control the set of applied configuration files using the
|
public static byte[] dex;
|
||||||
# proguardFiles setting in build.gradle.
|
<init>();
|
||||||
#
|
}
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
-keep class com.beust.jcommander.** { *; }
|
-keep class com.beust.jcommander.** { *; }
|
||||||
-keep class org.lsposed.lspatch.Patcher$Options { *; }
|
-keep class org.lsposed.lspatch.Patcher$Options { *; }
|
||||||
|
-keep class org.lsposed.lspatch.share.PatchConfig { *; }
|
||||||
-keepclassmembers class org.lsposed.patch.LSPatch {
|
-keepclassmembers class org.lsposed.patch.LSPatch {
|
||||||
private <fields>;
|
private <fields>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import static org.lsposed.lspatch.share.Constants.MANAGER_PACKAGE_NAME;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
@ -13,6 +14,8 @@ import android.util.Log;
|
||||||
import org.lsposed.lspd.models.Module;
|
import org.lsposed.lspd.models.Module;
|
||||||
import org.lsposed.lspd.service.ILSPApplicationService;
|
import org.lsposed.lspd.service.ILSPApplicationService;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RemoteApplicationService implements ILSPApplicationService {
|
public class RemoteApplicationService implements ILSPApplicationService {
|
||||||
|
|
@ -26,34 +29,34 @@ public class RemoteApplicationService implements ILSPApplicationService {
|
||||||
Bundle back = context.getContentResolver().call(PROVIDER, "getBinder", null, null);
|
Bundle back = context.getContentResolver().call(PROVIDER, "getBinder", null, null);
|
||||||
service = ILSPApplicationService.Stub.asInterface(back.getBinder("binder"));
|
service = ILSPApplicationService.Stub.asInterface(back.getBinder("binder"));
|
||||||
if (service == null) throw new RemoteException("Binder is null");
|
if (service == null) throw new RemoteException("Binder is null");
|
||||||
} catch (RemoteException e) {
|
} catch (Throwable e) {
|
||||||
Log.e("LSPatch", "Error when initializing RemoteApplicationServiceClient", e);
|
Log.e("LSPatch", "Error when initializing RemoteApplicationServiceClient", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder requestModuleBinder(String name) {
|
public IBinder requestModuleBinder(String name) {
|
||||||
return service.asBinder();
|
return service == null ? null : service.asBinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Module> getModulesList() throws RemoteException {
|
public List<Module> getModulesList() throws RemoteException {
|
||||||
return service.getModulesList();
|
return service == null ? new ArrayList<>() : service.getModulesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrefsPath(String packageName) throws RemoteException {
|
public String getPrefsPath(String packageName) {
|
||||||
return service.getPrefsPath(packageName);
|
return new File(Environment.getDataDirectory(), "data/" + packageName + "/shared_prefs/").getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bundle requestRemotePreference(String packageName, int userId, IBinder callback) throws RemoteException {
|
public Bundle requestRemotePreference(String packageName, int userId, IBinder callback) throws RemoteException {
|
||||||
return service.requestRemotePreference(packageName, userId, callback);
|
return service == null ? null : service.requestRemotePreference(packageName, userId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder asBinder() {
|
public IBinder asBinder() {
|
||||||
return service.asBinder();
|
return service == null ? null : service.asBinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ public class LSPatch {
|
||||||
throw new PatchError("Error when saving config");
|
throw new PatchError("Error when saving config");
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> apkArchs = new HashSet<>();
|
Set<String> apkArches = new HashSet<>();
|
||||||
|
|
||||||
logger.d("Search target apk library arch...");
|
logger.d("Search target apk library arch...");
|
||||||
|
|
||||||
|
|
@ -293,11 +293,11 @@ public class LSPatch {
|
||||||
var name = storedEntry.getCentralDirectoryHeader().getName();
|
var name = storedEntry.getCentralDirectoryHeader().getName();
|
||||||
if (name.startsWith("lib/") && name.length() >= 5) {
|
if (name.startsWith("lib/") && name.length() >= 5) {
|
||||||
var arch = name.substring(4, name.indexOf('/', 5));
|
var arch = name.substring(4, name.indexOf('/', 5));
|
||||||
apkArchs.add(arch);
|
apkArches.add(arch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (apkArchs.isEmpty()) apkArchs.addAll(ARCHES);
|
if (apkArches.isEmpty()) apkArches.addAll(ARCHES);
|
||||||
apkArchs.removeIf((arch) -> {
|
apkArches.removeIf((arch) -> {
|
||||||
if (!ARCHES.contains(arch) && !arch.equals("armeabi")) {
|
if (!ARCHES.contains(arch) && !arch.equals("armeabi")) {
|
||||||
logger.e("Warning: unsupported arch " + arch + ". Skipping...");
|
logger.e("Warning: unsupported arch " + arch + ". Skipping...");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue