Package brut.androlib.res.xml
Class ResXmlPatcher
java.lang.Object
brut.androlib.res.xml.ResXmlPatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAny @string reference in a provider value in AndroidManifest.xml will break on build, thus preventing the application from installing.static voidmodNetworkSecurityConfig(File file) Creates a modified network security config file that is more permissivestatic StringpullValueFromIntegers(File directory, String key) Finds key in integers.xml file and returns text valuestatic StringpullValueFromStrings(File directory, String key) Finds key in strings.xml file and returns text valuestatic voidRemoves "debug" tag from filestatic voidremoveManifestVersions(File file) Removes attributes like "versionCode" and "versionName" from file.static voidrenameManifestPackage(File file, String packageOriginal) Replaces package value with passed packageOriginal stringstatic voidSets "debug" tag in the file to truestatic voidsetNetworkSecurityConfig(File file) Sets the value of the network security config in the AndroidManifest file
-
Constructor Details
-
ResXmlPatcher
public ResXmlPatcher()
-
-
Method Details
-
removeApplicationDebugTag
Removes "debug" tag from file- Parameters:
file- AndroidManifest file- Throws:
AndrolibException- Error reading Manifest file
-
setApplicationDebugTagTrue
Sets "debug" tag in the file to true- Parameters:
file- AndroidManifest file
-
setNetworkSecurityConfig
Sets the value of the network security config in the AndroidManifest file- Parameters:
file- AndroidManifest file
-
modNetworkSecurityConfig
public static void modNetworkSecurityConfig(File file) throws ParserConfigurationException, TransformerException, IOException, SAXException Creates a modified network security config file that is more permissive- Parameters:
file- network security config file- Throws:
TransformerException- XML file could not be editedIOException- XML file could not be locatedSAXException- XML file could not be readParserConfigurationException- XML nodes could be written
-
fixingPublicAttrsInProviderAttributes
Any @string reference in a provider value in AndroidManifest.xml will break on build, thus preventing the application from installing. This is from a bug/error in AOSP where public resources cannot be part of an authorities attribute within a provider tag.This finds any reference and replaces it with the literal value found in the res/values/strings.xml file.
- Parameters:
file- File for AndroidManifest.xml
-
pullValueFromStrings
Finds key in strings.xml file and returns text value- Parameters:
directory- Root directory of apkkey- String reference (ie @string/foo)- Returns:
- String|null
-
pullValueFromIntegers
Finds key in integers.xml file and returns text value- Parameters:
directory- Root directory of apkkey- Integer reference (ie @integer/foo)- Returns:
- String|null
-
removeManifestVersions
Removes attributes like "versionCode" and "versionName" from file.- Parameters:
file- File representing AndroidManifest.xml
-
renameManifestPackage
Replaces package value with passed packageOriginal string- Parameters:
file- File for AndroidManifest.xmlpackageOriginal- Package name to replace
-