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 - remove the search panel from settings home page Bug: 110034419 Test: make RunSettingsRoboTests Change-Id: Ieb7eb0e8699229ec0824ccc19d7b958ac44965a2 Merged-In: Ieb7eb0e8699229ec0824ccc19d7b958ac44965a2
This commit is contained in:
@@ -322,7 +322,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
}
|
||||
|
||||
if (mIsShowingDashboard) {
|
||||
findViewById(R.id.search_bar).setVisibility(View.VISIBLE);
|
||||
setSearchBarVisibility();
|
||||
findViewById(R.id.action_bar).setVisibility(View.GONE);
|
||||
Toolbar toolbar = findViewById(R.id.search_action_bar);
|
||||
toolbar.setOnClickListener(this);
|
||||
@@ -406,6 +406,12 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setSearchBarVisibility() {
|
||||
findViewById(R.id.search_bar).setVisibility(
|
||||
Utils.isDeviceProvisioned(this) ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void launchSettingFragment(String initialFragmentName, boolean isSubSettings, Intent intent) {
|
||||
if (!mIsShowingDashboard && initialFragmentName != null) {
|
||||
|
||||
@@ -164,6 +164,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 = Utils.getFingerprintManagerOrNull(getActivity());
|
||||
@@ -248,6 +253,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);
|
||||
|
||||
@@ -129,6 +129,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