redex
redex copied to clipboard
If manifest contains service/activity with attribute "exported" of type "TYPE_REFERENCE" redex will not find the actual value
Manifest contains:
<service android:exported="@bool/some_bool" android:name="some_name" android:process=":search">
and inside resources.arsc there is:
<bool name="some_bool">false</bool>
In file RedexResources.cpp function get_bool_attribute_value() redex asserts read value to be TYPE_INT_BOOLEAN instead of checking the value it references in case its TYPE_REFERENCE.
Sorry for the very delayed response on this one. Thanks for the good quality report, we didn't consider that the manifest would contain references like this.
We could probably scan for all possible values of a boolean reference across all configurations and see if the value matches, then operate off that. But, I wonder what we'd do if the value varied on a configuration (does Android even let you vary android:exported based on something like dpi? that would be weird but I guess it could work). Maybe we'd have to provide a fallback option, or outright ban this case with an assert. Will take a look.
After making a test case for this, I realized there is actually 1 valid corner case where you could have android:exported="@bool/some_bool" such that some_bool is actually unknowable at compile time. Varying this value by API level is an acceptable thing to do (i.e. make some_bool false by default and make it true in values-v21 or whatever).
I'll propose we change ComponentTagInfo.is_exported to be boost::optional<boolean>for all cases when the attribute value is TYPE_REFERENCE, and any optimization that checks is_exported will need to do something sensible in the unknowable case.