Retain webview history when viewing Safety notices. Fixes #2160518
Save and restore webview history when changing orientation.
diff --git a/src/com/android/settings/SettingsSafetyLegalActivity.java b/src/com/android/settings/SettingsSafetyLegalActivity.java
index 619dc94..0c51928 100644
--- a/src/com/android/settings/SettingsSafetyLegalActivity.java
+++ b/src/com/android/settings/SettingsSafetyLegalActivity.java
@@ -58,7 +58,11 @@
// Begin accessing
mWebView.getSettings().setJavaScriptEnabled(true);
- mWebView.loadUrl(userSafetylegalUrl);
+ if (savedInstanceState == null) {
+ mWebView.loadUrl(userSafetylegalUrl);
+ } else {
+ mWebView.restoreState(savedInstanceState);
+ }
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
@@ -110,4 +114,10 @@
public void onCancel(DialogInterface dialog) {
finish();
}
+
+ @Override
+ public void onSaveInstanceState(Bundle icicle) {
+ mWebView.saveState(icicle);
+ super.onSaveInstanceState(icicle);
+ }
}