├── .github └── workflows │ └── ci.yml ├── .gitignore ├── Cargo.toml ├── LICENSE.APACHE ├── LICENSE.MIT ├── README.md ├── axmldecoder-printer ├── .gitignore ├── Cargo.toml └── src │ └── main.rs ├── examples ├── AndroidManifest-Chinese.xml ├── AndroidManifest-xmlns.xml ├── AndroidManifest.xml ├── AndroidManifestDoubleNamespace.xml ├── AndroidManifestExtraNamespace.xml ├── AndroidManifestLiapp.xml ├── AndroidManifestMaskingNamespace.xml ├── AndroidManifestMultipleNamespaces.xml ├── AndroidManifestNoNamespace.xml ├── AndroidManifestNonZeroStyle.xml ├── AndroidManifestNullbytes.xml ├── AndroidManifestTextChunksXML.xml ├── AndroidManifestUTF8Strings.xml ├── AndroidManifestUnknownNamespace.xml ├── AndroidManifestWithComment.xml ├── AndroidManifest_InvalidCharsInAttribute.xml ├── AndroidManifest_NamespaceInAttributeName.xml ├── AndroidManifest_NamespaceInAttributeName2.xml └── AndroidManifest_StringNotTerminated.xml └── src ├── binaryxml.rs ├── lib.rs ├── stringpool.rs └── xml.rs /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | name: Continuous integration 4 | 5 | jobs: 6 | check: 7 | name: Check 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - uses: actions-rs/toolchain@v1 12 | with: 13 | profile: minimal 14 | toolchain: stable 15 | override: true 16 | - uses: actions-rs/cargo@v1 17 | with: 18 | command: check 19 | 20 | test: 21 | name: Test Suite 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v2 25 | - uses: actions-rs/toolchain@v1 26 | with: 27 | profile: minimal 28 | toolchain: stable 29 | override: true 30 | - uses: actions-rs/cargo@v1 31 | with: 32 | command: test 33 | 34 | fmt: 35 | name: Rustfmt 36 | runs-on: ubuntu-latest 37 | steps: 38 | - uses: actions/checkout@v2 39 | - uses: actions-rs/toolchain@v1 40 | with: 41 | profile: minimal 42 | toolchain: stable 43 | override: true 44 | - run: rustup component add rustfmt 45 | - uses: actions-rs/cargo@v1 46 | with: 47 | command: fmt 48 | args: --all -- --check 49 | 50 | clippy: 51 | name: Clippy 52 | runs-on: ubuntu-latest 53 | steps: 54 | - uses: actions/checkout@v2 55 | - uses: actions-rs/toolchain@v1 56 | with: 57 | profile: minimal 58 | toolchain: stable 59 | override: true 60 | - run: rustup component add clippy 61 | - uses: actions-rs/cargo@v1 62 | with: 63 | command: clippy 64 | args: -- -D warnings 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axmldecoder" 3 | description = "Decode Android's binary XML format" 4 | license = "MIT OR Apache-2.0" 5 | version = "0.6.0" 6 | authors = ["Terry Chia "] 7 | edition = "2021" 8 | repository = "https://github.com/Ayrx/axmldecoder" 9 | exclude = ["examples/**", "axmldecoder-printer/**"] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | byteorder = "1.4.3" 15 | deku = "~0.16" 16 | indexmap = "1.9.2" 17 | thiserror = "1.0.37" 18 | -------------------------------------------------------------------------------- /LICENSE.APACHE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [2021] [Terry Chia] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 Terry Chia 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # axmldecoder 2 | 3 | [![Crates.io](https://img.shields.io/crates/v/axmldecoder?style=flat-square)](https://crates.io/crates/axmldecoder) 4 | 5 | Decoder for the binary XML format used by Android. 6 | 7 | This library implements the minimal amount of parsing required obtain 8 | useful information from a binary `AndroidManifest.xml`. It does not 9 | support parsing generic binary XML documents and does not have 10 | support for decoding resource identifiers. In return, the compiled 11 | footprint of the library is _much_ lighter as it does not have to 12 | link in Android's `resources.arsc` file. 13 | 14 | For a full-featured Rust binary XML parser, 15 | [abxml-rs](https://github.com/SUPERAndroidAnalyzer/abxml-rs) 16 | is highly recommended if it is acceptable to link a 30MB `resources.arsc` 17 | file into your compiled binary. 18 | 19 | Please file an issue with the relevant binary `AndroidManifest.xml` if 20 | if any issues are encountered. 21 | -------------------------------------------------------------------------------- /axmldecoder-printer/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /axmldecoder-printer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axmldecoder-printer" 3 | version = "0.1.0" 4 | authors = ["Terry Chia "] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow = "1.0.66" 11 | axmldecoder = { path = "../" } 12 | -------------------------------------------------------------------------------- /axmldecoder-printer/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{fs, env}; 2 | use anyhow::Result; 3 | use axmldecoder::{Cdata, Element, Node}; 4 | 5 | fn main() -> Result<()> { 6 | let args: Vec = env::args().collect(); 7 | 8 | if args.len() <= 1 { 9 | for path in fs::read_dir("../examples").unwrap() { 10 | let f = std::fs::read(path?.path())?; 11 | let xml = axmldecoder::parse(&f)?; 12 | 13 | let root = xml.get_root().as_ref().unwrap(); 14 | let mut s = String::new(); 15 | s.push_str("\n"); 16 | format_xml(&root, 0_usize, &mut s); 17 | 18 | let s = s.trim().to_string(); 19 | println!("{}", s); 20 | } 21 | } else { 22 | let fname = args.get(1).unwrap(); 23 | 24 | let f = std::fs::read(fname)?; 25 | let xml = axmldecoder::parse(&f)?; 26 | 27 | let root = xml.get_root().as_ref().unwrap(); 28 | let mut s = String::new(); 29 | s.push_str("\n"); 30 | format_xml(&root, 0_usize, &mut s); 31 | 32 | let s = s.trim().to_string(); 33 | println!("{}", s); 34 | } 35 | 36 | Ok(()) 37 | } 38 | 39 | fn format_xml(e: &Node, level: usize, output: &mut String) { 40 | match e { 41 | Node::Element(e) => { 42 | output.push_str(&format!( 43 | "{:indent$}{}\n", 44 | "", 45 | &format_start_element(&e), 46 | indent = level * 2 47 | )); 48 | 49 | for child in e.get_children() { 50 | format_xml(&child, level + 1, output) 51 | } 52 | 53 | if !e.get_children().is_empty() { 54 | output.push_str(&format!( 55 | "{:indent$}{}\n", 56 | "", 57 | &format_end_element(&e), 58 | indent = level * 2 59 | )); 60 | } 61 | } 62 | Node::Cdata(e) => { 63 | output.push_str(&format!( 64 | "{:indent$}{}\n", 65 | "", 66 | &format_cdata(&e, level), 67 | indent = level * 2 68 | )); 69 | } 70 | } 71 | } 72 | 73 | fn format_cdata(e: &Cdata, level: usize) -> String { 74 | let indent = format!("{:indent$}", "", indent = level * 2); 75 | let mut s = String::new(); 76 | s.push_str(""); 79 | s 80 | } 81 | 82 | fn format_start_element(e: &Element) -> String { 83 | let mut s = String::new(); 84 | s.push('<'); 85 | s.push_str(e.get_tag()); 86 | 87 | for (key, val) in e.get_attributes().iter() { 88 | s.push(' '); 89 | s.push_str(key); 90 | s.push('='); 91 | s.push('"'); 92 | s.push_str(val); 93 | s.push('"'); 94 | } 95 | 96 | if e.get_children().is_empty() { 97 | s.push('/'); 98 | } 99 | 100 | s.push('>'); 101 | 102 | s 103 | } 104 | 105 | fn format_end_element(e: &Element) -> String { 106 | let mut s = String::new(); 107 | s.push('<'); 108 | s.push('/'); 109 | s.push_str(e.get_tag()); 110 | s.push('>'); 111 | s 112 | } 113 | -------------------------------------------------------------------------------- /examples/AndroidManifest-Chinese.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest-Chinese.xml -------------------------------------------------------------------------------- /examples/AndroidManifest-xmlns.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest-xmlns.xml -------------------------------------------------------------------------------- /examples/AndroidManifest.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest.xml -------------------------------------------------------------------------------- /examples/AndroidManifestDoubleNamespace.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestDoubleNamespace.xml -------------------------------------------------------------------------------- /examples/AndroidManifestExtraNamespace.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestExtraNamespace.xml -------------------------------------------------------------------------------- /examples/AndroidManifestLiapp.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestLiapp.xml -------------------------------------------------------------------------------- /examples/AndroidManifestMaskingNamespace.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestMaskingNamespace.xml -------------------------------------------------------------------------------- /examples/AndroidManifestMultipleNamespaces.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestMultipleNamespaces.xml -------------------------------------------------------------------------------- /examples/AndroidManifestNoNamespace.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestNoNamespace.xml -------------------------------------------------------------------------------- /examples/AndroidManifestNonZeroStyle.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestNonZeroStyle.xml -------------------------------------------------------------------------------- /examples/AndroidManifestNullbytes.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestNullbytes.xml -------------------------------------------------------------------------------- /examples/AndroidManifestTextChunksXML.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestTextChunksXML.xml -------------------------------------------------------------------------------- /examples/AndroidManifestUTF8Strings.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestUTF8Strings.xml -------------------------------------------------------------------------------- /examples/AndroidManifestUnknownNamespace.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestUnknownNamespace.xml -------------------------------------------------------------------------------- /examples/AndroidManifestWithComment.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifestWithComment.xml -------------------------------------------------------------------------------- /examples/AndroidManifest_InvalidCharsInAttribute.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest_InvalidCharsInAttribute.xml -------------------------------------------------------------------------------- /examples/AndroidManifest_NamespaceInAttributeName.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest_NamespaceInAttributeName.xml -------------------------------------------------------------------------------- /examples/AndroidManifest_NamespaceInAttributeName2.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest_NamespaceInAttributeName2.xml -------------------------------------------------------------------------------- /examples/AndroidManifest_StringNotTerminated.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ayrx/axmldecoder/680ec1552199666b60b0b6a479dfc63d7f4b6f82/examples/AndroidManifest_StringNotTerminated.xml -------------------------------------------------------------------------------- /src/binaryxml.rs: -------------------------------------------------------------------------------- 1 | use crate::stringpool::StringPool; 2 | use deku::prelude::*; 3 | use std::rc::Rc; 4 | 5 | #[derive(Debug, DekuRead)] 6 | pub(crate) struct BinaryXmlDocument { 7 | #[allow(dead_code)] // `header` is used by `deku` 8 | pub(crate) header: ChunkHeader, 9 | pub(crate) string_pool: StringPool, 10 | pub(crate) resource_map: ResourceMap, 11 | #[deku(bytes_read = "header.size - 12 | u32::try_from(header.header_size).unwrap() - 13 | string_pool.header.chunk_header.size - 14 | resource_map.header.size")] 15 | pub(crate) elements: Vec, 16 | } 17 | 18 | #[derive(Debug, PartialEq, Clone, Copy, DekuRead, DekuWrite)] 19 | #[deku(type = "u16")] 20 | pub(crate) enum ResourceType { 21 | NullType = 0x000, 22 | StringPool = 0x0001, 23 | Table = 0x0002, 24 | Xml = 0x0003, 25 | XmlStartNameSpace = 0x0100, 26 | XmlEndNameSpace = 0x101, 27 | XmlStartElement = 0x0102, 28 | XmlEndElement = 0x0103, 29 | XmlCdata = 0x0104, 30 | XmlLastChunk = 0x017f, 31 | XmlResourceMap = 0x0180, 32 | TablePackage = 0x0200, 33 | TableType = 0x0201, 34 | TableTypeSpec = 0x0202, 35 | TableLibrary = 0x0203, 36 | } 37 | 38 | #[derive(Clone, Debug, DekuRead, DekuWrite)] 39 | pub(crate) struct ChunkHeader { 40 | pub(crate) typ: ResourceType, 41 | pub(crate) header_size: u16, 42 | pub(crate) size: u32, 43 | } 44 | 45 | #[derive(Debug, DekuRead, DekuWrite)] 46 | pub(crate) struct ResourceMap { 47 | pub(crate) header: ChunkHeader, 48 | #[deku(count = "(header.size - u32::from(header.header_size)) / 4")] 49 | pub(crate) resource_ids: Vec, 50 | } 51 | 52 | #[derive(Debug, DekuRead, DekuWrite)] 53 | pub(crate) struct XmlNode { 54 | pub(crate) header: XmlNodeHeader, 55 | #[deku(ctx = "header.chunk_header.typ")] 56 | pub(crate) element: XmlNodeType, 57 | } 58 | 59 | #[allow(clippy::enum_variant_names)] 60 | #[derive(Debug, DekuRead, DekuWrite)] 61 | #[deku(ctx = "typ: ResourceType", id = "typ")] 62 | pub(crate) enum XmlNodeType { 63 | #[deku(id = "ResourceType::XmlStartNameSpace")] 64 | XmlStartNameSpace(XmlStartNameSpace), 65 | #[deku(id = "ResourceType::XmlEndNameSpace")] 66 | XmlEndNameSpace(XmlEndNameSpace), 67 | #[deku(id = "ResourceType::XmlStartElement")] 68 | XmlStartElement(XmlStartElement), 69 | #[deku(id = "ResourceType::XmlEndElement")] 70 | XmlEndElement(XmlEndElement), 71 | #[deku(id = "ResourceType::XmlCdata")] 72 | XmlCdata(XmlCdata), 73 | } 74 | 75 | #[derive(Debug, DekuRead, DekuWrite)] 76 | pub(crate) struct XmlNodeHeader { 77 | pub(crate) chunk_header: ChunkHeader, 78 | pub(crate) line_no: u32, 79 | pub(crate) comment: u32, 80 | } 81 | 82 | #[derive(Debug, DekuRead, DekuWrite)] 83 | pub(crate) struct XmlStartNameSpace { 84 | pub(crate) prefix: u32, 85 | pub(crate) uri: u32, 86 | } 87 | 88 | #[derive(Debug, DekuRead, DekuWrite)] 89 | pub(crate) struct XmlEndNameSpace { 90 | pub(crate) prefix: u32, 91 | pub(crate) uri: u32, 92 | } 93 | 94 | #[derive(Debug, DekuRead, DekuWrite)] 95 | pub(crate) struct XmlAttrExt { 96 | pub(crate) ns: u32, 97 | pub(crate) name: u32, 98 | pub(crate) attribute_start: u16, 99 | pub(crate) attribute_size: u16, 100 | pub(crate) attribute_count: u16, 101 | pub(crate) id_index: u16, 102 | pub(crate) class_index: u16, 103 | pub(crate) style_index: u16, 104 | } 105 | 106 | #[derive(Debug, DekuRead, DekuWrite)] 107 | pub(crate) struct ResourceValue { 108 | pub(crate) size: u16, 109 | pub(crate) res: u8, 110 | pub(crate) data_type: ResourceValueType, 111 | pub(crate) data: u32, 112 | } 113 | 114 | impl ResourceValue { 115 | pub(crate) fn get_value(&self, string_pool: &StringPool) -> Rc { 116 | match &self.data_type { 117 | ResourceValueType::String => string_pool 118 | .get(usize::try_from(self.data).unwrap()) 119 | .unwrap(), 120 | ResourceValueType::Dec => Rc::new(self.data.to_string()), 121 | ResourceValueType::Hex => Rc::new(format!("0x{}", self.data)), 122 | ResourceValueType::Boolean => Rc::new(match self.data { 123 | 0 => "false".to_string(), 124 | _ => "true".to_string(), 125 | }), 126 | n => Rc::new(format!("ResourceValueType::{:?}/{}", n, self.data)), 127 | } 128 | } 129 | } 130 | 131 | #[derive(Debug, PartialEq, DekuRead, DekuWrite)] 132 | #[deku(type = "u8")] 133 | pub(crate) enum ResourceValueType { 134 | Null = 0x00, 135 | Reference = 0x01, 136 | Attribute = 0x02, 137 | String = 0x03, 138 | Float = 0x04, 139 | Dimension = 0x05, 140 | Fraction = 0x06, 141 | Dec = 0x10, 142 | Hex = 0x11, 143 | Boolean = 0x12, 144 | ColorArgb8 = 0x1c, 145 | ColorRgb8 = 0x1d, 146 | ColorArgb4 = 0x1e, 147 | ColorRgb4 = 0x1f, 148 | } 149 | 150 | #[derive(Debug, DekuRead, DekuWrite)] 151 | pub(crate) struct XmlAttribute { 152 | pub(crate) ns: u32, 153 | pub(crate) name: u32, 154 | pub(crate) raw_value: u32, 155 | pub(crate) typed_value: ResourceValue, 156 | } 157 | 158 | #[derive(Debug, DekuRead, DekuWrite)] 159 | pub(crate) struct XmlStartElement { 160 | pub(crate) attr_ext: XmlAttrExt, 161 | #[deku(count = "attr_ext.attribute_count")] 162 | pub(crate) attributes: Vec, 163 | } 164 | 165 | #[derive(Debug, DekuRead, DekuWrite)] 166 | pub(crate) struct XmlEndElement { 167 | pub(crate) ns: u32, 168 | pub(crate) name: u32, 169 | } 170 | 171 | #[derive(Debug, DekuRead, DekuWrite)] 172 | pub(crate) struct XmlCdata { 173 | pub(crate) data: u32, 174 | pub(crate) typed_data: ResourceValue, 175 | } 176 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //!Decoder for the binary XML format used by Android. 2 | //! 3 | //!This library implements the minimal amount of parsing required obtain 4 | //!useful information from a binary `AndroidManifest.xml`. It does not 5 | //!support parsing generic binary XML documents and does not have 6 | //!support for decoding resource identifiers. In return, the compiled 7 | //!footprint of the library is _much_ lighter as it does not have to 8 | //!link in Android's `resources.arsc` file. 9 | //! 10 | //!For a full-featured Rust binary XML parser, 11 | //![abxml-rs](https://github.com/SUPERAndroidAnalyzer/abxml-rs) 12 | //!is highly recommended if it is acceptable to link a 30MB `resources.arsc` 13 | //!file into your compiled binary. 14 | //! 15 | //!Please file an issue with the relevant binary `AndroidManifest.xml` if 16 | //!if any issues are encountered. 17 | 18 | mod binaryxml; 19 | mod stringpool; 20 | mod xml; 21 | 22 | use thiserror::Error; 23 | 24 | use crate::binaryxml::BinaryXmlDocument; 25 | pub use crate::xml::{Cdata, Element, Node, XmlDocument}; 26 | 27 | #[derive(Error, Debug)] 28 | pub enum ParseError { 29 | #[error("parse error: {0}")] 30 | DekuError(deku::DekuError), 31 | 32 | #[error("StringPool missing index: {0}")] 33 | StringNotFound(u32), 34 | 35 | #[error("ResourceMap missing index: {0}")] 36 | ResourceIdNotFound(u32), 37 | 38 | #[error("Unknown resource string: {0}")] 39 | UnknownResourceString(u32), 40 | 41 | #[error(transparent)] 42 | Utf8StringParseError(std::string::FromUtf8Error), 43 | 44 | #[error(transparent)] 45 | Utf16StringParseError(std::string::FromUtf16Error), 46 | } 47 | 48 | ///Parses an Android binary XML and returns a [`XmlDocument`] object. 49 | /// 50 | /// # Errors 51 | /// 52 | /// Will return `ParseError` if `input` cannot be parsed 53 | ///```rust 54 | ///use axmldecoder::parse; 55 | ///# use axmldecoder::ParseError; 56 | ///let data= include_bytes!("../examples/AndroidManifest.xml"); 57 | ///parse(data)?; 58 | ///# Ok::<(), ParseError>(()) 59 | ///``` 60 | pub fn parse(input: &[u8]) -> Result { 61 | let binaryxml = BinaryXmlDocument::try_from(input).map_err(ParseError::DekuError)?; 62 | XmlDocument::new(binaryxml) 63 | } 64 | 65 | #[cfg(test)] 66 | mod tests { 67 | use super::*; 68 | use std::fs::File; 69 | use std::io::Read; 70 | use std::path::PathBuf; 71 | 72 | #[test] 73 | fn test_parse() { 74 | let mut examples = PathBuf::from(env!("CARGO_MANIFEST_DIR")); 75 | examples.push("examples"); 76 | 77 | for entry in std::fs::read_dir(examples).unwrap() { 78 | let entry = entry.unwrap(); 79 | let mut f = File::open(entry.path()).unwrap(); 80 | let mut buf = Vec::new(); 81 | f.read_to_end(&mut buf).unwrap(); 82 | parse(&buf).unwrap_or_else(|_| panic!("{} failed to parse", entry.path().display())); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/stringpool.rs: -------------------------------------------------------------------------------- 1 | use deku::bitvec::{BitSlice, Msb0}; 2 | use deku::prelude::*; 3 | 4 | use byteorder::ByteOrder; 5 | use byteorder::LittleEndian; 6 | use std::io::Read; 7 | use std::rc::Rc; 8 | 9 | use crate::binaryxml::ChunkHeader; 10 | use crate::ParseError; 11 | 12 | #[derive(Debug, DekuRead, DekuWrite)] 13 | pub(crate) struct StringPoolHeader { 14 | pub(crate) chunk_header: ChunkHeader, 15 | pub(crate) string_count: u32, 16 | pub(crate) style_count: u32, 17 | pub(crate) flags: u32, 18 | pub(crate) string_start: u32, 19 | pub(crate) style_start: u32, 20 | } 21 | 22 | #[derive(Debug, DekuRead)] 23 | pub(crate) struct StringPool { 24 | pub(crate) header: StringPoolHeader, 25 | #[deku(reader = "StringPool::read_strings(header, deku::rest)")] 26 | pub(crate) strings: Vec>, 27 | } 28 | 29 | type DekuRest = BitSlice; 30 | impl StringPool { 31 | fn read_strings<'a>( 32 | header: &StringPoolHeader, 33 | mut rest: &'a DekuRest, 34 | ) -> Result<(&'a DekuRest, Vec>), DekuError> { 35 | const STRINGPOOL_HEADER_SIZE: usize = std::mem::size_of::(); 36 | 37 | assert_eq!(header.style_count, 0); 38 | 39 | let flag_is_utf8 = (header.flags & (1 << 8)) != 0; 40 | 41 | let s = usize::try_from(header.chunk_header.size).unwrap() - STRINGPOOL_HEADER_SIZE; 42 | 43 | let mut string_pool_data = vec![0; s]; 44 | rest.read_exact(&mut string_pool_data).unwrap(); 45 | 46 | // Parse string offsets 47 | let num_offsets = usize::try_from(header.string_count).unwrap(); 48 | let offsets = parse_offsets(&string_pool_data, num_offsets); 49 | 50 | let string_data_start = 51 | usize::try_from(header.string_start).unwrap() - STRINGPOOL_HEADER_SIZE; 52 | let string_data = &string_pool_data[string_data_start..]; 53 | 54 | let mut strings = Vec::with_capacity(usize::try_from(header.string_count).unwrap()); 55 | 56 | let parse_fn = if flag_is_utf8 { 57 | parse_utf8_string 58 | } else { 59 | parse_utf16_string 60 | }; 61 | 62 | for offset in offsets { 63 | strings.push(Rc::new( 64 | parse_fn(string_data, usize::try_from(offset).unwrap()) 65 | .map_err(|e| DekuError::Parse(e.to_string()))?, 66 | )); 67 | } 68 | 69 | Ok((rest, strings)) 70 | } 71 | 72 | pub(crate) fn get(&self, i: usize) -> Option> { 73 | if u32::try_from(i).unwrap() == u32::MAX { 74 | return None; 75 | } 76 | 77 | Some(self.strings.get(i)?.clone()) 78 | } 79 | } 80 | 81 | fn parse_offsets(string_data: &[u8], count: usize) -> Vec { 82 | let mut offsets = Vec::with_capacity(count); 83 | 84 | for i in 0..count { 85 | let index = i * 4; 86 | let offset = LittleEndian::read_u32(&string_data[index..index + 4]); 87 | offsets.push(offset); 88 | } 89 | 90 | offsets 91 | } 92 | 93 | fn parse_utf16_string(string_data: &[u8], offset: usize) -> Result { 94 | let len = LittleEndian::read_u16(&string_data[offset..offset + 2]); 95 | 96 | // Handles the case where the string is > 32767 characters 97 | if is_high_bit_set_16(len) { 98 | unimplemented!() 99 | } 100 | 101 | // This needs to change if we ever implement support for long strings 102 | let string_start = offset + 2; 103 | 104 | let mut s = Vec::with_capacity(len.into()); 105 | for i in 0..len { 106 | let index = string_start + usize::try_from(i * 2).unwrap(); 107 | let char = LittleEndian::read_u16(&string_data[index..index + 2]); 108 | s.push(char); 109 | } 110 | 111 | let s = String::from_utf16(&s).map_err(ParseError::Utf16StringParseError)?; 112 | Ok(s) 113 | } 114 | 115 | fn is_high_bit_set_16(input: u16) -> bool { 116 | input & (1 << 15) != 0 117 | } 118 | 119 | fn parse_utf8_string(string_data: &[u8], offset: usize) -> Result { 120 | let len = string_data[offset + 1]; 121 | 122 | // Handles the case where the length value has high bit set 123 | // Not quite clear if the UTF-8 encoding actually has this but 124 | // perform the check anyway... 125 | if is_high_bit_set_8(len) { 126 | unimplemented!() 127 | } 128 | 129 | // This needs to change if we ever implement support for long strings 130 | let string_start = offset + 2; 131 | 132 | let mut s = Vec::with_capacity(len.into()); 133 | for i in 0..len { 134 | let index = string_start + usize::try_from(i).unwrap(); 135 | let char = string_data[index]; 136 | s.push(char); 137 | } 138 | 139 | let s = String::from_utf8(s).map_err(ParseError::Utf8StringParseError)?; 140 | Ok(s) 141 | } 142 | 143 | fn is_high_bit_set_8(input: u8) -> bool { 144 | input & (1 << 7) != 0 145 | } 146 | -------------------------------------------------------------------------------- /src/xml.rs: -------------------------------------------------------------------------------- 1 | use indexmap::IndexMap; 2 | use std::rc::Rc; 3 | 4 | use crate::binaryxml::{ 5 | BinaryXmlDocument, XmlCdata, XmlNodeType, XmlStartElement, XmlStartNameSpace, 6 | }; 7 | use crate::stringpool::StringPool; 8 | use crate::ParseError; 9 | 10 | ///Struct representing a parsed XML document. 11 | #[derive(Debug)] 12 | pub struct XmlDocument { 13 | root: Option, 14 | } 15 | 16 | impl XmlDocument { 17 | pub(crate) fn new(binaryxml: BinaryXmlDocument) -> Result { 18 | let string_pool = binaryxml.string_pool; 19 | let resource_map = binaryxml.resource_map; 20 | 21 | let mut namespaces = IndexMap::new(); 22 | 23 | // There are some files without the XmlStartNameSpace element. 24 | // We should assume that the android namespace is always present even 25 | // if not explicitly defined in the document. 26 | // 27 | // examples/AndroidManifestNoNamespace.xml 28 | namespaces.insert( 29 | Rc::new("http://schemas.android.com/apk/res/android".to_string()), 30 | Rc::new("android".to_string()), 31 | ); 32 | 33 | let mut element_tracker: Vec = Vec::new(); 34 | for node in binaryxml.elements { 35 | match node.element { 36 | XmlNodeType::XmlStartNameSpace(e) => { 37 | let (uri, prefix) = Self::process_start_namespace(&e, &string_pool)?; 38 | namespaces.insert(uri.clone(), prefix.clone()); 39 | } 40 | XmlNodeType::XmlEndNameSpace(_) => {} 41 | XmlNodeType::XmlStartElement(e) => { 42 | element_tracker.push(Self::process_start_element( 43 | &e, 44 | &string_pool, 45 | &namespaces, 46 | &resource_map.resource_ids, 47 | )?); 48 | } 49 | XmlNodeType::XmlEndElement(_) => { 50 | let e = element_tracker.pop().unwrap(); 51 | 52 | if element_tracker.is_empty() { 53 | return Ok(XmlDocument { 54 | root: Some(Node::Element(e)), 55 | }); 56 | } 57 | 58 | element_tracker 59 | .last_mut() 60 | .unwrap() 61 | .insert_children(Node::Element(e)); 62 | } 63 | XmlNodeType::XmlCdata(e) => { 64 | let cdata = Self::process_cdata(&e, &string_pool)?; 65 | element_tracker 66 | .last_mut() 67 | .unwrap() 68 | .insert_children(Node::Cdata(cdata)); 69 | } 70 | }; 71 | } 72 | 73 | Ok(Self { root: None }) 74 | } 75 | 76 | ///Returns the root [Element] of the XML document. 77 | #[must_use] 78 | pub fn get_root(&self) -> &Option { 79 | &self.root 80 | } 81 | 82 | fn process_cdata(e: &XmlCdata, string_pool: &StringPool) -> Result { 83 | Ok(Cdata { 84 | data: string_pool 85 | .get(usize::try_from(e.data).unwrap()) 86 | .ok_or(ParseError::StringNotFound(e.data))? 87 | .to_string(), 88 | }) 89 | } 90 | 91 | fn process_start_namespace( 92 | e: &XmlStartNameSpace, 93 | string_pool: &StringPool, 94 | ) -> Result<(Rc, Rc), ParseError> { 95 | let uri = string_pool 96 | .get(usize::try_from(e.uri).unwrap()) 97 | .ok_or(ParseError::StringNotFound(e.uri))?; 98 | let prefix = string_pool 99 | .get(usize::try_from(e.prefix).unwrap()) 100 | .ok_or(ParseError::StringNotFound(e.prefix))?; 101 | 102 | Ok((uri, prefix)) 103 | } 104 | 105 | fn process_start_element( 106 | e: &XmlStartElement, 107 | string_pool: &StringPool, 108 | namespaces: &IndexMap, Rc>, 109 | resource_map: &[u32], 110 | ) -> Result { 111 | let name = string_pool 112 | .get(usize::try_from(e.attr_ext.name).unwrap()) 113 | .ok_or(ParseError::StringNotFound(e.attr_ext.name))?; 114 | let name = (*name).clone(); 115 | 116 | let mut attributes: IndexMap = IndexMap::new(); 117 | 118 | // Specially handle the element by adding the namespace 119 | // attributes to it. 120 | if name == "manifest" { 121 | for (url, name) in namespaces.iter() { 122 | attributes.insert(format!("xmlns:{}", name), url.to_string()); 123 | } 124 | } 125 | 126 | for attr in &e.attributes { 127 | let ns = string_pool.get(usize::try_from(attr.ns).unwrap()); 128 | let name = string_pool 129 | .get(usize::try_from(attr.name).unwrap()) 130 | .ok_or(ParseError::StringNotFound(attr.name))?; 131 | let value = attr.typed_value.get_value(string_pool); 132 | 133 | let mut final_name = String::new(); 134 | if name.is_empty() { 135 | let resource_id = resource_map 136 | .get(usize::try_from(attr.name).unwrap()) 137 | .ok_or(ParseError::ResourceIdNotFound(attr.name))?; 138 | let resource_str = get_resource_string(*resource_id) 139 | .ok_or(ParseError::UnknownResourceString(*resource_id))?; 140 | final_name.push_str(&resource_str); 141 | } else { 142 | if let Some(n) = ns { 143 | // There are samples where the namespace value is the 144 | // raw string instead of a URI found in a namespace chunk. 145 | // For now, skip appending the namespace for those cases. 146 | // 147 | // examples/AndroidManifestUnknownNamespace 148 | if let Some(n) = namespaces.get(&n) { 149 | final_name.push_str(n); 150 | final_name.push(':'); 151 | }; 152 | } 153 | final_name.push_str(&name); 154 | } 155 | 156 | attributes.insert(final_name, value.to_string()); 157 | } 158 | 159 | Ok(Element { 160 | attributes, 161 | tag: name, 162 | children: Vec::new(), 163 | }) 164 | } 165 | } 166 | 167 | ///Enum representing possible nodes within the parsed XML document. 168 | #[derive(Debug)] 169 | pub enum Node { 170 | Element(Element), 171 | Cdata(Cdata), 172 | } 173 | 174 | ///Struct representing an element within the parsed XML document. 175 | #[derive(Debug)] 176 | pub struct Element { 177 | attributes: IndexMap, 178 | tag: String, 179 | children: Vec, 180 | } 181 | 182 | impl Element { 183 | ///Returns a map of attributes associated with the element. 184 | #[must_use] 185 | pub fn get_attributes(&self) -> &IndexMap { 186 | &self.attributes 187 | } 188 | 189 | ///Returns the element tag. 190 | #[must_use] 191 | pub fn get_tag(&self) -> &str { 192 | &self.tag 193 | } 194 | 195 | ///Returns a list of child nodes. 196 | #[must_use] 197 | pub fn get_children(&self) -> &Vec { 198 | &self.children 199 | } 200 | 201 | fn insert_children(&mut self, child: Node) { 202 | self.children.push(child); 203 | } 204 | } 205 | 206 | ///Struct representing a Cdata element within the parsed XML document. 207 | #[derive(Debug)] 208 | pub struct Cdata { 209 | data: String, 210 | } 211 | 212 | impl Cdata { 213 | #[must_use] 214 | pub fn get_data(&self) -> &str { 215 | &self.data 216 | } 217 | } 218 | 219 | // Logic borrowed from: 220 | // https://github.com/ytsutano/axmldec/blob/master/lib/jitana/util/axml_parser.cpp#L504 221 | fn get_resource_string(resource_id: u32) -> Option { 222 | const RESOURCE_STRINGS: &[&str] = &[ 223 | "theme", 224 | "label", 225 | "icon", 226 | "name", 227 | "manageSpaceActivity", 228 | "allowClearUserData", 229 | "permission", 230 | "readPermission", 231 | "writePermission", 232 | "protectionLevel", 233 | "permissionGroup", 234 | "sharedUserId", 235 | "hasCode", 236 | "persistent", 237 | "enabled", 238 | "debuggable", 239 | "exported", 240 | "process", 241 | "taskAffinity", 242 | "multiprocess", 243 | "finishOnTaskLaunch", 244 | "clearTaskOnLaunch", 245 | "stateNotNeeded", 246 | "excludeFromRecents", 247 | "authorities", 248 | "syncable", 249 | "initOrder", 250 | "grantUriPermissions", 251 | "priority", 252 | "launchMode", 253 | "screenOrientation", 254 | "configChanges", 255 | "description", 256 | "targetPackage", 257 | "handleProfiling", 258 | "functionalTest", 259 | "value", 260 | "resource", 261 | "mimeType", 262 | "scheme", 263 | "host", 264 | "port", 265 | "path", 266 | "pathPrefix", 267 | "pathPattern", 268 | "action", 269 | "data", 270 | "targetClass", 271 | "colorForeground", 272 | "colorBackground", 273 | "backgroundDimAmount", 274 | "disabledAlpha", 275 | "textAppearance", 276 | "textAppearanceInverse", 277 | "textColorPrimary", 278 | "textColorPrimaryDisableOnly", 279 | "textColorSecondary", 280 | "textColorPrimaryInverse", 281 | "textColorSecondaryInverse", 282 | "textColorPrimaryNoDisable", 283 | "textColorSecondaryNoDisable", 284 | "textColorPrimaryInverseNoDisable", 285 | "textColorSecondaryInverseNoDisable", 286 | "textColorHintInverse", 287 | "textAppearanceLarge", 288 | "textAppearanceMedium", 289 | "textAppearanceSmall", 290 | "textAppearanceLargeInverse", 291 | "textAppearanceMediumInverse", 292 | "textAppearanceSmallInverse", 293 | "textCheckMark", 294 | "textCheckMarkInverse", 295 | "buttonStyle", 296 | "buttonStyleSmall", 297 | "buttonStyleInset", 298 | "buttonStyleToggle", 299 | "galleryItemBackground", 300 | "listPreferredItemHeight", 301 | "expandableListPreferredItemPaddingLeft", 302 | "expandableListPreferredChildPaddingLeft", 303 | "expandableListPreferredItemIndicatorLeft", 304 | "expandableListPreferredItemIndicatorRight", 305 | "expandableListPreferredChildIndicatorLeft", 306 | "expandableListPreferredChildIndicatorRight", 307 | "windowBackground", 308 | "windowFrame", 309 | "windowNoTitle", 310 | "windowIsFloating", 311 | "windowIsTranslucent", 312 | "windowContentOverlay", 313 | "windowTitleSize", 314 | "windowTitleStyle", 315 | "windowTitleBackgroundStyle", 316 | "alertDialogStyle", 317 | "panelBackground", 318 | "panelFullBackground", 319 | "panelColorForeground", 320 | "panelColorBackground", 321 | "panelTextAppearance", 322 | "scrollbarSize", 323 | "scrollbarThumbHorizontal", 324 | "scrollbarThumbVertical", 325 | "scrollbarTrackHorizontal", 326 | "scrollbarTrackVertical", 327 | "scrollbarAlwaysDrawHorizontalTrack", 328 | "scrollbarAlwaysDrawVerticalTrack", 329 | "absListViewStyle", 330 | "autoCompleteTextViewStyle", 331 | "checkboxStyle", 332 | "dropDownListViewStyle", 333 | "editTextStyle", 334 | "expandableListViewStyle", 335 | "galleryStyle", 336 | "gridViewStyle", 337 | "imageButtonStyle", 338 | "imageWellStyle", 339 | "listViewStyle", 340 | "listViewWhiteStyle", 341 | "popupWindowStyle", 342 | "progressBarStyle", 343 | "progressBarStyleHorizontal", 344 | "progressBarStyleSmall", 345 | "progressBarStyleLarge", 346 | "seekBarStyle", 347 | "ratingBarStyle", 348 | "ratingBarStyleSmall", 349 | "radioButtonStyle", 350 | "scrollbarStyle", 351 | "scrollViewStyle", 352 | "spinnerStyle", 353 | "starStyle", 354 | "tabWidgetStyle", 355 | "textViewStyle", 356 | "webViewStyle", 357 | "dropDownItemStyle", 358 | "spinnerDropDownItemStyle", 359 | "dropDownHintAppearance", 360 | "spinnerItemStyle", 361 | "mapViewStyle", 362 | "preferenceScreenStyle", 363 | "preferenceCategoryStyle", 364 | "preferenceInformationStyle", 365 | "preferenceStyle", 366 | "checkBoxPreferenceStyle", 367 | "yesNoPreferenceStyle", 368 | "dialogPreferenceStyle", 369 | "editTextPreferenceStyle", 370 | "ringtonePreferenceStyle", 371 | "preferenceLayoutChild", 372 | "textSize", 373 | "typeface", 374 | "textStyle", 375 | "textColor", 376 | "textColorHighlight", 377 | "textColorHint", 378 | "textColorLink", 379 | "state_focused", 380 | "state_window_focused", 381 | "state_enabled", 382 | "state_checkable", 383 | "state_checked", 384 | "state_selected", 385 | "state_active", 386 | "state_single", 387 | "state_first", 388 | "state_middle", 389 | "state_last", 390 | "state_pressed", 391 | "state_expanded", 392 | "state_empty", 393 | "state_above_anchor", 394 | "ellipsize", 395 | "x", 396 | "y", 397 | "windowAnimationStyle", 398 | "gravity", 399 | "autoLink", 400 | "linksClickable", 401 | "entries", 402 | "layout_gravity", 403 | "windowEnterAnimation", 404 | "windowExitAnimation", 405 | "windowShowAnimation", 406 | "windowHideAnimation", 407 | "activityOpenEnterAnimation", 408 | "activityOpenExitAnimation", 409 | "activityCloseEnterAnimation", 410 | "activityCloseExitAnimation", 411 | "taskOpenEnterAnimation", 412 | "taskOpenExitAnimation", 413 | "taskCloseEnterAnimation", 414 | "taskCloseExitAnimation", 415 | "taskToFrontEnterAnimation", 416 | "taskToFrontExitAnimation", 417 | "taskToBackEnterAnimation", 418 | "taskToBackExitAnimation", 419 | "orientation", 420 | "keycode", 421 | "fullDark", 422 | "topDark", 423 | "centerDark", 424 | "bottomDark", 425 | "fullBright", 426 | "topBright", 427 | "centerBright", 428 | "bottomBright", 429 | "bottomMedium", 430 | "centerMedium", 431 | "id", 432 | "tag", 433 | "scrollX", 434 | "scrollY", 435 | "background", 436 | "padding", 437 | "paddingLeft", 438 | "paddingTop", 439 | "paddingRight", 440 | "paddingBottom", 441 | "focusable", 442 | "focusableInTouchMode", 443 | "visibility", 444 | "fitsSystemWindows", 445 | "scrollbars", 446 | "fadingEdge", 447 | "fadingEdgeLength", 448 | "nextFocusLeft", 449 | "nextFocusRight", 450 | "nextFocusUp", 451 | "nextFocusDown", 452 | "clickable", 453 | "longClickable", 454 | "saveEnabled", 455 | "drawingCacheQuality", 456 | "duplicateParentState", 457 | "clipChildren", 458 | "clipToPadding", 459 | "layoutAnimation", 460 | "animationCache", 461 | "persistentDrawingCache", 462 | "alwaysDrawnWithCache", 463 | "addStatesFromChildren", 464 | "descendantFocusability", 465 | "layout", 466 | "inflatedId", 467 | "layout_width", 468 | "layout_height", 469 | "layout_margin", 470 | "layout_marginLeft", 471 | "layout_marginTop", 472 | "layout_marginRight", 473 | "layout_marginBottom", 474 | "listSelector", 475 | "drawSelectorOnTop", 476 | "stackFromBottom", 477 | "scrollingCache", 478 | "textFilterEnabled", 479 | "transcriptMode", 480 | "cacheColorHint", 481 | "dial", 482 | "hand_hour", 483 | "hand_minute", 484 | "format", 485 | "checked", 486 | "button", 487 | "checkMark", 488 | "foreground", 489 | "measureAllChildren", 490 | "groupIndicator", 491 | "childIndicator", 492 | "indicatorLeft", 493 | "indicatorRight", 494 | "childIndicatorLeft", 495 | "childIndicatorRight", 496 | "childDivider", 497 | "animationDuration", 498 | "spacing", 499 | "horizontalSpacing", 500 | "verticalSpacing", 501 | "stretchMode", 502 | "columnWidth", 503 | "numColumns", 504 | "src", 505 | "antialias", 506 | "filter", 507 | "dither", 508 | "scaleType", 509 | "adjustViewBounds", 510 | "maxWidth", 511 | "maxHeight", 512 | "tint", 513 | "baselineAlignBottom", 514 | "cropToPadding", 515 | "textOn", 516 | "textOff", 517 | "baselineAligned", 518 | "baselineAlignedChildIndex", 519 | "weightSum", 520 | "divider", 521 | "dividerHeight", 522 | "choiceMode", 523 | "itemTextAppearance", 524 | "horizontalDivider", 525 | "verticalDivider", 526 | "headerBackground", 527 | "itemBackground", 528 | "itemIconDisabledAlpha", 529 | "rowHeight", 530 | "maxRows", 531 | "maxItemsPerRow", 532 | "moreIcon", 533 | "max", 534 | "progress", 535 | "secondaryProgress", 536 | "indeterminate", 537 | "indeterminateOnly", 538 | "indeterminateDrawable", 539 | "progressDrawable", 540 | "indeterminateDuration", 541 | "indeterminateBehavior", 542 | "minWidth", 543 | "minHeight", 544 | "interpolator", 545 | "thumb", 546 | "thumbOffset", 547 | "numStars", 548 | "rating", 549 | "stepSize", 550 | "isIndicator", 551 | "checkedButton", 552 | "stretchColumns", 553 | "shrinkColumns", 554 | "collapseColumns", 555 | "layout_column", 556 | "layout_span", 557 | "bufferType", 558 | "text", 559 | "hint", 560 | "textScaleX", 561 | "cursorVisible", 562 | "maxLines", 563 | "lines", 564 | "height", 565 | "minLines", 566 | "maxEms", 567 | "ems", 568 | "width", 569 | "minEms", 570 | "scrollHorizontally", 571 | "password", 572 | "singleLine", 573 | "selectAllOnFocus", 574 | "includeFontPadding", 575 | "maxLength", 576 | "shadowColor", 577 | "shadowDx", 578 | "shadowDy", 579 | "shadowRadius", 580 | "numeric", 581 | "digits", 582 | "phoneNumber", 583 | "inputMethod", 584 | "capitalize", 585 | "autoText", 586 | "editable", 587 | "freezesText", 588 | "drawableTop", 589 | "drawableBottom", 590 | "drawableLeft", 591 | "drawableRight", 592 | "drawablePadding", 593 | "completionHint", 594 | "completionHintView", 595 | "completionThreshold", 596 | "dropDownSelector", 597 | "popupBackground", 598 | "inAnimation", 599 | "outAnimation", 600 | "flipInterval", 601 | "fillViewport", 602 | "prompt", 603 | "startYear", 604 | "endYear", 605 | "mode", 606 | "layout_x", 607 | "layout_y", 608 | "layout_weight", 609 | "layout_toLeftOf", 610 | "layout_toRightOf", 611 | "layout_above", 612 | "layout_below", 613 | "layout_alignBaseline", 614 | "layout_alignLeft", 615 | "layout_alignTop", 616 | "layout_alignRight", 617 | "layout_alignBottom", 618 | "layout_alignParentLeft", 619 | "layout_alignParentTop", 620 | "layout_alignParentRight", 621 | "layout_alignParentBottom", 622 | "layout_centerInParent", 623 | "layout_centerHorizontal", 624 | "layout_centerVertical", 625 | "layout_alignWithParentIfMissing", 626 | "layout_scale", 627 | "visible", 628 | "variablePadding", 629 | "constantSize", 630 | "oneshot", 631 | "duration", 632 | "drawable", 633 | "shape", 634 | "innerRadiusRatio", 635 | "thicknessRatio", 636 | "startColor", 637 | "endColor", 638 | "useLevel", 639 | "angle", 640 | "type", 641 | "centerX", 642 | "centerY", 643 | "gradientRadius", 644 | "color", 645 | "dashWidth", 646 | "dashGap", 647 | "radius", 648 | "topLeftRadius", 649 | "topRightRadius", 650 | "bottomLeftRadius", 651 | "bottomRightRadius", 652 | "left", 653 | "top", 654 | "right", 655 | "bottom", 656 | "minLevel", 657 | "maxLevel", 658 | "fromDegrees", 659 | "toDegrees", 660 | "pivotX", 661 | "pivotY", 662 | "insetLeft", 663 | "insetRight", 664 | "insetTop", 665 | "insetBottom", 666 | "shareInterpolator", 667 | "fillBefore", 668 | "fillAfter", 669 | "startOffset", 670 | "repeatCount", 671 | "repeatMode", 672 | "zAdjustment", 673 | "fromXScale", 674 | "toXScale", 675 | "fromYScale", 676 | "toYScale", 677 | "fromXDelta", 678 | "toXDelta", 679 | "fromYDelta", 680 | "toYDelta", 681 | "fromAlpha", 682 | "toAlpha", 683 | "delay", 684 | "animation", 685 | "animationOrder", 686 | "columnDelay", 687 | "rowDelay", 688 | "direction", 689 | "directionPriority", 690 | "factor", 691 | "cycles", 692 | "searchMode", 693 | "searchSuggestAuthority", 694 | "searchSuggestPath", 695 | "searchSuggestSelection", 696 | "searchSuggestIntentAction", 697 | "searchSuggestIntentData", 698 | "queryActionMsg", 699 | "suggestActionMsg", 700 | "suggestActionMsgColumn", 701 | "menuCategory", 702 | "orderInCategory", 703 | "checkableBehavior", 704 | "title", 705 | "titleCondensed", 706 | "alphabeticShortcut", 707 | "numericShortcut", 708 | "checkable", 709 | "selectable", 710 | "orderingFromXml", 711 | "key", 712 | "summary", 713 | "order", 714 | "widgetLayout", 715 | "dependency", 716 | "defaultValue", 717 | "shouldDisableView", 718 | "summaryOn", 719 | "summaryOff", 720 | "disableDependentsState", 721 | "dialogTitle", 722 | "dialogMessage", 723 | "dialogIcon", 724 | "positiveButtonText", 725 | "negativeButtonText", 726 | "dialogLayout", 727 | "entryValues", 728 | "ringtoneType", 729 | "showDefault", 730 | "showSilent", 731 | "scaleWidth", 732 | "scaleHeight", 733 | "scaleGravity", 734 | "ignoreGravity", 735 | "foregroundGravity", 736 | "tileMode", 737 | "targetActivity", 738 | "alwaysRetainTaskState", 739 | "allowTaskReparenting", 740 | "searchButtonText", 741 | "colorForegroundInverse", 742 | "textAppearanceButton", 743 | "listSeparatorTextViewStyle", 744 | "streamType", 745 | "clipOrientation", 746 | "centerColor", 747 | "minSdkVersion", 748 | "windowFullscreen", 749 | "unselectedAlpha", 750 | "progressBarStyleSmallTitle", 751 | "ratingBarStyleIndicator", 752 | "apiKey", 753 | "textColorTertiary", 754 | "textColorTertiaryInverse", 755 | "listDivider", 756 | "soundEffectsEnabled", 757 | "keepScreenOn", 758 | "lineSpacingExtra", 759 | "lineSpacingMultiplier", 760 | "listChoiceIndicatorSingle", 761 | "listChoiceIndicatorMultiple", 762 | "versionCode", 763 | "versionName", 764 | "marqueeRepeatLimit", 765 | "windowNoDisplay", 766 | "backgroundDimEnabled", 767 | "inputType", 768 | "isDefault", 769 | "windowDisablePreview", 770 | "privateImeOptions", 771 | "editorExtras", 772 | "settingsActivity", 773 | "fastScrollEnabled", 774 | "reqTouchScreen", 775 | "reqKeyboardType", 776 | "reqHardKeyboard", 777 | "reqNavigation", 778 | "windowSoftInputMode", 779 | "imeFullscreenBackground", 780 | "noHistory", 781 | "headerDividersEnabled", 782 | "footerDividersEnabled", 783 | "candidatesTextStyleSpans", 784 | "smoothScrollbar", 785 | "reqFiveWayNav", 786 | "keyBackground", 787 | "keyTextSize", 788 | "labelTextSize", 789 | "keyTextColor", 790 | "keyPreviewLayout", 791 | "keyPreviewOffset", 792 | "keyPreviewHeight", 793 | "verticalCorrection", 794 | "popupLayout", 795 | "state_long_pressable", 796 | "keyWidth", 797 | "keyHeight", 798 | "horizontalGap", 799 | "verticalGap", 800 | "rowEdgeFlags", 801 | "codes", 802 | "popupKeyboard", 803 | "popupCharacters", 804 | "keyEdgeFlags", 805 | "isModifier", 806 | "isSticky", 807 | "isRepeatable", 808 | "iconPreview", 809 | "keyOutputText", 810 | "keyLabel", 811 | "keyIcon", 812 | "keyboardMode", 813 | "isScrollContainer", 814 | "fillEnabled", 815 | "updatePeriodMillis", 816 | "initialLayout", 817 | "voiceSearchMode", 818 | "voiceLanguageModel", 819 | "voicePromptText", 820 | "voiceLanguage", 821 | "voiceMaxResults", 822 | "bottomOffset", 823 | "topOffset", 824 | "allowSingleTap", 825 | "handle", 826 | "content", 827 | "animateOnClick", 828 | "configure", 829 | "hapticFeedbackEnabled", 830 | "innerRadius", 831 | "thickness", 832 | "sharedUserLabel", 833 | "dropDownWidth", 834 | "dropDownAnchor", 835 | "imeOptions", 836 | "imeActionLabel", 837 | "imeActionId", 838 | "UNKNOWN", 839 | "imeExtractEnterAnimation", 840 | "imeExtractExitAnimation", 841 | "tension", 842 | "extraTension", 843 | "anyDensity", 844 | "searchSuggestThreshold", 845 | "includeInGlobalSearch", 846 | "onClick", 847 | "targetSdkVersion", 848 | "maxSdkVersion", 849 | "testOnly", 850 | "contentDescription", 851 | "gestureStrokeWidth", 852 | "gestureColor", 853 | "uncertainGestureColor", 854 | "fadeOffset", 855 | "fadeDuration", 856 | "gestureStrokeType", 857 | "gestureStrokeLengthThreshold", 858 | "gestureStrokeSquarenessThreshold", 859 | "gestureStrokeAngleThreshold", 860 | "eventsInterceptionEnabled", 861 | "fadeEnabled", 862 | "backupAgent", 863 | "allowBackup", 864 | "glEsVersion", 865 | "queryAfterZeroResults", 866 | "dropDownHeight", 867 | "smallScreens", 868 | "normalScreens", 869 | "largeScreens", 870 | "progressBarStyleInverse", 871 | "progressBarStyleSmallInverse", 872 | "progressBarStyleLargeInverse", 873 | "searchSettingsDescription", 874 | "textColorPrimaryInverseDisableOnly", 875 | "autoUrlDetect", 876 | "resizeable", 877 | "required", 878 | "accountType", 879 | "contentAuthority", 880 | "userVisible", 881 | "windowShowWallpaper", 882 | "wallpaperOpenEnterAnimation", 883 | "wallpaperOpenExitAnimation", 884 | "wallpaperCloseEnterAnimation", 885 | "wallpaperCloseExitAnimation", 886 | "wallpaperIntraOpenEnterAnimation", 887 | "wallpaperIntraOpenExitAnimation", 888 | "wallpaperIntraCloseEnterAnimation", 889 | "wallpaperIntraCloseExitAnimation", 890 | "supportsUploading", 891 | "killAfterRestore", 892 | "restoreNeedsApplication", 893 | "smallIcon", 894 | "accountPreferences", 895 | "textAppearanceSearchResultSubtitle", 896 | "textAppearanceSearchResultTitle", 897 | "summaryColumn", 898 | "detailColumn", 899 | "detailSocialSummary", 900 | "thumbnail", 901 | "detachWallpaper", 902 | "finishOnCloseSystemDialogs", 903 | "scrollbarFadeDuration", 904 | "scrollbarDefaultDelayBeforeFade", 905 | "fadeScrollbars", 906 | "colorBackgroundCacheHint", 907 | "dropDownHorizontalOffset", 908 | "dropDownVerticalOffset", 909 | "quickContactBadgeStyleWindowSmall", 910 | "quickContactBadgeStyleWindowMedium", 911 | "quickContactBadgeStyleWindowLarge", 912 | "quickContactBadgeStyleSmallWindowSmall", 913 | "quickContactBadgeStyleSmallWindowMedium", 914 | "quickContactBadgeStyleSmallWindowLarge", 915 | "author", 916 | "autoStart", 917 | "expandableListViewWhiteStyle", 918 | "installLocation", 919 | "vmSafeMode", 920 | "webTextViewStyle", 921 | "restoreAnyVersion", 922 | "tabStripLeft", 923 | "tabStripRight", 924 | "tabStripEnabled", 925 | "logo", 926 | "xlargeScreens", 927 | "immersive", 928 | "overScrollMode", 929 | "overScrollHeader", 930 | "overScrollFooter", 931 | "filterTouchesWhenObscured", 932 | "textSelectHandleLeft", 933 | "textSelectHandleRight", 934 | "textSelectHandle", 935 | "textSelectHandleWindowStyle", 936 | "popupAnimationStyle", 937 | "screenSize", 938 | "screenDensity", 939 | "allContactsName", 940 | "windowActionBar", 941 | "actionBarStyle", 942 | "navigationMode", 943 | "displayOptions", 944 | "subtitle", 945 | "customNavigationLayout", 946 | "hardwareAccelerated", 947 | "measureWithLargestChild", 948 | "animateFirstView", 949 | "dropDownSpinnerStyle", 950 | "actionDropDownStyle", 951 | "actionButtonStyle", 952 | "showAsAction", 953 | "previewImage", 954 | "actionModeBackground", 955 | "actionModeCloseDrawable", 956 | "windowActionModeOverlay", 957 | "valueFrom", 958 | "valueTo", 959 | "valueType", 960 | "propertyName", 961 | "ordering", 962 | "fragment", 963 | "windowActionBarOverlay", 964 | "fragmentOpenEnterAnimation", 965 | "fragmentOpenExitAnimation", 966 | "fragmentCloseEnterAnimation", 967 | "fragmentCloseExitAnimation", 968 | "fragmentFadeEnterAnimation", 969 | "fragmentFadeExitAnimation", 970 | "actionBarSize", 971 | "imeSubtypeLocale", 972 | "imeSubtypeMode", 973 | "imeSubtypeExtraValue", 974 | "splitMotionEvents", 975 | "listChoiceBackgroundIndicator", 976 | "spinnerMode", 977 | "animateLayoutChanges", 978 | "actionBarTabStyle", 979 | "actionBarTabBarStyle", 980 | "actionBarTabTextStyle", 981 | "actionOverflowButtonStyle", 982 | "actionModeCloseButtonStyle", 983 | "titleTextStyle", 984 | "subtitleTextStyle", 985 | "iconifiedByDefault", 986 | "actionLayout", 987 | "actionViewClass", 988 | "activatedBackgroundIndicator", 989 | "state_activated", 990 | "listPopupWindowStyle", 991 | "popupMenuStyle", 992 | "textAppearanceLargePopupMenu", 993 | "textAppearanceSmallPopupMenu", 994 | "breadCrumbTitle", 995 | "breadCrumbShortTitle", 996 | "listDividerAlertDialog", 997 | "textColorAlertDialogListItem", 998 | "loopViews", 999 | "dialogTheme", 1000 | "alertDialogTheme", 1001 | "dividerVertical", 1002 | "homeAsUpIndicator", 1003 | "enterFadeDuration", 1004 | "exitFadeDuration", 1005 | "selectableItemBackground", 1006 | "autoAdvanceViewId", 1007 | "useIntrinsicSizeAsMinimum", 1008 | "actionModeCutDrawable", 1009 | "actionModeCopyDrawable", 1010 | "actionModePasteDrawable", 1011 | "textEditPasteWindowLayout", 1012 | "textEditNoPasteWindowLayout", 1013 | "textIsSelectable", 1014 | "windowEnableSplitTouch", 1015 | "indeterminateProgressStyle", 1016 | "progressBarPadding", 1017 | "animationResolution", 1018 | "state_accelerated", 1019 | "baseline", 1020 | "homeLayout", 1021 | "opacity", 1022 | "alpha", 1023 | "transformPivotX", 1024 | "transformPivotY", 1025 | "translationX", 1026 | "translationY", 1027 | "scaleX", 1028 | "scaleY", 1029 | "rotation", 1030 | "rotationX", 1031 | "rotationY", 1032 | "showDividers", 1033 | "dividerPadding", 1034 | "borderlessButtonStyle", 1035 | "dividerHorizontal", 1036 | "itemPadding", 1037 | "buttonBarStyle", 1038 | "buttonBarButtonStyle", 1039 | "segmentedButtonStyle", 1040 | "staticWallpaperPreview", 1041 | "allowParallelSyncs", 1042 | "isAlwaysSyncable", 1043 | "verticalScrollbarPosition", 1044 | "fastScrollAlwaysVisible", 1045 | "fastScrollThumbDrawable", 1046 | "fastScrollPreviewBackgroundLeft", 1047 | "fastScrollPreviewBackgroundRight", 1048 | "fastScrollTrackDrawable", 1049 | "fastScrollOverlayPosition", 1050 | "customTokens", 1051 | "nextFocusForward", 1052 | "firstDayOfWeek", 1053 | "showWeekNumber", 1054 | "minDate", 1055 | "maxDate", 1056 | "shownWeekCount", 1057 | "selectedWeekBackgroundColor", 1058 | "focusedMonthDateColor", 1059 | "unfocusedMonthDateColor", 1060 | "weekNumberColor", 1061 | "weekSeparatorLineColor", 1062 | "selectedDateVerticalBar", 1063 | "weekDayTextAppearance", 1064 | "dateTextAppearance", 1065 | "UNKNOWN", 1066 | "spinnersShown", 1067 | "calendarViewShown", 1068 | "state_multiline", 1069 | "detailsElementBackground", 1070 | "textColorHighlightInverse", 1071 | "textColorLinkInverse", 1072 | "editTextColor", 1073 | "editTextBackground", 1074 | "horizontalScrollViewStyle", 1075 | "layerType", 1076 | "alertDialogIcon", 1077 | "windowMinWidthMajor", 1078 | "windowMinWidthMinor", 1079 | "queryHint", 1080 | "fastScrollTextColor", 1081 | "largeHeap", 1082 | "windowCloseOnTouchOutside", 1083 | "datePickerStyle", 1084 | "calendarViewStyle", 1085 | "textEditSidePasteWindowLayout", 1086 | "textEditSideNoPasteWindowLayout", 1087 | "actionMenuTextAppearance", 1088 | "actionMenuTextColor", 1089 | "textCursorDrawable", 1090 | "resizeMode", 1091 | "requiresSmallestWidthDp", 1092 | "compatibleWidthLimitDp", 1093 | "largestWidthLimitDp", 1094 | "state_hovered", 1095 | "state_drag_can_accept", 1096 | "state_drag_hovered", 1097 | "stopWithTask", 1098 | "switchTextOn", 1099 | "switchTextOff", 1100 | "switchPreferenceStyle", 1101 | "switchTextAppearance", 1102 | "track", 1103 | "switchMinWidth", 1104 | "switchPadding", 1105 | "thumbTextPadding", 1106 | "textSuggestionsWindowStyle", 1107 | "textEditSuggestionItemLayout", 1108 | "rowCount", 1109 | "rowOrderPreserved", 1110 | "columnCount", 1111 | "columnOrderPreserved", 1112 | "useDefaultMargins", 1113 | "alignmentMode", 1114 | "layout_row", 1115 | "layout_rowSpan", 1116 | "layout_columnSpan", 1117 | "actionModeSelectAllDrawable", 1118 | "isAuxiliary", 1119 | "accessibilityEventTypes", 1120 | "packageNames", 1121 | "accessibilityFeedbackType", 1122 | "notificationTimeout", 1123 | "accessibilityFlags", 1124 | "canRetrieveWindowContent", 1125 | "listPreferredItemHeightLarge", 1126 | "listPreferredItemHeightSmall", 1127 | "actionBarSplitStyle", 1128 | "actionProviderClass", 1129 | "backgroundStacked", 1130 | "backgroundSplit", 1131 | "textAllCaps", 1132 | "colorPressedHighlight", 1133 | "colorLongPressedHighlight", 1134 | "colorFocusedHighlight", 1135 | "colorActivatedHighlight", 1136 | "colorMultiSelectHighlight", 1137 | "drawableStart", 1138 | "drawableEnd", 1139 | "actionModeStyle", 1140 | "minResizeWidth", 1141 | "minResizeHeight", 1142 | "actionBarWidgetTheme", 1143 | "uiOptions", 1144 | "subtypeLocale", 1145 | "subtypeExtraValue", 1146 | "actionBarDivider", 1147 | "actionBarItemBackground", 1148 | "actionModeSplitBackground", 1149 | "textAppearanceListItem", 1150 | "textAppearanceListItemSmall", 1151 | "targetDescriptions", 1152 | "directionDescriptions", 1153 | "overridesImplicitlyEnabledSubtype", 1154 | "listPreferredItemPaddingLeft", 1155 | "listPreferredItemPaddingRight", 1156 | "requiresFadingEdge", 1157 | "publicKey", 1158 | "parentActivityName", 1159 | "UNKNOWN", 1160 | "isolatedProcess", 1161 | "importantForAccessibility", 1162 | "keyboardLayout", 1163 | "fontFamily", 1164 | "mediaRouteButtonStyle", 1165 | "mediaRouteTypes", 1166 | "supportsRtl", 1167 | "textDirection", 1168 | "textAlignment", 1169 | "layoutDirection", 1170 | "paddingStart", 1171 | "paddingEnd", 1172 | "layout_marginStart", 1173 | "layout_marginEnd", 1174 | "layout_toStartOf", 1175 | "layout_toEndOf", 1176 | "layout_alignStart", 1177 | "layout_alignEnd", 1178 | "layout_alignParentStart", 1179 | "layout_alignParentEnd", 1180 | "listPreferredItemPaddingStart", 1181 | "listPreferredItemPaddingEnd", 1182 | "singleUser", 1183 | "presentationTheme", 1184 | "subtypeId", 1185 | "initialKeyguardLayout", 1186 | "UNKNOWN", 1187 | "widgetCategory", 1188 | "permissionGroupFlags", 1189 | "labelFor", 1190 | "permissionFlags", 1191 | "checkedTextViewStyle", 1192 | "showOnLockScreen", 1193 | "format12Hour", 1194 | "format24Hour", 1195 | "timeZone", 1196 | "mipMap", 1197 | "mirrorForRtl", 1198 | "windowOverscan", 1199 | "requiredForAllUsers", 1200 | "indicatorStart", 1201 | "indicatorEnd", 1202 | "childIndicatorStart", 1203 | "childIndicatorEnd", 1204 | "restrictedAccountType", 1205 | "requiredAccountType", 1206 | "canRequestTouchExplorationMode", 1207 | "canRequestEnhancedWebAccessibility", 1208 | "canRequestFilterKeyEvents", 1209 | "layoutMode", 1210 | "keySet", 1211 | "targetId", 1212 | "fromScene", 1213 | "toScene", 1214 | "transition", 1215 | "transitionOrdering", 1216 | "fadingMode", 1217 | "startDelay", 1218 | "ssp", 1219 | "sspPrefix", 1220 | "sspPattern", 1221 | "addPrintersActivity", 1222 | "vendor", 1223 | "category", 1224 | "isAsciiCapable", 1225 | "autoMirrored", 1226 | "supportsSwitchingToNextInputMethod", 1227 | "requireDeviceUnlock", 1228 | "apduServiceBanner", 1229 | "accessibilityLiveRegion", 1230 | "windowTranslucentStatus", 1231 | "windowTranslucentNavigation", 1232 | "advancedPrintOptionsActivity", 1233 | "banner", 1234 | "windowSwipeToDismiss", 1235 | "isGame", 1236 | "allowEmbedded", 1237 | "setupActivity", 1238 | "fastScrollStyle", 1239 | "windowContentTransitions", 1240 | "windowContentTransitionManager", 1241 | "translationZ", 1242 | "tintMode", 1243 | "controlX1", 1244 | "controlY1", 1245 | "controlX2", 1246 | "controlY2", 1247 | "transitionName", 1248 | "transitionGroup", 1249 | "viewportWidth", 1250 | "viewportHeight", 1251 | "fillColor", 1252 | "pathData", 1253 | "strokeColor", 1254 | "strokeWidth", 1255 | "trimPathStart", 1256 | "trimPathEnd", 1257 | "trimPathOffset", 1258 | "strokeLineCap", 1259 | "strokeLineJoin", 1260 | "strokeMiterLimit", 1261 | "UNKNOWN", 1262 | "UNKNOWN", 1263 | "UNKNOWN", 1264 | "UNKNOWN", 1265 | "UNKNOWN", 1266 | "UNKNOWN", 1267 | "UNKNOWN", 1268 | "UNKNOWN", 1269 | "UNKNOWN", 1270 | "UNKNOWN", 1271 | "UNKNOWN", 1272 | "UNKNOWN", 1273 | "UNKNOWN", 1274 | "UNKNOWN", 1275 | "UNKNOWN", 1276 | "UNKNOWN", 1277 | "UNKNOWN", 1278 | "UNKNOWN", 1279 | "UNKNOWN", 1280 | "UNKNOWN", 1281 | "UNKNOWN", 1282 | "UNKNOWN", 1283 | "UNKNOWN", 1284 | "UNKNOWN", 1285 | "UNKNOWN", 1286 | "UNKNOWN", 1287 | "UNKNOWN", 1288 | "colorControlNormal", 1289 | "colorControlActivated", 1290 | "colorButtonNormal", 1291 | "colorControlHighlight", 1292 | "persistableMode", 1293 | "titleTextAppearance", 1294 | "subtitleTextAppearance", 1295 | "slideEdge", 1296 | "actionBarTheme", 1297 | "textAppearanceListItemSecondary", 1298 | "colorPrimary", 1299 | "colorPrimaryDark", 1300 | "colorAccent", 1301 | "nestedScrollingEnabled", 1302 | "windowEnterTransition", 1303 | "windowExitTransition", 1304 | "windowSharedElementEnterTransition", 1305 | "windowSharedElementExitTransition", 1306 | "windowAllowReturnTransitionOverlap", 1307 | "windowAllowEnterTransitionOverlap", 1308 | "sessionService", 1309 | "stackViewStyle", 1310 | "switchStyle", 1311 | "elevation", 1312 | "excludeId", 1313 | "excludeClass", 1314 | "hideOnContentScroll", 1315 | "actionOverflowMenuStyle", 1316 | "documentLaunchMode", 1317 | "maxRecents", 1318 | "autoRemoveFromRecents", 1319 | "stateListAnimator", 1320 | "toId", 1321 | "fromId", 1322 | "reversible", 1323 | "splitTrack", 1324 | "targetName", 1325 | "excludeName", 1326 | "matchOrder", 1327 | "windowDrawsSystemBarBackgrounds", 1328 | "statusBarColor", 1329 | "navigationBarColor", 1330 | "contentInsetStart", 1331 | "contentInsetEnd", 1332 | "contentInsetLeft", 1333 | "contentInsetRight", 1334 | "paddingMode", 1335 | "layout_rowWeight", 1336 | "layout_columnWeight", 1337 | "translateX", 1338 | "translateY", 1339 | "selectableItemBackgroundBorderless", 1340 | "elegantTextHeight", 1341 | "UNKNOWN", 1342 | "UNKNOWN", 1343 | "UNKNOWN", 1344 | "windowTransitionBackgroundFadeDuration", 1345 | "overlapAnchor", 1346 | "progressTint", 1347 | "progressTintMode", 1348 | "progressBackgroundTint", 1349 | "progressBackgroundTintMode", 1350 | "secondaryProgressTint", 1351 | "secondaryProgressTintMode", 1352 | "indeterminateTint", 1353 | "indeterminateTintMode", 1354 | "backgroundTint", 1355 | "backgroundTintMode", 1356 | "foregroundTint", 1357 | "foregroundTintMode", 1358 | "buttonTint", 1359 | "buttonTintMode", 1360 | "thumbTint", 1361 | "thumbTintMode", 1362 | "fullBackupOnly", 1363 | "propertyXName", 1364 | "propertyYName", 1365 | "relinquishTaskIdentity", 1366 | "tileModeX", 1367 | "tileModeY", 1368 | "actionModeShareDrawable", 1369 | "actionModeFindDrawable", 1370 | "actionModeWebSearchDrawable", 1371 | "transitionVisibilityMode", 1372 | "minimumHorizontalAngle", 1373 | "minimumVerticalAngle", 1374 | "maximumAngle", 1375 | "searchViewStyle", 1376 | "closeIcon", 1377 | "goIcon", 1378 | "searchIcon", 1379 | "voiceIcon", 1380 | "commitIcon", 1381 | "suggestionRowLayout", 1382 | "queryBackground", 1383 | "submitBackground", 1384 | "buttonBarPositiveButtonStyle", 1385 | "buttonBarNeutralButtonStyle", 1386 | "buttonBarNegativeButtonStyle", 1387 | "popupElevation", 1388 | "actionBarPopupTheme", 1389 | "multiArch", 1390 | "touchscreenBlocksFocus", 1391 | "windowElevation", 1392 | "launchTaskBehindTargetAnimation", 1393 | "launchTaskBehindSourceAnimation", 1394 | "restrictionType", 1395 | "dayOfWeekBackground", 1396 | "dayOfWeekTextAppearance", 1397 | "headerMonthTextAppearance", 1398 | "headerDayOfMonthTextAppearance", 1399 | "headerYearTextAppearance", 1400 | "yearListItemTextAppearance", 1401 | "yearListSelectorColor", 1402 | "calendarTextColor", 1403 | "recognitionService", 1404 | "timePickerStyle", 1405 | "timePickerDialogTheme", 1406 | "headerTimeTextAppearance", 1407 | "headerAmPmTextAppearance", 1408 | "numbersTextColor", 1409 | "numbersBackgroundColor", 1410 | "numbersSelectorColor", 1411 | "amPmTextColor", 1412 | "amPmBackgroundColor", 1413 | "UNKNOWN", 1414 | "checkMarkTint", 1415 | "checkMarkTintMode", 1416 | "popupTheme", 1417 | "toolbarStyle", 1418 | "windowClipToOutline", 1419 | "datePickerDialogTheme", 1420 | "showText", 1421 | "windowReturnTransition", 1422 | "windowReenterTransition", 1423 | "windowSharedElementReturnTransition", 1424 | "windowSharedElementReenterTransition", 1425 | "resumeWhilePausing", 1426 | "datePickerMode", 1427 | "timePickerMode", 1428 | "inset", 1429 | "letterSpacing", 1430 | "fontFeatureSettings", 1431 | "outlineProvider", 1432 | "contentAgeHint", 1433 | "country", 1434 | "windowSharedElementsUseOverlay", 1435 | "reparent", 1436 | "reparentWithOverlay", 1437 | "ambientShadowAlpha", 1438 | "spotShadowAlpha", 1439 | "navigationIcon", 1440 | "navigationContentDescription", 1441 | "fragmentExitTransition", 1442 | "fragmentEnterTransition", 1443 | "fragmentSharedElementEnterTransition", 1444 | "fragmentReturnTransition", 1445 | "fragmentSharedElementReturnTransition", 1446 | "fragmentReenterTransition", 1447 | "fragmentAllowEnterTransitionOverlap", 1448 | "fragmentAllowReturnTransitionOverlap", 1449 | "patternPathData", 1450 | "strokeAlpha", 1451 | "fillAlpha", 1452 | "windowActivityTransitions", 1453 | "colorEdgeEffect", 1454 | "resizeClip", 1455 | "collapseContentDescription", 1456 | "accessibilityTraversalBefore", 1457 | "accessibilityTraversalAfter", 1458 | "dialogPreferredPadding", 1459 | "searchHintIcon", 1460 | "revisionCode", 1461 | "drawableTint", 1462 | "drawableTintMode", 1463 | "fraction", 1464 | "trackTint", 1465 | "trackTintMode", 1466 | "start", 1467 | "end", 1468 | "breakStrategy", 1469 | "hyphenationFrequency", 1470 | "allowUndo", 1471 | "windowLightStatusBar", 1472 | "numbersInnerTextColor", 1473 | "colorBackgroundFloating", 1474 | "titleTextColor", 1475 | "subtitleTextColor", 1476 | "thumbPosition", 1477 | "scrollIndicators", 1478 | "contextClickable", 1479 | "fingerprintAuthDrawable", 1480 | "logoDescription", 1481 | "extractNativeLibs", 1482 | "fullBackupContent", 1483 | "usesCleartextTraffic", 1484 | "lockTaskMode", 1485 | "autoVerify", 1486 | "showForAllUsers", 1487 | "supportsAssist", 1488 | "supportsLaunchVoiceAssistFromKeyguard", 1489 | "listMenuViewStyle", 1490 | "subMenuArrow", 1491 | "defaultWidth", 1492 | "defaultHeight", 1493 | "resizeableActivity", 1494 | "supportsPictureInPicture", 1495 | "titleMargin", 1496 | "titleMarginStart", 1497 | "titleMarginEnd", 1498 | "titleMarginTop", 1499 | "titleMarginBottom", 1500 | "maxButtonHeight", 1501 | "buttonGravity", 1502 | "collapseIcon", 1503 | "level", 1504 | "contextPopupMenuStyle", 1505 | "textAppearancePopupMenuHeader", 1506 | "windowBackgroundFallback", 1507 | "defaultToDeviceProtectedStorage", 1508 | "directBootAware", 1509 | "preferenceFragmentStyle", 1510 | "canControlMagnification", 1511 | "languageTag", 1512 | "pointerIcon", 1513 | "tickMark", 1514 | "tickMarkTint", 1515 | "tickMarkTintMode", 1516 | "canPerformGestures", 1517 | "externalService", 1518 | "supportsLocalInteraction", 1519 | "startX", 1520 | "startY", 1521 | "endX", 1522 | "endY", 1523 | "offset", 1524 | "use32bitAbi", 1525 | "bitmap", 1526 | "hotSpotX", 1527 | "hotSpotY", 1528 | "version", 1529 | "backupInForeground", 1530 | "countDown", 1531 | "canRecord", 1532 | "tunerCount", 1533 | "fillType", 1534 | "popupEnterTransition", 1535 | "popupExitTransition", 1536 | "forceHasOverlappingRendering", 1537 | "contentInsetStartWithNavigation", 1538 | "contentInsetEndWithActions", 1539 | "numberPickerStyle", 1540 | "enableVrMode", 1541 | "UNKNOWN", 1542 | "networkSecurityConfig", 1543 | "shortcutId", 1544 | "shortcutShortLabel", 1545 | "shortcutLongLabel", 1546 | "shortcutDisabledMessage", 1547 | "roundIcon", 1548 | "contextUri", 1549 | "contextDescription", 1550 | "showMetadataInPreview", 1551 | "colorSecondary", 1552 | ]; 1553 | 1554 | let i = resource_id - 0x0101_0000; 1555 | 1556 | Some((*RESOURCE_STRINGS.get(usize::try_from(i).unwrap())?).to_string()) 1557 | } 1558 | --------------------------------------------------------------------------------