From 9b753da2b73de4b54785298658a65331747468e2 Mon Sep 17 00:00:00 2001 From: Ricky Wai Date: Tue, 12 Apr 2016 11:56:50 +0100 Subject: [PATCH] Force to unlock work challenge before reply inline notification Bug: 28036566 Change-Id: Ida63ce5003b7e3ec79e1575815d70d1350ffed2d --- .../notification/ConfigureNotificationSettings.java | 2 ++ .../NotificationLockscreenPreference.java | 11 +++++++++-- .../settings/notification/RedactionInterstitial.java | 5 ++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java index 4d50461118c..c342ba076c2 100644 --- a/src/com/android/settings/notification/ConfigureNotificationSettings.java +++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java @@ -241,6 +241,8 @@ public class ConfigureNotificationSettings extends SettingsPreferenceFragment { mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.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(); if (mLockscreenProfile.getEntries().length > 1) { mLockscreenProfile.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { diff --git a/src/com/android/settings/notification/NotificationLockscreenPreference.java b/src/com/android/settings/notification/NotificationLockscreenPreference.java index 39b9c5d2d07..cd3e30cc7b2 100644 --- a/src/com/android/settings/notification/NotificationLockscreenPreference.java +++ b/src/com/android/settings/notification/NotificationLockscreenPreference.java @@ -37,11 +37,16 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { private int mInitialIndex; private Listener mListener; private boolean mShowRemoteInput; + private boolean mRemoteInputCheckBoxEnabled = true; public NotificationLockscreenPreference(Context context, AttributeSet attrs) { super(context, attrs); } + public void setRemoteInputCheckBoxEnabled(boolean enabled) { + mRemoteInputCheckBoxEnabled = enabled; + } + @Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder, DialogInterface.OnClickListener innerListener) { @@ -85,8 +90,10 @@ public class NotificationLockscreenPreference extends RestrictedListPreference { return false; } - private static int checkboxVisibilityForSelectedIndex(int selected, boolean showRemoteAtAll) { - return selected == 1 && showRemoteAtAll ? View.VISIBLE : View.GONE; + private int checkboxVisibilityForSelectedIndex(int selected, + boolean showRemoteAtAll) { + return selected == 1 && showRemoteAtAll && mRemoteInputCheckBoxEnabled ? View.VISIBLE + : View.GONE; } private class Listener implements DialogInterface.OnClickListener, diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java index abadb8bc3d7..35e40364eb0 100644 --- a/src/com/android/settings/notification/RedactionInterstitial.java +++ b/src/com/android/settings/notification/RedactionInterstitial.java @@ -186,7 +186,10 @@ public class RedactionInterstitial extends SettingsActivity { private void updateRemoteInputCheckboxVisibility() { boolean visible = mRadioGroup.getCheckedRadioButtonId() == R.id.show_all; - mRemoteInputCheckbox.setVisibility(visible ? View.VISIBLE : View.INVISIBLE); + boolean isManagedProfile = Utils.isManagedProfile(UserManager.get(getPrefContext()), + mUserId); + mRemoteInputCheckbox + .setVisibility((visible && !isManagedProfile) ? View.VISIBLE : View.INVISIBLE); } } }