1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18package com.android.server.notification;
19
20option java_multiple_files = true;
21
22import "frameworks/base/core/proto/android/privacy.proto";
23
24// On disk data store for historical notifications
25message NotificationHistoryProto {
26  message StringPool {
27    optional int32 size = 1;
28    repeated string strings = 2;
29  }
30
31  message Notification {
32    // The package that posted the notification
33    optional string package = 1;
34    // package_index contains the index + 1 of the package name in the string pool
35    optional int32 package_index = 2;
36
37    // The name of the NotificationChannel this notification was posted to
38    optional string channel_name = 3 [(.android.privacy).dest = DEST_EXPLICIT];
39    // channel_name_index contains the index + 1 of the channel name in the string pool
40    optional int32 channel_name_index = 4;
41
42    // The id of the NotificationChannel this notification was posted to
43    optional string channel_id = 5;
44    // channel_id_index contains the index + 1 of the channel id in the string pool
45    optional int32 channel_id_index = 6;
46
47    // The uid of the package that posted the notification
48    optional int32 uid = 7;
49    // The user id that the notification was posted to
50    optional int32 user_id = 8;
51    // The time at which the notification was posted
52    optional int64 posted_time_ms = 9;
53    // The title of the notification
54    optional string title = 10 [(.android.privacy).dest = DEST_EXPLICIT];
55    // The text of the notification
56    optional string text = 11 [(.android.privacy).dest = DEST_EXPLICIT];
57    // The small icon of the notification
58    optional Icon icon = 12;
59
60    // The conversation id, if any, that this notification belongs to
61    optional string conversation_id = 13;
62    // conversation_id_index contains the index + 1 of the conversation id in the string pool
63    optional int32 conversation_id_index = 14;
64
65    // Matches the constants of android.graphics.drawable.Icon
66    enum ImageTypeEnum {
67      TYPE_UNKNOWN = 0;
68      TYPE_BITMAP = 1;
69      TYPE_RESOURCE = 2;
70      TYPE_DATA = 3;
71      TYPE_URI = 4;
72      TYPE_ADAPTIVE_BITMAP = 5;
73    }
74
75    message Icon {
76      optional ImageTypeEnum image_type = 1;
77      optional string image_bitmap_filename = 2;
78      optional int32 image_resource_id = 3;
79      optional string image_resource_id_package = 4;
80      optional bytes image_data = 5;
81      optional int32 image_data_length = 6;
82      optional int32 image_data_offset = 7;
83      optional string image_uri = 8;
84    }
85  }
86
87  // Pool of strings to save space
88  optional StringPool string_pool = 1;
89  // Versioning fields
90  optional int32 major_version = 2;
91
92  // List of historical notifications
93  repeated Notification notification = 3;
94}
95