Add summary text to Lock screen preferences.

Each time we refresh the security preference page, get the current
summary text from "On the lock screen" and populate to Lock screen
preferences summary.

Bug: 36540633
Test: make RunSettingsRoboTests
Change-Id: I317e3892b35b30981b62f7b7aee9cfdacd04a3ed
This commit is contained in:
Doris Ling
2017-04-06 16:01:37 -07:00
parent abde170529
commit cee83e4bbf
8 changed files with 47 additions and 12 deletions

View File

@@ -267,16 +267,20 @@ public class LockScreenNotificationPreferenceController extends PreferenceContro
}
}
public int getSummaryResource() {
final boolean enabled = getLockscreenNotificationsEnabled(UserHandle.myUserId());
final boolean allowPrivate = !mSecure
|| getLockscreenAllowPrivateNotifications(UserHandle.myUserId());
return !enabled ? R.string.lock_screen_notifications_summary_disable :
allowPrivate ? R.string.lock_screen_notifications_summary_show :
R.string.lock_screen_notifications_summary_hide;
}
private void updateLockscreenNotifications() {
if (mLockscreen == null) {
return;
}
final boolean enabled = getLockscreenNotificationsEnabled(UserHandle.myUserId());
final boolean allowPrivate = !mSecure
|| getLockscreenAllowPrivateNotifications(UserHandle.myUserId());
mLockscreenSelectedValue = !enabled ? R.string.lock_screen_notifications_summary_disable :
allowPrivate ? R.string.lock_screen_notifications_summary_show :
R.string.lock_screen_notifications_summary_hide;
mLockscreenSelectedValue = getSummaryResource();
mLockscreen.setValue(Integer.toString(mLockscreenSelectedValue));
}