Channel updates from users lock fields from interference.
Also some apis have changed. Test: manual, modify settings and check policy xml. Change-Id: I967cb1fb30d8d400bdc0f3aa92fa07b4c87ddcf5
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
package com.android.settings.applications;
|
package com.android.settings.applications;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
@@ -92,8 +93,8 @@ public class AppStateNotificationBridge extends AppStateBaseBridge {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AppRow row = (AppRow) info.extraInfo;
|
AppRow row = (AppRow) info.extraInfo;
|
||||||
return row.appImportance > NotificationListenerService.Ranking.IMPORTANCE_NONE
|
return row.appImportance > NotificationManager.IMPORTANCE_NONE
|
||||||
&& row.appImportance < NotificationListenerService.Ranking.IMPORTANCE_DEFAULT;
|
&& row.appImportance < NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@ import android.app.ActivityManager;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.LoaderManager.LoaderCallbacks;
|
import android.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -1099,15 +1100,15 @@ public class InstalledAppDetails extends AppInfoBase
|
|||||||
List<String> summaryAttributes = new ArrayList<>();
|
List<String> summaryAttributes = new ArrayList<>();
|
||||||
StringBuffer summary = new StringBuffer();
|
StringBuffer summary = new StringBuffer();
|
||||||
if (showSlider) {
|
if (showSlider) {
|
||||||
if (appRow.appImportance != Ranking.IMPORTANCE_UNSPECIFIED) {
|
if (appRow.appImportance != NotificationManager.IMPORTANCE_UNSPECIFIED) {
|
||||||
summaryAttributes.add(context.getString(
|
summaryAttributes.add(context.getString(
|
||||||
R.string.notification_summary_level, appRow.appImportance));
|
R.string.notification_summary_level, appRow.appImportance));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (appRow.banned) {
|
if (appRow.banned) {
|
||||||
summaryAttributes.add(context.getString(R.string.notifications_disabled));
|
summaryAttributes.add(context.getString(R.string.notifications_disabled));
|
||||||
} else if (appRow.appImportance > Ranking.IMPORTANCE_NONE
|
} else if (appRow.appImportance > NotificationManager.IMPORTANCE_NONE
|
||||||
&& appRow.appImportance < Ranking.IMPORTANCE_DEFAULT) {
|
&& appRow.appImportance < NotificationManager.IMPORTANCE_DEFAULT) {
|
||||||
summaryAttributes.add(context.getString(R.string.notifications_silenced));
|
summaryAttributes.add(context.getString(R.string.notifications_silenced));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,7 @@ public class AppNotificationSettings extends NotificationSettingsBase {
|
|||||||
mChannelList = mBackend.getChannels(mPkg, mUid).getList();
|
mChannelList = mBackend.getChannels(mPkg, mUid).getList();
|
||||||
|
|
||||||
setupImportancePrefs(mAppRow.systemApp, mAppRow.appImportance, mAppRow.banned,
|
setupImportancePrefs(mAppRow.systemApp, mAppRow.appImportance, mAppRow.banned,
|
||||||
NotificationManager.IMPORTANCE_MAX);
|
NotificationManager.IMPORTANCE_HIGH);
|
||||||
setupPriorityPref(mAppRow.appBypassDnd);
|
setupPriorityPref(mAppRow.appBypassDnd);
|
||||||
setupVisOverridePref(mAppRow.appVisOverride);
|
setupVisOverridePref(mAppRow.appVisOverride);
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.notification;
|
package com.android.settings.notification;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -24,6 +25,7 @@ import android.os.Bundle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.service.notification.NotificationListenerService.Ranking;
|
import android.service.notification.NotificationListenerService.Ranking;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.AppHeader;
|
import com.android.settings.AppHeader;
|
||||||
@@ -94,7 +96,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
setupVibrate();
|
setupVibrate();
|
||||||
setupRingtone();
|
setupRingtone();
|
||||||
mMaxImportance = mAppRow.appImportance == NotificationManager.IMPORTANCE_UNSPECIFIED
|
mMaxImportance = mAppRow.appImportance == NotificationManager.IMPORTANCE_UNSPECIFIED
|
||||||
? NotificationManager.IMPORTANCE_MAX : mAppRow.appImportance;
|
? NotificationManager.IMPORTANCE_HIGH : mAppRow.appImportance;
|
||||||
setupImportancePrefs(false, mChannel.getImportance(),
|
setupImportancePrefs(false, mChannel.getImportance(),
|
||||||
mChannel.getImportance() == NotificationManager.IMPORTANCE_NONE,
|
mChannel.getImportance() == NotificationManager.IMPORTANCE_NONE,
|
||||||
mMaxImportance);
|
mMaxImportance);
|
||||||
@@ -141,6 +143,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
final boolean lights = (Boolean) newValue;
|
final boolean lights = (Boolean) newValue;
|
||||||
mChannel.setLights(lights);
|
mChannel.setLights(lights);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_LIGHTS);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -155,6 +158,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
final boolean vibrate = (Boolean) newValue;
|
final boolean vibrate = (Boolean) newValue;
|
||||||
mChannel.setVibration(vibrate);
|
mChannel.setVibration(vibrate);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_VIBRATION);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -162,13 +166,14 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupRingtone() {
|
private void setupRingtone() {
|
||||||
mRingtone.setRingtone(mChannel.getDefaultRingtone());
|
mRingtone.setRingtone(mChannel.getRingtone());
|
||||||
mRingtone.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mRingtone.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
Uri ringtone = Uri.parse((String) newValue);
|
Uri ringtone = Uri.parse((String) newValue);
|
||||||
mRingtone.setRingtone(ringtone);
|
mRingtone.setRingtone(ringtone);
|
||||||
mChannel.setDefaultRingtone(ringtone);
|
mChannel.setRingtone(ringtone);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_RINGTONE);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.notification;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SeekBarPreference;
|
import com.android.settings.SeekBarPreference;
|
||||||
|
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
@@ -119,12 +120,10 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
|
|||||||
private void applyAuto(ImageView autoButton) {
|
private void applyAuto(ImageView autoButton) {
|
||||||
mAutoOn = !mAutoOn;
|
mAutoOn = !mAutoOn;
|
||||||
if (!mAutoOn) {
|
if (!mAutoOn) {
|
||||||
setProgress(NotificationListenerService.Ranking.IMPORTANCE_DEFAULT);
|
setProgress(NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
mCallback.onImportanceChanged(
|
mCallback.onImportanceChanged(NotificationManager.IMPORTANCE_DEFAULT, true);
|
||||||
NotificationListenerService.Ranking.IMPORTANCE_DEFAULT, true);
|
|
||||||
} else {
|
} else {
|
||||||
mCallback.onImportanceChanged(
|
mCallback.onImportanceChanged(NotificationManager.IMPORTANCE_UNSPECIFIED, true);
|
||||||
NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED, true);
|
|
||||||
}
|
}
|
||||||
applyAutoUi(autoButton);
|
applyAutoUi(autoButton);
|
||||||
}
|
}
|
||||||
@@ -140,9 +139,8 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
|
|||||||
mSeekBar.setAlpha(alpha);
|
mSeekBar.setAlpha(alpha);
|
||||||
|
|
||||||
if (mAutoOn) {
|
if (mAutoOn) {
|
||||||
setProgress(NotificationListenerService.Ranking.IMPORTANCE_DEFAULT);
|
setProgress(NotificationManager.IMPORTANCE_DEFAULT);
|
||||||
mSummary = getProgressSummary(
|
mSummary = getProgressSummary(NotificationManager.IMPORTANCE_UNSPECIFIED);
|
||||||
NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED);
|
|
||||||
}
|
}
|
||||||
mSummaryTextView.setText(mSummary);
|
mSummaryTextView.setText(mSummary);
|
||||||
}
|
}
|
||||||
@@ -168,18 +166,17 @@ public class ImportanceSeekBarPreference extends SeekBarPreference implements
|
|||||||
|
|
||||||
private String getProgressSummary(int progress) {
|
private String getProgressSummary(int progress) {
|
||||||
switch (progress) {
|
switch (progress) {
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_NONE:
|
case NotificationManager.IMPORTANCE_NONE:
|
||||||
return getContext().getString(R.string.notification_importance_blocked);
|
return getContext().getString(R.string.notification_importance_blocked);
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_MIN:
|
case NotificationManager.IMPORTANCE_MIN:
|
||||||
return getContext().getString(R.string.notification_importance_min);
|
return getContext().getString(R.string.notification_importance_min);
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_LOW:
|
case NotificationManager.IMPORTANCE_LOW:
|
||||||
return getContext().getString(R.string.notification_importance_low);
|
return getContext().getString(R.string.notification_importance_low);
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_DEFAULT:
|
case NotificationManager.IMPORTANCE_DEFAULT:
|
||||||
return getContext().getString(R.string.notification_importance_default);
|
return getContext().getString(R.string.notification_importance_default);
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_HIGH:
|
case NotificationManager.IMPORTANCE_HIGH:
|
||||||
|
case NotificationManager.IMPORTANCE_MAX:
|
||||||
return getContext().getString(R.string.notification_importance_high);
|
return getContext().getString(R.string.notification_importance_high);
|
||||||
case NotificationListenerService.Ranking.IMPORTANCE_MAX:
|
|
||||||
return getContext().getString(R.string.notification_importance_max);
|
|
||||||
default:
|
default:
|
||||||
return getContext().getString(R.string.notification_importance_unspecified);
|
return getContext().getString(R.string.notification_importance_unspecified);
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification;
|
|||||||
import android.app.INotificationManager;
|
import android.app.INotificationManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -139,7 +140,7 @@ public class NotificationBackend {
|
|||||||
return sINM.getImportance(pkg, uid);
|
return sINM.getImportance(pkg, uid);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(TAG, "Error calling NoMan", e);
|
Log.w(TAG, "Error calling NoMan", e);
|
||||||
return NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED;
|
return NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -178,16 +178,18 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
setVisible(mSilent, false);
|
setVisible(mSilent, false);
|
||||||
mImportance.setDisabledByAdmin(mSuspendedAppsAdmin);
|
mImportance.setDisabledByAdmin(mSuspendedAppsAdmin);
|
||||||
mImportance.setMinimumProgress(
|
mImportance.setMinimumProgress(
|
||||||
notBlockable ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
|
notBlockable ? NotificationManager.IMPORTANCE_MIN
|
||||||
|
: NotificationManager.IMPORTANCE_NONE);
|
||||||
mImportance.setMax(maxImportance);
|
mImportance.setMax(maxImportance);
|
||||||
mImportance.setProgress(Math.min(importance, maxImportance));
|
mImportance.setProgress(Math.min(importance, maxImportance));
|
||||||
mImportance.setAutoOn(importance == Ranking.IMPORTANCE_UNSPECIFIED);
|
mImportance.setAutoOn(importance == NotificationManager.IMPORTANCE_UNSPECIFIED);
|
||||||
mImportance.setCallback(new ImportanceSeekBarPreference.Callback() {
|
mImportance.setCallback(new ImportanceSeekBarPreference.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onImportanceChanged(int progress, boolean fromUser) {
|
public void onImportanceChanged(int progress, boolean fromUser) {
|
||||||
if (fromUser) {
|
if (fromUser) {
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
mChannel.setImportance(progress);
|
mChannel.setImportance(progress);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
} else {
|
} else {
|
||||||
mBackend.setImportance(mPkg, mUid, progress);
|
mBackend.setImportance(mPkg, mUid, progress);
|
||||||
@@ -209,10 +211,11 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
Object newValue) {
|
Object newValue) {
|
||||||
final boolean blocked = (Boolean) newValue;
|
final boolean blocked = (Boolean) newValue;
|
||||||
final int importance = blocked
|
final int importance = blocked
|
||||||
? Ranking.IMPORTANCE_NONE
|
? NotificationManager.IMPORTANCE_NONE
|
||||||
: Ranking.IMPORTANCE_UNSPECIFIED;
|
: NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
mChannel.setImportance(importance);
|
mChannel.setImportance(importance);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
} else {
|
} else {
|
||||||
mBackend.setImportance(mPkgInfo.packageName, mUid,
|
mBackend.setImportance(mPkgInfo.packageName, mUid,
|
||||||
@@ -226,9 +229,10 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
// app silenced; cannot un-silence a channel
|
// app silenced; cannot un-silence a channel
|
||||||
if (maxImportance == NotificationManager.IMPORTANCE_LOW) {
|
if (maxImportance == NotificationManager.IMPORTANCE_LOW) {
|
||||||
setVisible(mSilent, false);
|
setVisible(mSilent, false);
|
||||||
updateDependents(banned ? Ranking.IMPORTANCE_NONE : Ranking.IMPORTANCE_LOW);
|
updateDependents(banned ? NotificationManager.IMPORTANCE_NONE
|
||||||
|
: NotificationManager.IMPORTANCE_LOW);
|
||||||
} else {
|
} else {
|
||||||
mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
|
mSilent.setChecked(importance == NotificationManager.IMPORTANCE_LOW);
|
||||||
mSilent.setOnPreferenceChangeListener(
|
mSilent.setOnPreferenceChangeListener(
|
||||||
new Preference.OnPreferenceChangeListener() {
|
new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -236,10 +240,11 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
Object newValue) {
|
Object newValue) {
|
||||||
final boolean silenced = (Boolean) newValue;
|
final boolean silenced = (Boolean) newValue;
|
||||||
final int importance = silenced
|
final int importance = silenced
|
||||||
? Ranking.IMPORTANCE_LOW
|
? NotificationManager.IMPORTANCE_LOW
|
||||||
: Ranking.IMPORTANCE_UNSPECIFIED;
|
: NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
mChannel.setImportance(importance);
|
mChannel.setImportance(importance);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
} else {
|
} else {
|
||||||
mBackend.setImportance(mPkgInfo.packageName, mUid,
|
mBackend.setImportance(mPkgInfo.packageName, mUid,
|
||||||
@@ -249,7 +254,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
updateDependents(banned ? Ranking.IMPORTANCE_NONE : importance);
|
updateDependents(banned ? NotificationManager.IMPORTANCE_NONE : importance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,6 +268,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
final boolean bypassZenMode = (Boolean) newValue;
|
final boolean bypassZenMode = (Boolean) newValue;
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
mChannel.setBypassDnd(bypassZenMode);
|
mChannel.setBypassDnd(bypassZenMode);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_PRIORITY);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -280,7 +286,8 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
if (getLockscreenNotificationsEnabled() && getLockscreenAllowPrivateNotifications()) {
|
if (getLockscreenNotificationsEnabled() && getLockscreenAllowPrivateNotifications()) {
|
||||||
final String summaryShowEntry =
|
final String summaryShowEntry =
|
||||||
getString(R.string.lock_screen_notifications_summary_show);
|
getString(R.string.lock_screen_notifications_summary_show);
|
||||||
final String summaryShowEntryValue = Integer.toString(Ranking.VISIBILITY_NO_OVERRIDE);
|
final String summaryShowEntryValue =
|
||||||
|
Integer.toString(NotificationManager.VISIBILITY_NO_OVERRIDE);
|
||||||
entries.add(summaryShowEntry);
|
entries.add(summaryShowEntry);
|
||||||
values.add(summaryShowEntryValue);
|
values.add(summaryShowEntryValue);
|
||||||
setRestrictedIfNotificationFeaturesDisabled(summaryShowEntry, summaryShowEntryValue,
|
setRestrictedIfNotificationFeaturesDisabled(summaryShowEntry, summaryShowEntryValue,
|
||||||
@@ -306,7 +313,8 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
}
|
}
|
||||||
mVisibilityOverride.setSummary("%s");
|
mVisibilityOverride.setSummary("%s");
|
||||||
|
|
||||||
mVisibilityOverride.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mVisibilityOverride.setOnPreferenceChangeListener(
|
||||||
|
new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
int sensitive = Integer.parseInt((String) newValue);
|
int sensitive = Integer.parseInt((String) newValue);
|
||||||
@@ -315,6 +323,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
}
|
}
|
||||||
if (mChannel != null) {
|
if (mChannel != null) {
|
||||||
mChannel.setLockscreenVisibility(sensitive);
|
mChannel.setLockscreenVisibility(sensitive);
|
||||||
|
mChannel.lockFields(NotificationChannel.USER_LOCKED_VISIBILITY);
|
||||||
mBackend.updateChannel(mPkg, mUid, mChannel);
|
mBackend.updateChannel(mPkg, mUid, mChannel);
|
||||||
} else {
|
} else {
|
||||||
mBackend.setVisibilityOverride(mPkgInfo.packageName, mUid, sensitive);
|
mBackend.setVisibilityOverride(mPkgInfo.packageName, mUid, sensitive);
|
||||||
@@ -367,14 +376,15 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
|
|
||||||
protected void updateDependents(int importance) {
|
protected void updateDependents(int importance) {
|
||||||
if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) {
|
if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) {
|
||||||
setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance));
|
setVisible(mSilent, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN, importance));
|
||||||
mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
|
mSilent.setChecked(importance == NotificationManager.IMPORTANCE_LOW);
|
||||||
}
|
}
|
||||||
setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_DEFAULT, importance)
|
setVisible(mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT, importance)
|
||||||
|| (checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance)
|
|| (checkCanBeVisible(NotificationManager.IMPORTANCE_LOW, importance)
|
||||||
&& mDndVisualEffectsSuppressed));
|
&& mDndVisualEffectsSuppressed));
|
||||||
setVisible(mVisibilityOverride,
|
setVisible(mVisibilityOverride,
|
||||||
checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance) && isLockScreenSecure());
|
checkCanBeVisible(NotificationManager.IMPORTANCE_MIN, importance)
|
||||||
|
&& isLockScreenSecure());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setVisible(Preference p, boolean visible) {
|
protected void setVisible(Preference p, boolean visible) {
|
||||||
@@ -388,7 +398,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkCanBeVisible(int minImportanceVisible, int importance) {
|
protected boolean checkCanBeVisible(int minImportanceVisible, int importance) {
|
||||||
if (importance == Ranking.IMPORTANCE_UNSPECIFIED) {
|
if (importance == NotificationManager.IMPORTANCE_UNSPECIFIED) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return importance >= minImportanceVisible;
|
return importance >= minImportanceVisible;
|
||||||
|
Reference in New Issue
Block a user