From 0670737ea5a7de32a751b1c0b372525c19923578 Mon Sep 17 00:00:00 2001 From: althafvly Date: Tue, 10 Jan 2023 12:53:07 +0530 Subject: [PATCH] Updater: Check dev options toggle for test channel Change-Id: Ifecac146e3f637fa589241e513a269f3306764ed --- src/org/lineageos/updater/misc/Utils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index 3ed81f42..497b635f 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -34,6 +34,7 @@ import android.os.Environment; import android.os.StatFs; import android.os.SystemProperties; import android.os.storage.StorageManager; +import android.provider.Settings; import android.util.Log; import android.widget.Toast; @@ -221,7 +222,7 @@ public class Utils { String serverUrl = ""; if (retrieveStatus(context) != null) { - if (retrieveStatus(context).equals("true")) { + if (retrieveStatus(context).equals("true") && isDevModeOn(context)) { serverUrl = context.getString(R.string.ota_staging_server_url); return serverUrl.replace("{device}", device) .replace("{type}", type) @@ -458,6 +459,11 @@ public class Utils { return isAB; } + public static boolean isDevModeOn(Context context) { + return Settings.Secure.getInt(context.getContentResolver(), + Settings.Global.DEVELOPMENT_SETTINGS_ENABLED , 0) == 1; + } + public static boolean hasTouchscreen(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN); } -- GitLab