incidentd: Adding privacy tag and expanding field.
Also updating priority category enum to note new values. Bug: 65750824 Bug: 72393215 Test: flash device and check incident.proto output Change-Id: I0c764cd4bb258160aa7140e60e81f76f84cc28ce
This commit is contained in:
@@ -18,11 +18,11 @@ package android.service.notification;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -161,6 +161,22 @@ public final class Condition implements Parcelable {
|
||||
.append(']').toString();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void writeToProto(ProtoOutputStream proto, long fieldId) {
|
||||
final long token = proto.start(fieldId);
|
||||
|
||||
// id is guarantreed not to be null.
|
||||
proto.write(ConditionProto.ID, id.toString());
|
||||
proto.write(ConditionProto.SUMMARY, summary);
|
||||
proto.write(ConditionProto.LINE_1, line1);
|
||||
proto.write(ConditionProto.LINE_2, line2);
|
||||
proto.write(ConditionProto.ICON, icon);
|
||||
proto.write(ConditionProto.STATE, state);
|
||||
proto.write(ConditionProto.FLAGS, flags);
|
||||
|
||||
proto.end(token);
|
||||
}
|
||||
|
||||
@SystemApi
|
||||
public static String stateToString(int state) {
|
||||
if (state == STATE_FALSE) return "STATE_FALSE";
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.text.format.DateFormat;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
@@ -1262,6 +1263,30 @@ public class ZenModeConfig implements Parcelable {
|
||||
.append(']').toString();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public void writeToProto(ProtoOutputStream proto, long fieldId) {
|
||||
final long token = proto.start(fieldId);
|
||||
|
||||
proto.write(ZenRuleProto.ID, id);
|
||||
proto.write(ZenRuleProto.NAME, name);
|
||||
proto.write(ZenRuleProto.CREATION_TIME_MS, creationTime);
|
||||
proto.write(ZenRuleProto.ENABLED, enabled);
|
||||
proto.write(ZenRuleProto.ENABLER, enabler);
|
||||
proto.write(ZenRuleProto.IS_SNOOZING, snoozing);
|
||||
proto.write(ZenRuleProto.ZEN_MODE, zenMode);
|
||||
if (conditionId != null) {
|
||||
proto.write(ZenRuleProto.CONDITION_ID, conditionId.toString());
|
||||
}
|
||||
if (condition != null) {
|
||||
condition.writeToProto(proto, ZenRuleProto.CONDITION);
|
||||
}
|
||||
if (component != null) {
|
||||
component.writeToProto(proto, ZenRuleProto.COMPONENT);
|
||||
}
|
||||
|
||||
proto.end(token);
|
||||
}
|
||||
|
||||
private static void appendDiff(Diff d, String item, ZenRule from, ZenRule to) {
|
||||
if (d == null) return;
|
||||
if (from == null) {
|
||||
|
||||
@@ -18,10 +18,10 @@ syntax = "proto2";
|
||||
option java_package = "android.app";
|
||||
option java_multiple_files = true;
|
||||
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
package android.app;
|
||||
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
/**
|
||||
* An android.app.Notification object.
|
||||
* Deprecated fields are not included in the proto.
|
||||
|
||||
@@ -21,19 +21,22 @@ option java_multiple_files = true;
|
||||
package android.app;
|
||||
|
||||
import "frameworks/base/core/proto/android/media/audioattributes.proto";
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
/**
|
||||
* An android.app.NotificationChannel object.
|
||||
*/
|
||||
message NotificationChannelProto {
|
||||
optional string id = 1;
|
||||
optional string name = 2;
|
||||
optional string description = 3;
|
||||
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional string id = 1 [ (android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional string description = 3 [ (android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional int32 importance = 4;
|
||||
optional bool can_bypass_dnd = 5;
|
||||
// Default is VISIBILITY_NO_OVERRIDE (-1000).
|
||||
optional int32 lockscreen_visibility = 6;
|
||||
optional string sound = 7;
|
||||
optional string sound = 7 [ (android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional bool use_lights = 8;
|
||||
// Default is 0.
|
||||
optional int32 light_color = 9;
|
||||
@@ -46,7 +49,7 @@ message NotificationChannelProto {
|
||||
optional bool show_badge = 13;
|
||||
// Default is false.
|
||||
optional bool is_deleted = 14;
|
||||
optional string group = 15;
|
||||
optional string group = 15 [ (android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional android.media.AudioAttributesProto audio_attributes = 16;
|
||||
// If this is a blockable system notification channel.
|
||||
optional bool is_blockable_system = 17;
|
||||
|
||||
@@ -21,11 +21,14 @@ option java_multiple_files = true;
|
||||
package android.app;
|
||||
|
||||
import "frameworks/base/core/proto/android/app/notification_channel.proto";
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
/**
|
||||
* An android.app.NotificationChannelGroup object.
|
||||
*/
|
||||
message NotificationChannelGroupProto {
|
||||
option (.android.msg_privacy).dest = DEST_EXPLICIT;
|
||||
|
||||
optional string id = 1;
|
||||
optional string name = 2;
|
||||
optional string description = 3;
|
||||
|
||||
@@ -20,10 +20,14 @@ option java_multiple_files = true;
|
||||
|
||||
package android.app;
|
||||
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
/**
|
||||
* An android.app.NotificationMananger.Policy object.
|
||||
* An android.app.NotificationManager.Policy object.
|
||||
*/
|
||||
message PolicyProto {
|
||||
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
enum Category {
|
||||
CATEGORY_UNKNOWN = 0;
|
||||
// Reminder notifications are prioritized.
|
||||
@@ -36,6 +40,11 @@ message PolicyProto {
|
||||
CALLS = 4;
|
||||
// Calls from repeat callers are prioritized.
|
||||
REPEAT_CALLERS = 5;
|
||||
// Alarms are prioritized.
|
||||
ALARMS = 6;
|
||||
// Media, system, game (catch-all for non-never suppressible sounds) are
|
||||
// prioritized.
|
||||
MEDIA_SYSTEM_OTHER = 7;
|
||||
}
|
||||
repeated Category priority_categories = 1;
|
||||
|
||||
|
||||
@@ -25,8 +25,11 @@ import "frameworks/base/core/proto/android/app/notification_channel_group.proto"
|
||||
import "frameworks/base/core/proto/android/app/notificationmanager.proto";
|
||||
import "frameworks/base/core/proto/android/content/component_name.proto";
|
||||
import "frameworks/base/core/proto/android/media/audioattributes.proto";
|
||||
import "frameworks/base/libs/incident/proto/android/privacy.proto";
|
||||
|
||||
message NotificationServiceDumpProto {
|
||||
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
repeated NotificationRecordProto records = 1;
|
||||
|
||||
optional ZenModeProto zen = 2;
|
||||
@@ -45,7 +48,9 @@ message NotificationServiceDumpProto {
|
||||
}
|
||||
|
||||
message NotificationRecordProto {
|
||||
optional string key = 1;
|
||||
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional string key = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
|
||||
enum State {
|
||||
ENQUEUED = 0;
|
||||
@@ -54,21 +59,25 @@ message NotificationRecordProto {
|
||||
}
|
||||
optional State state = 2;
|
||||
optional int32 flags = 3;
|
||||
optional string channelId = 4;
|
||||
optional string sound = 5;
|
||||
optional string channelId = 4 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional string sound = 5 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional .android.media.AudioAttributesProto audio_attributes = 6;
|
||||
optional bool can_vibrate = 7;
|
||||
optional bool can_show_light = 8;
|
||||
optional string group_key = 9;
|
||||
optional string group_key = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional int32 importance = 10;
|
||||
}
|
||||
|
||||
message ListenersDisablingEffectsProto {
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional int32 hint = 1;
|
||||
repeated ManagedServiceInfoProto listeners = 2;
|
||||
}
|
||||
|
||||
message ManagedServiceInfoProto {
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional android.content.ComponentNameProto component = 1;
|
||||
optional int32 user_id = 2;
|
||||
optional string service = 3;
|
||||
@@ -77,10 +86,14 @@ message ManagedServiceInfoProto {
|
||||
}
|
||||
|
||||
message ManagedServicesProto {
|
||||
optional string caption = 1;
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional string caption = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
|
||||
message ServiceProto {
|
||||
repeated string name = 1;
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
repeated string name = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
|
||||
optional int32 user_id = 2;
|
||||
optional bool is_primary = 3;
|
||||
}
|
||||
@@ -97,9 +110,13 @@ message ManagedServicesProto {
|
||||
}
|
||||
|
||||
message RankingHelperProto {
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
repeated string notification_signal_extractors = 1;
|
||||
|
||||
message RecordProto {
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional string package = 1;
|
||||
// Default value is UNKNOWN_UID = USER_NULL = -10000.
|
||||
optional int32 uid = 2;
|
||||
@@ -118,16 +135,72 @@ message RankingHelperProto {
|
||||
repeated RecordProto records_restored_without_uid = 3;
|
||||
}
|
||||
|
||||
message ZenModeProto {
|
||||
enum ZenMode {
|
||||
ZEN_MODE_OFF = 0;
|
||||
ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
|
||||
ZEN_MODE_NO_INTERRUPTIONS = 2;
|
||||
ZEN_MODE_ALARMS = 3;
|
||||
enum ZenMode {
|
||||
ZEN_MODE_OFF = 0;
|
||||
ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
|
||||
ZEN_MODE_NO_INTERRUPTIONS = 2;
|
||||
ZEN_MODE_ALARMS = 3;
|
||||
}
|
||||
|
||||
// An android.service.notification.Condition object.
|
||||
message ConditionProto {
|
||||
option (android.msg_privacy).dest = DEST_EXPLICIT;
|
||||
|
||||
optional string id = 1;
|
||||
optional string summary = 2;
|
||||
optional string line_1 = 3;
|
||||
optional string line_2 = 4;
|
||||
optional int32 icon = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
|
||||
enum State {
|
||||
// Indicates that Do Not Disturb should be turned off.
|
||||
STATE_FALSE = 0;
|
||||
// Indicates that Do Not Disturb should be turned on.
|
||||
STATE_TRUE = 1;
|
||||
STATE_UNKNOWN = 2;
|
||||
STATE_ERROR = 3;
|
||||
}
|
||||
optional State state = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
|
||||
optional int32 flags = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
}
|
||||
|
||||
// An android.service.notification.ZenModeConfig.ZenRule object.
|
||||
message ZenRuleProto {
|
||||
option (android.msg_privacy).dest = DEST_EXPLICIT;
|
||||
|
||||
// Required for automatic (unique).
|
||||
optional string id = 1;
|
||||
// Required for automatic.
|
||||
optional string name = 2;
|
||||
// Required for automatic.
|
||||
optional int64 creation_time_ms = 3 [
|
||||
(android.privacy).dest = DEST_AUTOMATIC
|
||||
];
|
||||
optional bool enabled = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
// Package name, only used for manual rules.
|
||||
optional string enabler = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
|
||||
// User manually disabled this instance.
|
||||
optional bool is_snoozing = 6 [
|
||||
(android.privacy).dest = DEST_AUTOMATIC
|
||||
];
|
||||
optional ZenMode zen_mode = 7 [
|
||||
(android.privacy).dest = DEST_AUTOMATIC
|
||||
];
|
||||
|
||||
// Required for automatic.
|
||||
optional string condition_id = 8;
|
||||
optional ConditionProto condition = 9;
|
||||
optional android.content.ComponentNameProto component = 10;
|
||||
}
|
||||
|
||||
// A dump from com.android.server.notification.ZenModeHelper.
|
||||
message ZenModeProto {
|
||||
option (android.msg_privacy).dest = DEST_AUTOMATIC;
|
||||
|
||||
optional ZenMode zen_mode = 1;
|
||||
repeated string enabled_active_conditions = 2;
|
||||
repeated ZenRuleProto enabled_active_conditions = 2;
|
||||
optional int32 suppressed_effects = 3;
|
||||
repeated string suppressors = 4;
|
||||
repeated android.content.ComponentNameProto suppressors = 4;
|
||||
optional android.app.PolicyProto policy = 5;
|
||||
}
|
||||
|
||||
@@ -3421,7 +3421,7 @@ public class NotificationManagerService extends SystemService {
|
||||
long zenLog = proto.start(NotificationServiceDumpProto.ZEN);
|
||||
mZenModeHelper.dump(proto);
|
||||
for (ComponentName suppressor : mEffectsSuppressors) {
|
||||
proto.write(ZenModeProto.SUPPRESSORS, suppressor.toString());
|
||||
suppressor.writeToProto(proto, ZenModeProto.SUPPRESSORS);
|
||||
}
|
||||
proto.end(zenLog);
|
||||
|
||||
|
||||
@@ -553,16 +553,15 @@ public class ZenModeHelper {
|
||||
}
|
||||
|
||||
void dump(ProtoOutputStream proto) {
|
||||
|
||||
proto.write(ZenModeProto.ZEN_MODE, mZenMode);
|
||||
synchronized (mConfig) {
|
||||
if (mConfig.manualRule != null) {
|
||||
proto.write(ZenModeProto.ENABLED_ACTIVE_CONDITIONS, mConfig.manualRule.toString());
|
||||
mConfig.manualRule.writeToProto(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
|
||||
}
|
||||
for (ZenRule rule : mConfig.automaticRules.values()) {
|
||||
if (rule.enabled && rule.condition.state == Condition.STATE_TRUE
|
||||
&& !rule.snoozing) {
|
||||
proto.write(ZenModeProto.ENABLED_ACTIVE_CONDITIONS, rule.toString());
|
||||
rule.writeToProto(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
|
||||
}
|
||||
}
|
||||
mConfig.toNotificationPolicy().writeToProto(proto, ZenModeProto.POLICY);
|
||||
|
||||
Reference in New Issue
Block a user