DO NOT MERGE Disable changing lock when device is not provisioned.
When the device is not yet provisioned and settings is launched: - disable the entry point for changing device lock - set display search menu to false - disallow update to display the search menu Bug: 110034419 Test: make RunSettingsRoboTests Change-Id: Ieb7eb0e8699229ec0824ccc19d7b958ac44965a2
This commit is contained in:
@@ -51,6 +51,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.fingerprint.FingerprintEnrollBase;
|
||||
import com.android.settings.fingerprint.FingerprintEnrollFindSensor;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
@@ -140,6 +141,11 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final Activity activity = getActivity();
|
||||
if (!Utils.isDeviceProvisioned(activity) && !canRunBeforeDeviceProvisioned()) {
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
String chooseLockAction = getActivity().getIntent().getAction();
|
||||
mFingerprintManager =
|
||||
@@ -224,6 +230,10 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
addHeaderView();
|
||||
}
|
||||
|
||||
protected boolean canRunBeforeDeviceProvisioned() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void addHeaderView() {
|
||||
if (mForFingerprint) {
|
||||
setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
|
||||
|
@@ -626,7 +626,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
// No UP affordance if we are displaying the main Dashboard
|
||||
mDisplayHomeAsUpEnabled = false;
|
||||
// Show Search affordance
|
||||
mDisplaySearch = true;
|
||||
mDisplaySearch = Utils.isDeviceProvisioned(this);
|
||||
mInitialTitleResId = R.string.dashboard_title;
|
||||
|
||||
// add argument to indicate which settings tab should be initially selected
|
||||
@@ -708,7 +708,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
}
|
||||
|
||||
public void setDisplaySearchMenu(boolean displaySearch) {
|
||||
if (displaySearch != mDisplaySearch) {
|
||||
if (Utils.isDeviceProvisioned(this) && displaySearch != mDisplaySearch) {
|
||||
mDisplaySearch = displaySearch;
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
@@ -138,6 +138,11 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canRunBeforeDeviceProvisioned() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/***
|
||||
* Disables preferences that are less secure than required quality and shows only secure
|
||||
* screen lock options here.
|
||||
|
Reference in New Issue
Block a user