feat: add dual detection

This commit is contained in:
Dr-TSNG 2021-06-10 13:12:47 +08:00
commit 25f2f6f665
7 changed files with 29 additions and 12 deletions

4
.gitignore vendored
View file

@ -76,4 +76,6 @@ lint/tmp/
# lint/reports/
# Android Profiling
*.hprof
*.hprof
updates/

View file

@ -119,6 +119,6 @@ Java_com_tsng_hidemyapplist_MainActivity_initNative(JNIEnv *env, jobject, jstrin
}
extern "C" JNIEXPORT jint JNICALL
Java_com_tsng_hidemyapplist_ui_DetectionActivity_00024DetectionTask_nativeSync(JNIEnv *, jobject, jint result) {
Java_com_tsng_hidemyapplist_UtilsKt_nativeSync(JNIEnv *, jclass clazz, jint result) {
return sign ^ 0b1010011010 ? result * (0x53 - 0b1010011) + 1 : result * (0x4c - 0b1001011);
}

View file

@ -1,5 +1,6 @@
package com.tsng.hidemyapplist
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
@ -18,6 +19,7 @@ import okhttp3.Request
import org.json.JSONObject
import java.util.*
import kotlin.concurrent.thread
import kotlin.system.exitProcess
class MainActivity : AppCompatActivity(), View.OnClickListener {
companion object {
@ -39,10 +41,17 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
initNative(applicationContext.packageResourcePath)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
startService(Intent(this, ProvidePreferenceService::class.java))
if(!filesDir.absolutePath.startsWith("/data/user/0/")) {
Toast.makeText(this, R.string.do_not_dual, Toast.LENGTH_LONG).show()
finish()
exitProcess(0)
}
if (nativeSync(0) xor 1 == 0x01)
startService(Intent(this, ProvidePreferenceService::class.java))
makeUpdateAlert()
}
@SuppressLint("SetTextI18n")
override fun onResume() {
super.onResume()
val serviceVersion = XposedUtils.getServiceVersion(this)
@ -66,10 +75,9 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
else xposed_status_sub_text.text = getString(R.string.xposed_service_on) + " [$serviceVersion]"
val text = getString(R.string.xposed_serve_times).split("#")
xposed_status_serve_times.visibility = View.VISIBLE
xposed_status_serve_times.text = text[0] + XposedUtils.getServeTimes(this) + text[2]
xposed_status_serve_times.text = text[0] + nativeSync(XposedUtils.getServeTimes(this)) + text[2]
riru_status_text.visibility = View.VISIBLE
val riruExtensionVersion = XposedUtils.getRiruExtensionVersion(this)
when (riruExtensionVersion) {
when (val riruExtensionVersion = XposedUtils.getRiruExtensionVersion(this)) {
0 -> riru_status_text.text = getString(R.string.riru_not_installed)
-1 -> riru_status_text.text = getString(R.string.riru_version_too_old)
-2 -> riru_status_text.text = getString(R.string.riru_apk_version_too_old)

View file

@ -0,0 +1,3 @@
package com.tsng.hidemyapplist
external fun nativeSync(result: Int): Int

View file

@ -23,6 +23,7 @@ import androidx.preference.PreferenceManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.tsng.hidemyapplist.BuildConfig;
import com.tsng.hidemyapplist.R;
import com.tsng.hidemyapplist.UtilsKt;
import java.io.BufferedReader;
import java.io.File;
@ -190,19 +191,19 @@ public class DetectionActivity extends AppCompatActivity implements View.OnClick
br.append(getString(R.string.detection_color_means)).append("<br/>");
br.append("<h5><b>API requests</b></h5>");
for (Map.Entry<String, Integer> entry : M0.entrySet())
br.append(res.apply(nativeSync(methodStatus[0][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append(res.apply(UtilsKt.nativeSync(methodStatus[0][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append("<h5><b>Intent queries</b></h5>");
for (Map.Entry<String, Integer> entry : M1.entrySet())
br.append(res.apply(nativeSync(methodStatus[1][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append(res.apply(UtilsKt.nativeSync(methodStatus[1][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append("<h5><b>ID detections</b></h5>");
for (Map.Entry<String, Integer> entry : M2.entrySet())
br.append(res.apply(nativeSync(methodStatus[2][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append(res.apply(UtilsKt.nativeSync(methodStatus[2][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append("<h5><b>File detections</b></h5>");
for (Map.Entry<String, Integer> entry : M3.entrySet())
br.append(res.apply(nativeSync(methodStatus[3][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append(res.apply(UtilsKt.nativeSync(methodStatus[3][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append("<h5><b>Characteristics</b></h5>");
for (Map.Entry<String, Integer> entry : M4.entrySet())
br.append(res.apply(nativeSync(methodStatus[4][entry.getValue()]))).append(entry.getKey()).append("<br/>");
br.append(res.apply(UtilsKt.nativeSync(methodStatus[4][entry.getValue()]))).append(entry.getKey()).append("<br/>");
new MaterialAlertDialogBuilder(DetectionActivity.this)
@ -280,7 +281,6 @@ public class DetectionActivity extends AppCompatActivity implements View.OnClick
methodStatus[2][M2.get("getPackageUid")] = 0;
}
private native int nativeSync(int result);
private native int[] nativeFile(String path);
private void method_file() {

View file

@ -7,6 +7,8 @@
<string name="error">错误</string>
<string name="add">添加</string>
<string name="do_not_dual">不要双开模块 APP,这会导致配置覆盖!</string>
<string name="new_update">新版本可用:</string>
<string name="update_logs">更新日志</string>

View file

@ -7,6 +7,8 @@
<string name="error">Error</string>
<string name="add">Add</string>
<string name="do_not_dual">Do not dual the module app, cause it will lead to config override!</string>
<string name="new_update">New update:</string>
<string name="update_logs">New features</string>