-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
78 changed files
with
487 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* This file is part of HyperCeiler. | ||
* HyperCeiler is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License. | ||
* This program 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 Affero General Public License for more details. | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* Copyright (C) 2023-2024 HyperCeiler Contributions | ||
*/ | ||
package com.sevtinge.hyperceiler.module.base.dexkit; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.luckypray.dexkit.DexKitBridge; | ||
|
||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
public class DexKit { | ||
public boolean isInit = false; | ||
private final String TAG; | ||
private String hostDir = null; | ||
private XC_LoadPackage.LoadPackageParam loadPackageParam; | ||
private static DexKit dexKit = null; | ||
private static DexKitBridge privateDexKitBridge = null; | ||
|
||
public DexKit(XC_LoadPackage.LoadPackageParam param, String tag) { | ||
loadPackageParam = param; | ||
TAG = tag; | ||
dexKit = this; | ||
} | ||
|
||
private void init() { | ||
if (privateDexKitBridge == null) { | ||
if (hostDir == null) { | ||
if (loadPackageParam == null) { | ||
throw new RuntimeException(TAG != null ? TAG : "InitDexKit" + ": lpparam is null"); | ||
} | ||
hostDir = loadPackageParam.appInfo.sourceDir; | ||
} | ||
System.loadLibrary("dexkit"); | ||
privateDexKitBridge = DexKitBridge.create(hostDir); | ||
} | ||
isInit = true; | ||
} | ||
|
||
@NotNull | ||
public static DexKitBridge getDexKitBridge() { | ||
if (privateDexKitBridge == null) { | ||
if (dexKit == null) { | ||
throw new RuntimeException("InitDexKit is null!!"); | ||
} else { | ||
// new DexKitCache(dexKit.loadPackageParam).create(); | ||
dexKit.init(); | ||
} | ||
} | ||
return privateDexKitBridge; | ||
} | ||
|
||
/** | ||
* 请勿手动调用。 | ||
*/ | ||
public void close() { | ||
if (privateDexKitBridge != null) { | ||
privateDexKitBridge.close(); | ||
privateDexKitBridge = null; | ||
} | ||
loadPackageParam = null; | ||
dexKit = null; | ||
hostDir = null; | ||
isInit = false; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* This file is part of HyperCeiler. | ||
* HyperCeiler is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License. | ||
* This program 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 Affero General Public License for more details. | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* Copyright (C) 2023-2024 HyperCeiler Contributions | ||
*/ | ||
package com.sevtinge.hyperceiler.module.base.dexkit; | ||
|
||
import com.sevtinge.hyperceiler.callback.ITAG; | ||
import com.sevtinge.hyperceiler.utils.FileUtils; | ||
import com.sevtinge.hyperceiler.utils.log.XposedLogUtils; | ||
|
||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
public class DexKitCache { | ||
private final XC_LoadPackage.LoadPackageParam param; | ||
private final String data; | ||
private final String dexPath; | ||
private final String dexFile; | ||
|
||
public DexKitCache(XC_LoadPackage.LoadPackageParam param) { | ||
this.param = param; | ||
data = param.appInfo.dataDir; | ||
dexPath = data + "/dexkit"; | ||
dexFile = dexPath + "/cache"; | ||
XposedLogUtils.logE(ITAG.TAG, "data: " + data + " dex: " + dexPath); | ||
} | ||
|
||
public DexKitCache create() { | ||
FileUtils.mkdirs(dexPath); | ||
FileUtils.touch(dexFile); | ||
FileUtils.setPermission(dexFile); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/InitDexKit.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.