Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25889] Android: Emulator builds should not add additional permissions

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-01-27T22:30:28.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 9.0.0
ComponentsAndroid
Labelsandroid, engSchedule, geolocation, manifest, permissions, tiapp
ReporterRene Pot
AssigneeJoshua Quick
Created2018-03-20T16:35:17.000+0000
Updated2020-01-27T22:30:28.000+0000

Description

*Summary:* When building with deployment type "development" (ie: for the Android emulator), the Titanium build system adds the following permissions to the "AndroidManifest.xml" file, even if they're not defined in the "tiapp.xml" file. * android.permission.ACCESS_COARSE_LOCATION * android.permission.ACCESS_FINE_LOCATION * android.permission.ACCESS_MOCK_LOCATION The above behavior was intentional and was intended for fast incremental builds with LiveView and the emulator. However, this behavior has been known to cause confusion. *To-Do:* In Titanium 9.0.0, we should remove the above behavior. The build system should produce a consistent "AndroidManifest.xml" for all deployment types (ie: "test", "development", and "production"). *Note:* Titanium should still include its default permissions listed below. * android.permission.INTERNET * android.permission.ACCESS_WIFI_STATE * android.permission.ACCESS_NETWORK_STATE * android.permission.WRITE_EXTERNAL_STORAGE If you don't want the above default permissions injected, then you can set the following in your "tiapp.xml" file to override this behavior.
<ti:app xmlns:ti="http://ti.appcelerator.org">
	<override-permissions>true</override-permissions>
</ti:app>

Attachments

FileDateSize
AndroidManifest.xml2018-03-20T16:34:02.000+00002234

Comments

  1. Joshua Quick 2018-03-20

    This is not a bug. A location permission will be automatically injected if:

    You use the "Ti.Geolocation" API.

    You include a module that injects/requires this permission.

    When building with deploy-type "development". _(The default when building for the emulator.)_

    I suspect #3 is happening to you above. Try building for a real device or for deploy-type "test". Or do a release/production build. As long as your app is not doing #1 and #2 above, the generated "AndroidManifest.xml" won't contain the location permissions.
    appc run -p android --deploy-type test --build-only
  2. Rene Pot 2018-03-20

    [~jquick] yep that indeed appears to be happening. It is not happening when I run the command you provided. Is there any reason for it to happen on dev builds though? I'll point the person who reported the issue to this ticket, asking if he can also reproduce what I can now. Thanks for checking it
  3. Joshua Quick 2018-03-20

    To be honest, I don't know what the reasoning there is for this. And I agree that it's a bit confusing. The deploy-type of "development" and "test" is something that was inherited from the iOS build system where a simulator build *+is+* completely different than a mobile test build. On Android, it doesn't have to be this way (an APK is universal), but it was made this way to be consistent.
  4. Rene Pot 2018-03-21

    The user confirmed it is fixed also when doing the command provided. So unless this is unwanted to happen for development builds this ticket can be resolved
  5. Joshua Quick 2020-01-27

    This task was completed by ticket [TIMOB-19300] for Titanium 9.0.0.

JSON Source