From 0bc9fdbaa20fb1f93c547aada0a61843d44858ef Mon Sep 17 00:00:00 2001 From: tehcneko <7764726+tehcneko@users.noreply.github.com> Date: Sat, 20 Feb 2021 22:45:09 +0800 Subject: [PATCH] [core] Nuke KeepAll and KeepMembers --- core/proguard-rules.pro | 8 +------ .../io/github/lsposed/common/KeepAll.java | 24 ------------------- .../io/github/lsposed/common/KeepMembers.java | 24 ------------------- .../io/github/lsposed/lspd/core/Impl.java | 5 ++-- .../io/github/lsposed/lspd/core/Main.java | 6 +++-- .../io/github/lsposed/lspd/core/Proxy.java | 5 ++-- .../lspd/nativebridge/ClassLinker.java | 5 ++-- .../github/lsposed/lspd/proxy/BaseProxy.java | 4 ---- 8 files changed, 14 insertions(+), 67 deletions(-) delete mode 100644 core/src/main/java/io/github/lsposed/common/KeepAll.java delete mode 100644 core/src/main/java/io/github/lsposed/common/KeepMembers.java diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index e836635a..867f7975 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -23,10 +23,4 @@ -dontobfuscate -dontoptimize -keep class de.robv.android.xposed.** {*;} --keep class android.** { *; } - --keep interface io.github.lsposed.common.KeepAll --keep interface io.github.lsposed.common.KeepMembers - --keep class * implements io.github.lsposed.common.KeepAll { *; } --keepclassmembers class * implements io.github.lsposed.common.KeepMembers { *; } \ No newline at end of file +-keep class android.** { *; } \ No newline at end of file diff --git a/core/src/main/java/io/github/lsposed/common/KeepAll.java b/core/src/main/java/io/github/lsposed/common/KeepAll.java deleted file mode 100644 index 2fddcc13..00000000 --- a/core/src/main/java/io/github/lsposed/common/KeepAll.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 . - * - * Copyright (C) 2020 EdXposed Contributors - * Copyright (C) 2021 LSPosed Contributors - */ - -package io.github.lsposed.common; - -public interface KeepAll { -} diff --git a/core/src/main/java/io/github/lsposed/common/KeepMembers.java b/core/src/main/java/io/github/lsposed/common/KeepMembers.java deleted file mode 100644 index f3493b53..00000000 --- a/core/src/main/java/io/github/lsposed/common/KeepMembers.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 . - * - * Copyright (C) 2020 EdXposed Contributors - * Copyright (C) 2021 LSPosed Contributors - */ - -package io.github.lsposed.common; - -public interface KeepMembers { -} diff --git a/core/src/main/java/io/github/lsposed/lspd/core/Impl.java b/core/src/main/java/io/github/lsposed/lspd/core/Impl.java index ce15cae4..680c53ae 100644 --- a/core/src/main/java/io/github/lsposed/lspd/core/Impl.java +++ b/core/src/main/java/io/github/lsposed/lspd/core/Impl.java @@ -21,16 +21,17 @@ package io.github.lsposed.lspd.core; import androidx.annotation.IntDef; +import androidx.annotation.Keep; import androidx.annotation.NonNull; -import io.github.lsposed.common.KeepAll; import io.github.lsposed.lspd.proxy.Router; import java.lang.annotation.Retention; import static java.lang.annotation.RetentionPolicy.SOURCE; -public interface Impl extends KeepAll { +@Keep +public interface Impl { int NONE = 0; int YAHFA = 1; diff --git a/core/src/main/java/io/github/lsposed/lspd/core/Main.java b/core/src/main/java/io/github/lsposed/lspd/core/Main.java index f7460c35..9297a3eb 100644 --- a/core/src/main/java/io/github/lsposed/lspd/core/Main.java +++ b/core/src/main/java/io/github/lsposed/lspd/core/Main.java @@ -25,7 +25,8 @@ import android.os.Binder; import android.os.IBinder; import android.ddm.DdmHandleAppName; -import io.github.lsposed.common.KeepAll; +import androidx.annotation.Keep; + import io.github.lsposed.lspd.config.LSPApplicationServiceClient; import io.github.lsposed.lspd.service.ServiceManager; import io.github.lsposed.lspd.util.Utils; @@ -35,7 +36,8 @@ import java.util.concurrent.atomic.AtomicReference; import static io.github.lsposed.lspd.config.LSPApplicationServiceClient.serviceClient; @SuppressLint("DefaultLocale") -public class Main implements KeepAll { +@Keep +public class Main { private static final AtomicReference lspdImplRef = new AtomicReference<>(null); private static final Binder heartBeatBinder = new Binder(); diff --git a/core/src/main/java/io/github/lsposed/lspd/core/Proxy.java b/core/src/main/java/io/github/lsposed/lspd/core/Proxy.java index 9337ba6f..cf9e0d24 100644 --- a/core/src/main/java/io/github/lsposed/lspd/core/Proxy.java +++ b/core/src/main/java/io/github/lsposed/lspd/core/Proxy.java @@ -20,9 +20,10 @@ package io.github.lsposed.lspd.core; -import io.github.lsposed.common.KeepAll; +import androidx.annotation.Keep; -public interface Proxy extends KeepAll { +@Keep +public interface Proxy { boolean init(); diff --git a/core/src/main/java/io/github/lsposed/lspd/nativebridge/ClassLinker.java b/core/src/main/java/io/github/lsposed/lspd/nativebridge/ClassLinker.java index 3559cfcb..ba2b6a86 100644 --- a/core/src/main/java/io/github/lsposed/lspd/nativebridge/ClassLinker.java +++ b/core/src/main/java/io/github/lsposed/lspd/nativebridge/ClassLinker.java @@ -20,13 +20,14 @@ package io.github.lsposed.lspd.nativebridge; -import io.github.lsposed.common.KeepAll; +import androidx.annotation.Keep; import java.lang.reflect.Member; import de.robv.android.xposed.PendingHooks; -public class ClassLinker implements KeepAll { +@Keep +public class ClassLinker { public static native void setEntryPointsToInterpreter(Member method); diff --git a/core/src/main/java/io/github/lsposed/lspd/proxy/BaseProxy.java b/core/src/main/java/io/github/lsposed/lspd/proxy/BaseProxy.java index 07a0dcc7..88d043f7 100644 --- a/core/src/main/java/io/github/lsposed/lspd/proxy/BaseProxy.java +++ b/core/src/main/java/io/github/lsposed/lspd/proxy/BaseProxy.java @@ -36,8 +36,4 @@ public abstract class BaseProxy implements Proxy { public boolean init() { return true; } - - public static void onBlackListed() { - XposedBridge.clearAllCallbacks(); - } }