Skip to content

Commit

Permalink
Fixed: Catch exceptions if failed to bypass hidden API restrictions
Browse files Browse the repository at this point in the history
Attempting to bypass restrictions while tests are running will fail due to call to `TermuxApplication.onCreate()` -> `TermuxShellEnvironment.init()` -> `SELinuxUtils.getContext()`
  • Loading branch information
agnostic-apollo committed Jun 13, 2022
1 parent 162469f commit b80126f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ public class ReflectionUtils {
public static void bypassHiddenAPIReflectionRestrictions() {
if (!HIDDEN_API_REFLECTION_RESTRICTIONS_BYPASSED && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Logger.logDebug(LOG_TAG, "Bypassing android hidden api reflection restrictions");
HiddenApiBypass.addHiddenApiExemptions("");
try {
HiddenApiBypass.addHiddenApiExemptions("");
} catch (Throwable t) {
Logger.logStackTraceWithMessage(LOG_TAG, "Failed to bypass hidden API reflection restrictions", t);
}

HIDDEN_API_REFLECTION_RESTRICTIONS_BYPASSED = true;
}
}
Expand Down

0 comments on commit b80126f

Please sign in to comment.