Jacky Wang | 659b696 | 2024-09-13 16:40:04 +0800 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | package com.android.settingslib.graph; |
| 4 | |
| 5 | option java_package = "com.android.settingslib.graph.proto"; |
| 6 | option java_multiple_files = true; |
| 7 | |
| 8 | // Proto represents preference graph. |
| 9 | message 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. |
| 22 | message 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. |
| 32 | message 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. |
| 40 | message 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. |
| 50 | message 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; |
Jacky Wang | d2fa673 | 2024-10-30 17:12:28 +0800 | [diff] [blame] | 77 | // Intent to show and locate the preference (might have highlight animation on |
| 78 | // the preference). |
| 79 | optional IntentProto launch_intent = 14; |
Jacky Wang | 659b696 | 2024-09-13 16:40:04 +0800 | [diff] [blame] | 80 | |
| 81 | // Target of an Intent |
| 82 | message ActionTarget { |
| 83 | oneof kind { |
| 84 | // Resolved key of the preference screen located in current app. |
| 85 | // This is resolved from android:fragment or activity of current app. |
| 86 | string key = 1; |
| 87 | // Unresolvable Intent that is either an unrecognized activity of current |
| 88 | // app or activity belongs to other app. |
| 89 | IntentProto intent = 2; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // Proto of string or string resource id. |
| 95 | message TextProto { |
| 96 | oneof text { |
| 97 | int32 resource_id = 1; |
| 98 | string string = 2; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Proto of preference value. |
| 103 | message PreferenceValueProto { |
| 104 | oneof value { |
| 105 | bool boolean_value = 1; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // Proto of android.content.Intent |
| 110 | message IntentProto { |
| 111 | // The action of the Intent. |
| 112 | optional string action = 1; |
| 113 | |
| 114 | // The data attribute of the Intent, expressed as a URI. |
| 115 | optional string data = 2; |
| 116 | |
| 117 | // The package attribute of the Intent, which may be set to force the |
| 118 | // detection of a particular application package that can handle the event. |
| 119 | optional string pkg = 3; |
| 120 | |
| 121 | // The component attribute of the Intent, which may be set to force the |
| 122 | // detection of a particular component (app). If present, this must be a |
| 123 | // package name followed by a '/' and then followed by the class name. |
| 124 | optional string component = 4; |
| 125 | |
| 126 | // Flags controlling how intent is handled. The value must be bitwise OR of |
| 127 | // intent flag constants defined by Android. |
| 128 | // http://developer.android.com/reference/android/content/Intent.html#setFlags(int) |
| 129 | optional int32 flags = 5; |
| 130 | |
| 131 | // Extended data from the intent. |
| 132 | optional BundleProto extras = 6; |
| 133 | |
| 134 | // The MIME type of the Intent (e.g. "text/plain"). |
| 135 | // |
| 136 | // For more information, see |
| 137 | // https://developer.android.com/reference/android/content/Intent#setType(java.lang.String). |
| 138 | optional string mime_type = 7; |
| 139 | } |
| 140 | |
| 141 | // Proto of android.os.Bundle |
| 142 | message BundleProto { |
| 143 | // Bundle data. |
| 144 | map<string, BundleValue> values = 1; |
| 145 | |
| 146 | message BundleValue { |
| 147 | // Bundle data value for the associated key name. |
| 148 | // Can be extended to support other types of bundled data. |
| 149 | oneof value { |
| 150 | string string_value = 1; |
| 151 | bytes bytes_value = 2; |
| 152 | int32 int_value = 3; |
| 153 | int64 long_value = 4; |
| 154 | bool boolean_value = 5; |
| 155 | double double_value = 6; |
| 156 | BundleProto bundle_value = 7; |
| 157 | } |
| 158 | } |
| 159 | } |