fix(android): stop using deprecated hasPermission to read Cordova prefs - #8550
Merged
OS-ruimoreiramendes merged 8 commits intoAug 7, 2026
Merged
Conversation
OS-ruimoreiramendes
marked this pull request as ready for review
August 5, 2026 15:50
OS-ruimoreiramendes
requested review from
ItsChaceD,
OS-pedrogustavobilro,
alexgerardojacinto,
andredestro,
markemer and
theproducer
August 5, 2026 15:51
OS-pedrogustavobilro
approved these changes
Aug 7, 2026
OS-ruimoreiramendes
deleted the
fix/RMET-5358/deprecated-haspermission-android
branch
August 7, 2026 12:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Bridge.isDeployDisabled()andBridge.shouldKeepRunning()usedPlugin.hasPermission(String), adeprecated Android permission API to fetch the Cordova
DisableDeployandKeepRunningpreferencesfrom the internal
CordovaPlugin. Those strings are not Android permissions, they are Cordovaconfig.xmlpreferences.Introduce a small
CordovaBridgeConfiginterface incom.getcapacitor, implemented byCordovaPlugin(incapacitor-cordova-android). The Bridge now queries the plugin instance viainstanceofand reads the preferences through the interface. The misleadinghasPermissionoverride inCordovaPluginis removed.ref: https://outsystemsrd.atlassian.net/browse/RMET-5358
Change Type
Rationale / Problems Fixed
Plugin.hasPermission(String)has been@Deprecatedfor a while and is meant for Android runtime permissions, not for reading arbitrary configuration values. TheCordovaPluginwas overriding it to intercept two strings (DisableDeploy,KeepRunning) and route them topreferences.getBoolean(), which does not match the API's intent and produces deprecation warnings at both call sites in Bridge.The new
CordovaBridgeConfiginterface:isDeployDisabled,shouldKeepRunning)capacitor-androiddoes not depend oncapacitor-cordova-android, so the interface acts as the bridge between themTests or Reproductions
Validated using
capacitor-testappwith runtime validation. A Cordova plugin was registered andconfig.xmlpreferences set:Bridge returned
isDeployDisabled=true,shouldKeepRunning=falsemeaning values read correctly through the interface. Fallback path (no Cordova plugin registered) returns false for both, matching prior behavior.Platforms Affected