Name Date Size #Lines LOC

..--

library/src/main/java/org/lsposed/hiddenapibypass/H25-Apr-2025-525379

local_modifications/org/lsposed/hiddenapibypass/library/H25-Apr-2025-104

stub/src/main/java/dalvik/system/H25-Apr-2025-108

BUILD.gnH A D25-Apr-2025883 3025

LICENSEH A D25-Apr-202511.1 KiB202169

README.chromiumH A D25-Apr-2025552 1916

README.mdH A D25-Apr-20253.3 KiB8570

README.chromium

1Name: AndroidHiddenApiBypass
2URL: https://github.com/LSPosed/AndroidHiddenApiBypass
3Version: b16cc3934a27e55e51f00f5504c7f49e7c8cfab7
4Revision: b16cc3934a27e55e51f00f5504c7f49e7c8cfab7
5License: Apache-2.0
6License File: LICENSE
7Security Critical: no
8Shipped: no
9
10Description:
11AndroidHiddenApiBypass enables reflection on APIs that are meant to be guarded
12by Android's API Blocklist.
13
14Local Modifications:
15* Removed files related to Gradle.
16* Added local_modifications/.../BuildConfig.java to replace what Gradle would
17  have generated.
18* Added BUILD.gn
19

README.md

1# AndroidHiddenApiBypass
2
3[![Android CI status](https://github.com/LSPosed/AndroidHiddenApiBypass/actions/workflows/android.yml/badge.svg?branch=main)](https://github.com/LSPosed/AndroidHiddenApiBypass/actions/workflows/android.yml)
4
5Bypass restrictions on non-SDK interfaces.
6
7## Why AndroidHiddenApiBypass?
8
9- Pure Java: no native code used.
10- Reliable: does not rely on specific behaviors, so it will not be blocked like meta-reflection or `dexfile`.
11- Stable: `unsafe`, art structs and `setHiddenApiExemptions` are stable APIs.
12
13[How it works (Chinese)](https://lovesykun.cn/archives/android-hidden-api-bypass.html)
14
15## Integration
16
17Gradle:
18
19```gradle
20repositories {
21    mavenCentral()
22}
23dependencies {
24    implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
25}
26```
27
28## Usage
29
301. Invoke a restricted method:
31    ```java
32    HiddenApiBypass.invoke(ApplicationInfo.class, new ApplicationInfo(), "usesNonSdkApi"/*, args*/)
33    ```
341. Invoke restricted constructor:
35    ```java
36    Object instance = HiddenApiBypass.newInstance(Class.forName("android.app.IActivityManager$Default")/*, args*/);
37    ```
381. Get all methods including restricted ones from a class:
39    ```java
40    var allMethods = HiddenApiBypass.getDeclaredMethods(ApplicationInfo.class);
41    ((Method).stream(allMethods).filter(e -> e.getName().equals("usesNonSdkApi")).findFirst().get()).invoke(new ApplicationInfo());
42    ```
431. Get all non-static fields including restricted ones from a class:
44    ```java
45    var allInstanceFields = HiddenApiBypass.getInstanceFields(ApplicationInfo.class);
46    ((Method).stream(allInstanceFields).filter(e -> e.getName().equals("longVersionCode")).findFirst().get()).get(new ApplicationInfo());
47    ```
481. Get all static fields including restricted ones from a class:
49    ```java
50    var allStaticFields = HiddenApiBypass.getStaticFields(ApplicationInfo.class);
51    ((Method).stream(allInstanceFields).filter(e -> e.getName().equals("HIDDEN_API_ENFORCEMENT_DEFAULT")).findFirst().get()).get(null);
52    ```
531. Get specific class method or class constructor
54    ```java
55    var ctor = HiddenApiBypass.getDeclaredConstructor(ClipDrawable.class /*, args */);
56    var method = HiddenApiBypass.getDeclaredMethod(ApplicationInfo.class, "getHiddenApiEnforcementPolicy" /*, args */);
57    ```
581. Add a class to exemption list:
59    ```java
60    HiddenApiBypass.addHiddenApiExemptions(
61        "Landroid/content/pm/ApplicationInfo;", // one specific class
62        "Ldalvik/system" // all classes in packages dalvik.system
63        "Lx" // all classes whose full name is started with x
64    );
65    ```
66    if you are going to add all classes to exemption list, just leave an empty prefix:
67    ```java
68    HiddenApiBypass.addHiddenApiExemptions("");
69    ```
70## License
71
72    Copyright 2021 LSPosed
73
74    Licensed under the Apache License, Version 2.0 (the "License");
75    you may not use this file except in compliance with the License.
76    You may obtain a copy of the License at
77
78        https://www.apache.org/licenses/LICENSE-2.0
79
80    Unless required by applicable law or agreed to in writing, software
81    distributed under the License is distributed on an "AS IS" BASIS,
82    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83    See the License for the specific language governing permissions and
84    limitations under the License.
85