use crate::{
self as resand,
defs::ResTableRef,
impl_enum,
traits::{FromResValue, FromResValueError, IntoResValue, Mergeable, Referenced},
};
use resand_derive::{FromNode, IntoNode};
macro_rules! push_name {
($field:ident, $other:ident, $self:ident) => {
for _other_val in $other.$field {
if $self
.$field
.iter()
.find(|p| p.name == _other_val.name)
.is_none()
{
$self.$field.push(_other_val);
}
}
};
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ColorMode(u32);
impl_enum! {ColorMode, default => 0, wide_color_gamut => 1, hdr => 2}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ConfigChanges(u32);
impl_enum! {ConfigChanges,
mcc => 0x0001,
mnc => 0x0002,
locale => 0x0004,
touchscreen => 0x0008,
keyboard => 0x0010,
keyboard_hidden => 0x0020,
navigation => 0x0040,
orientation => 0x0080,
screen_layout => 0x100,
ui_mode => 0x0200,
screen_size => 0x0400,
smallest_screen_size => 0x0800,
density => 0x1000,
layout_direction => 0x2000,
color_mode => 0x4000,
grammatical_gender => 0x8000,
font_scale => 0x40000000,
font_weight_adjustment => 0x10000000,
assets_path => 0x80000000,
resources_unused => 0x8000000
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct DocumentLaunchMode(u32);
impl_enum! {DocumentLaunchMode, none => 0, into_existing => 1, always => 2, never => 3}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct LaunchMode(u32);
impl_enum! {LaunchMode,
standard => 0,
single_top => 1,
single_task => 2,
single_instance => 3,
single_instance_per_task => 4
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct LockTaskMode(u32);
impl_enum! {LockTaskMode, normal => 0, never => 1, always => 2, if_whitelisted => 3}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct PersistableMode(u32);
impl_enum! {PersistableMode, persist_root_only => 0, persist_never => 1, persist_across_reboots => 2}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct RequireContentUriPermissionFromCaller(u32);
impl_enum! {RequireContentUriPermissionFromCaller, none => 0, read => 1, write => 2, read_or_write => 3, read_and_write => 4}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ScreenOrientation(i32);
impl_enum! {ScreenOrientation,
unspecified => -1,
landscape => 0,
portrait => 1,
user => 2,
behind => 3,
sensor => 4,
nosensor => 5,
sensor_landscape => 6,
sensor_portrait => 7,
reverse_landscape => 8,
reverse_portrait => 9,
full_sensor => 10,
user_landscape => 11,
user_portrait => 12,
full_user => 13,
locked => 14
}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct WindowSoftInputMode(u32);
impl_enum! {WindowSoftInputMode,
state_unspecified => 0,
state_unchanged => 1,
state_hidden => 2,
state_always_hidden => 3,
state_visible => 4,
state_always_visible => 5,
adjust_unspecified => 0x00,
adjust_resize => 0x10,
adjust_pan => 0x20,
adjust_nothing => 0x30
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct Gravity(u32);
impl_enum! {Gravity,
top => 0x30,
bottom => 0x50,
left => 0x03,
right => 0x05,
center_vertical => 0x10,
fill_vertical => 0x70,
center_horizontal => 0x01,
fill_horizontal => 0x07,
center => 0x11,
fill => 0x77,
clip_vertical => 0x80,
clip_horizontal => 0x08,
start => 0x00800003,
end => 0x00800005
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 1, android)]
pub struct Layout {
#[resand(attr, android, table_ref = 0x010104f4)]
pub default_width: u32, #[resand(attr, android, table_ref = 0x010104f5)]
pub default_height: u32, #[resand(attr, android, table_ref = 0x010100af)]
pub gravity: Gravity,
#[resand(attr, android, table_ref = 0x0101013f)]
pub min_width: u32,
#[resand(attr, android, table_ref = 0x01010140)]
pub min_height: u32,
#[resand(attr, android, table_ref = 0x01010619)]
pub window_layout_affinity: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 2, android)]
pub struct Activity {
#[resand(attr, android, table_ref = 0x01010000, optional)]
pub theme: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010020, optional)]
pub description: Option<String>,
#[resand(attr, android, table_ref = 0x01020006, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101052c, optional)]
pub round_icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x010103f2, optional)]
pub banner: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x010102be, optional)]
pub logo: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub enabled: Option<bool>,
#[resand(attr, android, table_ref = 0x01010010, optional)]
pub exported: Option<bool>,
#[resand(attr, android, table_ref = 0x01010012, optional)]
pub task_affinity: Option<String>,
#[resand(attr, android, table_ref = 0x01010017, optional)]
pub exclude_from_recents: Option<bool>,
#[resand(attr, android, table_ref = 0x0101001d, optional)]
pub launch_mode: Option<LaunchMode>,
#[resand(attr, android, table_ref = 0x0101001e, optional)]
pub screen_orientation: Option<ScreenOrientation>,
#[resand(attr, android, table_ref = 0x0101001f, optional)]
pub config_changes: Option<ConfigChanges>,
#[resand(child, android, many)]
pub intent_filter: Vec<IntentFilter>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(child, android, many)]
pub layout: Vec<Layout>,
#[resand(attr, android, table_ref = 0x10103f5, optional)]
pub allow_embedded: Option<bool>,
#[resand(attr, android, table_ref = 0x010204, optional)]
pub allow_task_reparenting: Option<bool>,
#[resand(attr, android, table_ref = 0x01010203, optional)]
pub always_retain_task_state: Option<bool>,
#[resand(attr, android, table_ref = 0x01010447, optional)]
pub auto_remove_from_recents: Option<bool>,
#[resand(attr, android, table_ref = 0x01010650, optional)]
pub can_display_on_remote_devices: Option<bool>,
#[resand(attr, android, table_ref = 0x01010015, optional)]
pub clear_task_on_launch: Option<bool>,
#[resand(attr, android, table_ref = 0x0101054a, optional)]
pub color_mode: Option<ColorMode>,
#[resand(attr, android, table_ref = 0x01010505, optional)]
pub direct_boot_aware: Option<bool>,
#[resand(attr, android, table_ref = 0x01010445, optional)]
pub document_launch_mode: Option<DocumentLaunchMode>,
#[resand(attr, android, table_ref = 0x0101066c, optional)]
pub enable_on_back_invoked_callback: Option<bool>,
#[resand(attr, android, table_ref = 0x010100dd, optional)]
pub fits_system_windows: Option<bool>,
#[resand(attr, android, table_ref = 0x01010014, optional)]
pub finish_on_task_launch: Option<bool>,
#[resand(attr, android, table_ref = 0x010102d3, optional)]
pub hardware_accelerated: Option<bool>,
#[resand(attr, android, table_ref = 0x010102c0, optional)]
pub immersive: Option<bool>,
#[resand(attr, android, table_ref = 0x010104ed, optional)]
pub lock_task_mode: Option<LockTaskMode>,
#[resand(attr, android, table_ref = 0x01010446, optional)]
pub max_recents: Option<u32>,
#[resand(attr, android, table_ref = 0x01010560, optional)]
pub max_aspect_ratio: Option<f32>,
#[resand(attr, android, table_ref = 0x0101059b, optional)]
pub min_aspect_ratio: Option<f32>,
#[resand(attr, android, table_ref = 0x01010013, optional)]
pub multiprocess: Option<bool>,
#[resand(attr, android, table_ref = 0x0101022d, optional)]
pub no_history: Option<bool>,
#[resand(attr, android, table_ref = 0x010103a7, optional)]
pub parent_activity_name: Option<String>,
#[resand(attr, android, table_ref = 0x0101042d, optional)]
pub persistable_mode: Option<PersistableMode>,
#[resand(attr, android, table_ref = 0x01010006, optional)]
pub permission: Option<String>,
#[resand(attr, android, table_ref = 0x01010011, optional)]
pub process: Option<String>,
#[resand(attr, android, table_ref = 0x01010476, optional)]
pub relinquish_task_identity: Option<bool>,
#[resand(attr, android, table_ref = 0x0101069b, optional)]
pub require_content_uri_permission_from_caller: Option<RequireContentUriPermissionFromCaller>,
#[resand(attr, android, table_ref = 0x010104f6, optional)]
pub resizeable_activity: Option<bool>,
#[resand(attr, android, table_ref = 0x010104ef, optional)]
pub show_for_all_users: Option<bool>,
#[resand(attr, android, table_ref = 0x01010016, optional)]
pub state_not_needed: Option<bool>,
#[resand(attr, android, table_ref = 0x010104f7, optional)]
pub supports_picture_in_picture: Option<bool>,
#[resand(attr, android, table_ref = 0x01010398, optional)]
pub ui_options: Option<UiOptions>,
#[resand(attr, android, table_ref = 0x0101022b, optional)]
pub window_soft_input_mode: Option<WindowSoftInputMode>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 3, android)]
pub struct ActivityAlias {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(child, android, many)]
pub intent_filter: Vec<IntentFilter>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(attr, android, table_ref = 0x0101000e)]
pub enabled: bool,
#[resand(attr, android, table_ref = 0x01010010)]
pub exported: bool,
#[resand(attr, android, table_ref = 0x01010002)]
pub icon: ResTableRef,
#[resand(attr, android, table_ref = 0x01010001)]
pub label: ResTableRef,
#[resand(attr, android, table_ref = 0x01010006)]
pub permission: String,
#[resand(attr, android, table_ref = 0x01010202)]
pub target_activity: String,
}
#[derive(Debug, PartialEq, Clone)]
pub enum MetaDataValue {
Float(f32),
String(String),
TableRef(ResTableRef),
Bool(bool),
Int(u32),
}
impl Default for MetaDataValue {
fn default() -> Self {
Self::String(String::default())
}
}
impl IntoResValue for MetaDataValue {
fn into_res_value(
self,
string_pool: &mut crate::string_pool::StringPoolHandler,
) -> crate::res_value::ResValue {
match self {
MetaDataValue::Float(f) => f.into_res_value(string_pool),
MetaDataValue::String(s) => s.into_res_value(string_pool),
MetaDataValue::TableRef(res_table_ref) => res_table_ref.into_res_value(string_pool),
MetaDataValue::Bool(b) => b.into_res_value(string_pool),
MetaDataValue::Int(i) => i.into_res_value(string_pool),
}
}
}
impl FromResValue for MetaDataValue {
type Error = FromResValueError;
fn from_res_value(
value: crate::res_value::ResValue,
string_pool: &crate::string_pool::StringPoolHandler,
) -> Result<Self, Self::Error> {
match value.data {
crate::res_value::ResValueType::String(_) => {
Ok(Self::String(String::from_res_value(value, string_pool)?))
}
crate::res_value::ResValueType::Float(f) => Ok(Self::Float(f)),
crate::res_value::ResValueType::Reference(f) => Ok(Self::TableRef(f)),
crate::res_value::ResValueType::IntBoolean(b) => Ok(Self::Bool(b.into())),
crate::res_value::ResValueType::IntDec(i) => Ok(Self::Int(i.into())),
crate::res_value::ResValueType::IntHex(h) => Ok(Self::Int(h.into())),
_ => {
return Err(FromResValueError::InvalidType(
"Float or String or Reference or IntBoolean or IntDec or IntHex",
value.data,
));
}
}
}
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 4, android)]
pub struct MetaData {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010025, optional)]
pub resource: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010024, optional)]
pub value: Option<MetaDataValue>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 5, android)]
pub struct Profileable {
#[resand(attr, android, table_ref = 0x01010594)]
pub shell: bool,
#[resand(attr, android, table_ref = 0x0101000e)]
pub enabled: bool,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 6, android)]
pub struct UsesLibrary {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x0101028e)]
pub required: bool,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 7, android)]
pub struct UsesNativeLibrary {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x0101028e)]
pub required: bool,
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ForegroundServiceType(u32);
impl_enum! {ForegroundServiceType,
data_sync => 0x01,
media_playback => 0x02,
phone_call => 0x04,
location => 0x08,
connected_device => 0x10,
media_projection => 0x20,
camera => 0x40,
microphone => 0x80,
health => 0x100,
remote_messaging => 0x200,
system_exempted => 0x400,
short_service => 0x800,
media_processing => 0x2000,
special_use => 0x40000000
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 8, android)]
pub struct Service {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(child, android, many)]
pub intent_filter: Vec<IntentFilter>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(attr, android, table_ref = 0x01010020, optional)]
pub description: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010006, optional)]
pub permission: Option<String>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub enabled: Option<Referenced<bool>>,
#[resand(attr, android, table_ref = 0x01010010, optional)]
pub exported: Option<bool>,
#[resand(attr, android, table_ref = 0x01010505, optional)]
pub direct_boot_aware: Option<bool>,
#[resand(attr, android, table_ref = 0x01010599, optional)]
pub foreground_service_type: Option<ForegroundServiceType>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x010103a9, optional)]
pub isolated_process: Option<bool>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010011, optional)]
pub process: Option<String>,
#[resand(attr, android, table_ref = 0x0101036a, optional)]
pub stop_with_task: Option<bool>,
#[resand(attr, android, table_ref = 0x01010531, optional)]
pub visible_to_instant_apps: Option<bool>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 9, android)]
pub struct BroadcastReceiver {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(child, android, many)]
pub intent_filter: Vec<IntentFilter>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(attr, android, table_ref = 0x01010006, optional)]
pub permission: Option<String>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub enabled: Option<Referenced<bool>>,
#[resand(attr, android, table_ref = 0x01010010, optional)]
pub exported: Option<bool>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010011, optional)]
pub process: Option<String>,
#[resand(attr, android, table_ref = 0x01010505, optional)]
pub direct_boot_aware: Option<bool>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 10, android)]
pub struct GrantUriPermission {
#[resand(attr, android, table_ref = 0x0101002a)]
pub path: String,
#[resand(attr, android, table_ref = 0x0101002d)]
pub path_pattern: String,
#[resand(attr, android, table_ref = 0x0101002b)]
pub path_prefix: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 11, android)]
pub struct PathPermission {
#[resand(attr, android, table_ref = 0x0101002a)]
pub path: String,
#[resand(attr, android, table_ref = 0x0101002d)]
pub path_pattern: String,
#[resand(attr, android, table_ref = 0x0101002b)]
pub path_prefix: String,
#[resand(attr, android, table_ref = 0x01010006)]
pub permission: String,
#[resand(attr, android, table_ref = 0x01010007)]
pub read_permission: String,
#[resand(attr, android, table_ref = 0x01010008)]
pub write_permission: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 12, android)]
pub struct ContentProvider {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010011, optional)]
pub process: Option<String>,
#[resand(attr, android, table_ref = 0x01010010)]
pub exported: bool,
#[resand(attr, android, table_ref = 0x01010018)]
pub authorities: Referenced<String>,
#[resand(attr, android, table_ref = 0x01010019, optional)]
pub syncable: Option<bool>,
#[resand(attr, android, table_ref = 0x01010007, optional)]
pub read_permission: Option<String>,
#[resand(attr, android, table_ref = 0x01010008, optional)]
pub write_permission: Option<String>,
#[resand(child, android, many)]
pub grant_uri_permission: Vec<GrantUriPermission>,
#[resand(attr, android, table_ref = 0x0101001b, optional)]
pub grant_uri_permissions: Option<bool>,
#[resand(attr, android, table_ref = 0x01010006, optional)]
pub permission: Option<String>,
#[resand(attr, android, table_ref = 0x01010013, optional)]
pub multiprocess: Option<bool>,
#[resand(attr, android, table_ref = 0x0101001a, optional)]
pub init_order: Option<u32>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub enabled: Option<bool>,
#[resand(child, android, many)]
pub intent_filter: Vec<IntentFilter>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(child, android, many)]
pub path_permission: Vec<PathPermission>,
#[resand(attr, android, table_ref = 0x01010505, optional)]
pub direct_boot_aware: Option<bool>,
}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct AppCategory(u32);
impl_enum! {AppCategory,
game => 0,
audio => 1,
video => 2,
image => 3,
social => 4,
news => 5,
maps => 6,
productivity => 7,
accessibility => 8
}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct GwpAsanMode(i32);
impl_enum! {GwpAsanMode, default => -1, never => 0, always => 1}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct IsMonitoringTool(u32);
impl_enum! {IsMonitoringTool, parental_control => 0, enterprise_management => 1, other => 2}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct UiOptions(u32);
impl_enum! {UiOptions, none => 0, split_action_bar_when_narrow => 1}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 13, android)]
pub struct Property {
#[resand(attr, android, table_ref = 0x010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010025)]
pub resource: ResTableRef,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 14, android)]
pub struct Application {
#[resand(attr, android, table_ref = 0x010003, optional)]
pub name: Option<String>,
#[resand(child, android, many)]
pub activity: Vec<Activity>,
#[resand(child, android, many)]
pub activity_alias: Vec<ActivityAlias>,
#[resand(child, android, many)]
pub meta_data: Vec<MetaData>,
#[resand(child, android, many)]
pub service: Vec<Service>,
#[resand(child, android, many)]
pub receiver: Vec<BroadcastReceiver>,
#[resand(child, android, many)]
pub profileable: Vec<Profileable>,
#[resand(child, android, many)]
pub provider: Vec<ContentProvider>,
#[resand(child, android, many)]
pub property: Vec<Property>,
#[resand(child, android, many)]
pub uses_library: Vec<UsesLibrary>,
#[resand(child, android, many)]
pub uses_native_library: Vec<UsesNativeLibrary>,
#[resand(attr, android, table_ref = 0x01010204, optional)]
pub allow_task_reparenting: Option<bool>,
#[resand(attr, android, table_ref = 0x01010000, optional)]
pub theme: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010280, optional)]
pub allow_backup: Option<bool>,
#[resand(attr, android, table_ref = 0x01010005, optional)]
pub allow_clear_user_data: Option<bool>,
#[resand(attr, android, table_ref = 0x010102d3, optional)]
pub hardware_accelerated: Option<bool>,
#[resand(attr, android, table_ref = 0x010103af, optional)]
pub supports_rtl: Option<bool>,
#[resand(attr, android, table_ref = 0x010104ea, optional)]
pub extract_native_libs: Option<bool>,
#[resand(attr, android, table_ref = 0x010104eb, optional)]
pub full_backup_content: Option<bool>,
#[resand(attr, android, table_ref = 0x010104f6, optional)]
pub resizeable_activity: Option<bool>,
#[resand(attr, android, table_ref = 0x01010527, optional)]
pub network_security_config: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010545, optional)]
pub app_category: Option<AppCategory>,
#[resand(attr, android, table_ref = 0x0101057a, optional)]
pub app_component_factory: Option<String>,
#[resand(attr, android, table_ref = 0x0101027f, optional)]
pub backup_agent: Option<String>,
#[resand(attr, android, table_ref = 0x0101051a, optional)]
pub backup_in_foreground: Option<bool>,
#[resand(attr, android, table_ref = 0x010103f2, optional)]
pub banner: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010612, optional)]
pub allow_native_heap_pointer_tagging: Option<bool>,
#[resand(attr, android, table_ref = 0x01010616, optional)]
pub gwp_asan_mode: Option<GwpAsanMode>,
#[resand(attr, android, table_ref = 0x0101063e, optional)]
pub data_extraction_rules: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101000f, optional)]
pub debuggable: Option<bool>,
#[resand(attr, android, table_ref = 0x01010020, optional)]
pub description: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub enabled: Option<bool>,
#[resand(attr, android, table_ref = 0x0101066c, optional)]
pub enable_on_back_invoked_callback: Option<bool>,
#[resand(attr, android, table_ref = 0x01010473, optional)]
pub full_backup_only: Option<bool>,
#[resand(attr, android, table_ref = 0x0101000c, optional)]
pub has_code: Option<bool>,
#[resand(attr, android, table_ref = 0x0101059a, optional)]
pub has_fragile_user_data: Option<bool>,
#[resand(attr, android, table_ref = 0x10103f4, optional)]
pub is_game: Option<bool>,
#[resand(attr, android, optional)]
pub is_monitoring_tool: Option<IsMonitoringTool>,
#[resand(attr, android, table_ref = 0x0101029c, optional)]
pub kill_after_restore: Option<bool>,
#[resand(attr, android, table_ref = 0x0101035a, optional)]
pub large_heap: Option<bool>,
#[resand(attr, android, table_ref = 0x010102be, optional)]
pub logo: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010004, optional)]
pub manage_space_activity: Option<String>,
#[resand(attr, android, table_ref = 0x01010006, optional)]
pub permission: Option<String>,
#[resand(attr, android, table_ref = 0x0101000e, optional)]
pub persistent: Option<bool>,
#[resand(attr, android, table_ref = 0x01010011, optional)]
pub process: Option<String>,
#[resand(attr, android, table_ref = 0x010102ba, optional)]
pub restore_any_version: Option<bool>,
#[resand(attr, android, table_ref = 0x01010603, optional)]
pub request_legacy_external_storage: Option<bool>,
#[resand(attr, android, table_ref = 0x010103d6, optional)]
pub required_account_type: Option<String>,
#[resand(attr, android, table_ref = 0x010103d5, optional)]
pub restricted_account_type: Option<String>,
#[resand(attr, android, table_ref = 0x01010012, optional)]
pub task_affinity: Option<String>,
#[resand(attr, android, table_ref = 0x01010272, optional)]
pub test_only: Option<bool>,
#[resand(attr, android, table_ref = 0x01010398, optional)]
pub ui_options: Option<UiOptions>,
#[resand(attr, android, table_ref = 0x010104ec, optional)]
pub uses_cleartext_traffic: Option<bool>,
#[resand(attr, android, table_ref = 0x010102b8, optional)]
pub vm_safe_mode: Option<bool>,
}
impl Mergeable for Application {
type Returns = ();
fn merge(&mut self, other: Self) {
push_name!(activity, other, self);
push_name!(activity_alias, other, self);
push_name!(meta_data, other, self);
push_name!(service, other, self);
push_name!(receiver, other, self);
push_name!(provider, other, self);
push_name!(property, other, self);
push_name!(uses_library, other, self);
push_name!(uses_native_library, other, self);
}
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 15, android)]
pub struct Attribution {
#[resand(attr, android, table_ref = 0x010100d1)]
pub tag: String,
#[resand(attr, android, table_ref = 0x01010001)]
pub label: String,
}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct ScreenSize(u32);
impl_enum! {ScreenSize, small => 200, normal => 300, large => 400, xlarge => 500}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct ScreenDensity(u32);
impl_enum! {ScreenDensity, ldpi => 120, mdpi => 160, hdpi => 240, xhdpi => 320, xxhdpi => 480, xxxhpi => 640}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 16, android)]
pub struct Screen {
#[resand(attr, android, table_ref = 0x010102ca)]
pub screen_size: ScreenSize,
#[resand(attr, android, table_ref = 0x010102cb)]
pub screen_density: ScreenDensity,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 17, android)]
pub struct CompatibleScreens {
#[resand(child, android, many)]
pub screens: Vec<Screen>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 18, android)]
pub struct Instrumentation {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010023)]
pub functional_test: bool,
#[resand(attr, android, table_ref = 0x01010022)]
pub handle_profiling: bool,
#[resand(attr, android, table_ref = 0x01010002)]
pub icon: ResTableRef,
#[resand(attr, android, table_ref = 0x01010001)]
pub label: ResTableRef,
#[resand(attr, android, table_ref = 0x01010021)]
pub target_package: String,
#[resand(attr, android, table_ref = 0x01010541)]
pub target_processes: String,
}
#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct ProtectionLevel(u32);
impl_enum! {ProtectionLevel,
normal => 0,
dangerous => 1,
signature => 2,
signature_or_system => 3,
internal => 4,
privileged => 0x10,
system => 0x10,
development => 0x20,
appop => 0x40,
pre23 => 0x80,
installer => 0x100,
verifier => 0x200,
pre_installed => 0x400,
setup => 0x800,
instant => 0x1000,
runtime => 0x2000,
oem => 0x4000,
vendor_privileged => 0x8000,
text_classifier => 0x10000,
configurator => 0x80000,
incident_report_approver => 0x100000,
app_predictor => 0x200000,
module => 0x400000,
companion => 0x800000,
retail_demo => 0x1000000,
recents => 0x2000000,
role => 0x4000000,
known_signer => 0x8000000
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 18, android)]
pub struct Permission {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: Referenced<String>,
#[resand(attr, android, table_ref = 0x01010020, optional)]
pub description: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101000a, optional)]
pub permission_group: Option<String>,
#[resand(attr, android, table_ref = 0x01010009)]
pub protection_level: ProtectionLevel,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 19, android)]
pub struct PermissionGroup {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010020)]
pub description: ResTableRef,
#[resand(attr, android, table_ref = 0x01010002)]
pub icon: ResTableRef,
#[resand(attr, android, table_ref = 0x01010001)]
pub label: ResTableRef,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 20, android)]
pub struct PermissionTree {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010002)]
pub icon: ResTableRef,
#[resand(attr, android, table_ref = 0x01010001)]
pub label: ResTableRef,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 21, android)]
pub struct Package {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 22, android)]
pub struct Category {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 23, android)]
pub struct DataIntent {
#[resand(attr, android, table_ref = 0x01010027, optional)]
pub scheme: Option<String>,
#[resand(attr, android, table_ref = 0x01010028, optional)]
pub host: Option<String>,
#[resand(attr, android, table_ref = 0x0101061e, optional)]
pub path_suffix: Option<String>,
#[resand(attr, android, table_ref = 0x01010620, optional)]
pub path_advanced_pattern: Option<String>,
#[resand(attr, android, table_ref = 0x01010026, optional)]
pub mime_type: Option<String>,
#[resand(attr, android, table_ref = 0x0101002a, optional)]
pub path: Option<String>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 24, android)]
pub struct Data {
#[resand(attr, android, table_ref = 0x01010027)]
pub scheme: String,
#[resand(attr, android, table_ref = 0x01010028, optional)]
pub host: Option<String>,
#[resand(attr, android, table_ref = 0x01010029, optional)]
pub port: Option<String>,
#[resand(attr, android, table_ref = 0x0101002a, optional)]
pub path: Option<String>,
#[resand(attr, android, table_ref = 0x0101002c, optional)]
pub path_pattern: Option<String>,
#[resand(attr, android, table_ref = 0x0101002b, optional)]
pub path_prefix: Option<String>,
#[resand(attr, android, table_ref = 0x0101061e, optional)]
pub path_suffix: Option<String>,
#[resand(attr, android, table_ref = 0x01010620, optional)]
pub path_advanced_pattern: Option<String>,
#[resand(attr, android, table_ref = 0x01010026, optional)]
pub mime_type: Option<String>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 25, android)]
pub struct DataUriRelativeFilterGroup {
#[resand(attr, android, table_ref = 0x0101002a)]
pub path: String,
#[resand(attr, android, table_ref = 0x0101002c)]
pub path_pattern: String,
#[resand(attr, android, table_ref = 0x0101002b)]
pub path_prefix: String,
#[resand(attr, android, table_ref = 0x0101061e)]
pub path_suffix: String,
#[resand(attr, android, table_ref = 0x01010620)]
pub path_advanced_pattern: String,
#[resand(attr, android, table_ref = 0x010102e3)]
pub fragment: String,
#[resand(attr, android, table_ref = 0x01010695)]
pub fragment_pattern: String,
#[resand(attr, android, table_ref = 0x01010694)]
pub fragment_prefix: String,
#[resand(attr, android, table_ref = 0x01010697)]
pub fragment_suffix: String,
#[resand(attr, android, table_ref = 0x01010696)]
pub fragment_advanced_pattern: String,
#[resand(attr, android, table_ref = 0x0101068f)]
pub query: String,
#[resand(attr, android, table_ref = 0x01010691)]
pub query_pattern: String,
#[resand(attr, android, table_ref = 0x01010690)]
pub query_prefix: String,
#[resand(attr, android, table_ref = 0x01010693)]
pub query_suffix: String,
#[resand(attr, android, table_ref = 0x01010692)]
pub query_advanced_pattern: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 26, android)]
pub struct UriRelativeFilterGroup {
#[resand(attr, android, table_ref = 0x0101068e)]
pub allow: bool,
#[resand(child, android, many)]
pub data: Vec<DataUriRelativeFilterGroup>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 27, android)]
pub struct IntentFilter {
#[resand(child, android, many)]
pub action: Vec<Action>,
#[resand(child, android, many)]
pub category: Vec<Category>,
#[resand(child, android, many)]
pub data: Vec<Data>,
#[resand(child, android, optional)]
pub uri_relative_filter_group: Option<UriRelativeFilterGroup>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101001c, optional)]
pub priority: Option<u32>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 28, android)]
pub struct Action {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 29, android)]
pub struct Intent {
#[resand(child, android)]
pub action: Action,
#[resand(child, android, many)]
pub category: Vec<Category>,
#[resand(child, android, many)]
pub data: Vec<DataIntent>,
#[resand(child, android, optional)]
pub uri_relative_filter_group: Option<UriRelativeFilterGroup>,
#[resand(attr, android, table_ref = 0x01010002, optional)]
pub icon: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x01010001, optional)]
pub label: Option<ResTableRef>,
#[resand(attr, android, table_ref = 0x0101001c, optional)]
pub priority: Option<u32>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 30, android)]
pub struct Queries {
#[resand(child, android, many)]
pub package: Vec<Package>,
#[resand(child, android, many)]
pub intent: Vec<Intent>,
}
impl Mergeable for Queries {
type Returns = ();
fn merge(&mut self, other: Self) {
push_name!(package, other, self);
}
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 31, android)]
pub struct SupportsGlTexture {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 32, android)]
pub struct SupportsScreens {
#[resand(attr, android, table_ref = 0x0101028d)]
pub resizeable: bool,
#[resand(attr, android, table_ref = 0x01010284)]
pub small_screens: bool,
#[resand(attr, android, table_ref = 0x0101028d)]
pub normal_screens: bool,
#[resand(attr, android, table_ref = 0x01010285)]
pub large_screens: bool,
#[resand(attr, android, table_ref = 0x010102bf)]
pub xlarge_screens: bool,
#[resand(attr, android, table_ref = 0x0101026c)]
pub any_density: bool,
#[resand(attr, android, table_ref = 0x01010364)]
pub requires_smallest_width_dp: u32,
#[resand(attr, android, table_ref = 0x01010365)]
pub compatible_width_limit_dp: u32,
#[resand(attr, android, table_ref = 0x010366)]
pub largest_width_limit_dp: u32,
}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ReqNavigation(u32);
impl_enum! {ReqNavigation, undefined => 0, nonav => 1, dpad => 2, trackball => 3, wheel => 4}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ReqTouchScreen(u32);
impl_enum! {ReqTouchScreen, undefined => 0, notouch => 1, stylus => 2, finger => 3}
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct ReqKeyboardType(u32);
impl_enum! {ReqKeyboardType, undefined => 0, nokeys => 1, qwerty => 2, twelvekey => 3}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 33, android)]
pub struct UsesConfiguration {
#[resand(attr, android, table_ref = 0x01010232)]
pub req_five_way_nav: bool,
#[resand(attr, android, table_ref = 0x01010229)]
pub req_hard_keyboard: bool,
#[resand(attr, android, table_ref = 0x01010228)]
pub req_keyboard_type: ReqKeyboardType,
#[resand(attr, android, table_ref = 0x0101022a)]
pub req_navigation: ReqNavigation,
#[resand(attr, android, table_ref = 0x01010227)]
pub req_touch_screen: ReqTouchScreen,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 34, android)]
pub struct UsesFeature {
#[resand(attr, android, table_ref = 0x01010003, optional)]
pub name: Option<String>,
#[resand(attr, android, table_ref = 0x01010281, optional)]
pub gl_es_version: Option<u32>,
#[resand(attr, android, table_ref = 0x0101028e)]
pub required: bool,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 35, android)]
pub struct UsesPermission {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: Referenced<String>,
#[resand(attr, android, table_ref = 0x01010271, optional)]
pub max_sdk_version: Option<u32>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 36, android)]
pub struct UsesPermissionSdk23 {
#[resand(attr, android, table_ref = 0x01010003)]
pub name: String,
#[resand(attr, android, table_ref = 0x01010271)]
pub max_sdk_version: u32,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 37, android)]
pub struct UsesSdk {
#[resand(attr, android, table_ref = 0x0101020c)]
pub min_sdk_version: u32,
#[resand(attr, android, table_ref = 0x01010270)]
pub target_sdk_version: u32,
#[resand(attr, android, table_ref = 0x01010271, optional)]
pub max_sdk_version: Option<u32>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 38, dist)]
pub struct Module {
#[resand(child, dist, many)]
pub fusing: Vec<Fusing>,
#[resand(child, dist, many)]
pub delivery: Vec<Delivery>,
#[resand(attr, dist, name = "type")]
pub r#type: String,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 39, dist)]
pub struct Fusing {
#[resand(attr, dist)]
pub include: bool,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 40, dist)]
pub struct Delivery {
#[resand(child, dist, many)]
pub install_time: Vec<InstallTime>,
}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 41, dist)]
pub struct InstallTime {}
#[derive(Debug, PartialEq, Clone, IntoNode, Default, FromNode)]
#[resand(line_number = 42)]
#[resand(name = "manifest", android)]
pub struct AndroidManifest {
#[resand(child, android, many)]
pub uses_sdk: Vec<UsesSdk>,
#[resand(child, android, many)]
pub uses_permission: Vec<UsesPermission>,
#[resand(child, android)]
pub application: Application,
#[resand(child, android, optional)]
pub attribution: Option<Attribution>,
#[resand(child, android, optional)]
pub compatible_screens: Option<CompatibleScreens>,
#[resand(child, android, many)]
pub instrumentation: Vec<Instrumentation>,
#[resand(child, android, many)]
pub permission: Vec<Permission>,
#[resand(child, android, many)]
pub permission_group: Vec<PermissionGroup>,
#[resand(child, android, many)]
pub permission_tree: Vec<PermissionTree>,
#[resand(child, android, many)]
pub queries: Vec<Queries>,
#[resand(child, android, many)]
pub supports_gl_texture: Vec<SupportsGlTexture>,
#[resand(child, android, many)]
pub supports_screens: Vec<SupportsScreens>,
#[resand(child, android, many)]
pub uses_configuration: Vec<UsesConfiguration>,
#[resand(child, android, many)]
pub uses_feature: Vec<UsesFeature>,
#[resand(child, android, many)]
pub uses_permission_sdk_23: Vec<UsesPermissionSdk23>,
#[resand(child, android, many)]
pub module: Vec<Module>,
#[resand(attr, android, table_ref = 0x0101021b)]
pub version_code: u32,
#[resand(attr, android, table_ref = 0x0101021c, optional)]
pub version_name: Option<String>,
#[resand(attr, android, table_ref = 0x01010572, optional)]
pub compile_sdk_version: Option<u32>,
#[resand(attr, android, table_ref = 0x01010573, optional)]
pub compile_sdk_version_codename: Option<String>,
#[resand(attr)]
pub package: String,
#[resand(attr, optional)]
pub platform_build_version_code: Option<u32>,
#[resand(attr, optional)]
pub platform_build_version_name: Option<u32>,
#[resand(attr, android, table_ref = 0x0101000b, optional)]
pub shared_user_id: Option<String>,
#[resand(attr, android, table_ref = 0x0101054c, optional)]
pub target_sandbox_version: Option<u32>,
#[resand(attr, android, table_ref = 0x01010261, optional)]
pub shared_user_label: Option<String>,
#[resand(attr, android, table_ref = 0x0101064d, optional)]
pub shared_user_max_sdk_version: Option<u32>,
#[resand(attr, android, table_ref = 0x010102b7, optional)]
pub install_location: Option<String>,
#[resand(attr, android, table_ref = 0x0101064e, optional)]
pub required_split_types: Option<String>,
#[resand(attr, android, table_ref = 0x0101064f, optional)]
pub split_types: Option<String>,
#[resand(attr, android, table_ref = 0x0101055b, optional)]
pub is_feature_split: Option<bool>,
#[resand(attr, optional)]
pub split: Option<String>,
}
impl Mergeable for AndroidManifest {
type Returns = ();
fn merge(&mut self, other: Self) {
self.application.merge(other.application);
self.queries.extend(other.queries);
push_name!(uses_permission, other, self);
push_name!(instrumentation, other, self);
push_name!(permission, other, self);
push_name!(permission_group, other, self);
push_name!(permission_tree, other, self);
push_name!(supports_gl_texture, other, self);
push_name!(uses_feature, other, self);
push_name!(uses_permission_sdk_23, other, self);
}
}