Revert "java: Implement keystore clearing for target packages during initialization"

This reverts commit c285992226.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
This commit is contained in:
Dakkshesh
2025-09-03 10:39:05 +05:30
parent 77323fad91
commit 7d371dd766
4 changed files with 0 additions and 60 deletions
@@ -36,24 +36,9 @@ private fun initializeInterceptors() {
}
PkgConfig.initialize()
clearKeyStore()
Logger.i("Interceptors initialized successfully")
}
private fun clearKeyStore() {
val targetUIDs = PkgConfig.getTargetPackageUids()
Logger.i("Clearing keystore for ${targetUIDs.size} target packages")
targetUIDs.forEach { uid ->
kotlin.runCatching {
android.security.AndroidKeyStoreMaintenance.clearNamespace(0, uid.toLong())
Logger.d("Cleared keystore namespace for UID: $uid")
}.onFailure {
Logger.e("Failed to clear keystore for UID: $uid", it)
}
}
}
private fun selectKeystoreInterceptor() = when {
Build.VERSION.SDK_INT in Build.VERSION_CODES.Q..Build.VERSION_CODES.R -> {
Logger.i("Using KeystoreInterceptor for Android Q/R (SDK ${Build.VERSION.SDK_INT})")
@@ -10,7 +10,6 @@ import android.os.Build
import android.os.FileObserver
import android.os.IBinder
import android.os.IInterface
import android.os.Process
import android.os.ServiceManager
import io.github.beakthoven.TrickyStoreOSS.AttestUtils.TEEStatus
import io.github.beakthoven.TrickyStoreOSS.KeyBoxUtils
@@ -176,33 +175,6 @@ object PkgConfig {
return false
}.onFailure { Logger.e("failed to get packages", it) }.getOrNull() ?: false
private fun getTargetPackages(): Set<String> {
return (hackPackages + generatePackages + packageModes.keys).toSet()
}
fun getTargetPackageUids(): Set<Int> {
val result = mutableSetOf<Int>()
val pm = getPm() ?: return emptySet()
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) 0L else 0
val userId = Process.myUid() / 100000
getTargetPackages().forEach { pkg ->
kotlin.runCatching {
val appInfo = pm.getApplicationInfo(pkg, flags, userId)
if (appInfo != null) {
result.add(appInfo.uid)
Logger.d("Got UID ${appInfo.uid} for package: $pkg")
} else {
Logger.e("ApplicationInfo is null for package: $pkg")
}
}.onFailure {
Logger.e("Failed to get UID for package: $pkg", it)
}
}
return result
}
@Volatile
var _customPatchLevel: CustomPatchLevel? = null
@@ -10,10 +10,6 @@ import android.os.IBinder;
public interface IPackageManager {
String[] getPackagesForUid(int uid);
ApplicationInfo getApplicationInfo(String packageName, int flags, int userId);
ApplicationInfo getApplicationInfo(String packageName, long flags, int userId);
PackageInfo getPackageInfo(String packageName, long flags, int userId);
PackageInfo getPackageInfo(String packageName, int flags, int userId);
@@ -1,13 +0,0 @@
/*
* Copyright 2025 Dakkshesh <beakthoven@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package android.security;
public class AndroidKeyStoreMaintenance {
public static int clearNamespace(int domain, long namespace) {
throw new RuntimeException("");
}
}