[Samsung Galaxy Note 9 Questions & Answers] zeyus:
Working patch for using ELM key with latest master branch

I spent a little bit of time on this and managed to force activation with an ELM key (S9 plus, android 9.0 pie).

For those of you who want to know why it wasn't working, it's because the new licence "KPE Development Limited" no longer has the required permissions com.samsung.android.knox.permission.KNOX_FIREWALL and com.samsung.android.knox.permission.KNOX_APP_MGMT. The ELM key still has those permissions.

One note, when you run the app, put the key in the second box (or in your app.properties in the backwards.key config). Once you activate it will take some time and then close the app, when you come back the activation is complete. This patch is experimental and I just wanted to get adhell working and I'm in the middle of a math assignment so...yeah be careful I'm not sure what the implications of using the ELM are, and you will no longer be able to "change" the key within the app...nor deactivate.

I'm not allowed to post links yet but if you go to github and find gist with id 3557b301cb75c99be670b2aa89bf1a38 if you want to use it to patch or

From f7dc6d692faa6112c5780fc025d26aff87ce45dc Mon Sep 17 00:00:00 2001
From: zeyus <zeyus@zeyus.com>
Date: Tue, 26 Feb 2019 19:59:31 +0100
Subject: [PATCH] ****ty patch to use ELM

---
.../ActivationDialogFragment.java | 31 ++++++++++---------
.../adhell3/utils/DeviceAdminInteractor.java | 3 +-
2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/app/src/main/java/com/fusionjack/adhell3/dialogfragment/ActivationDialogFragment.java b/app/src/main/java/com/fusionjack/adhell3/dialogfragment/ActivationDialogFragment.java
index ebe119a..b1b9f57 100644
--- a/app/src/main/java/com/fusionjack/adhell3/dialogfragment/ActivationDialogFragment.java
+++ b/app/src/main/java/com/fusionjack/adhell3/dialogfragment/ActivationDialogFragment.java
@@ -54,21 +54,24 @@ public class ActivationDialogFragment extends DialogFragment {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

- if (KnoxEnterpriseLicenseManager.ACTION_LICENSE_STATUS.equals(action)) {
- int errorCode = intent.getIntExtra(KnoxEnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, -1);
- if (errorCode == KnoxEnterpriseLicenseManager.ERROR_NONE) {
- boolean useBackwardKey = deviceAdminInteractor.useBackwardCompatibleKey();
- if (useBackwardKey) {
- deviceAdminInteractor.activateBackwardKey(sharedPreferences, getContext());
- } else {
- handleResult(intent);
- }
- } else {
- handleError(intent, context, errorCode);
- }
- }
+// if (KnoxEnterpriseLicenseManager.ACTION_LICENSE_STATUS.equals(action)) {
+// LogUtils.info("KLM");
+// int errorCode = intent.getIntExtra(KnoxEnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, -1);
+// if (errorCode == KnoxEnterpriseLicenseManager.ERROR_NONE) {
+// boolean useBackwardKey = deviceAdminInteractor.useBackwardCompatibleKey();
+// if (useBackwardKey) {
+// LogUtils.info("KLMBAK");
+// deviceAdminInteractor.activateBackwardKey(sharedPreferences, getContext());
+// } else {
+// handleResult(intent);
+// }
+// } else {
+// handleError(intent, context, errorCode);
+// }
+// }

if (EnterpriseLicenseManager.ACTION_LICENSE_STATUS.equals(action)) {
+ LogUtils.info("ELM");
int errorCode = intent.getIntExtra(EnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, -1);
if (errorCode == EnterpriseLicenseManager.ERROR_NONE) {
handleResult(intent);
@@ -102,7 +105,7 @@ public class ActivationDialogFragment extends DialogFragment {
if (knoxEnabled) {
deviceAdminInteractor.deactivateKnoxKey(sharedPreferences, getContext());
} else {
- deviceAdminInteractor.activateKnoxKey(sharedPreferences, getContext());
+ deviceAdminInteractor.activateBackwardKey(sharedPreferences, getContext());
}
}

diff --git a/app/src/main/java/com/fusionjack/adhell3/utils/DeviceAdminInteractor.java b/app/src/main/java/com/fusionjack/adhell3/utils/DeviceAdminInteractor.java
index 7ed2ede..7deffe5 100644
--- a/app/src/main/java/com/fusionjack/adhell3/utils/DeviceAdminInteractor.java
+++ b/app/src/main/java/com/fusionjack/adhell3/utils/DeviceAdminInteractor.java
@@ -100,6 +100,7 @@ public final class DeviceAdminInteractor {
public void activateKnoxKey(SharedPreferences sharedPreferences, Context context) {
String knoxKey = getKnoxKey(sharedPreferences);
if (knoxKey != null) {
+ LogUtils.info("Activate KLM?");
KnoxEnterpriseLicenseManager.getInstance(context).activateLicense(knoxKey);
}
}
@@ -114,6 +115,7 @@ public final class DeviceAdminInteractor {
public void activateBackwardKey(SharedPreferences sharedPreferences, Context context) {
String backwardKey = getBackwardKey(sharedPreferences);
if (backwardKey != null) {
+ LogUtils.info("Activate ELM?");
EnterpriseLicenseManager.getInstance(context).activateLicense(backwardKey);
}
}
@@ -230,7 +232,6 @@ public final class DeviceAdminInteractor {
case KNOX_3_1:
case KNOX_3_2:
case KNOX_3_2_1:
- return false;
default:
return true;
}
--
2.17.0.windows.1

[IMG="Adhell 3 running on S9/Pie"]https://i.imgur.com/qSmb8qT.jpg[/IMG]