{"action":"created","comment":{"url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/comments/31589370","id":31589370,"diff_hunk":"@@ -420,11 +424,28 @@ private static void setNotificationAlarms(Context context,\n     String ledBlinkPattern       = TextSecurePreferences.getNotificationLedPattern(context);\n     String ledBlinkPatternCustom = TextSecurePreferences.getNotificationLedPatternCustom(context);\n     String[] blinkPatternArray   = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom);\n+    Uri ringtoneUri              = TextUtils.isEmpty(ringtone) || !signal ? null : Uri.parse(ringtone);\n+    TelephonyManager telephony   = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);\n \n-    builder.setSound(TextUtils.isEmpty(ringtone) || !signal ? null : Uri.parse(ringtone));\n+    if (telephony.getCallState() == TelephonyManager.CALL_STATE_IDLE) {\n+      builder.setSound(ringtoneUri);\n \n-    if (signal && vibrate) {\n-      builder.setDefaults(Notification.DEFAULT_VIBRATE);\n+      if (signal && vibrate) {\n+        builder.setDefaults(Notification.DEFAULT_VIBRATE);\n+      }\n+    }\n+    else {\n+      AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);\n+      if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL && ringtoneUri != null) {\n+        Ringtone tone = RingtoneManager.getRingtone(context, Uri.parse(ringtone));\n+        tone.setStreamType(AudioManager.STREAM_VOICE_CALL);\n+        tone.play();\n+      }\n+\n+      if (signal && vibrate) {\n+        Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);\n+        vibrator.vibrate(new long[] {0, 250, 250, 250}, -1);","path":"src/org/thoughtcrime/securesms/notifications/MessageNotifier.java","position":43,"original_position":43,"commit_id":"149fafada775d244f0f1b03f84e4395afe4e8195","original_commit_id":"149fafada775d244f0f1b03f84e4395afe4e8195","user":{"login":"rhodey","id":3441581,"avatar_url":"https://avatars.githubusercontent.com/u/3441581?v=3","gravatar_id":"","url":"https://api.github.com/users/rhodey","html_url":"https://github.com/rhodey","followers_url":"https://api.github.com/users/rhodey/followers","following_url":"https://api.github.com/users/rhodey/following{/other_user}","gists_url":"https://api.github.com/users/rhodey/gists{/gist_id}","starred_url":"https://api.github.com/users/rhodey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhodey/subscriptions","organizations_url":"https://api.github.com/users/rhodey/orgs","repos_url":"https://api.github.com/users/rhodey/repos","events_url":"https://api.github.com/users/rhodey/events{/privacy}","received_events_url":"https://api.github.com/users/rhodey/received_events","type":"User","site_admin":false},"body":"good point, I'll take out the vibrate. settings only allow led blink pattern ftr.","created_at":"2015-06-03T02:18:06Z","updated_at":"2015-06-03T02:18:06Z","html_url":"https://github.com/WhisperSystems/TextSecure/pull/3321#discussion_r31589370","pull_request_url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321","_links":{"self":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/comments/31589370"},"html":{"href":"https://github.com/WhisperSystems/TextSecure/pull/3321#discussion_r31589370"},"pull_request":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321"}}},"pull_request":{"url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321","id":36784686,"html_url":"https://github.com/WhisperSystems/TextSecure/pull/3321","diff_url":"https://github.com/WhisperSystems/TextSecure/pull/3321.diff","patch_url":"https://github.com/WhisperSystems/TextSecure/pull/3321.patch","issue_url":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/3321","number":3321,"state":"open","locked":false,"title":"notification sound + vibrate while in call","user":{"login":"rhodey","id":3441581,"avatar_url":"https://avatars.githubusercontent.com/u/3441581?v=3","gravatar_id":"","url":"https://api.github.com/users/rhodey","html_url":"https://github.com/rhodey","followers_url":"https://api.github.com/users/rhodey/followers","following_url":"https://api.github.com/users/rhodey/following{/other_user}","gists_url":"https://api.github.com/users/rhodey/gists{/gist_id}","starred_url":"https://api.github.com/users/rhodey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhodey/subscriptions","organizations_url":"https://api.github.com/users/rhodey/orgs","repos_url":"https://api.github.com/users/rhodey/repos","events_url":"https://api.github.com/users/rhodey/events{/privacy}","received_events_url":"https://api.github.com/users/rhodey/received_events","type":"User","site_admin":false},"body":"play notification sound and vibrate (if enabled) when new message received during a phone call.\r\n\r\nFixes #1830\r\n// FREEBIE","created_at":"2015-06-02T23:17:29Z","updated_at":"2015-06-03T02:18:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1912c12cc421c450dced26c2980cb378f6ab5deb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321/commits","review_comments_url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321/comments","review_comment_url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/3321/comments","statuses_url":"https://api.github.com/repos/WhisperSystems/TextSecure/statuses/149fafada775d244f0f1b03f84e4395afe4e8195","head":{"label":"rhodey:issue-1830","ref":"issue-1830","sha":"149fafada775d244f0f1b03f84e4395afe4e8195","user":{"login":"rhodey","id":3441581,"avatar_url":"https://avatars.githubusercontent.com/u/3441581?v=3","gravatar_id":"","url":"https://api.github.com/users/rhodey","html_url":"https://github.com/rhodey","followers_url":"https://api.github.com/users/rhodey/followers","following_url":"https://api.github.com/users/rhodey/following{/other_user}","gists_url":"https://api.github.com/users/rhodey/gists{/gist_id}","starred_url":"https://api.github.com/users/rhodey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhodey/subscriptions","organizations_url":"https://api.github.com/users/rhodey/orgs","repos_url":"https://api.github.com/users/rhodey/repos","events_url":"https://api.github.com/users/rhodey/events{/privacy}","received_events_url":"https://api.github.com/users/rhodey/received_events","type":"User","site_admin":false},"repo":{"id":31562260,"name":"TextSecure","full_name":"rhodey/TextSecure","owner":{"login":"rhodey","id":3441581,"avatar_url":"https://avatars.githubusercontent.com/u/3441581?v=3","gravatar_id":"","url":"https://api.github.com/users/rhodey","html_url":"https://github.com/rhodey","followers_url":"https://api.github.com/users/rhodey/followers","following_url":"https://api.github.com/users/rhodey/following{/other_user}","gists_url":"https://api.github.com/users/rhodey/gists{/gist_id}","starred_url":"https://api.github.com/users/rhodey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhodey/subscriptions","organizations_url":"https://api.github.com/users/rhodey/orgs","repos_url":"https://api.github.com/users/rhodey/repos","events_url":"https://api.github.com/users/rhodey/events{/privacy}","received_events_url":"https://api.github.com/users/rhodey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhodey/TextSecure","description":"A secure text messaging application for Android.","fork":true,"url":"https://api.github.com/repos/rhodey/TextSecure","forks_url":"https://api.github.com/repos/rhodey/TextSecure/forks","keys_url":"https://api.github.com/repos/rhodey/TextSecure/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhodey/TextSecure/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhodey/TextSecure/teams","hooks_url":"https://api.github.com/repos/rhodey/TextSecure/hooks","issue_events_url":"https://api.github.com/repos/rhodey/TextSecure/issues/events{/number}","events_url":"https://api.github.com/repos/rhodey/TextSecure/events","assignees_url":"https://api.github.com/repos/rhodey/TextSecure/assignees{/user}","branches_url":"https://api.github.com/repos/rhodey/TextSecure/branches{/branch}","tags_url":"https://api.github.com/repos/rhodey/TextSecure/tags","blobs_url":"https://api.github.com/repos/rhodey/TextSecure/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhodey/TextSecure/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhodey/TextSecure/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhodey/TextSecure/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhodey/TextSecure/statuses/{sha}","languages_url":"https://api.github.com/repos/rhodey/TextSecure/languages","stargazers_url":"https://api.github.com/repos/rhodey/TextSecure/stargazers","contributors_url":"https://api.github.com/repos/rhodey/TextSecure/contributors","subscribers_url":"https://api.github.com/repos/rhodey/TextSecure/subscribers","subscription_url":"https://api.github.com/repos/rhodey/TextSecure/subscription","commits_url":"https://api.github.com/repos/rhodey/TextSecure/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhodey/TextSecure/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhodey/TextSecure/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhodey/TextSecure/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhodey/TextSecure/contents/{+path}","compare_url":"https://api.github.com/repos/rhodey/TextSecure/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhodey/TextSecure/merges","archive_url":"https://api.github.com/repos/rhodey/TextSecure/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhodey/TextSecure/downloads","issues_url":"https://api.github.com/repos/rhodey/TextSecure/issues{/number}","pulls_url":"https://api.github.com/repos/rhodey/TextSecure/pulls{/number}","milestones_url":"https://api.github.com/repos/rhodey/TextSecure/milestones{/number}","notifications_url":"https://api.github.com/repos/rhodey/TextSecure/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhodey/TextSecure/labels{/name}","releases_url":"https://api.github.com/repos/rhodey/TextSecure/releases{/id}","created_at":"2015-03-02T20:46:02Z","updated_at":"2015-05-08T00:26:41Z","pushed_at":"2015-06-02T23:15:03Z","git_url":"git://github.com/rhodey/TextSecure.git","ssh_url":"git@github.com:rhodey/TextSecure.git","clone_url":"https://github.com/rhodey/TextSecure.git","svn_url":"https://github.com/rhodey/TextSecure","homepage":"","size":48958,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WhisperSystems:master","ref":"master","sha":"f1e8357131a91c9000bebcd0b8858a2be7c4adb5","user":{"login":"WhisperSystems","id":702459,"avatar_url":"https://avatars.githubusercontent.com/u/702459?v=3","gravatar_id":"","url":"https://api.github.com/users/WhisperSystems","html_url":"https://github.com/WhisperSystems","followers_url":"https://api.github.com/users/WhisperSystems/followers","following_url":"https://api.github.com/users/WhisperSystems/following{/other_user}","gists_url":"https://api.github.com/users/WhisperSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/WhisperSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WhisperSystems/subscriptions","organizations_url":"https://api.github.com/users/WhisperSystems/orgs","repos_url":"https://api.github.com/users/WhisperSystems/repos","events_url":"https://api.github.com/users/WhisperSystems/events{/privacy}","received_events_url":"https://api.github.com/users/WhisperSystems/received_events","type":"Organization","site_admin":false},"repo":{"id":2990192,"name":"TextSecure","full_name":"WhisperSystems/TextSecure","owner":{"login":"WhisperSystems","id":702459,"avatar_url":"https://avatars.githubusercontent.com/u/702459?v=3","gravatar_id":"","url":"https://api.github.com/users/WhisperSystems","html_url":"https://github.com/WhisperSystems","followers_url":"https://api.github.com/users/WhisperSystems/followers","following_url":"https://api.github.com/users/WhisperSystems/following{/other_user}","gists_url":"https://api.github.com/users/WhisperSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/WhisperSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WhisperSystems/subscriptions","organizations_url":"https://api.github.com/users/WhisperSystems/orgs","repos_url":"https://api.github.com/users/WhisperSystems/repos","events_url":"https://api.github.com/users/WhisperSystems/events{/privacy}","received_events_url":"https://api.github.com/users/WhisperSystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WhisperSystems/TextSecure","description":"A private messenger for Android.","fork":false,"url":"https://api.github.com/repos/WhisperSystems/TextSecure","forks_url":"https://api.github.com/repos/WhisperSystems/TextSecure/forks","keys_url":"https://api.github.com/repos/WhisperSystems/TextSecure/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WhisperSystems/TextSecure/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WhisperSystems/TextSecure/teams","hooks_url":"https://api.github.com/repos/WhisperSystems/TextSecure/hooks","issue_events_url":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/events{/number}","events_url":"https://api.github.com/repos/WhisperSystems/TextSecure/events","assignees_url":"https://api.github.com/repos/WhisperSystems/TextSecure/assignees{/user}","branches_url":"https://api.github.com/repos/WhisperSystems/TextSecure/branches{/branch}","tags_url":"https://api.github.com/repos/WhisperSystems/TextSecure/tags","blobs_url":"https://api.github.com/repos/WhisperSystems/TextSecure/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WhisperSystems/TextSecure/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WhisperSystems/TextSecure/git/refs{/sha}","trees_url":"https://api.github.com/repos/WhisperSystems/TextSecure/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WhisperSystems/TextSecure/statuses/{sha}","languages_url":"https://api.github.com/repos/WhisperSystems/TextSecure/languages","stargazers_url":"https://api.github.com/repos/WhisperSystems/TextSecure/stargazers","contributors_url":"https://api.github.com/repos/WhisperSystems/TextSecure/contributors","subscribers_url":"https://api.github.com/repos/WhisperSystems/TextSecure/subscribers","subscription_url":"https://api.github.com/repos/WhisperSystems/TextSecure/subscription","commits_url":"https://api.github.com/repos/WhisperSystems/TextSecure/commits{/sha}","git_commits_url":"https://api.github.com/repos/WhisperSystems/TextSecure/git/commits{/sha}","comments_url":"https://api.github.com/repos/WhisperSystems/TextSecure/comments{/number}","issue_comment_url":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/comments{/number}","contents_url":"https://api.github.com/repos/WhisperSystems/TextSecure/contents/{+path}","compare_url":"https://api.github.com/repos/WhisperSystems/TextSecure/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WhisperSystems/TextSecure/merges","archive_url":"https://api.github.com/repos/WhisperSystems/TextSecure/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WhisperSystems/TextSecure/downloads","issues_url":"https://api.github.com/repos/WhisperSystems/TextSecure/issues{/number}","pulls_url":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls{/number}","milestones_url":"https://api.github.com/repos/WhisperSystems/TextSecure/milestones{/number}","notifications_url":"https://api.github.com/repos/WhisperSystems/TextSecure/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WhisperSystems/TextSecure/labels{/name}","releases_url":"https://api.github.com/repos/WhisperSystems/TextSecure/releases{/id}","created_at":"2011-12-15T20:01:12Z","updated_at":"2015-06-02T09:50:06Z","pushed_at":"2015-06-03T01:45:11Z","git_url":"git://github.com/WhisperSystems/TextSecure.git","ssh_url":"git@github.com:WhisperSystems/TextSecure.git","clone_url":"https://github.com/WhisperSystems/TextSecure.git","svn_url":"https://github.com/WhisperSystems/TextSecure","homepage":"https://whispersystems.org","size":87810,"stargazers_count":3958,"watchers_count":3958,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1151,"mirror_url":null,"open_issues_count":418,"forks":1151,"open_issues":418,"watchers":3958,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321"},"html":{"href":"https://github.com/WhisperSystems/TextSecure/pull/3321"},"issue":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/3321"},"comments":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/issues/3321/comments"},"review_comments":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321/comments"},"review_comment":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/pulls/3321/commits"},"statuses":{"href":"https://api.github.com/repos/WhisperSystems/TextSecure/statuses/149fafada775d244f0f1b03f84e4395afe4e8195"}}}}