resolve merge conflicts of 380b01a
to nyc-mr1-dev-plus-aosp
Change-Id: If97f5d5b4d67177b8160b96894a35d685573c46a
This commit is contained in:
@@ -64,16 +64,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/lock_screen_notifications_summary_disable" />
|
android:text="@string/lock_screen_notifications_summary_disable" />
|
||||||
|
|
||||||
<!-- Place the checkbox inside RadioGroup and use SuwRadioButton style instead of
|
|
||||||
SuwCheckBox style so that the checkbox and text is aligned with radio buttons. -->
|
|
||||||
<com.android.settings.RestrictedCheckBox
|
|
||||||
android:id="@+id/lockscreen_remote_input"
|
|
||||||
style="@style/SuwRadioButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/redaction_vertical_margins"
|
|
||||||
android:text="@string/lockscreen_remote_input" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
android:title="@string/notification_pulse_title" />
|
android:title="@string/notification_pulse_title" />
|
||||||
|
|
||||||
<!-- When device is locked -->
|
<!-- When device is locked -->
|
||||||
<com.android.settings.notification.NotificationLockscreenPreference
|
<com.android.settings.notification.RestrictedDropDownPreference
|
||||||
android:key="lock_screen_notifications"
|
android:key="lock_screen_notifications"
|
||||||
android:title="@string/lock_screen_notifications_title"
|
android:title="@string/lock_screen_notifications_title"
|
||||||
android:summary="%s" />
|
android:summary="%s" />
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/profile_section_header" >
|
android:title="@string/profile_section_header" >
|
||||||
|
|
||||||
<com.android.settings.notification.NotificationLockscreenPreference
|
<com.android.settings.notification.RestrictedDropDownPreference
|
||||||
android:key="lock_screen_notifications_profile"
|
android:key="lock_screen_notifications_profile"
|
||||||
android:title="@string/lock_screen_notifications_title"
|
android:title="@string/lock_screen_notifications_title"
|
||||||
android:summary="%s" />
|
android:summary="%s" />
|
||||||
|
@@ -57,8 +57,8 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private TwoStatePreference mNotificationPulse;
|
private TwoStatePreference mNotificationPulse;
|
||||||
private NotificationLockscreenPreference mLockscreen;
|
private RestrictedDropDownPreference mLockscreen;
|
||||||
private NotificationLockscreenPreference mLockscreenProfile;
|
private RestrictedDropDownPreference mLockscreenProfile;
|
||||||
private boolean mSecure;
|
private boolean mSecure;
|
||||||
private boolean mSecureProfile;
|
private boolean mSecureProfile;
|
||||||
private int mLockscreenSelectedValue;
|
private int mLockscreenSelectedValue;
|
||||||
@@ -148,7 +148,7 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initLockscreenNotifications() {
|
private void initLockscreenNotifications() {
|
||||||
mLockscreen = (NotificationLockscreenPreference) getPreferenceScreen().findPreference(
|
mLockscreen = (RestrictedDropDownPreference) getPreferenceScreen().findPreference(
|
||||||
KEY_LOCK_SCREEN_NOTIFICATIONS);
|
KEY_LOCK_SCREEN_NOTIFICATIONS);
|
||||||
if (mLockscreen == null) {
|
if (mLockscreen == null) {
|
||||||
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_NOTIFICATIONS);
|
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_NOTIFICATIONS);
|
||||||
@@ -178,9 +178,6 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLockscreen.setRemoteInputRestricted(RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
|
||||||
mContext, DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT, UserHandle.myUserId()));
|
|
||||||
|
|
||||||
mLockscreen.setEntries(entries.toArray(new CharSequence[entries.size()]));
|
mLockscreen.setEntries(entries.toArray(new CharSequence[entries.size()]));
|
||||||
mLockscreen.setEntryValues(values.toArray(new CharSequence[values.size()]));
|
mLockscreen.setEntryValues(values.toArray(new CharSequence[values.size()]));
|
||||||
updateLockscreenNotifications();
|
updateLockscreenNotifications();
|
||||||
@@ -211,13 +208,12 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
// === Lockscreen (public / private) notifications ===
|
// === Lockscreen (public / private) notifications ===
|
||||||
private void initLockscreenNotificationsForProfile() {
|
private void initLockscreenNotificationsForProfile() {
|
||||||
mLockscreenProfile = (NotificationLockscreenPreference) getPreferenceScreen()
|
mLockscreenProfile = (RestrictedDropDownPreference) getPreferenceScreen()
|
||||||
.findPreference(KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
|
.findPreference(KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
|
||||||
if (mLockscreenProfile == null) {
|
if (mLockscreenProfile == null) {
|
||||||
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
|
Log.i(TAG, "Preference not found: " + KEY_LOCK_SCREEN_PROFILE_NOTIFICATIONS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLockscreenProfile.setUserId(mProfileChallengeUserId);
|
|
||||||
ArrayList<CharSequence> entries = new ArrayList<>();
|
ArrayList<CharSequence> entries = new ArrayList<>();
|
||||||
ArrayList<CharSequence> values = new ArrayList<>();
|
ArrayList<CharSequence> values = new ArrayList<>();
|
||||||
entries.add(getString(R.string.lock_screen_notifications_summary_disable_profile));
|
entries.add(getString(R.string.lock_screen_notifications_summary_disable_profile));
|
||||||
@@ -243,14 +239,14 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLockscreen.setRemoteInputRestricted(RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
mLockscreenProfile.setOnPreClickListener(
|
||||||
mContext, DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT,
|
(Preference p) -> Utils.startQuietModeDialogIfNecessary(mContext,
|
||||||
mProfileChallengeUserId));
|
UserManager.get(mContext),
|
||||||
|
mProfileChallengeUserId)
|
||||||
|
);
|
||||||
|
|
||||||
mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.size()]));
|
mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.size()]));
|
||||||
mLockscreenProfile.setEntryValues(values.toArray(new CharSequence[values.size()]));
|
mLockscreenProfile.setEntryValues(values.toArray(new CharSequence[values.size()]));
|
||||||
// Work profile does not support this settings as we do not have a policy to enforce it yet
|
|
||||||
mLockscreenProfile.setRemoteInputCheckBoxEnabled(false);
|
|
||||||
updateLockscreenNotificationsForProfile();
|
updateLockscreenNotificationsForProfile();
|
||||||
if (mLockscreenProfile.getEntries().length > 1) {
|
if (mLockscreenProfile.getEntries().length > 1) {
|
||||||
mLockscreenProfile.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
mLockscreenProfile.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
@@ -284,15 +280,18 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
CharSequence entryValue, int keyguardNotificationFeatures) {
|
CharSequence entryValue, int keyguardNotificationFeatures) {
|
||||||
EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
EnforcedAdmin admin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
||||||
mContext, keyguardNotificationFeatures, UserHandle.myUserId());
|
mContext, keyguardNotificationFeatures, UserHandle.myUserId());
|
||||||
if (admin != null) {
|
if (admin != null && mLockscreen != null) {
|
||||||
RestrictedItem item = new RestrictedItem(entry, entryValue, admin);
|
RestrictedDropDownPreference.RestrictedItem item =
|
||||||
|
new RestrictedDropDownPreference.RestrictedItem(entry, entryValue, admin);
|
||||||
mLockscreen.addRestrictedItem(item);
|
mLockscreen.addRestrictedItem(item);
|
||||||
}
|
}
|
||||||
if (mProfileChallengeUserId != UserHandle.USER_NULL) {
|
if (mProfileChallengeUserId != UserHandle.USER_NULL) {
|
||||||
EnforcedAdmin profileAdmin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
EnforcedAdmin profileAdmin = RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
|
||||||
mContext, keyguardNotificationFeatures, mProfileChallengeUserId);
|
mContext, keyguardNotificationFeatures, mProfileChallengeUserId);
|
||||||
if (profileAdmin != null) {
|
if (profileAdmin != null && mLockscreenProfile != null) {
|
||||||
RestrictedItem item = new RestrictedItem(entry, entryValue, profileAdmin);
|
RestrictedDropDownPreference.RestrictedItem item =
|
||||||
|
new RestrictedDropDownPreference.RestrictedItem(
|
||||||
|
entry, entryValue, profileAdmin);
|
||||||
mLockscreenProfile.addRestrictedItem(item);
|
mLockscreenProfile.addRestrictedItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,13 +82,11 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class RedactionInterstitialFragment extends SettingsPreferenceFragment
|
public static class RedactionInterstitialFragment extends SettingsPreferenceFragment
|
||||||
implements RadioGroup.OnCheckedChangeListener, CompoundButton.OnCheckedChangeListener,
|
implements RadioGroup.OnCheckedChangeListener, View.OnClickListener {
|
||||||
View.OnClickListener {
|
|
||||||
|
|
||||||
private RadioGroup mRadioGroup;
|
private RadioGroup mRadioGroup;
|
||||||
private RestrictedRadioButton mShowAllButton;
|
private RestrictedRadioButton mShowAllButton;
|
||||||
private RestrictedRadioButton mRedactSensitiveButton;
|
private RestrictedRadioButton mRedactSensitiveButton;
|
||||||
private RestrictedCheckBox mRemoteInputCheckbox;
|
|
||||||
private int mUserId;
|
private int mUserId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,9 +107,6 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all);
|
mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all);
|
||||||
mRedactSensitiveButton =
|
mRedactSensitiveButton =
|
||||||
(RestrictedRadioButton) view.findViewById(R.id.redact_sensitive);
|
(RestrictedRadioButton) view.findViewById(R.id.redact_sensitive);
|
||||||
mRemoteInputCheckbox =
|
|
||||||
(RestrictedCheckBox) view.findViewById(R.id.lockscreen_remote_input);
|
|
||||||
mRemoteInputCheckbox.setOnCheckedChangeListener(this);
|
|
||||||
|
|
||||||
mRadioGroup.setOnCheckedChangeListener(this);
|
mRadioGroup.setOnCheckedChangeListener(this);
|
||||||
mUserId = Utils.getUserIdFromBundle(
|
mUserId = Utils.getUserIdFromBundle(
|
||||||
@@ -151,9 +146,6 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
|
KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
|
||||||
checkNotificationFeaturesAndSetDisabled(mRedactSensitiveButton,
|
checkNotificationFeaturesAndSetDisabled(mRedactSensitiveButton,
|
||||||
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);
|
||||||
mRemoteInputCheckbox.setDisabledByAdmin(
|
|
||||||
RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(getActivity(),
|
|
||||||
DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT, mUserId));
|
|
||||||
loadFromSettings();
|
loadFromSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,12 +172,6 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mRadioGroup.check(checkedButtonId);
|
mRadioGroup.check(checkedButtonId);
|
||||||
|
|
||||||
boolean allowRemoteInput = Settings.Secure.getIntForUser(getContentResolver(),
|
|
||||||
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0, mUserId) != 0;
|
|
||||||
mRemoteInputCheckbox.setChecked(!allowRemoteInput);
|
|
||||||
|
|
||||||
updateRemoteInputCheckboxVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -198,23 +184,6 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
Settings.Secure.putIntForUser(getContentResolver(),
|
Settings.Secure.putIntForUser(getContentResolver(),
|
||||||
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0, mUserId);
|
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0, mUserId);
|
||||||
|
|
||||||
updateRemoteInputCheckboxVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
|
|
||||||
if (buttonView == mRemoteInputCheckbox) {
|
|
||||||
Settings.Secure.putIntForUser(getContentResolver(),
|
|
||||||
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, checked ? 0 : 1, mUserId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateRemoteInputCheckboxVisibility() {
|
|
||||||
boolean visible = mRadioGroup.getCheckedRadioButtonId() == R.id.show_all;
|
|
||||||
boolean isManagedProfile = Utils.isManagedProfile(UserManager.get(getPrefContext()),
|
|
||||||
mUserId);
|
|
||||||
mRemoteInputCheckbox
|
|
||||||
.setVisibility((visible && !isManagedProfile) ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,7 @@ public class RestrictedDropDownPreference extends DropDownPreference {
|
|||||||
private ReselectionSpinner mSpinner;
|
private ReselectionSpinner mSpinner;
|
||||||
private List<RestrictedItem> mRestrictedItems = new ArrayList<>();
|
private List<RestrictedItem> mRestrictedItems = new ArrayList<>();
|
||||||
private boolean mUserClicked = false;
|
private boolean mUserClicked = false;
|
||||||
|
private OnPreferenceClickListener mPreClickListener;
|
||||||
|
|
||||||
public RestrictedDropDownPreference(Context context, AttributeSet attrs) {
|
public RestrictedDropDownPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@@ -118,6 +119,9 @@ public class RestrictedDropDownPreference extends DropDownPreference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performClick() {
|
public void performClick() {
|
||||||
|
if (mPreClickListener != null && mPreClickListener.onPreferenceClick(this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!mHelper.performClick()) {
|
if (!mHelper.performClick()) {
|
||||||
mUserClicked = true;
|
mUserClicked = true;
|
||||||
super.performClick();
|
super.performClick();
|
||||||
@@ -139,6 +143,14 @@ public class RestrictedDropDownPreference extends DropDownPreference {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similar to {@link #setOnPreferenceClickListener(OnPreferenceClickListener)}, but can
|
||||||
|
* preempt {@link #onClick()}.
|
||||||
|
*/
|
||||||
|
public void setOnPreClickListener(OnPreferenceClickListener l) {
|
||||||
|
mPreClickListener = l;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDisabledByAdmin() {
|
public boolean isDisabledByAdmin() {
|
||||||
return mHelper.isDisabledByAdmin();
|
return mHelper.isDisabledByAdmin();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user