diff --git a/res/values/arrays.xml b/res/values/arrays.xml new file mode 100644 index 0000000000000000000000000000000000000000..0363e102b0c87c6510fe7d95c1a8d748b43e8229 --- /dev/null +++ b/res/values/arrays.xml @@ -0,0 +1,25 @@ + + + + + + + google:redfin + + diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java index c40c8a53297f94e96eb9b08d728e9d56cb956266..243e17344f3aae6c80149a7b86ceaf7b91dbdd7f 100644 --- a/src/org/lineageos/setupwizard/SetupWizardApp.java +++ b/src/org/lineageos/setupwizard/SetupWizardApp.java @@ -20,6 +20,7 @@ package org.lineageos.setupwizard; import android.app.Application; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.service.oemlock.OemLockManager; @@ -103,7 +104,20 @@ public class SetupWizardApp extends Application { if (SetupWizardUtils.isOwner() && !SetupWizardUtils.isBootloaderUnlocked(this) && SetupWizardUtils.isOemunlockAllowed(this)) { - getSystemService(OemLockManager.class).setOemUnlockAllowedByUser(false); + String manufacturer = Build.MANUFACTURER.toLowerCase(); + String device = Build.DEVICE.toLowerCase(); + String[] allowedBrandsAndDevices = getResources().getStringArray(R.array.allowed_brands_and_devices); + + for (String brandAndDevice : allowedBrandsAndDevices) { + String[] parts = brandAndDevice.split(":"); + String allowedBrand = parts[0]; + String allowedDevice = parts[1]; + + if (manufacturer.equals(allowedBrand) && device.equals(allowedDevice)) { + getSystemService(OemLockManager.class).setOemUnlockAllowedByUser(false); + break; + } + } } }