Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2113)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Issue 2930553002: Add UMA metric to track the time elapsed since a WebAPK was last launched (Closed)
Patch Set: Merge branch 'master' into last_launched2 Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
index 6acfaacd43f8457c0f941ab1efe3e5c6332562b5..78264c4311d77f26c6a84a5ae71c29588f82187c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -362,10 +362,23 @@ public class WebappActivity extends FullScreenActivity {
// app is not directly launched from the home screen, as this interferes
// with the heuristic.
if (mWebappInfo.isLaunchedFromHomescreen()) {
+ boolean previouslyLaunched = storage.hasBeenLaunched();
+ long previousUsageTimestamp = storage.getLastUsedTime();
+ storage.setHasBeenLaunched();
storage.updateLastUsedTime();
+ onUpdatedLastUsedTime(storage, previouslyLaunched, previousUsageTimestamp);
}
}
+ /**
+ * Called after updating the last used time in {@link WebappDataStorage}.
+ * @param previouslyLaunched Whether the webapp has been previously launched from the home
+ * screen.
+ * @param previousUsageTimestamp The previous time that the webapp was used.
+ */
+ protected void onUpdatedLastUsedTime(
+ WebappDataStorage storage, boolean previouslyLaunched, long previousUsageTimestamp) {}
+
private void updateUrlBar() {
Tab tab = getActivityTab();
if (tab == null || mUrlBar == null) return;

Powered by Google App Engine
This is Rietveld 408576698