-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
19 changed files
with
172 additions
and
247 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
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
50 changes: 0 additions & 50 deletions
50
app/src/main/java/com/tsng/hidemyapplist/xposed/XposedBase.kt
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
66 changes: 66 additions & 0 deletions
66
app/src/main/java/com/tsng/hidemyapplist/xposed/XposedUtils.kt
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,66 @@ | ||
package com.tsng.hidemyapplist.xposed | ||
|
||
import android.util.Log | ||
import com.tsng.hidemyapplist.BuildConfig | ||
import de.robv.android.xposed.XSharedPreferences | ||
import de.robv.android.xposed.XposedBridge | ||
import de.robv.android.xposed.XposedHelpers | ||
|
||
class XposedUtils { | ||
companion object { | ||
const val LOG = "hma_log" | ||
const val APPNAME = BuildConfig.APPLICATION_ID | ||
|
||
@JvmStatic | ||
fun getTemplatePref(pkg: String?): XSharedPreferences? { | ||
val pref = XSharedPreferences(APPNAME, "Scope") | ||
if (!pref.file.exists()) return null | ||
val str = pref.getString(pkg, null) ?: return null | ||
return XSharedPreferences(APPNAME, "tpl_$str") | ||
} | ||
|
||
@JvmStatic | ||
fun isUseHook(pref: XSharedPreferences?, callerName: String?, hook: String): Boolean { | ||
if (pref == null) return false | ||
if (callerName == APPNAME) | ||
if (!XSharedPreferences(APPNAME, "Settings").getBoolean("HookSelf", false)) | ||
return false | ||
val enableAllHooks = pref.getBoolean("EnableAllHooks", false) | ||
val enabled = pref.getStringSet("ApplyHooks", HashSet()) | ||
return enableAllHooks or enabled.contains(hook) | ||
} | ||
|
||
@JvmStatic | ||
fun isToHide(pref: XSharedPreferences?, callerName: String, pkgstr: String?): Boolean { | ||
if (pref == null || pkgstr == null) return false | ||
if (pref.getBoolean("ExcludeSelf", false) && pkgstr.contains(callerName)) return false | ||
if (pref.getBoolean("HideAllApps", false)) return true | ||
val set = pref.getStringSet("HideApps", HashSet()) | ||
for (pkg in set) if (pkgstr.contains(pkg)) { | ||
ld("HIDE $pkgstr") | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
@JvmStatic | ||
fun getRecursiveField(entry: Any, list: List<String>) : Any? { | ||
var field : Any? = entry | ||
for (it in list) | ||
field = XposedHelpers.getObjectField(field, it) ?: return null | ||
return field | ||
} | ||
|
||
@JvmStatic | ||
fun ld(log: String) { | ||
XposedBridge.log("[HMA DEBUG] $log") | ||
Log.d(LOG, log) | ||
} | ||
|
||
@JvmStatic | ||
fun le(log: String) { | ||
XposedBridge.log("[HMA ERROR] $log") | ||
Log.e(LOG, log) | ||
} | ||
} | ||
} |
Oops, something went wrong.