[TIMOB-27304] Android: Setting <uses-feature/> required "true" in "tiapp.xml" should override "false" setting in libraries
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-08-21T11:36:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.1.1 |
Components | Android |
Labels | android, engSchedule, manifest, modules, xml |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2019-08-02T21:18:16.000+0000 |
Updated | 2019-08-30T07:19:30.000+0000 |
Description
*Summary:*
The "AndroidManifest.xml" file's Add the
Go to project subdirectory:
Observe its
<uses-feature/>
"android:required" attribute value can be set to true
or false
. When multiple manifests declare the same <uses-feature/>
, the merge process must do a logical OR of these values. This means that if one of the manifest files sets it to true
, it can be made false
at the end of the XML merge. (The true
setting wins.)
https://developer.android.com/studio/build/manifest-merge
When the Titanium build merges "timodule.xml" and "tiapp.xml" settings, it does not "OR" the "android:required" values. Instead the original "timodule.xml" value always wins. This means if the "timodule.xml" sets it false
, the "tiapp.xml" is never able to set it true
. (The reverse is not an issue though.)
*Note:*
The behavior of the XML merge has changed as of Titanium 8.0.2. Before 8.0.2, the "tiapp.xml" manifest settings used to blindly overwrite the "timodule.xml" manifest settings, which was not technically correct but did allow the "tiapp.xml" to override <uses-feature/>
to true
or false
(it still wasn't OR
ing the values though). Titanium 8.0.2 improved the merge to better follow Google's merging rules, but it is not OR
ing the values which is what's needed.
*Steps to reproduce:*
Create a Classic Titanium app project.
Add modules "ti.barcode" to "tiapp.xml". (Can download from [here](https://github.com/appcelerator-modules/ti.barcode).)
Add the <uses-feature/>
settings in "tiapp.xml" as shown below.
Build for Android.
Open Mac's "Finder" window. (Or "Windows Explorer" on Windows.)
Go to project subdirectory: ./build/android
Open file "AndroidManifest.xml".
Observe its <uses-feature/>
XML elements.
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="true"/>
</manifest>
</android>
<modules>
<module platform="android">ti.barcode</module>
</modules>
</ti:app>
*Result:*
The merged "AndroidManifest.xml" file's <uses-feature/>
for "android.hardware.touchscreen" is false
when it should be true
.
*Expected Result:*
The <uses-feature/>
for "android.hardware.touchscreen" should be true
, not false
. The values need to be OR
'ed together.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11110 PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11111
FR passed. Correct value of elements in manifest file based on OR(ing) of values from all the involved xml files. Waiting for the merge of PR's
PR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11146
FR Passed. Waiting on Jenkins build to pass.
Merged to master, 8_3_X and 8_1_X
*Closing ticket* fix verified in SDK version
8.2.0.v20190820104021
,8.1.1.v20190820143437
and8.3.0.v20190820103430
. Test and other information can be found at: PR (master): https://github.com/appcelerator/titanium_mobile/pull/11110 PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/11111 PR (8.3.x): https://github.com/appcelerator/titanium_mobile/pull/11146Thank you for resolving this!