{"action":"created","issue":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/2056","repository_url":"https://api.github.com/repos/robolectric/robolectric","labels_url":"https://api.github.com/repos/robolectric/robolectric/issues/2056/labels{/name}","comments_url":"https://api.github.com/repos/robolectric/robolectric/issues/2056/comments","events_url":"https://api.github.com/repos/robolectric/robolectric/issues/2056/events","html_url":"https://github.com/robolectric/robolectric/issues/2056","id":107821832,"number":2056,"title":"ShadowAlarmManager does not replace existing alarm with equal intents","user":{"login":"kanelbulle","id":294755,"avatar_url":"https://avatars.githubusercontent.com/u/294755?v=3","gravatar_id":"","url":"https://api.github.com/users/kanelbulle","html_url":"https://github.com/kanelbulle","followers_url":"https://api.github.com/users/kanelbulle/followers","following_url":"https://api.github.com/users/kanelbulle/following{/other_user}","gists_url":"https://api.github.com/users/kanelbulle/gists{/gist_id}","starred_url":"https://api.github.com/users/kanelbulle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanelbulle/subscriptions","organizations_url":"https://api.github.com/users/kanelbulle/orgs","repos_url":"https://api.github.com/users/kanelbulle/repos","events_url":"https://api.github.com/users/kanelbulle/events{/privacy}","received_events_url":"https://api.github.com/users/kanelbulle/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/robolectric/robolectric/labels/3.0","name":"3.0","color":"c7def8"},{"url":"https://api.github.com/repos/robolectric/robolectric/labels/defect","name":"defect","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/robolectric/robolectric/milestones/7","html_url":"https://github.com/robolectric/robolectric/milestones/3.1","labels_url":"https://api.github.com/repos/robolectric/robolectric/milestones/7/labels","id":1083024,"number":7,"title":"3.1","description":"","creator":{"login":"erd","id":184194,"avatar_url":"https://avatars.githubusercontent.com/u/184194?v=3","gravatar_id":"","url":"https://api.github.com/users/erd","html_url":"https://github.com/erd","followers_url":"https://api.github.com/users/erd/followers","following_url":"https://api.github.com/users/erd/following{/other_user}","gists_url":"https://api.github.com/users/erd/gists{/gist_id}","starred_url":"https://api.github.com/users/erd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erd/subscriptions","organizations_url":"https://api.github.com/users/erd/orgs","repos_url":"https://api.github.com/users/erd/repos","events_url":"https://api.github.com/users/erd/events{/privacy}","received_events_url":"https://api.github.com/users/erd/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":27,"state":"closed","created_at":"2015-04-25T00:15:41Z","updated_at":"2016-07-13T01:39:22Z","due_on":null,"closed_at":"2016-07-13T01:39:22Z"},"comments":2,"created_at":"2015-09-22T23:18:17Z","updated_at":"2016-08-18T19:45:18Z","closed_at":"2015-10-14T17:24:28Z","body":"Recently there was a change to ShadowAlarmManager where it was changed to \"only remove an existing alarm if the trigger times are equal\". However, the doc doesn't specify this behavior -- the doc says that an existing alarm will be replaced if the intents matches using filterEquals (and nothing else):\r\nhttp://developer.android.com/reference/android/app/AlarmManager.html#set(int, long, android.app.PendingIntent)\r\n\r\nSo, the previous behavior was actually correct and matches the doc. The patch is therefore incorrect and should be reverted.\r\n\r\nThis is the patch mentioned above:\r\nhttps://github.com/robolectric/robolectric/commit/971279e06eff78bf83f697e30892bbdeeb6b6be0"},"comment":{"url":"https://api.github.com/repos/robolectric/robolectric/issues/comments/240834753","html_url":"https://github.com/robolectric/robolectric/issues/2056#issuecomment-240834753","issue_url":"https://api.github.com/repos/robolectric/robolectric/issues/2056","id":240834753,"user":{"login":"DanDevine","id":555958,"avatar_url":"https://avatars.githubusercontent.com/u/555958?v=3","gravatar_id":"","url":"https://api.github.com/users/DanDevine","html_url":"https://github.com/DanDevine","followers_url":"https://api.github.com/users/DanDevine/followers","following_url":"https://api.github.com/users/DanDevine/following{/other_user}","gists_url":"https://api.github.com/users/DanDevine/gists{/gist_id}","starred_url":"https://api.github.com/users/DanDevine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanDevine/subscriptions","organizations_url":"https://api.github.com/users/DanDevine/orgs","repos_url":"https://api.github.com/users/DanDevine/repos","events_url":"https://api.github.com/users/DanDevine/events{/privacy}","received_events_url":"https://api.github.com/users/DanDevine/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T19:45:18Z","updated_at":"2016-08-18T19:45:18Z","body":"I don't think the original bug report is correct.  From the Android docs, the incoming Intent must match the filter test...AND the PendingIntent request code must match too, since that's what's being saved by the real AlarmManager.\r\n\r\n```\r\nIntent toLaunch = new Intent(\"com.foo.bar.AlarmReceiver.NOTIFICATION_EVENT\");\r\nPendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, toLaunch, PendingIntent.FLAG_ONE_SHOT);\r\nalarmManager.setExact(AlarmManager.RTC_WAKEUP, alarmTime, pendingIntent);\r\n\r\ntoLaunch = new Intent(\"com.foo.bar.AlarmReceiver.NOTIFICATION_EVENT\");\r\npendingIntent = PendingIntent.getBroadcast(this, 2, toLaunch, PendingIntent.FLAG_ONE_SHOT);\r\nalarmManager.setExact(AlarmManager.RTC_WAKEUP, alarmTime, pendingIntent);\r\n```\r\n\r\nAssuming that the times are not identical, there should be 2 separate Alarm events in the queue due to the differing PendingIntent id's.   Please don't assume everyone just sets the Id field to 0.\r\n\r\nI found this bug report, because my test isn't matching the real 'on-device' behavior.  When I set two distinct alarms on the device using the above code, I get two distinct events.  When checking the scheduled alarms with 3.0, I get only one....\r\n\r\n"}}
{"actor":{"display_login":"DanDevine"}}