Made changes to padlock support for preferences.

- Currently, if a preference is disabled by admin, we add a padlock and disable
the preference. And now if the preference is enabled in some other place, the
padlock is not removed. Updated RestrictedPreference to fix this
behavior.
- Made RestrictedPreferenceHelper and
RestrictedPreferenceHelper.onAttachedToHierarchy public so that preferences in
Settings can use these.
- Put a check for null to avoid NullPointerException.
- Removed a redundant statement.

Change-Id: Ie88a761dc38c58a680c62b3703d2081c67462079
3 files changed