org.chromium.components.variations.VariationsAssociatedData Java Examples
The following examples show how to use
org.chromium.components.variations.VariationsAssociatedData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeBrowserInitializer.java From delion with Apache License 2.0 | 6 votes |
private void onFinishNativeInitialization() { if (mNativeInitializationComplete) return; mNativeInitializationComplete = true; ContentUriUtils.setFileProviderUtil(new FileProviderHelper()); if (TextUtils.equals("true", VariationsAssociatedData.getVariationParamValue( MinidumpDirectoryObserver.MINIDUMP_EXPERIMENT_NAME, "Enabled"))) { // Start the file observer to watch the minidump directory. new AsyncTask<Void, Void, MinidumpDirectoryObserver>() { @Override protected MinidumpDirectoryObserver doInBackground(Void... params) { return new MinidumpDirectoryObserver(); } @Override protected void onPostExecute(MinidumpDirectoryObserver minidumpDirectoryObserver) { mMinidumpDirectoryObserver = minidumpDirectoryObserver; mMinidumpDirectoryObserver.startWatching(); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
Example #2
Source File: ContextualSearchFieldTrial.java From 365browser with Apache License 2.0 | 6 votes |
/** * Returns an integer value for a Finch parameter, or the default value if no parameter exists * in the current configuration. Also checks for a command-line switch with the same name. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @param defaultValue The default value to return when there's no param or switch. * @return An integer value -- either the param or the default. */ private static int getIntParamValueOrDefault(String paramName, int defaultValue) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } if (!TextUtils.isEmpty(value)) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { return defaultValue; } } return defaultValue; }
Example #3
Source File: ContextualSearchFieldTrial.java From delion with Apache License 2.0 | 6 votes |
/** * Returns an integer value for a Finch parameter, or the default value if no parameter exists * in the current configuration. Also checks for a command-line switch with the same name. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @param defaultValue The default value to return when there's no param or switch. * @return An integer value -- either the param or the default. */ private static int getIntParamValueOrDefault(String paramName, int defaultValue) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } if (!TextUtils.isEmpty(value)) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { return defaultValue; } } return defaultValue; }
Example #4
Source File: ContextualSearchFieldTrial.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Returns an integer value for a Finch parameter, or the default value if no parameter exists * in the current configuration. Also checks for a command-line switch with the same name. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @param defaultValue The default value to return when there's no param or switch. * @return An integer value -- either the param or the default. */ private static int getIntParamValueOrDefault(String paramName, int defaultValue) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } if (!TextUtils.isEmpty(value)) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { return defaultValue; } } return defaultValue; }
Example #5
Source File: UpdateMenuItemHelper.java From 365browser with Apache License 2.0 | 5 votes |
/** * Gets a String VariationsAssociatedData parameter. Also checks for a command-line switch with * the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return The command-line flag value if present, or the param is value if present. */ private static String getStringParamValue(String paramName) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } return value; }
Example #6
Source File: UpdateMenuItemHelper.java From 365browser with Apache License 2.0 | 5 votes |
/** * Gets a boolean VariationsAssociatedData parameter, assuming the <paramName>="true" format. * Also checks for a command-line switch with the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return Whether the param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #7
Source File: CardsVariationParameters.java From 365browser with Apache License 2.0 | 5 votes |
private static String getParamValue(String fieldTrialName, String paramName) { if (sTestVariationParams != null) { String value = sTestVariationParams.get(paramName); if (value == null) return ""; return value; } return VariationsAssociatedData.getVariationParamValue(fieldTrialName, paramName); }
Example #8
Source File: ContextualSearchFieldTrial.java From 365browser with Apache License 2.0 | 5 votes |
/** * Gets a boolean Finch parameter, assuming the <paramName>="true" format. Also checks for a * command-line switch with the same name, for easy local testing. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @return Whether the Finch param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #9
Source File: DataReductionPromoSnackbarController.java From 365browser with Apache License 2.0 | 5 votes |
/** * Creates an instance of a {@link DataReductionPromoSnackbarController}. * * @param context The {@link Context} in which snackbar is shown. * @param snackbarManager The manager that helps to show the snackbar. */ public DataReductionPromoSnackbarController(Context context, SnackbarManager snackbarManager) { mSnackbarManager = snackbarManager; mContext = context; String variationParamValue = VariationsAssociatedData .getVariationParamValue(PROMO_FIELD_TRIAL_NAME, PROMO_PARAM_NAME); if (variationParamValue.isEmpty()) { if (CommandLine.getInstance() .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { mPromoDataSavingsMB = new int[1]; mPromoDataSavingsMB[0] = 1; } else { mPromoDataSavingsMB = new int[0]; } } else { variationParamValue = variationParamValue.replace(" ", ""); String[] promoDataSavingStrings = variationParamValue.split(";"); if (CommandLine.getInstance() .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { mPromoDataSavingsMB = new int[promoDataSavingStrings.length + 1]; mPromoDataSavingsMB[promoDataSavingStrings.length] = 1; } else { mPromoDataSavingsMB = new int[promoDataSavingStrings.length]; } for (int i = 0; i < promoDataSavingStrings.length; i++) { try { mPromoDataSavingsMB[i] = Integer.parseInt(promoDataSavingStrings[i]); } catch (NumberFormatException e) { mPromoDataSavingsMB[i] = -1; } } } }
Example #10
Source File: DataUseTabUIManager.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking ended UI (snackbar or interstitial) should be shown. */ public static boolean shouldShowDataUseEndedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_ENDED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #11
Source File: DataUseTabUIManager.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking started UI (snackbar) should be shown. */ public static boolean shouldShowDataUseStartedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_STARTED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #12
Source File: UpdateMenuItemHelper.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Gets a String VariationsAssociatedData parameter. Also checks for a command-line switch with * the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return The command-line flag value if present, or the param is value if present. */ private static String getStringParamValue(String paramName) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } return value; }
Example #13
Source File: UpdateMenuItemHelper.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Gets a boolean VariationsAssociatedData parameter, assuming the <paramName>="true" format. * Also checks for a command-line switch with the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return Whether the param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #14
Source File: CardsVariationParameters.java From AndroidChromium with Apache License 2.0 | 5 votes |
private static int getIntValue(String paramName, int defaultValue) { // TODO(jkrcal): Get parameter by feature name, not field trial name. String value = VariationsAssociatedData.getVariationParamValue( FIELD_TRIAL_NAME, paramName); if (!TextUtils.isEmpty(value)) { try { return Integer.parseInt(value); } catch (NumberFormatException ex) { Log.w(TAG, "Cannot parse %s experiment value, %s.", paramName, value); } } return defaultValue; }
Example #15
Source File: ContextualSearchFieldTrial.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Gets a boolean Finch parameter, assuming the <paramName>="true" format. Also checks for a * command-line switch with the same name, for easy local testing. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @return Whether the Finch param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #16
Source File: DataUseTabUIManager.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking ended UI (snackbar or interstitial) should be shown. */ public static boolean shouldShowDataUseEndedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_ENDED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #17
Source File: DataUseTabUIManager.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking started UI (snackbar) should be shown. */ public static boolean shouldShowDataUseStartedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_STARTED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #18
Source File: UpdateMenuItemHelper.java From delion with Apache License 2.0 | 5 votes |
/** * Gets a String VariationsAssociatedData parameter. Also checks for a command-line switch with * the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return The command-line flag value if present, or the param is value if present. */ private static String getStringParamValue(String paramName) { String value = CommandLine.getInstance().getSwitchValue(paramName); if (TextUtils.isEmpty(value)) { value = VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName); } return value; }
Example #19
Source File: UpdateMenuItemHelper.java From delion with Apache License 2.0 | 5 votes |
/** * Gets a boolean VariationsAssociatedData parameter, assuming the <paramName>="true" format. * Also checks for a command-line switch with the same name, for easy local testing. * @param paramName The name of the parameter (or command-line switch) to get a value for. * @return Whether the param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #20
Source File: Tab.java From delion with Apache License 2.0 | 5 votes |
/** * Performs any subclass-specific tasks when the Tab crashes. */ void handleTabCrash() { mIsLoading = false; mIsBeingRestored = false; if (mTabUma != null) mTabUma.onRendererCrashed(); if (!TextUtils.equals("true", VariationsAssociatedData.getVariationParamValue( MinidumpDirectoryObserver.MINIDUMP_EXPERIMENT_NAME, "Enabled"))) { try { // Update the most recent minidump file with the logcat. Doing this asynchronously // adds a race condition in the case of multiple simultaneously renderer crashses // but because the data will be the same for all of them it is innocuous. We can // attempt to do this regardless of whether it was a foreground tab in the event // that it's a real crash and not just android killing the tab. Context context = getApplicationContext(); Intent intent = MinidumpUploadService.createFindAndUploadLastCrashIntent(context); context.startService(intent); RecordUserAction.record("MobileBreakpadUploadAttempt"); } catch (SecurityException e) { // For KitKat and below, there was a framework bug which cause us to not be able to // find our own crash uploading service. Ignore a SecurityException here on older // OS versions since the crash will eventually get uploaded on next start. // crbug/542533 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { throw e; } } } }
Example #21
Source File: ContextualSearchFieldTrial.java From delion with Apache License 2.0 | 5 votes |
/** * Gets a boolean Finch parameter, assuming the <paramName>="true" format. Also checks for a * command-line switch with the same name, for easy local testing. * @param paramName The name of the Finch parameter (or command-line switch) to get a value for. * @return Whether the Finch param is defined with a value "true", if there's a command-line * flag present with any value. */ private static boolean getBooleanParam(String paramName) { if (CommandLine.getInstance().hasSwitch(paramName)) { return true; } return TextUtils.equals(ENABLED_VALUE, VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName)); }
Example #22
Source File: UmaSessionStats.java From delion with Apache License 2.0 | 5 votes |
/** * Updating Android preferences according to equivalent native preferences so that the values * can be retrieved while native preferences are not accessible. */ private void updatePreferences() { PrivacyPreferencesManager prefManager = PrivacyPreferencesManager.getInstance(); // Update cellular experiment preference. Cellular experiment is ON by default. boolean cellularExperiment = true; if (TextUtils.equals("false", VariationsAssociatedData.getVariationParamValue( "UMA_EnableCellularLogUpload", "Enabled"))) { cellularExperiment = false; } prefManager.setCellularExperiment(cellularExperiment); // Migrate to new preferences for cellular experiment. if (cellularExperiment) { PrefServiceBridge prefBridge = PrefServiceBridge.getInstance(); // If the native preference metrics reporting has not been set, then initialize it // based on the older android preference. if (!prefBridge.hasSetMetricsReporting()) { prefBridge.setMetricsReportingEnabled(prefManager.isUploadCrashDumpEnabled()); } // Set new Android preference for usage and crash reporting. prefManager.setUsageAndCrashReporting(prefBridge.isMetricsReportingEnabled()); } // Make sure preferences are in sync. prefManager.syncUsageAndCrashReportingPrefs(); }
Example #23
Source File: DataUseTabUIManager.java From delion with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking ended UI (snackbar or interstitial) should be shown. */ public static boolean shouldShowDataUseEndedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_ENDED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #24
Source File: DataUseTabUIManager.java From delion with Apache License 2.0 | 5 votes |
/** * @return true if the data use tracking started UI (snackbar) should be shown. */ public static boolean shouldShowDataUseStartedUI() { // UI should be shown only when field trial is active, not disabled in Finch and in // non-roaming-cellular connection. return FieldTrialList.trialExists(DATA_USE_FIELD_TRIAL) && !DISABLE_DATA_USE_UI_PARAM_VALUE.equals( VariationsAssociatedData.getVariationParamValue( DATA_USE_FIELD_TRIAL, DISABLE_DATA_USE_STARTED_UI_PARAM)) && nativeIsNonRoamingCellularConnection(); }
Example #25
Source File: DataReductionPromoSnackbarController.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Creates an instance of a {@link DataReductionPromoSnackbarController}. * * @param context The {@link Context} in which snackbar is shown. * @param snackbarManager The manager that helps to show the snackbar. */ public DataReductionPromoSnackbarController(Context context, SnackbarManager snackbarManager) { mSnackbarManager = snackbarManager; mContext = context; String variationParamValue = VariationsAssociatedData .getVariationParamValue(PROMO_FIELD_TRIAL_NAME, PROMO_PARAM_NAME); if (variationParamValue.isEmpty()) { if (CommandLine.getInstance() .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { mPromoDataSavingsMB = new int[1]; mPromoDataSavingsMB[0] = 1; } else { mPromoDataSavingsMB = new int[0]; } } else { variationParamValue = variationParamValue.replace(" ", ""); String[] promoDataSavingStrings = variationParamValue.split(";"); if (CommandLine.getInstance() .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) { mPromoDataSavingsMB = new int[promoDataSavingStrings.length + 1]; mPromoDataSavingsMB[promoDataSavingStrings.length] = 1; } else { mPromoDataSavingsMB = new int[promoDataSavingStrings.length]; } for (int i = 0; i < promoDataSavingStrings.length; i++) { try { mPromoDataSavingsMB[i] = Integer.parseInt(promoDataSavingStrings[i]); } catch (NumberFormatException e) { mPromoDataSavingsMB[i] = -1; } } } if (CommandLine.getInstance().hasSwitch(CLEAR_DATA_REDUCTION_PROXY_DATA_SAVINGS_SWITCH)) { DataReductionPromoUtils.saveSnackbarPromoDisplayed(0); } }
Example #26
Source File: CardsVariationParameters.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * @return Whether the NTP should initially be scrolled below the fold. */ public static boolean isScrollBelowTheFoldEnabled() { return Boolean.parseBoolean(VariationsAssociatedData.getVariationParamValue( FIELD_TRIAL_NAME, PARAM_SCROLL_BELOW_THE_FOLD)); }
Example #27
Source File: CardsVariationParameters.java From AndroidChromium with Apache License 2.0 | 4 votes |
public static boolean isFaviconServiceEnabled() { return !PARAM_DISABLED_VALUE.equals(VariationsAssociatedData.getVariationParamValue( FIELD_TRIAL_NAME, PARAM_FAVICON_SERVICE_NAME)); }
Example #28
Source File: FeedbackCollector.java From AndroidChromium with Apache License 2.0 | 4 votes |
private void addVariationsData() { if (mProfile.isOffTheRecord()) return; mData.putAll(VariationsAssociatedData.getFeedbackMap()); }
Example #29
Source File: FeedbackCollector.java From 365browser with Apache License 2.0 | 4 votes |
private void addVariationsData() { if (mProfile.isOffTheRecord()) return; mData.putAll(VariationsAssociatedData.getFeedbackMap()); }
Example #30
Source File: FeedbackCollector.java From delion with Apache License 2.0 | 4 votes |
private void addVariationsData() { if (mProfile.isOffTheRecord()) return; mData.putAll(VariationsAssociatedData.getFeedbackMap()); }