├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── scripts │ ├── deploy_snapshot.sh │ └── gen_keystore.sh └── workflows │ └── android.yml ├── .gitignore ├── .run ├── publishToCentral.run.xml └── publishToLocal.run.xml ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── resources-helper ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── anggrayudi │ │ └── hiddenapi │ │ ├── InternalAccessor.java │ │ └── ResourcesHolder.java │ └── test │ └── java │ └── com │ └── anggrayudi │ └── hiddenapi │ └── ExampleUnitTest.kt ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── anggrayudi │ │ │ └── hiddenapi │ │ │ └── sample │ │ │ ├── Adapter.kt │ │ │ ├── App.kt │ │ │ ├── MainActivity.kt │ │ │ ├── Model.kt │ │ │ └── Receiver.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ └── list_layout.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── anggrayudi │ └── hiddenapi │ └── sample │ └── ExampleUnitTest.kt └── settings.gradle /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: [ paypal.me/hardiannicko, saweria.co/hardiannicko ] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Library version: 35.0 11 | OS version: [Android 10] 12 | Device model: [Samsung S20] 13 | 14 | **Describe the bug** 15 | [A clear and concise description of what the bug is] 16 | 17 | **To Reproduce** 18 | [Explain the steps to reproduce] 19 | 20 | **Stacktrace** 21 | [If applicable] 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What feature you want to suggest?** 11 | [Explain your idea and how it can help Simple Storage to be better] 12 | 13 | **Your solution** 14 | [Expected solution for the feature, if any] 15 | 16 | **Your current alternative** 17 | [Do you have any alternative or workaround to overcome the feature that's not available yet?] 18 | -------------------------------------------------------------------------------- /.github/scripts/deploy_snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SLUG="anggrayudi/android-hidden-api" 4 | 5 | set -e 6 | 7 | if [ "$GITHUB_REPOSITORY" != "$SLUG" ]; then 8 | echo "Skipping deployment: wrong repository. Expected '$SLUG' but was '$GITHUB_REPOSITORY'." 9 | elif [ "${GITHUB_REF##*/}" != "master" ]; then 10 | echo "Skipping deployment: wrong branch. Expected 'master' but was '${GITHUB_REF##*/}'." 11 | else 12 | echo "Deploying snapshot..." 13 | ./gradlew :resources-helper:publishAllPublicationsToMavenCentral --no-daemon --no-parallel --stacktrace 14 | echo "Snapshot released!" 15 | fi 16 | -------------------------------------------------------------------------------- /.github/scripts/gen_keystore.sh: -------------------------------------------------------------------------------- 1 | # Append suffix -SNAPSHOT 2 | if [[ ! ($(grep "VERSION_NAME=" gradle.properties) == *"-SNAPSHOT") ]]; then 3 | sed -ie "s/VERSION_NAME.*$/&-SNAPSHOT/g" gradle.properties 4 | rm -f gradle.propertiese 5 | fi 6 | 7 | mkdir "$HOME/.android" 8 | keytool -genkey -v -keystore "$HOME/.android/debug.keystore" -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug" 9 | 10 | { 11 | printf "\nkeyAlias=androiddebugkey" 12 | printf "\nkeyPassword=android" 13 | printf "\nstorePassword=android" 14 | } >>local.properties 15 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the master branch 5 | on: 6 | push: 7 | branches: [ master ] 8 | pull_request: 9 | branches: 10 | - 'master' 11 | - 'release/**' 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v2 21 | 22 | - name: Setup JDK 17 23 | uses: actions/setup-java@v1 24 | with: 25 | java-version: 17 26 | 27 | - name: Generate keystore 28 | run: ./.github/scripts/gen_keystore.sh 29 | 30 | - name: Build with Gradle 31 | if: ${{ github.repository_owner == 'anggrayudi' }} 32 | env: 33 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSS_SONATYPE_NEXUS_USERNAME }} 34 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSS_SONATYPE_NEXUS_PASSWORD }} 35 | run: ./gradlew build test check 36 | 37 | - name: Build with Gradle (default) 38 | if: ${{ github.repository_owner != 'anggrayudi' }} 39 | env: 40 | ORG_GRADLE_PROJECT_mavenCentralUsername: 'abc' 41 | ORG_GRADLE_PROJECT_mavenCentralPassword: 'xyz' 42 | run: ./gradlew build test check 43 | 44 | - name: Upload snapshot archives 45 | if: ${{ github.repository_owner == 'anggrayudi' }} 46 | env: 47 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSS_SONATYPE_NEXUS_USERNAME }} 48 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSS_SONATYPE_NEXUS_PASSWORD }} 49 | run: ./.github/scripts/deploy_snapshot.sh 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /captures 3 | constants-converter readme.docx 4 | 5 | local.properties 6 | 7 | # Mobile Tools for Java (J2ME) 8 | .mtj.tmp/ 9 | 10 | # Package Files # 11 | *.war 12 | *.ear 13 | *.apk 14 | *.aab 15 | 16 | # generated files 17 | bin 18 | gen 19 | build 20 | captures 21 | .idea 22 | .gradle 23 | *.class 24 | *.dex 25 | *.iml 26 | .cxx 27 | .DS_Store 28 | .navigation 29 | 30 | #NDK 31 | obj/ 32 | .externalNativeBuild 33 | 34 | # Windows thumbnail db 35 | Thumbs.db 36 | 37 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 38 | hs_err_pid* -------------------------------------------------------------------------------- /.run/publishToCentral.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /.run/publishToLocal.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015-2025 Anggrayudi Hardiannico A. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Hidden APIs 2 | 3 | **Android Hidden APIs** are classes, methods and resources that Google hides from you because of stability reason. 4 | These features are hidden because they may be changed on next API version. 5 | 6 | The internal APIs are located in package `com.android.internal` and available in the `framework.jar`, 7 | while the hidden APIs are located in the `android.jar` file with `@hide` javadoc attribute. 8 | Now you know the difference. But I will refer to both as hidden APIs. 9 | 10 | This repo contains custom `android.jar` which you can use to develop your app. 11 | However, if you urgently need to create your own `android.jar`, I also share you the Krabby Patty 12 | secret recipe here: [Create Your Own Android Hidden APIs](https://medium.com/@hardiannicko/create-your-own-android-hidden-apis-fa3cca02d345). 13 | 14 | ## Use Custom `android.jar` 15 | 16 | 1. Download custom `android.jar` from [Google Drive](https://drive.google.com/drive/folders/17oMwQ0xBcSGn159mgbqxcXXEcneUmnph). 17 | 2. Go to `/platforms/`. 18 | 3. Copy, paste and replace the downloaded hidden API file into this directory, e.g. `android-30/android.jar`. 19 | 4. Change `compileSdkVersion` and `targetSdkVersion` to 35 (for example). 20 | 5. Finally, rebuild your project. 21 | 22 | Note: Higher `compileSdkVersion` and `targetSdkVersion` will be better. 23 | 24 | ## Resources Helper 25 | ![Maven Central](https://img.shields.io/maven-central/v/com.anggrayudi/android-hidden-api.svg) 26 | 27 | If you plan to use only Android internal resources rather than internal classes or methods, do: 28 | 29 | ````gradle 30 | dependencies { 31 | implementation 'com.anggrayudi:android-hidden-api:X.Y' 32 | } 33 | ```` 34 | 35 | Where `X.Y` is the library version: ![Maven Central](https://img.shields.io/maven-central/v/com.anggrayudi/android-hidden-api.svg) 36 | 37 | All versions can be found [here](https://oss.sonatype.org/#nexus-search;gav~com.anggrayudi~android-hidden-api~~~~kw,versionexpand). 38 | To use `SNAPSHOT` version, you need to add this URL to the root Gradle: 39 | 40 | ```groovy 41 | allprojects { 42 | repositories { 43 | google() 44 | mavenCentral() 45 | // add this line 46 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 47 | } 48 | } 49 | ``` 50 | 51 | Here's some example of accessing internal resources: 52 | 53 | ```java 54 | String accept = InternalAccessor.getString("accept"); 55 | float sbar_height = InternalAccessor.getDimension("status_bar_height"); 56 | int notif_color = InternalAccessor.getColor("config_defaultNotificationColor"); 57 | ``` 58 | 59 | ## Contributing 60 | 61 | If you have your own custom `android.jar` and want to add it to 62 | [Google Drive](https://drive.google.com/drive/folders/17oMwQ0xBcSGn159mgbqxcXXEcneUmnph), 63 | please create an issue. I will upload it. 64 | 65 | ## License 66 | 67 | Copyright 2015-2025 Anggrayudi Hardiannico A. 68 | 69 | Licensed under the Apache License, Version 2.0 (the "License"); 70 | you may not use this file except in compliance with the License. 71 | You may obtain a copy of the License at 72 | 73 | http://www.apache.org/licenses/LICENSE-2.0 74 | 75 | Unless required by applicable law or agreed to in writing, software 76 | distributed under the License is distributed on an "AS IS" BASIS, 77 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 78 | See the License for the specific language governing permissions and 79 | limitations under the License. 80 | 81 | 82 | [1]: https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction 83 | [2]: https://github.com/anggrayudi/android-hidden-api/issues/9 84 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 2 | 3 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 4 | 5 | buildscript { 6 | ext.kotlin_version = '2.0.21' 7 | repositories { 8 | google() 9 | mavenCentral() 10 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 11 | } 12 | 13 | dependencies { 14 | classpath 'com.android.tools.build:gradle:8.8.0' 15 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 16 | classpath 'com.vanniktech:gradle-maven-publish-plugin:0.22.0' 17 | classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.8.20' 18 | } 19 | } 20 | 21 | allprojects { 22 | repositories { 23 | google() 24 | mavenCentral() 25 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 26 | } 27 | 28 | //Support @JvmDefault 29 | tasks.withType(KotlinCompile).configureEach { 30 | kotlinOptions { 31 | freeCompilerArgs = ['-Xjvm-default=all', '-opt-in=kotlin.RequiresOptIn'] 32 | jvmTarget = '1.8' 33 | } 34 | } 35 | } 36 | 37 | subprojects { 38 | if (name != 'sample') { 39 | apply plugin: "com.vanniktech.maven.publish" 40 | 41 | repositories { 42 | maven { 43 | url = version.toString().endsWith("SNAPSHOT") 44 | ? 'https://oss.sonatype.org/content/repositories/snapshots/' 45 | : 'https://oss.sonatype.org/service/local/staging/deploy/maven2' 46 | } 47 | } 48 | } 49 | 50 | afterEvaluate { 51 | android { 52 | compileSdkVersion 35 53 | 54 | defaultConfig { 55 | minSdkVersion 21 56 | targetSdkVersion 35 57 | versionCode 1 58 | versionName "$VERSION_NAME" 59 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 60 | vectorDrawables.useSupportLibrary = true 61 | } 62 | 63 | compileOptions { 64 | sourceCompatibility JavaVersion.VERSION_1_8 65 | targetCompatibility JavaVersion.VERSION_1_8 66 | } 67 | 68 | buildFeatures { 69 | buildConfig true 70 | } 71 | } 72 | configurations.configureEach { 73 | resolutionStrategy { 74 | // Force Kotlin to use current version 75 | force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 76 | force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 77 | force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 78 | force "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version" 79 | force "org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version" 80 | } 81 | } 82 | // global dependencies for all modules 83 | dependencies { 84 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 85 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" 86 | } 87 | } 88 | } 89 | 90 | tasks.register('clean', Delete) { 91 | delete rootProject.layout.buildDirectory 92 | } 93 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2G 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | # For publishing: 23 | GROUP=com.anggrayudi 24 | POM_ARTIFACT_ID=android-hidden-api 25 | VERSION_NAME=35.0-SNAPSHOT 26 | RELEASE_SIGNING_ENABLED=false 27 | SONATYPE_AUTOMATIC_RELEASE=true 28 | SONATYPE_HOST=DEFAULT 29 | POM_NAME=android-hidden-api 30 | POM_DESCRIPTION=A library that provides access to Android hidden APIs and internal resources. 31 | POM_INCEPTION_YEAR=2015 32 | POM_URL=https://github.com/anggrayudi/android-hidden-api 33 | POM_LICENSE_NAME=The Apache Software License, Version 2.0 34 | POM_LICENSE_URL=https://github.com/anggrayudi/android-hidden-api/blob/master/LICENSE 35 | POM_LICENSE_DIST=https://www.apache.org/licenses/LICENSE-2.0.txt 36 | POM_SCM_URL=https://github.com/anggrayudi/android-hidden-api 37 | POM_SCM_CONNECTION=scm:git:git://github.com/anggrayudi/android-hidden-api.git 38 | POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:anggrayudi/android-hidden-api.git 39 | POM_DEVELOPER_ID=anggrayudi 40 | POM_DEVELOPER_NAME=Anggrayudi H 41 | POM_DEVELOPER_URL=https://github.com/anggrayudi/ 42 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jan 17 15:08:39 WIB 2025 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /resources-helper/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /resources-helper/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | group = 'com.anggrayudi' 5 | archivesBaseName = 'android-hidden-api' 6 | version = "$VERSION_NAME" 7 | 8 | android { 9 | namespace 'com.anggrayudi.hiddenapi' 10 | 11 | buildTypes { 12 | release { 13 | minifyEnabled false 14 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 15 | } 16 | debug { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | // Testing 25 | testImplementation 'junit:junit:4.13.2' 26 | testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 27 | 28 | implementation 'androidx.appcompat:appcompat:1.7.0' 29 | implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' 30 | } 31 | -------------------------------------------------------------------------------- /resources-helper/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/resources-helper/consumer-rules.pro -------------------------------------------------------------------------------- /resources-helper/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /resources-helper/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources-helper/src/main/java/com/anggrayudi/hiddenapi/InternalAccessor.java: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.res.Resources; 5 | import android.content.res.XmlResourceParser; 6 | import android.graphics.drawable.Drawable; 7 | import android.os.Build; 8 | 9 | import androidx.annotation.NonNull; 10 | 11 | import java.io.InputStream; 12 | import java.lang.reflect.Method; 13 | 14 | /** 15 | * Created by Anggrayudi on 11/03/2016.

16 | * A utility class that provides access to all resources in com.android.internal.R 17 | * class. 18 | * This class does not use Java reflection anymore, and certainly safe. 19 | */ 20 | @SuppressWarnings({"EmptyCatchBlock"}) 21 | public final class InternalAccessor { 22 | 23 | /* 24 | // These are primitive classes which are available since API 7 25 | private static final Class anim = com.android.internal.R.anim.class; 26 | private static final Class array = com.android.internal.R.array.class; 27 | private static final Class attr = com.android.internal.R.attr.class; 28 | private static final Class bool = com.android.internal.R.bool.class; 29 | private static final Class color = com.android.internal.R.color.class; 30 | private static final Class dimen = com.android.internal.R.dimen.class; 31 | private static final Class drawable = com.android.internal.R.drawable.class; 32 | private static final Class id = com.android.internal.R.id.class; 33 | private static final Class integer = com.android.internal.R.integer.class; 34 | private static final Class layout = com.android.internal.R.layout.class; 35 | private static final Class plurals = com.android.internal.R.plurals.class; 36 | private static final Class raw = com.android.internal.R.raw.class; 37 | private static final Class string = com.android.internal.R.string.class; 38 | private static final Class style = com.android.internal.R.style.class; 39 | private static final Class styleable = com.android.internal.R.styleable.class; 40 | private static final Class xml = com.android.internal.R.xml.class; 41 | 42 | // These are up to date classes and may not available in API 10 43 | private static final Class fraction = com.android.internal.R.fraction.class; 44 | private static final Class interpolator = com.android.internal.R.interpolator.class; 45 | private static final Class menu = com.android.internal.R.menu.class; 46 | private static final Class mipmap = com.android.internal.R.mipmap.class; 47 | private static final Class transition = com.android.internal.R.transition.class; 48 | */ 49 | 50 | public static final String ANIM = "anim"; 51 | 52 | public static final String ARRAY = "array"; 53 | 54 | public static final String ATTR = "attr"; 55 | 56 | public static final String BOOL = "bool"; 57 | 58 | public static final String COLOR = "color"; 59 | 60 | public static final String DIMEN = "dimen"; 61 | 62 | public static final String DRAWABLE = "drawable"; 63 | 64 | public static final String ID = "id"; 65 | 66 | public static final String INTEGER = "integer"; 67 | 68 | public static final String LAYOUT = "layout"; 69 | 70 | public static final String PLURALS = "plurals"; 71 | 72 | public static final String RAW = "raw"; 73 | 74 | public static final String STRING = "string"; 75 | 76 | public static final String STYLE = "style"; 77 | 78 | public static final String STYLEABLE = "styleable"; 79 | 80 | public static final String XML = "xml"; 81 | 82 | public static final String FRACTION = "fraction"; 83 | 84 | public static final String INTERPOLATOR = "interpolator"; 85 | 86 | public static final String MENU = "menu"; 87 | 88 | public static final String MIPMAP = "mipmap"; 89 | 90 | public static final String TRANSITION = "transition"; 91 | 92 | private InternalAccessor() { 93 | } 94 | 95 | /** 96 | * Pick resource id from com.android.internal.R 97 | * 98 | * @param clas for example = string, drawable, color, style, id, attr. 99 | * And they will be wrote as com.android.internal.R.drawable 100 | * @param resName for example = cancel, ic_launcher, activity_main 101 | * @return internal resource id in integer, for example: com.android.internal.R.xml 102 | * .audio_assets 103 | * returns 17891329 in integer. 104 | */ 105 | public static int getResourceId(@NonNull String clas, @NonNull String resName) { 106 | int id = Resources.getSystem().getIdentifier(resName, clas, "android"); 107 | if (id == 0) 108 | throw new Resources.NotFoundException("Cannot find '" + clas + "' for '" + resName + 109 | "', or this resource currently is not available for API " + Build.VERSION.SDK_INT); 110 | return id; 111 | } 112 | 113 | /** 114 | * Pick Animation resources from com.android.internal.R.anim 115 | * 116 | * @param resName for example = snackbar_in, abc_fade_in 117 | * @return internal XmlResourceParser animation 118 | */ 119 | public static XmlResourceParser getAnimation(@NonNull String resName) { 120 | return Resources.getSystem().getAnimation(getResourceId(ANIM, resName)); 121 | } 122 | 123 | /** 124 | * Pick boolean resources from com.android.internal.R.bool 125 | * 126 | * @return internal boolean 127 | */ 128 | public static boolean getBoolean(@NonNull String resName) { 129 | return Resources.getSystem().getBoolean(getResourceId(BOOL, resName)); 130 | } 131 | 132 | /** 133 | * Pick color resources from com.android.internal.R.color 134 | * 135 | * @return internal color 136 | */ 137 | public static int getColor(@NonNull String resName) { 138 | return Resources.getSystem().getColor(getResourceId(COLOR, resName)); 139 | } 140 | 141 | /** 142 | * Pick dimension resources from com.android.internal.R.dimen 143 | * 144 | * @return internal dimension 145 | */ 146 | public static float getDimension(@NonNull String resName) { 147 | return Resources.getSystem().getDimension(getResourceId(DIMEN, resName)); 148 | } 149 | 150 | /** 151 | * Pick Drawable resources from com.android.internal.R.drawable 152 | * 153 | * @return internal Drawable 154 | */ 155 | @SuppressLint("UseCompatLoadingForDrawables") 156 | public static Drawable getDrawable(@NonNull String resName) { 157 | return Resources.getSystem().getDrawable(getResourceId(DRAWABLE, resName)); 158 | } 159 | 160 | /** 161 | * Pick Drawable resources from com.android.internal.R.drawable 162 | * 163 | * @return internal Drawable 164 | */ 165 | @SuppressLint("UseCompatLoadingForDrawables") 166 | public static Drawable getDrawable(@NonNull String resName, Resources.Theme theme) { 167 | return Resources.getSystem().getDrawable(getResourceId(DRAWABLE, resName), theme); 168 | } 169 | 170 | /** 171 | * Pick fractional unit resources from com.android.internal.R.fraction 172 | * 173 | * @return internal fractional unit 174 | */ 175 | public static float getFraction(@NonNull String resName, int base, int pbase) { 176 | return Resources.getSystem().getFraction(getResourceId(FRACTION, resName), base, pbase); 177 | } 178 | 179 | /** 180 | * Pick Integer resources from com.android.internal.R.integer 181 | * 182 | * @return internal Integer 183 | */ 184 | public static int getInteger(@NonNull String resName) { 185 | return Resources.getSystem().getInteger(getResourceId(INTEGER, resName)); 186 | } 187 | 188 | /** 189 | * Pick layout resources from com.android.internal.R.layout 190 | * 191 | * @return internal XmlResourceParser layout 192 | */ 193 | public static XmlResourceParser getLayout(@NonNull String resName) { 194 | return Resources.getSystem().getLayout(getResourceId(LAYOUT, resName)); 195 | } 196 | 197 | /** 198 | * Pick menu resources from com.android.internal.R.menu 199 | * 200 | * @return internal XmlResourceParser menu 201 | */ 202 | public static XmlResourceParser getMenu(@NonNull String resName) { 203 | return Resources.getSystem().getLayout(getResourceId(MENU, resName)); 204 | } 205 | 206 | /** 207 | * Pick mipmap drawable resources from com.android.internal.R.mipmap 208 | * 209 | * @return internal Drawable mipmap 210 | */ 211 | @SuppressLint("UseCompatLoadingForDrawables") 212 | public static Drawable getMipmap(@NonNull String resName) { 213 | return Resources.getSystem().getDrawable(getResourceId(MIPMAP, resName)); 214 | } 215 | 216 | /** 217 | * Pick mipmap drawable resources from com.android.internal.R.mipmap 218 | * 219 | * @return internal Drawable mipmap 220 | */ 221 | @SuppressLint("UseCompatLoadingForDrawables") 222 | public static Drawable getMipmap(@NonNull String resName, Resources.Theme theme) { 223 | return Resources.getSystem().getDrawable(getResourceId(MIPMAP, resName), theme); 224 | } 225 | 226 | /** 227 | * Pick RAW resources from com.android.internal.R.raw 228 | * 229 | * @return internal InputStream raw 230 | */ 231 | public static InputStream getRaw(@NonNull String resName) { 232 | return Resources.getSystem().openRawResource(getResourceId(RAW, resName)); 233 | } 234 | 235 | /** 236 | * Pick Integer array resources from com.android.internal.R.array 237 | * 238 | * @return internal Integer array 239 | */ 240 | public static int[] getIntArray(@NonNull String resName) { 241 | return Resources.getSystem().getIntArray(getResourceId(ARRAY, resName)); 242 | } 243 | 244 | /** 245 | * Pick String array resources from com.android.internal.R.array 246 | * 247 | * @param resName for example = emailAddressTypes 248 | * @return internal String array 249 | */ 250 | public static String[] getStringArray(@NonNull String resName) { 251 | return Resources.getSystem().getStringArray(getResourceId(ARRAY, resName)); 252 | } 253 | 254 | /** 255 | * Pick string resources from com.android.internal.R.string 256 | * 257 | * @param resName for example = accept, cancel, upload_file, find_on_page 258 | * @return internal String 259 | */ 260 | public static String getString(@NonNull String resName) { 261 | return Resources.getSystem().getString(getResourceId(STRING, resName)); 262 | } 263 | 264 | /** 265 | * Pick XML resources from com.android.internal.R.xml 266 | * 267 | * @return internal XmlResourceParser XML 268 | */ 269 | public static XmlResourceParser getXml(@NonNull String resName) { 270 | return Resources.getSystem().getXml(getResourceId(XML, resName)); 271 | } 272 | 273 | /** 274 | * Check whether a class exists, and do your action when it's return true. 275 | * 276 | * @param className class name with its package, e.g. android.content.Intent 277 | * @return true if the class exists 278 | */ 279 | public static boolean isClassExists(String className) { 280 | try { 281 | Class.forName(className); 282 | return true; 283 | } catch (ClassNotFoundException e) { 284 | return false; 285 | } 286 | } 287 | 288 | /** 289 | * Check whether a method exists within its class. An example for this method is: 290 | *

291 |      * boolean methodExists = InternalAccessor.isMethodExists("android.content.Intent", "putExtra", String.class, Integer.class);
292 |      * if (methodExists){
293 |      *     ...
294 |      * }
295 |      * 
296 | * where putExtra() has two types of parameter, i.e. String and 297 | * Integer. 298 | * If you look at the source code, you'll see that the real method is: putExtra(String 299 | * name, int value). 300 | *

See {@link InternalAccessor#isMethodExists(String, String)}

301 | * 302 | * @param className class name with its package, e.g. android.content.Intent 303 | * @param methodName method name within its class, e.g. putExtra 304 | * @param parameterTypes class of the method's parameter type, e.g. for putExtra(String 305 | * name, int value), 306 | * you should type String.class, Integer.class 307 | * @return true if the method exists, false otherwise or the class 308 | * could not be found 309 | */ 310 | public static boolean isMethodExists(String className, String methodName, 311 | Class... parameterTypes) { 312 | try { 313 | Class cls = Class.forName(className); 314 | cls.getMethod(methodName, parameterTypes); 315 | return true; 316 | } catch (ClassNotFoundException | NoSuchMethodException e) { 317 | return false; 318 | } 319 | } 320 | 321 | /** 322 | * Check whether a method exists without checking its parameter types. This is similar with 323 | * {@link InternalAccessor#isMethodExists(String, String, Class[])} 324 | * 325 | * @param className class name with its package, e.g. android.content.Intent 326 | * @param methodName method name within its class, e.g. putExtra 327 | * @return true if the method exists, false otherwise or the class 328 | * could not be found 329 | */ 330 | public static boolean isMethodExists(String className, String methodName) { 331 | try { 332 | Class cls = Class.forName(className); 333 | for (Method method : cls.getDeclaredMethods()) 334 | if (method.getName().equals(methodName)) 335 | return true; 336 | } catch (ClassNotFoundException e) { 337 | } 338 | return false; 339 | } 340 | 341 | /** 342 | * @deprecated since we don't use Context and Java reflection to get the internal 343 | * resources, so using this 344 | * Builder is redundant. Get them directly without storing to this class or {@link 345 | * ResourcesHolder} 346 | */ 347 | public static class Builder { 348 | 349 | final boolean saveToResourcesHolder; 350 | 351 | ResourcesHolder holder = new ResourcesHolder(); 352 | 353 | /** 354 | * @param saveToResourcesHolder determine whether once we get the value also store it to 355 | * ResourcesHolder automatically. The key for 356 | * every data stored to 357 | * ResourcesHolder always uses 358 | * resName 359 | * argument of the method. 360 | */ 361 | public Builder(boolean saveToResourcesHolder) { 362 | this.saveToResourcesHolder = saveToResourcesHolder; 363 | } 364 | 365 | public ResourcesHolder getResourcesHolder() { 366 | return holder; 367 | } 368 | 369 | /** 370 | * Replacement for {@link InternalAccessor#getAnimation(String)} 371 | */ 372 | public XmlResourceParser getAnimation(@NonNull String resName) { 373 | XmlResourceParser anim = InternalAccessor.getAnimation(resName); 374 | if (saveToResourcesHolder) 375 | holder.put(resName, anim); 376 | return anim; 377 | } 378 | 379 | /** 380 | * Replacement for {@link InternalAccessor#getBoolean(String)} 381 | */ 382 | public boolean getBoolean(@NonNull String resName) { 383 | boolean bol = InternalAccessor.getBoolean(resName); 384 | if (saveToResourcesHolder) 385 | holder.put(resName, bol); 386 | return bol; 387 | } 388 | 389 | /** 390 | * Replacement for {@link InternalAccessor#getColor(String)} 391 | */ 392 | public int getColor(@NonNull String resName) { 393 | int color = InternalAccessor.getColor(resName); 394 | if (saveToResourcesHolder) 395 | holder.put(resName, color); 396 | return color; 397 | } 398 | 399 | /** 400 | * Replacement for {@link InternalAccessor#getDimension(String)} 401 | */ 402 | public float getDimension(@NonNull String resName) { 403 | float dimens = InternalAccessor.getDimension(resName); 404 | if (saveToResourcesHolder) 405 | holder.put(resName, dimens); 406 | return dimens; 407 | } 408 | 409 | /** 410 | * Replacement for {@link InternalAccessor#getDrawable(String)} 411 | */ 412 | public Drawable getDrawable(@NonNull String resName) { 413 | Drawable drawable = InternalAccessor.getDrawable(resName); 414 | if (saveToResourcesHolder) 415 | holder.put(resName, drawable); 416 | return drawable; 417 | } 418 | 419 | /** 420 | * Replacement for {@link InternalAccessor#getFraction(String, int, int)} 421 | */ 422 | public float getFraction(@NonNull String resName, int base, int pbase) { 423 | float fract = InternalAccessor.getFraction(resName, base, pbase); 424 | if (saveToResourcesHolder) 425 | holder.put(resName, fract); 426 | return fract; 427 | } 428 | 429 | /** 430 | * Replacement for {@link InternalAccessor#getInteger(String)} 431 | */ 432 | public int getInteger(@NonNull String resName) { 433 | int integer = InternalAccessor.getInteger(resName); 434 | if (saveToResourcesHolder) 435 | holder.put(resName, integer); 436 | return integer; 437 | } 438 | 439 | /** 440 | * Replacement for {@link InternalAccessor#getLayout(String)} 441 | */ 442 | public XmlResourceParser getLayout(@NonNull String resName) { 443 | XmlResourceParser layout = InternalAccessor.getLayout(resName); 444 | if (saveToResourcesHolder) 445 | holder.put(resName, layout); 446 | return layout; 447 | } 448 | 449 | /** 450 | * Replacement for {@link InternalAccessor#getMenu(String)} 451 | */ 452 | public XmlResourceParser getMenu(@NonNull String resName) { 453 | XmlResourceParser menu = InternalAccessor.getMenu(resName); 454 | if (saveToResourcesHolder) 455 | holder.put(resName, menu); 456 | return menu; 457 | } 458 | 459 | /** 460 | * Replacement for {@link InternalAccessor#getMipmap(String)} 461 | */ 462 | public Drawable getMipmap(@NonNull String resName) { 463 | Drawable mipmap = InternalAccessor.getMipmap(resName); 464 | if (saveToResourcesHolder) 465 | holder.put(resName, mipmap); 466 | return mipmap; 467 | } 468 | 469 | /** 470 | * Replacement for {@link InternalAccessor#getRaw(String)} 471 | */ 472 | public InputStream getRaw(@NonNull String resName) { 473 | InputStream stream = InternalAccessor.getRaw(resName); 474 | if (saveToResourcesHolder) 475 | holder.put(resName, stream); 476 | return stream; 477 | } 478 | 479 | /** 480 | * Replacement for {@link InternalAccessor#getIntArray(String)} 481 | */ 482 | public int[] getIntArray(@NonNull String resName) { 483 | int[] ints = InternalAccessor.getIntArray(resName); 484 | if (saveToResourcesHolder) 485 | holder.put(resName, ints); 486 | return ints; 487 | } 488 | 489 | /** 490 | * Replacement for {@link InternalAccessor#getStringArray(String)} 491 | */ 492 | public String[] getStringArray(@NonNull String resName) { 493 | String[] strings = InternalAccessor.getStringArray(resName); 494 | if (saveToResourcesHolder) 495 | holder.put(resName, strings); 496 | return strings; 497 | } 498 | 499 | /** 500 | * Replacement for {@link InternalAccessor#getString(String)} 501 | */ 502 | public String getString(@NonNull String resName) { 503 | String string = InternalAccessor.getString(resName); 504 | if (saveToResourcesHolder) 505 | holder.put(resName, string); 506 | return string; 507 | } 508 | 509 | /** 510 | * Replacement for {@link InternalAccessor#getXml(String)} 511 | */ 512 | public XmlResourceParser getXml(@NonNull String resName) { 513 | XmlResourceParser xml = InternalAccessor.getXml(resName); 514 | if (saveToResourcesHolder) 515 | holder.put(resName, xml); 516 | return xml; 517 | } 518 | } 519 | } 520 | -------------------------------------------------------------------------------- /resources-helper/src/main/java/com/anggrayudi/hiddenapi/ResourcesHolder.java: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Parcel; 6 | import android.os.Parcelable; 7 | import android.util.Log; 8 | 9 | import androidx.annotation.NonNull; 10 | import androidx.localbroadcastmanager.content.LocalBroadcastManager; 11 | 12 | import java.util.Arrays; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | import java.util.Set; 16 | import java.util.TreeMap; 17 | 18 | /** 19 | * Created by Anggrayudi on 11/03/2016.

20 | * Since version 0.0.5 the uses of this class is diverted. You don't need to avoid Java reflection by storing 21 | * the internal resources you just retrieved to {@link ResourcesHolder} and send them via Broadcast, because this version 22 | * does not use Java reflection anymore. Instead, you can use this class to store any objects you 23 | * might need in other classes (like passing objects from activity to service) and send them via Broadcast. 24 | *


25 | *

Obsolete documentation (v0.0.4 and lower)

26 | * A class that holds internal resources which are retrieved by {@link InternalAccessor}. 27 | * We need to hold the resources we just retrieved, because InternalAccessor uses reflection, 28 | * and Java reflection may slow down user's machine performance. Using reflection every time you reflect the 29 | * same value is not a good practice. So, use this class instead. 30 | *

Also, you can use this class to holds non-internal resources, according to your needs. 31 | * 32 | *

An example to use this class is: 33 | *

 34 |  *     ResourcesHolder holder = new ResourcesHolder()
 35 |  *              .putString("my_string_key", InternalAccessor.getString("accept"))
 36 |  *              .putResourceId("my_res_id_key", InternalAccessor.getResourceId("drawable", "loading_tile_android");
 37 |  *
 38 |  *     // Retrieve the values from another place
 39 |  *     holder.getString("my_string_key");
 40 |  *     holder.getResourceId("my_res_id_key");
 41 |  *
 42 |  *     // If you plan to send 'holder' to another class via BroadcastReceiver or LocalBroadcastManager
 43 |  *     Intent intent = new Intent(ResourcesHolder.ACTION_SEND_RESOURCES_HOLDER);
 44 |  *     intent.putExtra("holder", holder);
 45 |  *
 46 |  *     // send via LocalBroadcastManager
 47 |  *     LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
 48 |  *
 49 |  *     // send via BroadcastReceiver
 50 |  *     sendBroadcast(intent);
 51 |  *
 52 |  *     // Instead, you can do this in simple way
 53 |  *     holder.sendBroadcast(this, "holder");
 54 |  *     // or with this
 55 |  *     holder.sendViaLocalBroadcastManager(this, "holder");
 56 |  * 
57 | */ 58 | public class ResourcesHolder implements Parcelable { 59 | public static final String ACTION_SEND_RESOURCES_HOLDER = "com.anggrayudi.hiddenapi.ACTION_SEND_RESOURCES_HOLDER"; 60 | public static final Creator CREATOR = new Creator() { 61 | @Override 62 | public ResourcesHolder createFromParcel(Parcel in) { 63 | return new ResourcesHolder(in); 64 | } 65 | 66 | @Override 67 | public ResourcesHolder[] newArray(int size) { 68 | return new ResourcesHolder[size]; 69 | } 70 | }; 71 | private static final String TAG = "ResourcesHolder"; 72 | private HashMap mValues = new HashMap<>(); 73 | 74 | public ResourcesHolder() { 75 | } 76 | 77 | @SuppressWarnings("unchecked") 78 | private ResourcesHolder(Parcel in) { 79 | mValues = (HashMap) in.readValue(HashMap.class.getClassLoader()); 80 | } 81 | 82 | public ResourcesHolder put(String key, short value) { 83 | mValues.put(key, value); 84 | return this; 85 | } 86 | 87 | public ResourcesHolder put(String key, byte value) { 88 | mValues.put(key, value); 89 | return this; 90 | } 91 | 92 | public ResourcesHolder put(String key, char value) { 93 | mValues.put(key, value); 94 | return this; 95 | } 96 | 97 | public ResourcesHolder put(String key, boolean value) { 98 | mValues.put(key, value); 99 | return this; 100 | } 101 | 102 | public ResourcesHolder put(String key, int value) { 103 | mValues.put(key, value); 104 | return this; 105 | } 106 | 107 | public ResourcesHolder put(String key, long value) { 108 | mValues.put(key, value); 109 | return this; 110 | } 111 | 112 | public ResourcesHolder put(String key, float value) { 113 | mValues.put(key, value); 114 | return this; 115 | } 116 | 117 | public ResourcesHolder put(String key, double value) { 118 | mValues.put(key, value); 119 | return this; 120 | } 121 | 122 | public ResourcesHolder put(String key, String value) { 123 | mValues.put(key, value); 124 | return this; 125 | } 126 | 127 | /** 128 | * An additional method to holds an Object, for non-primitive data types. For example 129 | * Drawable, XmlResourceParser, etc. To retrieve it back to the original object, 130 | * cast it to its origin class. You also can store an array here. An example of using this method is: 131 | *
132 |      *  List<String> strs = new ArrayList<>();
133 |      *  strs.add("FOO");
134 |      *  strs.add("BXY");
135 |      *
136 |      *  Person[] persons = {new Person(), null, new Person()};
137 |      *
138 |      *  XmlResourceParser parser = getResources().getXml(R.xml.preferences);
139 |      *
140 |      *  ResourcesHolder holder = new ResourcesHolder()
141 |      *      .put("arrayInt", new int[]{9, 8, 5})
142 |      *      .put("arrayStringList", strs)
143 |      *      .put("arrayPerson", persons)
144 |      *      .put("my_parser", parser);
145 |      *
146 |      *  // Then, retrieve them back to the original form
147 |      *  int[] ints = holder.getAsIntArray("arrayInt");
148 |      *  //noinspection unchecked
149 |      *  strs = (List<String>) holder.getAsObject("arrayStringList");
150 |      *  // cast them to the original class
151 |      *  persons = (Person[]) holder.getAsObject("arrayPerson");
152 |      *  parser = (XmlResourceParser) holder.getAsObject("my_parser");
153 |      * 
154 | */ 155 | public ResourcesHolder put(String key, Object object) { 156 | mValues.put(key, object); 157 | return this; 158 | } 159 | 160 | public short getAsShort(String key) { 161 | return isCompatibleCast(key, Short.class) ? (short) mValues.get(key) : 0; 162 | } 163 | 164 | public byte getAsByte(String key) { 165 | return isCompatibleCast(key, Byte.class) ? (byte) mValues.get(key) : 0; 166 | } 167 | 168 | public char getAsChar(String key) { 169 | return isCompatibleCast(key, Character.class) ? (char) mValues.get(key) : '\u0000'; 170 | } 171 | 172 | public boolean getAsBoolean(String key) { 173 | return isCompatibleCast(key, Boolean.class) && (boolean) mValues.get(key); 174 | } 175 | 176 | /** 177 | * Some resources use this data type, they are color, resourceId and integerResource. 178 | * You also can get any integer here. 179 | */ 180 | public int getAsInteger(String key) { 181 | return isCompatibleCast(key, Integer.class) ? (int) mValues.get(key) : 0; 182 | } 183 | 184 | public long getAsLong(String key) { 185 | return isCompatibleCast(key, Long.class) ? (long) mValues.get(key) : 0; 186 | } 187 | 188 | /** 189 | * Some resources use this data type, they are dimension and fraction. 190 | * You also can get any float here. 191 | */ 192 | public float getAsFloat(String key) { 193 | return isCompatibleCast(key, Float.class) ? (float) mValues.get(key) : 0; 194 | } 195 | 196 | public double getAsDouble(String key) { 197 | return isCompatibleCast(key, Double.class) ? (double) mValues.get(key) : 0; 198 | } 199 | 200 | public String getAsString(String key) { 201 | return isCompatibleCast(key, String.class) ? (String) mValues.get(key) : null; 202 | } 203 | 204 | public short[] getAsShortArray(String key) { 205 | return isCompatibleCast(key, short[].class) ? (short[]) mValues.get(key) : null; 206 | } 207 | 208 | public byte[] getAsByteArray(String key) { 209 | return isCompatibleCast(key, byte[].class) ? (byte[]) mValues.get(key) : null; 210 | } 211 | 212 | public char[] getAsCharArray(String key) { 213 | return isCompatibleCast(key, char[].class) ? (char[]) mValues.get(key) : null; 214 | } 215 | 216 | public boolean[] getAsBooleanArray(String key) { 217 | return isCompatibleCast(key, boolean[].class) ? (boolean[]) mValues.get(key) : null; 218 | } 219 | 220 | public int[] getAsIntArray(String key) { 221 | return isCompatibleCast(key, int[].class) ? (int[]) mValues.get(key) : null; 222 | } 223 | 224 | public long[] getAsLongArray(String key) { 225 | return isCompatibleCast(key, long[].class) ? (long[]) mValues.get(key) : null; 226 | } 227 | 228 | public float[] getAsFloatArray(String key) { 229 | return isCompatibleCast(key, float[].class) ? (float[]) mValues.get(key) : null; 230 | } 231 | 232 | public double[] getAsDoubleArray(String key) { 233 | return isCompatibleCast(key, double[].class) ? (double[]) mValues.get(key) : null; 234 | } 235 | 236 | public String[] getAsStringArray(String key) { 237 | return isCompatibleCast(key, String[].class) ? (String[]) mValues.get(key) : null; 238 | } 239 | 240 | /** 241 | * Get any values that is stored as Object, i.e. for non-primitive data types. 242 | * They can be an array or an instance from a class. 243 | */ 244 | public Object getAsObject(String key) { 245 | return mValues.get(key); 246 | } 247 | 248 | /** 249 | * This method equals with {@link Context#sendBroadcast(Intent)}. Notice that the Intent 250 | * uses {@link ResourcesHolder#ACTION_SEND_RESOURCES_HOLDER} action. So that, register your 251 | * BroadcastReceiver with that action to make it able to receive the extra from Intent. 252 | *

See {@link ResourcesHolder#sendViaLocalBroadcastManager(Context, String)}

253 | * 254 | * @param key key for the Intent 255 | */ 256 | public void sendBroadcast(Context context, @NonNull String key) { 257 | Intent intent = new Intent(ACTION_SEND_RESOURCES_HOLDER); 258 | intent.putExtra(key, this); 259 | context.sendBroadcast(intent); 260 | } 261 | 262 | /** 263 | * Send ResourcesHolder instance to another class via LocalBroadcastManager. 264 | * Make sure that the BroadcastReceiver is registered with 265 | * {@link ResourcesHolder#ACTION_SEND_RESOURCES_HOLDER} action. 266 | * 267 | * @param key key for the Intent 268 | */ 269 | public void sendViaLocalBroadcastManager(Context context, @NonNull String key) { 270 | Intent intent = new Intent(ACTION_SEND_RESOURCES_HOLDER); 271 | intent.putExtra(key, this); 272 | LocalBroadcastManager.getInstance(context).sendBroadcast(intent); 273 | } 274 | 275 | /** 276 | * Clear all values that is saved in this class. 277 | */ 278 | public void clear() { 279 | mValues.clear(); 280 | } 281 | 282 | public int size() { 283 | return mValues.size(); 284 | } 285 | 286 | public boolean containsKey(String key) { 287 | return mValues.containsKey(key); 288 | } 289 | 290 | /** 291 | * Remove a value by key. 292 | */ 293 | public void remove(String key) { 294 | mValues.remove(key); 295 | } 296 | 297 | /** 298 | * Sort ResourcesHolder by keys. 299 | * 300 | * @param descending or set to false to make it ascending 301 | */ 302 | public void sort(boolean descending) { 303 | TreeMap treeMap = new TreeMap<>(mValues); 304 | if (descending) { 305 | treeMap.descendingMap(); 306 | } 307 | mValues.clear(); 308 | mValues.putAll(treeMap); 309 | } 310 | 311 | /** 312 | * Returns a set of all of the keys and values 313 | * 314 | * @return a set of all of the keys and values 315 | */ 316 | public Set> valueSet() { 317 | return mValues.entrySet(); 318 | } 319 | 320 | /** 321 | * Returns a set of all of the keys 322 | * 323 | * @return a set of all of the keys 324 | */ 325 | public Set keySet() { 326 | return mValues.keySet(); 327 | } 328 | 329 | /** 330 | * Print all values that is saved via put*(Key, Value) method. 331 | */ 332 | public void printAll() { 333 | for (Map.Entry entry : mValues.entrySet()) { 334 | 335 | Object value = entry.getValue(); 336 | String toPrint = value.toString(); 337 | 338 | if (value.getClass().isArray()) { 339 | if (value instanceof boolean[]) 340 | toPrint = Arrays.toString((boolean[]) value); 341 | else if (value instanceof int[]) 342 | toPrint = Arrays.toString((int[]) value); 343 | else if (value instanceof long[]) 344 | toPrint = Arrays.toString((long[]) value); 345 | else if (value instanceof float[]) 346 | toPrint = Arrays.toString((float[]) value); 347 | else if (value instanceof double[]) 348 | toPrint = Arrays.toString((double[]) value); 349 | else if (value instanceof String[]) 350 | toPrint = Arrays.toString((String[]) value); 351 | else if (value instanceof short[]) 352 | toPrint = Arrays.toString((short[]) value); 353 | else if (value instanceof byte[]) 354 | toPrint = Arrays.toString((byte[]) value); 355 | else if (value instanceof char[]) 356 | toPrint = Arrays.toString((char[]) value); 357 | } 358 | Log.d(TAG, "key = " + entry.getKey() + ", value = " + toPrint); 359 | } 360 | } 361 | 362 | /** 363 | * Determine whether an Object is able to be casted to another class. 364 | * 365 | * @return true if the object is able to be casted. 366 | */ 367 | private boolean isCompatibleCast(String key, Class classToCast) { 368 | Object obj = mValues.get(key); 369 | try { 370 | if (mValues.get(key) instanceof Number && obj == null) { 371 | Log.e(TAG, "Cannot cast null value to a " + classToCast.getSimpleName() + " number format."); 372 | return false; 373 | } 374 | 375 | classToCast.cast(obj); 376 | return true; 377 | } catch (ClassCastException e) { 378 | Log.e(TAG, "Cannot cast object value from " + obj + " to " + classToCast.getSimpleName() + " for key '" + key + "'", e); 379 | return false; 380 | } 381 | } 382 | 383 | @Override 384 | public int describeContents() { 385 | return 0; 386 | } 387 | 388 | @Override 389 | public void writeToParcel(Parcel dest, int flags) { 390 | dest.writeValue(mValues); 391 | } 392 | } 393 | -------------------------------------------------------------------------------- /resources-helper/src/test/java/com/anggrayudi/hiddenapi/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi 2 | 3 | import org.junit.Assert 4 | import org.junit.Test 5 | 6 | /** 7 | * Example local unit test, which will execute on the development machine (host). 8 | * 9 | * @see [Testing documentation](http://d.android.com/tools/testing) 10 | */ 11 | class ExampleUnitTest { 12 | 13 | @Test 14 | fun addition_isCorrect() { 15 | Assert.assertEquals(4, 2 + 2.toLong()) 16 | } 17 | } -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | 5 | android { 6 | namespace 'com.anggrayudi.hiddenapi.sample' 7 | 8 | defaultConfig { 9 | multiDexEnabled true 10 | } 11 | 12 | signingConfigs { 13 | debug { 14 | keyAlias 'androiddebugkey' 15 | keyPassword 'android' 16 | storePassword 'android' 17 | storeFile file("${System.properties['user.home']}${File.separator}.android${File.separator}debug.keystore") 18 | } 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | signingConfig signingConfigs.debug 26 | } 27 | } 28 | 29 | lintOptions { 30 | abortOnError false 31 | } 32 | 33 | buildFeatures { 34 | viewBinding = true 35 | } 36 | 37 | flavorDimensions = ["librarySource"] 38 | productFlavors { 39 | local { 40 | dimension "librarySource" 41 | getIsDefault().set(true) 42 | } 43 | maven { 44 | dimension "librarySource" 45 | configurations.all { 46 | // Check for updates every build 47 | resolutionStrategy.cacheChangingModulesFor 0, 'seconds' 48 | } 49 | } 50 | } 51 | } 52 | 53 | dependencies { 54 | // Testing 55 | testImplementation 'junit:junit:4.13.2' 56 | 57 | implementation fileTree(dir: 'libs', include: ['*.jar']) 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 59 | implementation 'androidx.multidex:multidex:2.0.1' 60 | implementation 'androidx.appcompat:appcompat:1.7.0' 61 | implementation "androidx.core:core-ktx:1.15.0" 62 | implementation 'com.jakewharton.timber:timber:5.0.1' 63 | 64 | implementation project(':resources-helper') 65 | // If you want to modify this library's source code, set build variant to 'local'. 66 | // localImplementation project(':resources-helper') 67 | // mavenImplementation("com.anggrayudi:android-hidden-api:$VERSION_NAME") { changing = true } 68 | } -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 10 | 11 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sample/src/main/java/com/anggrayudi/hiddenapi/sample/Adapter.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.BaseAdapter 8 | import android.widget.TextView 9 | 10 | /** Created by Anggrayudi on 11/03/2016. */ 11 | class Adapter(private val models: List = emptyList()) : BaseAdapter() { 12 | 13 | private class ViewHolder(val source: TextView, val result: TextView, val desc: TextView) 14 | 15 | override fun getCount() = models.size 16 | 17 | override fun getItem(position: Int) = models[position] 18 | 19 | override fun getItemId(position: Int) = position.toLong() 20 | 21 | override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { 22 | var view = convertView 23 | if (view == null) { 24 | val inflater = 25 | parent.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater 26 | view = inflater.inflate(R.layout.list_layout, parent, false) 27 | view.tag = 28 | ViewHolder( 29 | view.findViewById(R.id.source), 30 | view.findViewById(R.id.result), 31 | view.findViewById(R.id.desc), 32 | ) 33 | } 34 | val holder = view!!.tag as ViewHolder 35 | val (source, result, description) = models[position] 36 | holder.source.text = source 37 | holder.result.visibility = if (result.isNullOrEmpty()) View.GONE else View.VISIBLE 38 | holder.result.text = "Result = $result" 39 | holder.desc.visibility = if (description.isNullOrEmpty()) View.GONE else View.VISIBLE 40 | holder.desc.text = description 41 | return view 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/src/main/java/com/anggrayudi/hiddenapi/sample/App.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | import androidx.multidex.MultiDexApplication 4 | import timber.log.Timber 5 | 6 | /** 7 | * Created on 17/01/25 8 | * 9 | * @author Anggrayudi Hardiannico A. 10 | */ 11 | class App : MultiDexApplication() { 12 | 13 | override fun onCreate() { 14 | super.onCreate() 15 | Timber.plant(Timber.DebugTree()) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sample/src/main/java/com/anggrayudi/hiddenapi/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | // import android.net.wifi.WifiLinkLayerStats 4 | import android.content.Intent 5 | import android.net.Uri 6 | import android.os.Build 7 | import android.os.Bundle 8 | import android.text.Editable 9 | import android.view.MenuItem 10 | import android.widget.AdapterView.OnItemClickListener 11 | import androidx.appcompat.app.AppCompatActivity 12 | import com.anggrayudi.hiddenapi.InternalAccessor 13 | import com.anggrayudi.hiddenapi.sample.databinding.ActivityMainBinding 14 | import timber.log.Timber 15 | 16 | /** 17 | * Created by Anggrayudi on 11/03/2016. 18 | * 19 | * An example class for Hidden API. 20 | * 21 | * If you plan to use only Android internal resources rather than internal classes or methods, just 22 | * add

`compile 'com.anggrayudi:android-hidden-api:30.0'`

library to your app's 23 | * module without need to replace `android.jar`. This version does not use Java reflection anymore, 24 | * and certainly safe. See the [Usage](https://github.com/anggrayudi/android-hidden-api#usage). 25 | */ 26 | class MainActivity : AppCompatActivity() { 27 | 28 | private lateinit var binding: ActivityMainBinding 29 | 30 | override fun onCreate(savedInstanceState: Bundle?) { 31 | super.onCreate(savedInstanceState) 32 | binding = ActivityMainBinding.inflate(layoutInflater) 33 | setContentView(binding.root) 34 | setSupportActionBar(binding.toolbar) 35 | supportActionBar?.setDisplayHomeAsUpEnabled(true) 36 | 37 | // Test if Editable included in custom android.jar 38 | var editable: Editable 39 | 40 | val items = 41 | mutableListOf( 42 | // Model( 43 | // /* 44 | // formatShortElapsedTime method will show error 'Cannot resolve 45 | // symbol' 46 | // if you don't use custom android.jar 47 | // Since custom android.jar v28, some methods are no longer 48 | // accessible. I 49 | // don't know why. 50 | // Android Studio will say, "formatShortElapsedTime has private 51 | // access". 52 | // A workaround is you HAVE TO copy this static method into your own 53 | // code. 54 | // */ 55 | // "Formatter.formatShortElapsedTime(this, 100000000)", 56 | // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 57 | // Formatter.formatShortElapsedTime(this, 100000000) else null, 58 | // """ 59 | // Accessing hidden method. This method only available for API 21+. 60 | // If 61 | // you run it on a device with API 20 and lower, 62 | // you'll get java.lang.NoSuchMethodError exception. 63 | // """.trimIndent() 64 | // ), 65 | Model( 66 | "com.android.internal.R.string.accept", 67 | description = 68 | "Accessing hidden String resource. We cannot access internal resources directly. " + 69 | "Sometimes, IDE says 'error: cannot find symbol variable accept' " + 70 | "once you run the app, or your app picks wrong resource id. If you want to have the internal resources, " + 71 | "copy them to your project or use InternalAccessor utility class. Below are the example.", 72 | ), 73 | Model( 74 | "InternalAccessor.getString(\"accept\")", 75 | InternalAccessor.getString("accept"), 76 | "Accessing hidden String resource. Because above method is not working, " + 77 | "so we need to use InternalAccessor.getString() method.", 78 | ), 79 | ) 80 | items.add( 81 | Model( 82 | "InternalAccessor.getDimension(\"status_bar_height\")", 83 | InternalAccessor.getDimension("status_bar_height").toString(), 84 | "Accessing hidden dimension resource.", 85 | ) 86 | ) 87 | items.add( 88 | Model( 89 | "InternalAccessor.getColor(\"config_defaultNotificationColor\")", 90 | InternalAccessor.getColor("config_defaultNotificationColor").toString(), 91 | "Accessing hidden color resource.", 92 | ) 93 | ) 94 | items.add( 95 | Model( 96 | "Info", 97 | description = 98 | "For more information, download this app's source code on " + 99 | "https://github.com/anggrayudi/android-hidden-api", 100 | ) 101 | ) 102 | 103 | binding.listView.adapter = Adapter(items) 104 | binding.listView.onItemClickListener = OnItemClickListener { _, _, position, _ -> 105 | if (position == items.size - 1) { 106 | startActivity( 107 | Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/anggrayudi/android-hidden-api")) 108 | ) 109 | } 110 | } 111 | 112 | if (Build.VERSION.SDK_INT >= 22) { 113 | /* 114 | Accessing WifiLinkLayerStats that is a hidden class. 115 | If you want to find out which API was built to, just type method, resource or class name 116 | to search box on http://jcs.mobile-utopia.com/servlet/Source?type=s&q=WifiLinkLayerStats 117 | And then, look at 'Category' column. 118 | 119 | WifiLinkLayerStats method will show error 'Cannot resolve symbol' if you don't use custom android.jar 120 | For source code: http://jcs.mobile-utopia.com/jcs/7601_WifiLinkLayerStats.java 121 | */ 122 | // var wifiLinkLayer: WifiLinkLayerStats 123 | } 124 | 125 | // If you want to check whether WifiLinkLayerStats exists without checking API level, you 126 | // can 127 | // call: 128 | val isClassExists = InternalAccessor.isClassExists("android.net.wifi.WifiLinkLayerStats") 129 | Timber.d("isClassExists = $isClassExists") 130 | 131 | // Check whether a method exists 132 | val isMethodExists = InternalAccessor.isMethodExists("android.content.Intent", "getExtra") 133 | Timber.d("isMethodExists = $isMethodExists") 134 | 135 | // This will retrieve resource id named accelerate_cubic in 136 | // com.android.internal.R.interpolator 137 | // class. 138 | Timber.d( 139 | "interpolator.accelerate_cubic = %s", 140 | InternalAccessor.getResourceId(InternalAccessor.INTERPOLATOR, "accelerate_cubic"), 141 | ) 142 | Timber.d( 143 | "plurals.duration_hours = %s", 144 | InternalAccessor.getResourceId(InternalAccessor.PLURALS, "last_num_days"), 145 | ) 146 | Timber.d( 147 | "transition.no_transition = %s", 148 | InternalAccessor.getResourceId(InternalAccessor.TRANSITION, "no_transition"), 149 | ) 150 | 151 | /* 152 | DEPRECATED EXAMPLE OF InternalAccessor.Builder 153 | 154 | // Using InternalAccessor with other code styling 155 | InternalAccessor.Builder builder = new InternalAccessor.Builder(true); 156 | boolean b = builder.getBoolean("config_sip_wifi_only"); 157 | String accept = builder.getString("accept"); 158 | 159 | // Because we set true to 'saveToResourcesHolder' in the Builder constructor, every value we got always 160 | // saved to ResourcesHolder automatically. We can retrieve the holder now: 161 | ResourcesHolder accessorHolder = builder.getResourcesHolder(); 162 | b = accessorHolder.getAsBoolean("config_sip_wifi_only"); 163 | accept = accessorHolder.getAsString("accept"); 164 | */ 165 | } 166 | 167 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 168 | if (item.itemId == android.R.id.home) finish() 169 | return super.onOptionsItemSelected(item) 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /sample/src/main/java/com/anggrayudi/hiddenapi/sample/Model.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | /** Created by Anggrayudi on 11/03/2016. */ 4 | data class Model(val source: String, val result: String? = null, val description: String? = null) 5 | -------------------------------------------------------------------------------- /sample/src/main/java/com/anggrayudi/hiddenapi/sample/Receiver.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | import android.content.BroadcastReceiver 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.widget.Toast 7 | import androidx.core.content.IntentCompat 8 | import com.anggrayudi.hiddenapi.ResourcesHolder 9 | 10 | /** Created by Anggrayudi on 12/03/2016. */ 11 | class Receiver : BroadcastReceiver() { 12 | 13 | override fun onReceive(context: Context, intent: Intent) { 14 | Toast.makeText(context, "ResourceHolder is received. See detail on LogCat.", Toast.LENGTH_SHORT) 15 | .show() 16 | val holder = 17 | IntentCompat.getParcelableExtra(intent, "holder", ResourcesHolder::class.java) ?: return 18 | holder.sort(true) 19 | holder.printAll() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 24 | 25 | 32 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/list_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | 25 | 26 | 33 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anggrayudi/android-hidden-api/773d56dc82a162d342a9efd43c4d64fb23d515c8/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #795548 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hidden APIs 3 | These are example from hidden API. To view the usage for 4 | hidden class, see the code in MainActivity. 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sample/src/test/java/com/anggrayudi/hiddenapi/sample/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.anggrayudi.hiddenapi.sample 2 | 3 | import org.junit.Assert 4 | import org.junit.Test 5 | 6 | /** 7 | * Example local unit test, which will execute on the development machine (host). 8 | * 9 | * @see [Testing documentation](http://d.android.com/tools/testing) 10 | */ 11 | class ExampleUnitTest { 12 | 13 | @Test 14 | fun addition_isCorrect() { 15 | Assert.assertEquals(4, 2 + 2.toLong()) 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':resources-helper', ':sample' --------------------------------------------------------------------------------