{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/6827","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/6827/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/6827/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/6827/events","html_url":"https://github.com/flutter/flutter/issues/6827","id":188885146,"number":6827,"title":"Instance state not saved when app is killed by OS","user":{"login":"LouisCAD","id":6975237,"avatar_url":"https://avatars0.githubusercontent.com/u/6975237?v=4","gravatar_id":"","url":"https://api.github.com/users/LouisCAD","html_url":"https://github.com/LouisCAD","followers_url":"https://api.github.com/users/LouisCAD/followers","following_url":"https://api.github.com/users/LouisCAD/following{/other_user}","gists_url":"https://api.github.com/users/LouisCAD/gists{/gist_id}","starred_url":"https://api.github.com/users/LouisCAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LouisCAD/subscriptions","organizations_url":"https://api.github.com/users/LouisCAD/orgs","repos_url":"https://api.github.com/users/LouisCAD/repos","events_url":"https://api.github.com/users/LouisCAD/events{/privacy}","received_events_url":"https://api.github.com/users/LouisCAD/received_events","type":"User","site_admin":false},"labels":[{"id":284438921,"url":"https://api.github.com/repos/flutter/flutter/labels/prod:%20engine","name":"prod: engine","color":"003570","default":false},{"id":284437560,"url":"https://api.github.com/repos/flutter/flutter/labels/prod:%20framework","name":"prod: framework","color":"207de5","default":false},{"id":669403841,"url":"https://api.github.com/repos/flutter/flutter/labels/prod:%20routes","name":"prod: routes","color":"207de5","default":false},{"id":283479900,"url":"https://api.github.com/repos/flutter/flutter/labels/%E2%96%A3%20platform-android","name":"▣ platform-android","color":"003570","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/flutter/flutter/milestones/22","html_url":"https://github.com/flutter/flutter/milestone/22","labels_url":"https://api.github.com/repos/flutter/flutter/milestones/22/labels","id":2270094,"number":22,"title":"4: Next milestone","description":"These are tasks we're aiming to complete for a 1.0 release. It includes issues we've identified that might block fully shipping broad consumer-facing apps, bugs relating to polish and quality, and some features we explicitly are delaying until after beta. We expect for issues here to be moved up in priority as our top customers and user base require them.\r\n\r\nThe date on this milestone is utterly arbitrary and just intended to sort the milestone appropriately.","creator":{"login":"Hixie","id":551196,"avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"open_issues":566,"closed_issues":181,"state":"open","created_at":"2017-01-23T00:27:59Z","updated_at":"2018-03-05T12:30:31Z","due_on":"2029-12-31T08:00:00Z","closed_at":null},"comments":55,"created_at":"2016-11-12T01:50:34Z","updated_at":"2018-03-05T15:34:05Z","closed_at":null,"author_association":"NONE","body":"## What is instance state, and why it exists\r\nOn Android, an [Activity](https://developer.android.com/reference/android/app/Activity.html) can be killed at any time by the system. This happens usually when Android needs memory when your Activity is not in the foreground, or because of a non-handled configuration change, such as a locale change.\r\nTo avoid the user having to restart what he did from scratch when Android killed the Activity, the system calls `onSaveInstanceState(…)` when the Activity is paused, where the app is supposed to save it's data in a [`Bundle`](https://developer.android.com/reference/android/os/Bundle.html), and passes the saved bundle in both `onCreate(…)` and `onRestoreInstanceState(…)` when the task is resumed if the activity has been killed by the system.\r\n\r\n## The issue about it in flutter\r\nIn the flutter apps I tried (Flutter Gallery, and the base project with the FAB tap counter), if I open enough apps to make Android kill the flutter app's Activity, all the state is lost when I come back to the flutter activity (while not having remove the task from recents).\r\n\r\n## Steps to Reproduce\r\n\r\n1. Install [Flutter Gallery](https://play.google.com/store/apps/details?id=io.flutter.gallery&hl=en)\r\n2. Open the device's settings, and in developer options, switch \"Don't keep activities\" on. (see the screenshot)\r\n![dev_option](https://pbs.twimg.com/media/Cw6qdhfWQAAKo_J.jpg:small)\r\nThis will allow to simulate when Android kills Activities because it lacks memory and you're not in the foreground.\r\n3. Open the Flutter Gallery app and go anywhere other than the main screen.\r\n4. Go to the launcher by pressing the device's home button.\r\n5. Press the overview button and return to Flutter Gallery. Here's the bug.\r\n\r\n**What's expected:** The app is in the same state that where we left off, with untouched UI.\r\n**What happens:** The activity is restarted from scratch, losing all the UI state, even really really long forms.\r\n"},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/370457661","html_url":"https://github.com/flutter/flutter/issues/6827#issuecomment-370457661","issue_url":"https://api.github.com/repos/flutter/flutter/issues/6827","id":370457661,"user":{"login":"LouisCAD","id":6975237,"avatar_url":"https://avatars0.githubusercontent.com/u/6975237?v=4","gravatar_id":"","url":"https://api.github.com/users/LouisCAD","html_url":"https://github.com/LouisCAD","followers_url":"https://api.github.com/users/LouisCAD/followers","following_url":"https://api.github.com/users/LouisCAD/following{/other_user}","gists_url":"https://api.github.com/users/LouisCAD/gists{/gist_id}","starred_url":"https://api.github.com/users/LouisCAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LouisCAD/subscriptions","organizations_url":"https://api.github.com/users/LouisCAD/orgs","repos_url":"https://api.github.com/users/LouisCAD/repos","events_url":"https://api.github.com/users/LouisCAD/events{/privacy}","received_events_url":"https://api.github.com/users/LouisCAD/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T15:34:05Z","updated_at":"2018-03-05T15:34:05Z","author_association":"NONE","body":"@nsreenath Any chat app should persist messages draft by itself every few characters and when going to background. You may type a long message, and if the device shutdown for some reason, you'd not want to lose your progress on this. Android instance state is for light user input and progress into the screens"}}
{"actor":{"display_login":"LouisCAD"}}