1syntax = "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 // Parameterized screens (not recursive, provided on the top level only) 30 repeated ParameterizedPreferenceScreenProto parameterized_screens = 4; 31} 32 33// Proto of parameterized preference screen 34message ParameterizedPreferenceScreenProto { 35 optional BundleProto args = 1; 36 optional PreferenceScreenProto screen = 2; 37} 38 39// Proto of PreferenceGroup. 40message PreferenceGroupProto { 41 // Self information of PreferenceGroup. 42 optional PreferenceProto preference = 1; 43 // A list of children. 44 repeated PreferenceOrGroupProto preferences = 2; 45} 46 47// Proto represents either PreferenceProto or PreferenceGroupProto. 48message PreferenceOrGroupProto { 49 oneof kind { 50 // It is a Preference. 51 PreferenceProto preference = 1; 52 // It is a PreferenceGroup. 53 PreferenceGroupProto group = 2; 54 } 55} 56 57// Proto of Preference. 58message PreferenceProto { 59 // Key of the preference. 60 optional string key = 1; 61 // Title of the preference. 62 optional TextProto title = 2; 63 // Summary of the preference. 64 optional TextProto summary = 3; 65 // Icon of the preference. 66 optional int32 icon = 4; 67 // Additional keywords for indexing. 68 optional int32 keywords = 5; 69 // Extras of the preference. 70 optional BundleProto extras = 6; 71 // Whether the preference is indexable. 72 optional bool indexable = 7; 73 // Whether the preference is enabled. 74 optional bool enabled = 8; 75 // Whether the preference is available/visible. 76 optional bool available = 9; 77 // Whether the preference is persistent. 78 optional bool persistent = 10; 79 // Whether the preference is restricted by managed configurations. 80 optional bool restricted = 11; 81 // Target of the preference action. 82 optional ActionTarget action_target = 12; 83 // Preference value (if present, it means `persistent` is true). 84 optional PreferenceValueProto value = 13; 85 // Intent to show and locate the preference (might have highlight animation on 86 // the preference). 87 optional IntentProto launch_intent = 14; 88 // Descriptor of the preference value. 89 optional PreferenceValueDescriptorProto value_descriptor = 15; 90 // Indicate how sensitive of the preference. 91 optional int32 sensitivity_level = 16; 92 // The required permissions to read preference value. 93 optional PermissionsProto read_permissions = 17; 94 // The required permissions to write preference value. 95 optional PermissionsProto write_permissions = 18; 96 // Tag constants associated with the preference. 97 repeated string tags = 19; 98 // Permit to read and write preference value (the lower 15 bits is reserved for read permit). 99 optional int32 read_write_permit = 20; 100 101 // Target of an Intent 102 message ActionTarget { 103 oneof kind { 104 // Resolved key of the preference screen located in current app. 105 // This is resolved from android:fragment or activity of current app. 106 string key = 1; 107 // Unresolvable Intent that is either an unrecognized activity of current 108 // app or activity belongs to other app. 109 IntentProto intent = 2; 110 } 111 } 112} 113 114// Proto of permissions 115message PermissionsProto { 116 repeated PermissionProto all_of = 1; 117 repeated PermissionProto any_of = 2; 118} 119 120// Proto of permission 121message PermissionProto { 122 oneof kind { 123 string permission = 1; 124 PermissionsProto permissions = 2; 125 } 126} 127 128// Proto of string or string resource id. 129message TextProto { 130 oneof text { 131 int32 resource_id = 1; 132 string string = 2; 133 } 134} 135 136// Proto of preference value. 137message PreferenceValueProto { 138 oneof value { 139 bool boolean_value = 1; 140 int32 int_value = 2; 141 float float_value = 3; 142 } 143} 144 145// Proto of preference value descriptor. 146message PreferenceValueDescriptorProto { 147 oneof type { 148 bool boolean_type = 1; 149 RangeValueProto range_value = 2; 150 bool float_type = 3; 151 } 152} 153 154// Proto of preference value that is between a range. 155message RangeValueProto { 156 // The lower bound (inclusive) of the range. 157 optional int32 min = 1; 158 // The upper bound (inclusive) of the range. 159 optional int32 max = 2; 160 // The increment step within the range. 0 means unset, which implies step size is 1. 161 optional int32 step = 3; 162} 163 164// Proto of android.content.Intent 165message IntentProto { 166 // The action of the Intent. 167 optional string action = 1; 168 169 // The data attribute of the Intent, expressed as a URI. 170 optional string data = 2; 171 172 // The package attribute of the Intent, which may be set to force the 173 // detection of a particular application package that can handle the event. 174 optional string pkg = 3; 175 176 // The component attribute of the Intent, which may be set to force the 177 // detection of a particular component (app). If present, this must be a 178 // package name followed by a '/' and then followed by the class name. 179 optional string component = 4; 180 181 // Flags controlling how intent is handled. The value must be bitwise OR of 182 // intent flag constants defined by Android. 183 // http://developer.android.com/reference/android/content/Intent.html#setFlags(int) 184 optional int32 flags = 5; 185 186 // Extended data from the intent. 187 optional BundleProto extras = 6; 188 189 // The MIME type of the Intent (e.g. "text/plain"). 190 // 191 // For more information, see 192 // https://developer.android.com/reference/android/content/Intent#setType(java.lang.String). 193 optional string mime_type = 7; 194} 195 196// Proto of android.os.Bundle 197message BundleProto { 198 // Bundle data. 199 map<string, BundleValue> values = 1; 200 201 message BundleValue { 202 // Bundle data value for the associated key name. 203 // Can be extended to support other types of bundled data. 204 oneof value { 205 string string_value = 1; 206 bytes bytes_value = 2; 207 int32 int_value = 3; 208 int64 long_value = 4; 209 bool boolean_value = 5; 210 double double_value = 6; 211 BundleProto bundle_value = 7; 212 } 213 } 214} 215