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 - remove the search menu Bug: 110034419 Test: make RunSettingsRoboTests Change-Id: Ieb7eb0e8699229ec0824ccc19d7b958ac44965a2 Merged-In: Ieb7eb0e8699229ec0824ccc19d7b958ac44965a2
This commit is contained in:
@@ -291,8 +291,10 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
launchSettingFragment(initialFragmentName, isSubSettings, intent);
|
||||
}
|
||||
|
||||
final boolean deviceProvisioned = Utils.isDeviceProvisioned(this);
|
||||
if (mIsShowingDashboard) {
|
||||
findViewById(R.id.search_bar).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.search_bar).setVisibility(
|
||||
deviceProvisioned ? View.VISIBLE : View.INVISIBLE);
|
||||
findViewById(R.id.action_bar).setVisibility(View.GONE);
|
||||
final Toolbar toolbar = findViewById(R.id.search_action_bar);
|
||||
FeatureFactory.getFactory(this).getSearchFeatureProvider()
|
||||
@@ -311,7 +313,6 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
boolean deviceProvisioned = Utils.isDeviceProvisioned(this);
|
||||
actionBar.setDisplayHomeAsUpEnabled(deviceProvisioned);
|
||||
actionBar.setHomeButtonEnabled(deviceProvisioned);
|
||||
actionBar.setDisplayShowTitleEnabled(!mIsShowingDashboard);
|
||||
|
@@ -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());
|
||||
@@ -249,6 +254,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.
|
||||
|
@@ -25,6 +25,7 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.SearchFeatureProvider;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
@@ -52,6 +53,9 @@ public class SearchMenuController implements LifecycleObserver, OnCreateOptionsM
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (!Utils.isDeviceProvisioned(mHost.getContext())) {
|
||||
return;
|
||||
}
|
||||
if (menu == null) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user