Fix home/back buttons flow in PreferenceActivity.
Bug: b/35977048 Test: Done manually. Automated test will be added later. After recent changes in PreferenceActivity finishing the activity on pressing back is not correct anymore. Instead onBackButton method should be called to deal with it (we have fragments transactions for instance). There can be multiple buttons: 1. The native default one - calls onBackPressed by default so no extra work needed. 2. PreferenceActivity has buttons that can de displayed when settting EXTRA_PREFS_SHOW_BUTTON_BAR to true. But it is a private API and I didn't find any usage of it, so there is no need to change that. Also it looks like something very specific used in WiFi wizards. 3. Apps often use a toolbar that has a home button which essentialy emulates back button. The issue is that this Activity never had support for this. So apps had to override onOptionsItemSelected and some of those are unfortunately calling finish() which worked previously when PreferenceActivity wasn't using fragments in single pane. This CL adds support so app will no longer need to override that method and some apps need to be instructed to use that override in O. Change-Id: I94f557edb2e03f89fbf02e800beb390b2ad0544f
Loading
Please register or sign in to comment