Default to enable oem-unlocking preference

Whether the device supports carriorlock or not, oem-unlocking preference
will be enabled by default, except sdk_gphone_x86-eng target.

Fixes: 129982117
Test: emulator, robotest
Change-Id: I02af50e425fe5a93c244bbf8fe8bd2682275974f
This commit is contained in:
Mill Chen
2019-04-10 17:34:20 -07:00
parent 3d46fcd5b4
commit 7b1ec94fc9
2 changed files with 20 additions and 14 deletions

View File

@@ -21,13 +21,12 @@ import static com.android.settings.development.DevelopmentOptionsActivityRequest
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Build;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.oemlock.OemLockManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -56,15 +55,11 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
DevelopmentSettingsDashboardFragment fragment) {
super(context);
if (context.getPackageManager().hasSystemFeature(PackageManager
.FEATURE_TELEPHONY_CARRIERLOCK)) {
mOemLockManager = (OemLockManager) context.getSystemService(Context.OEM_LOCK_SERVICE);
} else {
if (Build.IS_EMULATOR && Build.IS_ENG) {
mOemLockManager = null;
Log.i(TAG, "Missing FEATURE_TELEPHONY_CARRIERLOCK, OemUnlock Preference" +
" Controller disabled.");
} else {
mOemLockManager = (OemLockManager) context.getSystemService(Context.OEM_LOCK_SERVICE);
}
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
mFragment = fragment;