Clarify restore dialog, prevent spam
Bug: 4599646
State that it is the browser's windows/tabs to be restored and
show the browser's app icon in the dialog.
Also cut down on the frequency this prompt will appear by
ignoring tabs that haven't loaded anything except the home page.
Change-Id: I2c2cc03aa92da3199c47b455256145d392548930
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 6566ac8..1367ba2 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -288,6 +288,9 @@
*/
void saveState(Bundle outState, boolean saveImages) {
final int numTabs = getTabCount();
+ if (numTabs == 0) {
+ return;
+ }
long[] ids = new long[numTabs];
int i = 0;
for (Tab tab : mTabs) {
@@ -297,13 +300,15 @@
tab.getSavedState(saveImages));
}
}
- outState.putLongArray(POSITIONS, ids);
- Tab current = getCurrentTab();
- long cid = -1;
- if (current != null) {
- cid = current.getId();
+ if (!outState.isEmpty()) {
+ outState.putLongArray(POSITIONS, ids);
+ Tab current = getCurrentTab();
+ long cid = -1;
+ if (current != null) {
+ cid = current.getId();
+ }
+ outState.putLong(CURRENT, cid);
}
- outState.putLong(CURRENT, cid);
}
/**