Loading packages/SettingsLib/Graph/graph.proto +2 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ message PreferenceProto { optional PermissionsProto read_permissions = 17; // The required permissions to write preference value. optional PermissionsProto write_permissions = 18; // Tag constants associated with the preference. repeated string tags = 19; // Target of an Intent message ActionTarget { Loading packages/SettingsLib/Graph/src/com/android/settingslib/graph/PreferenceGraphBuilder.kt +1 −0 Original line number Diff line number Diff line Loading @@ -412,6 +412,7 @@ fun PreferenceMetadata.toProto( } metadata.intent(context)?.let { actionTarget = it.toActionTarget(context) } screenMetadata.getLaunchIntent(context, metadata)?.let { launchIntent = it.toProto() } for (tag in metadata.tags(context)) addTags(tag) } persistent = metadata.isPersistent(context) if (persistent) { Loading packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt +15 −1 Original line number Diff line number Diff line Loading @@ -89,10 +89,24 @@ interface PreferenceMetadata { /** * Return the extras Bundle object associated with this preference. * * It is used to provide more information for metadata. * It is used to provide more *internal* information for metadata. External app is not expected * to use this information as it could be changed in future. Consider [tags] for external usage. */ fun extras(context: Context): Bundle? = null /** * Returns the tags associated with this preference. * * Unlike [extras], tags are exposed for external usage. The returned tag list must be constants * and **append only**. Do not edit/delete existing tag strings as it can cause backward * compatibility issue. * * Use cases: * - identify a specific preference * - identify a group of preferences related to network settings */ fun tags(context: Context): Array<String> = arrayOf() /** * Returns if preference is indexable, default value is `true`. * Loading Loading
packages/SettingsLib/Graph/graph.proto +2 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ message PreferenceProto { optional PermissionsProto read_permissions = 17; // The required permissions to write preference value. optional PermissionsProto write_permissions = 18; // Tag constants associated with the preference. repeated string tags = 19; // Target of an Intent message ActionTarget { Loading
packages/SettingsLib/Graph/src/com/android/settingslib/graph/PreferenceGraphBuilder.kt +1 −0 Original line number Diff line number Diff line Loading @@ -412,6 +412,7 @@ fun PreferenceMetadata.toProto( } metadata.intent(context)?.let { actionTarget = it.toActionTarget(context) } screenMetadata.getLaunchIntent(context, metadata)?.let { launchIntent = it.toProto() } for (tag in metadata.tags(context)) addTags(tag) } persistent = metadata.isPersistent(context) if (persistent) { Loading
packages/SettingsLib/Metadata/src/com/android/settingslib/metadata/PreferenceMetadata.kt +15 −1 Original line number Diff line number Diff line Loading @@ -89,10 +89,24 @@ interface PreferenceMetadata { /** * Return the extras Bundle object associated with this preference. * * It is used to provide more information for metadata. * It is used to provide more *internal* information for metadata. External app is not expected * to use this information as it could be changed in future. Consider [tags] for external usage. */ fun extras(context: Context): Bundle? = null /** * Returns the tags associated with this preference. * * Unlike [extras], tags are exposed for external usage. The returned tag list must be constants * and **append only**. Do not edit/delete existing tag strings as it can cause backward * compatibility issue. * * Use cases: * - identify a specific preference * - identify a group of preferences related to network settings */ fun tags(context: Context): Array<String> = arrayOf() /** * Returns if preference is indexable, default value is `true`. * Loading