Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27304

Android: Setting <uses-feature/> required "true" in "tiapp.xml" should override "false" setting in libraries

    Details

    • Story Points:
      5
    • Sprint:
      2019 Sprint 17

      Description

      Summary:
      The "AndroidManifest.xml" file's <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:

      1. Create a Classic Titanium app project.
      2. Add modules "ti.barcode" to "tiapp.xml". (Can download from here.)
      3. Add the <uses-feature/> settings in "tiapp.xml" as shown below.
      4. Build for Android.
      5. Open Mac's "Finder" window. (Or "Windows Explorer" on Windows.)
      6. Go to project subdirectory: ./build/android
      7. Open file "AndroidManifest.xml".
      8. 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jquick Joshua Quick
                Reviewer:
                Yordan Banev
                Tester:
                Satyam Sekhri
              • Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration