By comparing the rates for FENNEC_SESSIONSTORE_DAMAGED_SESSION_FILE and this new probe, we might be able to infer whether there is a failure mode for the session store where the main session store file is completely lost after an interrupted write and doesn't exist even as an empty file of 0 bytes size.
The first run case will be excluded, because in that case both the main and the backup session file won't exist, so neither telemetry probe will be triggered.
MozReview-Commit-ID: JTR54Vk18jW
Since a SessionRestoreException also happens if we deliberately skipped all tabs (because they didn't contain anything interesting apart from about:home) or the session file was valid but didn't contain any tabs (because the user cleared history), we need to ensure that we don't switch to the backup copy in that case.
To that extent, we extend the SessionParser's parse function to return whether any JSON exceptions occured while parsing the session file, which would signify a corrupt session file.
MozReview-Commit-ID: Kdh5d69irqF
Currently, despite its name sessionstore.bak isn't actually a backup copy, but simply contains the last session if we aren't restoring tabs automatically and is used for powering what used to be the "Tabs from last time" section of the Recent Tabs panel.
This patch changes its filename to sessionstore.old, which frees up sessionstore.bak to be used for an actual backup copy of the current session store data.
If we are not restoring tabs automatically, sessionstore.old will be freshly recreated during each app startup by copying from sessionstore.js's contents, whereas if we *are* restoring automatically, any sessionstore.old file older than a day will be expired anyway, therefore no special migration logic is necessary for this change.
MozReview-Commit-ID: H7Gl5MQi2J4
We're now calling setIntent on the background thread. The onTargetSelected callback expects
to be run on the UI thread, and it looks like Android hangs up when we call UI methods
on the background thread. This in turn means the entire background thread gets locked up
(we execute tasks on the background thread sequentially) and no further background runnables
are executed. This breaks anything else requiring use of the background thread, e.g.
favicon generation, search, permissions doorhangers, etc.
MozReview-Commit-ID: CoYUOMqNX0m
In this patch, I move the telemetry server preference from app preferences
to per-profile preferences. We never allowed the user to set the preference
so this should cause no issues.
MozReview-Commit-ID: 7D5y58R2ejd
Edge case: the admin profile can disable health report upload for themselves
but (I assume) the new profile won't automatically match these settings. While
I'm not sure if this is even possible, it's outside the scope of this bug.
MozReview-Commit-ID: 1SkXhL7B5xb
DB access happens deep in the internals of setting a new Intent for our
ActionProvider. Posting this to a background thread here seems to be the simplest
option to ensure correct threading.
MozReview-Commit-ID: 3iS8w5Cxf02
It's possible there are more UI-thread DB accesses lurking. To avoid maintenance burden
we should therefore enable this assert only in debug builds - releases will be
unaffected, but we can still notice incorrect DB access during development.
MozReview-Commit-ID: Kgzf1L3WjIE
Currently we might have old (aka stale) clients appear on the History panel, which could be confusing.
This patch modifies underlying query to select only those clients whose LAST_MODIFIED timestamp
is newer than three weeks ago.
MozReview-Commit-ID: JsZJwNONDJG
For people with customised home panels, we need to explicitly remove the Recent Tabs panel. We also unhide the Combined History panel if it was previously hidden and additionally turn it into the default panel if the Recent Tabs panel was the previous default panel.
MozReview-Commit-ID: 5CSJUTRysQU
By passing the panel types to be removed/set as new default panel as arguments instead of hard coding them, we can reuse that function for our own home panel config migration.
MozReview-Commit-ID: BsMxcbInRbX
After detecting multiple successive crashes in a row, we temporarily switch off automatic session restoring and display the Recent Tabs panel instead. As that panel is going to be removed, we intercept loads of the Recent Tabs panel about:home?panel=... URL and redirect them to the Combined History panel. We also use the facilities provided by bug 1060544 to jump directly to the Recent Tabs folder in that case.
MozReview-Commit-ID: 7dQ7tW2dD1M
This adds telemetry for clicking on a closed tab or the "Open all" button. Methods and extras strings are based on those used for the old Recent Tabs panel.
MozReview-Commit-ID: 1Kc8fACkmIc
Recently closed tabs aren't synced, therefore being able to swipe to refresh within the Recent tabs folder isn't necessary. To avoid triggering a refresh by accident, we restrict swipe to refresh to the Synced devices folder itself.
MozReview-Commit-ID: YwekSwQr2q
Sessionstore.bak is only read when we are initialising the home panels, so after clearing all history from the button in the Combined History panel, the "Tabs from last time" section would still linger around until the home panels have been closed and reopened. To prevent this, we now directly notify the RecentTabsAdapter when all history has been deleted, so it can immediately clear its own copy of the last session's tabs.
MozReview-Commit-ID: 3EFY2WbWqzh
Depending on the History panel's PanelLevel state, we now dynamically set the panel footer button's text and determine its onClick behaviour.
MozReview-Commit-ID: EjesnHsntyC
We need to update the recent tabs count displayed by the smart folder as necessary. To do this, we copy the approach used for updating the synced devices count.
MozReview-Commit-ID: BFwv5bY1DWk
The recent tabs count might change while the Recent Tabs folder is open, e.g. immediately after startup, once we receive the first "ClosedTabs:Data" message from the session store. Therefore, we need to hide/unhide the empty view as necessary, which is normally handled by the Combined History panel's updateEmptyView() function. Since we aren't using a cursor, we can't hinge calling that on the CursorLoader's onLoadFinished() callback, so instead, we include our own callback to the Combined History panel, modelled after the DeviceUpdateHandler used for updating the count of synced devices.
MozReview-Commit-ID: GLHM9LoWk2h
This fills the new smart folder we've previously added with life and displays the recently closed tabs as we receive them from the session store. If we can find a sessionstore.bak file (previously the "Tabs from last time"), we also add those tabs to the bottom of the list.
Most of the code for communicating with the session store and reading sessionstore.bak is adapted from the original Recent Tabs panel, however unlike the previous implementation, I've opted for a cursor-less approach of storing and retrieving the recent tabs data, since the recent tabs data isn't actually powered by a database anyway. Instead, the RecentTabsAdapter maintains two arrays for storing "Recently closed tabs" (as received through messages from the Gecko session store) and "Tabs from last time" (as read from sessionstore.bak during panel initialisation).
Also, as per the other Combined History panel adapters and because we're now using a RecyclerView instead of a ListView, list item types are now determined on demand through getItemTypeForPosition() instead of precalculating them during a data update and directly storing together with the tab data items in a cursor.
MozReview-Commit-ID: IpoUr9f0JBP
This folder can be opened and closed to get back to the history view, however it doesn't contain any actual content (closed tabs) yet. Its empty view is based on the original empty view of the Recent Tabs panel.
For displaying the recently closed tabs count within the smart folder similarly to how we display the number of synced devices, two new strings need to be added.
MozReview-Commit-ID: IAL0yDrc2Ld
See the added code comments for motivations.
Note that this is a speculative patch - I was unable to reproduce the crash and
thus do not know if it fixes it, however, I did test that the appropriate
toolbar configuration is created on vanilla Android for phone & tablet.
MozReview-Commit-ID: 2v1Ix8X68LH