mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1159753 - Add telemetry for Tab Queue (r=mfinkle)
This commit is contained in:
parent
4732b4b918
commit
f69d811043
@ -723,10 +723,10 @@ public class BrowserApp extends GeckoApp
|
||||
mBrowserToolbar.setTitle(intent.getDataString());
|
||||
|
||||
showTabQueuePromptIfApplicable(intent);
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT);
|
||||
} else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
|
||||
GuestSession.handleIntent(this, intent);
|
||||
} else if (TabQueueHelper.LOAD_URLS_ACTION.equals(action)) {
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "tabqueue");
|
||||
}
|
||||
|
||||
if (HardwareUtils.isTablet()) {
|
||||
@ -937,6 +937,10 @@ public class BrowserApp extends GeckoApp
|
||||
ThreadUtils.assertNotOnUiThread();
|
||||
|
||||
int queuedTabCount = TabQueueHelper.getTabQueueLength(BrowserApp.this);
|
||||
|
||||
Telemetry.addToHistogram("FENNEC_TABQUEUE_QUEUESIZE", queuedTabCount);
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "tabqueue-delayed");
|
||||
|
||||
TabQueueHelper.openQueuedUrls(BrowserApp.this, mProfile, TabQueueHelper.FILE_NAME, false);
|
||||
|
||||
// If there's more than one tab then also show the tabs panel.
|
||||
@ -1724,6 +1728,7 @@ public class BrowserApp extends GeckoApp
|
||||
Telemetry.addToHistogram("FENNEC_THUMBNAILS_COUNT", db.getCount(cr, "thumbnails"));
|
||||
Telemetry.addToHistogram("FENNEC_READING_LIST_COUNT", db.getReadingListAccessor().getCount(cr));
|
||||
Telemetry.addToHistogram("BROWSER_IS_USER_DEFAULT", (isDefaultBrowser(Intent.ACTION_VIEW) ? 1 : 0));
|
||||
Telemetry.addToHistogram("FENNEC_TABQUEUE_ENABLED", (TabQueueHelper.isTabQueueEnabled(BrowserApp.this) ? 1 : 0));
|
||||
if (Versions.feature16Plus) {
|
||||
Telemetry.addToHistogram("BROWSER_IS_ASSIST_DEFAULT", (isDefaultBrowser(Intent.ACTION_ASSIST) ? 1 : 0));
|
||||
}
|
||||
@ -3494,12 +3499,11 @@ public class BrowserApp extends GeckoApp
|
||||
// Hide firstrun-pane if the user is loading a URL from an external app.
|
||||
hideFirstrunPager();
|
||||
|
||||
// GeckoApp.ACTION_HOMESCREEN_SHORTCUT means we're opening a bookmark that
|
||||
// was added to Android's homescreen.
|
||||
final TelemetryContract.Method method =
|
||||
(isViewAction ? TelemetryContract.Method.INTENT : TelemetryContract.Method.HOMESCREEN);
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, method);
|
||||
if (isBookmarkAction) {
|
||||
// GeckoApp.ACTION_HOMESCREEN_SHORTCUT means we're opening a bookmark that
|
||||
// was added to Android's homescreen.
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.HOMESCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
showTabQueuePromptIfApplicable(intent);
|
||||
@ -3518,6 +3522,7 @@ public class BrowserApp extends GeckoApp
|
||||
|
||||
// If the user has clicked the tab queue notification then load the tabs.
|
||||
if(AppConstants.NIGHTLY_BUILD && AppConstants.MOZ_ANDROID_TAB_QUEUE && mInitialized && isTabQueueAction) {
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "tabqueue");
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -157,6 +157,9 @@ public interface TelemetryContract {
|
||||
// No method is specified.
|
||||
NONE(null),
|
||||
|
||||
// Action triggered from a notification in the Android notification bar.
|
||||
NOTIFICATION("notification"),
|
||||
|
||||
// Action triggered from a pageaction in the URLBar.
|
||||
// Note: Only used in JavaScript for now, but here for completeness.
|
||||
PAGEACTION("pageaction"),
|
||||
|
@ -9,6 +9,8 @@ import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.Locales;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.mozglue.ContextUtils;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
|
||||
@ -55,7 +57,7 @@ public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean shouldShowOpenInBackgroundToast = GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
|
||||
boolean shouldShowOpenInBackgroundToast = TabQueueHelper.isTabQueueEnabled(this);
|
||||
|
||||
if (shouldShowOpenInBackgroundToast) {
|
||||
showToast(safeIntent.getUnsafe());
|
||||
@ -76,6 +78,7 @@ public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
|
||||
private void loadNormally(Intent intent) {
|
||||
intent.setClassName(getApplicationContext(), AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
|
||||
startActivity(intent);
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "");
|
||||
finish();
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,11 @@ public class TabQueueHelper {
|
||||
public static boolean shouldShowTabQueuePrompt(Context context) {
|
||||
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
|
||||
|
||||
boolean isTabQueueEnabled = prefs.getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
|
||||
int numberOfTimesTabQueuePromptSeen = prefs.getInt(PREF_TAB_QUEUE_TIMES_PROMPT_SHOWN, 0);
|
||||
|
||||
// Exit early if the feature is already enabled or the user has seen the
|
||||
// prompt more than MAX_TIMES_TO_SHOW_PROMPT times.
|
||||
if (isTabQueueEnabled || numberOfTimesTabQueuePromptSeen >= MAX_TIMES_TO_SHOW_PROMPT) {
|
||||
if (isTabQueueEnabled(prefs) || numberOfTimesTabQueuePromptSeen >= MAX_TIMES_TO_SHOW_PROMPT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -184,10 +183,9 @@ public class TabQueueHelper {
|
||||
// TODO: Use profile shared prefs when bug 1147925 gets fixed.
|
||||
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
|
||||
|
||||
boolean tabQueueEnabled = prefs.getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
|
||||
int tabsQueued = prefs.getInt(PREF_TAB_QUEUE_COUNT, 0);
|
||||
|
||||
return tabQueueEnabled && tabsQueued > 0;
|
||||
return isTabQueueEnabled(prefs) && tabsQueued > 0;
|
||||
}
|
||||
|
||||
public static int getTabQueueLength(final Context context) {
|
||||
@ -270,4 +268,12 @@ public class TabQueueHelper {
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isTabQueueEnabled(Context context) {
|
||||
return isTabQueueEnabled(GeckoSharedPrefs.forApp(context));
|
||||
}
|
||||
|
||||
public static boolean isTabQueueEnabled(SharedPreferences prefs) {
|
||||
return prefs.getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,10 @@
|
||||
|
||||
package org.mozilla.gecko.tabqueue;
|
||||
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.Locales;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.animation.TransitionsTracker;
|
||||
|
||||
import android.os.Bundle;
|
||||
@ -39,15 +41,19 @@ public class TabQueuePrompt extends Locales.LocaleAwareActivity {
|
||||
private void showTabQueueEnablePrompt() {
|
||||
setContentView(R.layout.tab_queue_prompt);
|
||||
|
||||
final int numberOfTimesTabQueuePromptSeen = GeckoSharedPrefs.forApp(this).getInt(TabQueueHelper.PREF_TAB_QUEUE_TIMES_PROMPT_SHOWN, 0);
|
||||
|
||||
findViewById(R.id.ok_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onConfirmButtonPressed();
|
||||
Telemetry.addToHistogram("FENNEC_TABQUEUE_PROMPT_ENABLE_YES", numberOfTimesTabQueuePromptSeen);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.cancel_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Telemetry.addToHistogram("FENNEC_TABQUEUE_PROMPT_ENABLE_NO", numberOfTimesTabQueuePromptSeen);
|
||||
setResult(TabQueueHelper.TAB_QUEUE_NO);
|
||||
finish();
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.mozglue.ContextUtils;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
|
||||
@ -29,6 +31,7 @@ import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -199,6 +202,17 @@ public class TabQueueService extends Service {
|
||||
GeckoSharedPrefs.forApp(getApplicationContext()).edit().remove(GeckoPreferences.PREFS_TAB_QUEUE_LAST_SITE)
|
||||
.remove(GeckoPreferences.PREFS_TAB_QUEUE_LAST_TIME)
|
||||
.apply();
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "tabqueue-now");
|
||||
|
||||
executorService.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int queuedTabCount = TabQueueHelper.getTabQueueLength(TabQueueService.this);
|
||||
Telemetry.addToHistogram("FENNEC_TABQUEUE_QUEUESIZE", queuedTabCount);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void removeView() {
|
||||
|
@ -7993,5 +7993,29 @@
|
||||
"expires_in_version": "never",
|
||||
"kind": "count",
|
||||
"description": "Record the removal of defective permissions.sqlite"
|
||||
},
|
||||
"FENNEC_TABQUEUE_QUEUESIZE" : {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"high": "50",
|
||||
"n_buckets": 10,
|
||||
"description": "The number of tabs queued when opened."
|
||||
},
|
||||
"FENNEC_TABQUEUE_PROMPT_ENABLE_YES" : {
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": 3,
|
||||
"description": "The number of times the tab queue prompt was seen before the user selected YES."
|
||||
},
|
||||
"FENNEC_TABQUEUE_PROMPT_ENABLE_NO" : {
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"n_values": 3,
|
||||
"description": "The number of times the tab queue prompt was seen before the user selected NO."
|
||||
},
|
||||
"FENNEC_TABQUEUE_ENABLED": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "flag",
|
||||
"description": "Has the tab queue functionality been enabled"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user