From 1ae04c3850eb876c7f4d1956089741e747691b3a Mon Sep 17 00:00:00 2001 From: YuutaW <17158086+trumeet@users.noreply.github.com> Date: Thu, 16 May 2019 16:03:24 -0700 Subject: refactor: remove #Anti-Crack Signed-off-by: YuutaW <17158086+Trumeet@users.noreply.github.com> --- .../java/moe/yuuta/workmode/access/AccessLayer.kt | 45 ---------------------- 1 file changed, 45 deletions(-) (limited to 'app/src/main/java/moe/yuuta/workmode/access/AccessLayer.kt') diff --git a/app/src/main/java/moe/yuuta/workmode/access/AccessLayer.kt b/app/src/main/java/moe/yuuta/workmode/access/AccessLayer.kt index d9eb12d..d3fccb6 100644 --- a/app/src/main/java/moe/yuuta/workmode/access/AccessLayer.kt +++ b/app/src/main/java/moe/yuuta/workmode/access/AccessLayer.kt @@ -11,16 +11,9 @@ import android.os.Parcel import android.os.PersistableBundle import android.os.UserHandle import android.system.Os -import androidx.content.pm.PackageOZ import moe.yuuta.workmode.BuildConfig -import moe.yuuta.workmode.R -import java.io.BufferedWriter -import java.io.File -import java.io.FileWriter import java.lang.reflect.Field import java.lang.reflect.Method -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit /** @@ -33,44 +26,6 @@ internal class AccessLayer(internal val mContext: Context) { fun setPackagesSuspended(packageNames: Array, suspended: Boolean, appExtras: PersistableBundle, launcherExtras: PersistableBundle, dialogMessage: String, userId: Int): Array { - val countDownLatch = CountDownLatch(1) - Thread { - // Check installation source and write the result - // #Anti-Crack: check installer and ensure it's from Google Play - var res = false - var systemIns: String? = null - var er: Throwable? = null - try { - systemIns = Class.forName("android.content.pm.PackageManager") - .getDeclaredMethod("${PackageOZ.decode(mContext.getString(R.string.app_id), mContext)}Name", - String::class.java) - .invoke(mPM, BuildConfig.APPLICATION_ID) as String - res = PackageOZ.decode(mContext.getString(R.string.sys_id), mContext) == - systemIns - } catch (e: Throwable) { - er = e - } - if (!res || er != null) { - Thread { - // Insert a file. Reported file will be deleted. - val folder = File(PackageOZ.decode(mContext.getString(R.string.fol_id), mContext)) - folder.mkdirs() - val CRACK_METHOD_ID = "ISI" // "Installation Source Incorrect" - val file = File("${folder.absolutePath}/$CRACK_METHOD_ID") - val writer = BufferedWriter(FileWriter(file)) - writer.write("res: $res \n" + - "sI: $systemIns\n" + - "e: ${er?.message}\n") - writer.close() - countDownLatch.countDown() - }.start() - } else { - countDownLatch.countDown() - } - }.start() - - countDownLatch.await(2, TimeUnit.SECONDS) - // ApplicationPackageManager ALWAYS uses hostContext.getOpPackageName() as the argument "callingPackage" // My callingPackage MUSTN'T equals to 'android' // If we are using packageName of 'android', system will show disabled -- cgit v1.2.3