blob: e93d756d028536b223f57b90cd1cc389c96a427c [file] [log] [blame]
Jacky Wang659b6962024-09-13 16:40:04 +08001syntax = "proto3";
2
3package com.android.settingslib.graph;
4
5option java_package = "com.android.settingslib.graph.proto";
6option java_multiple_files = true;
7
8// Proto represents preference graph.
9message PreferenceGraphProto {
10 // Preference screens appear in the graph.
11 // Key: preference key of the PreferenceScreen. Value: PreferenceScreen.
12 map<string, PreferenceScreenProto> screens = 1;
13 // Roots of the graph.
14 // Each element is a preference key of the PreferenceScreen.
15 repeated string roots = 2;
16 // Activities appear in the graph.
17 // Key: activity class. Value: preference key of associated PreferenceScreen.
18 map<string, string> activity_screens = 3;
19}
20
21// Proto of PreferenceScreen.
22message PreferenceScreenProto {
23 // Intent to show the PreferenceScreen.
24 optional IntentProto intent = 1;
25 // Root of the PreferenceScreen hierarchy.
26 optional PreferenceGroupProto root = 2;
27 // If the preference screen provides complete hierarchy by source code.
28 optional bool complete_hierarchy = 3;
29}
30
31// Proto of PreferenceGroup.
32message PreferenceGroupProto {
33 // Self information of PreferenceGroup.
34 optional PreferenceProto preference = 1;
35 // A list of children.
36 repeated PreferenceOrGroupProto preferences = 2;
37}
38
39// Proto represents either PreferenceProto or PreferenceGroupProto.
40message PreferenceOrGroupProto {
41 oneof kind {
42 // It is a Preference.
43 PreferenceProto preference = 1;
44 // It is a PreferenceGroup.
45 PreferenceGroupProto group = 2;
46 }
47}
48
49// Proto of Preference.
50message PreferenceProto {
51 // Key of the preference.
52 optional string key = 1;
53 // Title of the preference.
54 optional TextProto title = 2;
55 // Summary of the preference.
56 optional TextProto summary = 3;
57 // Icon of the preference.
58 optional int32 icon = 4;
59 // Additional keywords for indexing.
60 optional int32 keywords = 5;
61 // Extras of the preference.
62 optional BundleProto extras = 6;
63 // Whether the preference is indexable.
64 optional bool indexable = 7;
65 // Whether the preference is enabled.
66 optional bool enabled = 8;
67 // Whether the preference is available/visible.
68 optional bool available = 9;
69 // Whether the preference is persistent.
70 optional bool persistent = 10;
71 // Whether the preference is restricted by managed configurations.
72 optional bool restricted = 11;
73 // Target of the preference action.
74 optional ActionTarget action_target = 12;
75 // Preference value (if present, it means `persistent` is true).
76 optional PreferenceValueProto value = 13;
77
78 // Target of an Intent
79 message ActionTarget {
80 oneof kind {
81 // Resolved key of the preference screen located in current app.
82 // This is resolved from android:fragment or activity of current app.
83 string key = 1;
84 // Unresolvable Intent that is either an unrecognized activity of current
85 // app or activity belongs to other app.
86 IntentProto intent = 2;
87 }
88 }
89}
90
91// Proto of string or string resource id.
92message TextProto {
93 oneof text {
94 int32 resource_id = 1;
95 string string = 2;
96 }
97}
98
99// Proto of preference value.
100message PreferenceValueProto {
101 oneof value {
102 bool boolean_value = 1;
103 }
104}
105
106// Proto of android.content.Intent
107message IntentProto {
108 // The action of the Intent.
109 optional string action = 1;
110
111 // The data attribute of the Intent, expressed as a URI.
112 optional string data = 2;
113
114 // The package attribute of the Intent, which may be set to force the
115 // detection of a particular application package that can handle the event.
116 optional string pkg = 3;
117
118 // The component attribute of the Intent, which may be set to force the
119 // detection of a particular component (app). If present, this must be a
120 // package name followed by a '/' and then followed by the class name.
121 optional string component = 4;
122
123 // Flags controlling how intent is handled. The value must be bitwise OR of
124 // intent flag constants defined by Android.
125 // http://developer.android.com/reference/android/content/Intent.html#setFlags(int)
126 optional int32 flags = 5;
127
128 // Extended data from the intent.
129 optional BundleProto extras = 6;
130
131 // The MIME type of the Intent (e.g. "text/plain").
132 //
133 // For more information, see
134 // https://developer.android.com/reference/android/content/Intent#setType(java.lang.String).
135 optional string mime_type = 7;
136}
137
138// Proto of android.os.Bundle
139message BundleProto {
140 // Bundle data.
141 map<string, BundleValue> values = 1;
142
143 message BundleValue {
144 // Bundle data value for the associated key name.
145 // Can be extended to support other types of bundled data.
146 oneof value {
147 string string_value = 1;
148 bytes bytes_value = 2;
149 int32 int_value = 3;
150 int64 long_value = 4;
151 bool boolean_value = 5;
152 double double_value = 6;
153 BundleProto bundle_value = 7;
154 }
155 }
156}