Fix the empty preference after clicking gear icon

Because there is no other options for 'None' or 'Swipe, there is no
necessary for showing the gear icon to show options.

'Lock screen message' could be found in
Settings > Display > Lock screen display.

Add testcase to verify the ChangeScreenLockPreferenceController's
behavior.

Test: make ROBOTEST_FILTER=ChangeScreenLockPreferenceControllerTest \
      RunSettingsRoboTests -j40
Change-Id: Icdcd672261749d106162053d6f5228cee420a810
Fixes: 110848852
This commit is contained in:
felkachang
2018-07-19 20:06:50 +08:00
parent c879386e5a
commit c2b6764057
2 changed files with 162 additions and 2 deletions

View File

@@ -84,8 +84,7 @@ public class ChangeScreenLockPreferenceController extends AbstractPreferenceCont
@Override
public void updateState(Preference preference) {
if (mPreference != null && mPreference instanceof GearPreference) {
if (mLockPatternUtils.isSecure(mUserId)
|| !mLockPatternUtils.isLockScreenDisabled(mUserId)) {
if (mLockPatternUtils.isSecure(mUserId)) {
((GearPreference) mPreference).setOnGearClickListener(this);
} else {
((GearPreference) mPreference).setOnGearClickListener(null);