{ "id": "152691", "key": "TIMOB-19885", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" }, { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-12T02:14:06.000+0000", "created": "2015-11-06T02:31:21.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-5.1.0", "regression" ], "versions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" } ], "issuelinks": [ { "id": "49772", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "152706", "key": "TIMOB-19887", "fields": { "summary": "Android 6.0: Issues with getting contacts info on android 6.0", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-05-27T22:46:41.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*This is a regression. This issue is not seen with SDK 5.1.0.v20151104153625*\r\n\r\nh5.Description:\r\n1. Use the code below in your tiapp.xml & build for android 6.0 device:\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nwin.addEventListener(\"open\", function(e) {\r\n if (Ti.Contacts.hasContactsPermissions()) {\r\n Ti.API.info(\"People: \" + JSON.stringify(Ti.Contacts.getAllPeople()));\r\n } else {\r\n Ti.Contacts.requestContactsPermissions(function(e) {\r\n if (e.success === true) {\r\n alert(\"Access granted\");\r\n Ti.API.info(\"People: \" + JSON.stringify(Ti.Contacts.getAllPeople()));\r\n } else {\r\n alert(\"Access denied, error: \" + e.error);\r\n }\r\n });\r\n }\r\n});\r\nwin.open();\r\n{code}\r\n2. After the app launches grant permissions to access contacts.\r\n3. Observe the alert you get after.\r\n\r\nh5.Actual Results:\r\n1. We see alert \"Access denied, error: ContactsOne or more permissions were denied\"\r\n*Attached screenshot for the alert & the permissions in settings for the app.*\r\n\r\nh5.Expected Results:\r\n1. We should see success.", "attachment": [ { "id": "57269", "filename": "Screenshot_20151105-181714.png", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-06T02:32:01.000+0000", "size": 64681, "mimeType": "image/png" }, { "id": "57268", "filename": "Screenshot_20151105-181723.png", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-06T02:32:03.000+0000", "size": 88483, "mimeType": "image/png" } ], "flagged": false, "summary": "Android 6.0 : Asking for contacts permissions fails with \"one or more permissions denied\" with SDK 5.1.0.v20151104190037", "creator": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Environment:\r\nAppc Studio : 4.4.0.201511040454\r\nTi SDK : 5.1.0.v20151104190037\r\nTi CLI : 5.0.5\r\nAlloy : 1.7.24\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.1\r\nAppc CLI : 5.1.0-43\r\nNode: v0.10.37\r\nNexus 5 - Android 6.0", "closedSprints": [ { "id": 525, "state": "closed", "name": "2015 Sprint 23 SDK", "startDate": "2015-11-07T01:30:15.519Z", "endDate": "2015-11-21T01:30:00.000Z", "completeDate": "2015-11-23T02:54:27.887Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "369154", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Tried this and unable to reproduce this. I got `Access granted`.\r\n\r\nUsing Android 6.0, Nexus 6.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-06T04:20:42.000+0000", "updated": "2015-11-06T04:22:02.000+0000" }, { "id": "369155", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~hpham] Could you see if you can reproduce this as well?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-06T04:22:54.000+0000", "updated": "2015-11-06T04:22:54.000+0000" }, { "id": "369222", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "I can also reproduce this issue. \r\n\r\nMac OSX El Capitan 10.11 (15A284) \r\nTi SDK: 5.1.0.v20151104190037 \r\nAppc NPM: 4.2.1 \r\nAppc CLI: 5.1.0-43\r\nTi CLI: 5.0.4 \r\nAlloy: 1.7.23 \r\nXcode 7.1(7B91b) \r\nNode v0.12.7 \r\nproduction", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-06T22:07:06.000+0000", "updated": "2015-11-06T22:07:06.000+0000" }, { "id": "369452", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tried it, couldn't reproduce this either.\r\nEdit: Ok, I figured out what the problem is. This problem will occur when your AndroidManifest is missing either READ_CONTACT, or WRITE_CONTACT permission. Usually the CLI is pretty good at adding these permissions, but contacts is a special case. Depending on which method you use, sometimes only READ_CONTACT permission is included in the manifest. This causes the problem. ", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-09T20:53:33.000+0000", "updated": "2015-11-09T23:50:56.000+0000" }, { "id": "369472", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/7413\r\n5.1.X PR: https://github.com/appcelerator/titanium_mobile/pull/7414", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-09T23:52:00.000+0000", "updated": "2015-11-09T23:55:40.000+0000" }, { "id": "369645", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Both master and 5.1.X PR merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-11T02:22:06.000+0000", "updated": "2015-11-11T02:22:06.000+0000" }, { "id": "369802", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hpham], This piece of code throws same errors when getting contact permissions:\r\n{code}\r\nfunction askContactPermission(){\r\n\tif (Ti.Contacts.hasContactsPermissions()) {\r\n\t return true;\r\n\t } else {\r\n\t Ti.Contacts.requestContactsPermissions(function(e) {\r\n\t if (e.success === true) { \r\n\t \t Ti.API.info(\"Contacts Permissions Granted\");\r\n\t return true;\r\n\t } else {\r\n\t alert(\"Access denied, error: \" + e.error);\r\n\t }\r\n\t });\r\n\t }\r\n}\r\n \r\nif(askContactPermission()){\r\n\talert(\"All permissions granted\");\r\n}\r\nelse{\r\n\talert(\"One or more permissions not granted. Check permissions\");\r\n}\r\n{code}\r\n\r\nAndroidManifest has following permissions:\r\n{code}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n{code}\r\nNotice it does not have contact permissions added.\r\nDo we need to have a code to access contacts in the permissions code i.e Ti.Contacts.hasContactsPermissions or Ti.Contacts.requestContactsPermissions to get a success? \r\n\r\nReopening for the time being.\r\n\r\nEnvironment:\r\nAppc Studio : 4.4.0.201511101919\r\nTi SDK : 5.1.0.v20151110202023\r\nTi CLI : 5.0.5\r\nAlloy : 1.7.24\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.1\r\nAppc CLI : 5.1.0-50\r\nNode: v0.10.37\r\nNexus 6 - Android 6.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-11T19:59:47.000+0000", "updated": "2015-11-11T19:59:47.000+0000" }, { "id": "369804", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Well, that's expected. You're not using any contacts method, so no permission is given, therefore your access is denied. This will be the case for ALL permissions, not just contacts. If you request a permission but not actually using an API regarding that permission, your access will be denied.\r\n\r\nEdit: Keep in mind that the AndroidManifest is generated at compile time, and we append needed permissions based on API usage. Checking and asking for permissions do NOT trigger the permissions to be added to the manifest - only APIs that require permissions to work do.", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-11T20:14:35.000+0000", "updated": "2015-11-11T20:20:40.000+0000" }, { "id": "369826", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "So the issue is not fixed running the code in the description goes not get the contact info & shows {code}People: null{code}\r\nIn logcat I get this:\r\n{code}\r\n11-11 15:37:43.245: D/msm8974_platform(382): platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)\r\n11-11 15:37:43.245: D/audio_hw_primary(382): enable_snd_device: snd_device(2: speaker)\r\n11-11 15:37:43.247: I/ALERT(18599): (KrollRuntimeThread) [1527,1863] Access granted\r\n11-11 15:37:43.249: D/audio_hw_primary(382): enable_audio_route: apply and update mixer path: low-latency-playback speaker\r\n11-11 15:37:43.252: W/TiCommonContactsApi(18599): (KrollRuntimeThread) [5,1868] Contact permissions are missing\r\n11-11 15:37:43.252: E/TiContacts5(18599): (KrollRuntimeThread) [0,1868] Contacts permissions missing\r\n11-11 15:37:43.253: I/TiAPI(18599): People: null\r\n{code}\r\n\r\nAndroid Manifest has the READ_CONTACTS permissions:\r\n{code}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n{code}\r\n\r\nReopening.\r\n\r\nEnvironment:\r\nAppc Studio : 4.4.0.201511101919\r\nTi SDK : 5.1.0.v20151110202023\r\nTi CLI : 5.0.5\r\nAlloy : 1.7.24\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.1\r\nAppc CLI : 5.1.0-50\r\nNode: v0.10.37\r\nNexus 6 - Android 6.0\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-11T23:55:36.000+0000", "updated": "2015-11-11T23:55:36.000+0000" }, { "id": "369829", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/7427\r\n5_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/7428", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-12T00:33:57.000+0000", "updated": "2015-11-12T00:35:40.000+0000" }, { "id": "369840", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Code reviewed and functionally tested. Able to see contacts with test code in description. Both PR Merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-12T02:13:58.000+0000", "updated": "2015-11-12T02:14:25.000+0000" }, { "id": "370123", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\nPermissions are granted successfully & we can see the contacts.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.4.0.201511101919\r\nTi SDK : 5.1.0.v20151111182050, 5.2.0.v20151112112825\r\nTi CLI : 5.0.5\r\nAlloy : 1.7.24\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.1\r\nAppc CLI : 5.1.0-52\r\nNode: v0.10.37\r\nNexus 6 - Android 6.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-12T19:36:03.000+0000", "updated": "2015-11-12T19:36:03.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }