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 9789ce1e14aa0b48e6740005f435af510c08295a..651bd5e9850a033feac5dce0fe942e935dc7997a 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.app.StatusBarManager; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.service.oemlock.OemLockManager; @@ -107,7 +108,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; + } + } } }