{"action":"created","issue":{"url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/163","repository_url":"https://api.github.com/repos/bugsnag/bugsnag-android","labels_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/163/comments","events_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/163/events","html_url":"https://github.com/bugsnag/bugsnag-android/pull/163","id":242372885,"number":163,"title":"Setup strictmode notification","user":{"login":"fractalwrench","id":11800640,"avatar_url":"https://avatars0.githubusercontent.com/u/11800640?v=3","gravatar_id":"","url":"https://api.github.com/users/fractalwrench","html_url":"https://github.com/fractalwrench","followers_url":"https://api.github.com/users/fractalwrench/followers","following_url":"https://api.github.com/users/fractalwrench/following{/other_user}","gists_url":"https://api.github.com/users/fractalwrench/gists{/gist_id}","starred_url":"https://api.github.com/users/fractalwrench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractalwrench/subscriptions","organizations_url":"https://api.github.com/users/fractalwrench/orgs","repos_url":"https://api.github.com/users/fractalwrench/repos","events_url":"https://api.github.com/users/fractalwrench/events{/privacy}","received_events_url":"https://api.github.com/users/fractalwrench/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-12T13:04:43Z","updated_at":"2017-07-13T13:16:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bugsnag/bugsnag-android/pulls/163","html_url":"https://github.com/bugsnag/bugsnag-android/pull/163","diff_url":"https://github.com/bugsnag/bugsnag-android/pull/163.diff","patch_url":"https://github.com/bugsnag/bugsnag-android/pull/163.patch"},"body":"@kattrali I've investigated the following options for StrictMode and thought it'd be good to discuss what the next step should be.\r\n\r\n1. DropboxManager - wasn't feasible as this required the READ_LOGS permission, which is no longer granted to 3rd party apps.\r\n2. Using the Logcat stacktrace by specifying StrictMode.penaltyLog(). There doesn't appear to be any way of reliably intercepting this info.\r\n3. Using StrictMode.penaltyDeath(), which throws an Exception on policy violations. Ultimately this gets propagated up to the DefaultUncaughtExceptionHandler, where we can detect whether the Throwable was caused by a StrictMode violation.\r\n\r\nThe problem with penaltyDeath() is that it will terminate the thread when a violation occurs, so if we enable inspections by default, it's probable there would be a few false positives from the Android framework/3rd party library code, causing crashes. I suppose we would need some sort of API that allows developers to specify what policies are enabled/disabled.\r\n\r\nI think it should be possible to parse the StrictMode exception message for the Policy Violation Type (e.g. File Write, Network on Main Thread). We could then try passing that up in the MetaData when sending the Error Report?\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/comments/315074580","html_url":"https://github.com/bugsnag/bugsnag-android/pull/163#issuecomment-315074580","issue_url":"https://api.github.com/repos/bugsnag/bugsnag-android/issues/163","id":315074580,"user":{"login":"fractalwrench","id":11800640,"avatar_url":"https://avatars0.githubusercontent.com/u/11800640?v=3","gravatar_id":"","url":"https://api.github.com/users/fractalwrench","html_url":"https://github.com/fractalwrench","followers_url":"https://api.github.com/users/fractalwrench/followers","following_url":"https://api.github.com/users/fractalwrench/following{/other_user}","gists_url":"https://api.github.com/users/fractalwrench/gists{/gist_id}","starred_url":"https://api.github.com/users/fractalwrench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractalwrench/subscriptions","organizations_url":"https://api.github.com/users/fractalwrench/orgs","repos_url":"https://api.github.com/users/fractalwrench/repos","events_url":"https://api.github.com/users/fractalwrench/events{/privacy}","received_events_url":"https://api.github.com/users/fractalwrench/received_events","type":"User","site_admin":false},"created_at":"2017-07-13T13:16:35Z","updated_at":"2017-07-13T13:16:35Z","body":"@kattrali it looks like the policy violation codes and exception message format have remained constant since the StrictMode class was first publicly released. Currently the code is setup to include a human-readable description of the policy violation in the Report's MetaData, so if it does change in future that should just default to null.\r\n\r\nI think it would be best to document that the SDK records this extra info for debugging, and recommend that developers setup StrictMode in the same way as they would for any other app. The alternative is to enable this behaviour by default, but this could quite easily result in apps crashing due to bugs in 3rd party code/Android framework code that can't be resolved."}}
{"actor":{"display_login":"fractalwrench"}}