Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28050] Android: Investigate "package visibility" handling on Android 11

GitHub Issuen/a
TypeStory
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-11-25T15:15:16.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsandroid, canOpenUrl, email, emaildialog, intent, openUrl
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-07-25T01:49:05.000+0000
Updated2020-11-25T15:15:16.000+0000

Description

*Summary:* Android 11 requires developers to add a new <query/> entries into the "AndroidManifest.xml" for all intents passed to the Java resolveActivity() and queryIntentActivities() methods or else they will return false or an empty collection respectively. https://developer.android.com/preview/privacy/package-visibility https://developer.android.com/preview/privacy/package-visibility-use-cases#open-a-file Google lists which Java APIs are not affected below. The startActivity() and startActivityForResult() methods are not impacted. Intents referencing their own app are fine too. https://developer.android.com/preview/privacy/package-visibility#use-cases-not-affected *Impact:* The following Titanium methods are impacted by this: * [Ti.Platform.canOpenURL()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-canOpenURL) * [Ti.Platform.openURL()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Platform-method-openURL) * [Ti.UI.EmailDialog.isSupported()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.EmailDialog-method-isSupported) *To-Do:* * Our openURL() method should not call the Java resolveActivity() anymore so that it won't require the <query/> block. However, our canOpenURL() should continue to use it and we'll need to document the need for this. (Note that iOS requires a "LSApplicationQueriesSchemes" plist setting for this method as well for the same reasons.) * Ideally, our build system should auto-inject the <query/> block needed if the app's code contains a createEmailDialog() method call. The canOpenURL() and openURL() methods should log an error if a <query/> entry is needed. *Test:* The below PR has test code for canOpenURL() and openURL() which tests several different URLs. https://github.com/appcelerator/titanium_mobile/pull/10881

Comments

  1. Joshua Quick 2020-08-28

    Regarding the [EmailDialog.isSupported()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.EmailDialog-method-isSupported) method, a <queries/> block was not required a on a physical Pixel 3a device running Android 11, but it was required in the Android 11 emulator. Injecting the following into the "AndroidManifest.xml" will make our isSupported() method work.
       <manifest>
       	<queries>
       		<intent>
       			<action android:name="android.intent.action.SEND"/>
       			<data android:mimeType="message/rfc822"/>
       		</intent>
       	</queries>
       </manifest>
       
  2. Joshua Quick 2020-08-29

    PR (9.3.x): https://github.com/appcelerator/titanium_mobile/pull/11985
  3. Christopher Williams 2020-10-26

    merged to 9_3_X branch, backport cherry-picked to master for 9.3.0 target
  4. Samir Mohammed 2020-11-25

    *Closing ticket*. Fix verified in SDK version 9.3.0.v20201125050632. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11985

JSON Source