Merge "New DeviceConfig flags for NAS"

This commit is contained in:
Chloris Kuo
2020-12-15 02:43:04 +00:00
committed by Android (Google) Code Review
2 changed files with 33 additions and 4 deletions

View File

@@ -47,6 +47,21 @@ public final class SystemUiDeviceConfigFlags {
*/
public static final String NAS_MAX_SUGGESTIONS = "nas_max_suggestions";
/**
* Whether the Notification Assistant can change ranking.
*/
public static final String ENABLE_NAS_RANKING = "enable_nas_ranking";
/**
* Whether the Notification Assistant can prioritize notification.
*/
public static final String ENABLE_NAS_PRIORITIZER = "enable_nas_prioritizer";
/**
* Whether to enable feedback UI for Notification Assistant
*/
public static final String ENABLE_NAS_FEEDBACK = "enable_nas_feedback";
// Flags related to screenshot intelligence
/**

View File

@@ -2274,10 +2274,24 @@ public class NotificationManagerService extends SystemService {
if (!DeviceConfig.NAMESPACE_SYSTEMUI.equals(properties.getNamespace())) {
return;
}
if (properties.getKeyset()
.contains(SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE)) {
mAssistants.allowAdjustmentType(Adjustment.KEY_IMPORTANCE);
mAssistants.resetDefaultAssistantsIfNecessary();
for (String name : properties.getKeyset()) {
if (SystemUiDeviceConfigFlags.NAS_DEFAULT_SERVICE.equals(name)) {
mAssistants.resetDefaultAssistantsIfNecessary();
} else if (SystemUiDeviceConfigFlags.ENABLE_NAS_PRIORITIZER.equals(name)) {
String value = properties.getString(name, null);
if ("true".equals(value)) {
mAssistants.allowAdjustmentType(Adjustment.KEY_IMPORTANCE);
} else if ("false".equals(value)) {
mAssistants.disallowAdjustmentType(Adjustment.KEY_IMPORTANCE);
}
} else if (SystemUiDeviceConfigFlags.ENABLE_NAS_RANKING.equals(name)) {
String value = properties.getString(name, null);
if ("true".equals(value)) {
mAssistants.allowAdjustmentType(Adjustment.KEY_RANKING_SCORE);
} else if ("false".equals(value)) {
mAssistants.disallowAdjustmentType(Adjustment.KEY_RANKING_SCORE);
}
}
}
};
DeviceConfig.addOnPropertiesChangedListener(