Commit ef70c85e authored by Paul Miller's avatar Paul Miller Committed by Commit Bot

WebView: Ignore permanent-consistency experiments

Android WebView currently treats permanent-consistency experiments
(which are intended to retain their group assignments across runs) as
session-consistency (which are intended to be randomly assigned on each
run). It's safer to not apply permanent-consistency experiments to
WebView at all, to avoid mistakes.

BUG=866722

Change-Id: I9d501437718d934c2a59b95335c787302ce758e7
Reviewed-on: https://chromium-review.googlesource.com/1148991Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578070}
parent f94b6a70
...@@ -58,6 +58,10 @@ Channel AwVariationsServiceClient::GetChannel() { ...@@ -58,6 +58,10 @@ Channel AwVariationsServiceClient::GetChannel() {
return channel == Channel::UNKNOWN ? Channel::STABLE : channel; return channel == Channel::UNKNOWN ? Channel::STABLE : channel;
} }
bool AwVariationsServiceClient::GetSupportsPermanentConsistency() {
return false;
}
bool AwVariationsServiceClient::OverridesRestrictParameter( bool AwVariationsServiceClient::OverridesRestrictParameter(
std::string* parameter) { std::string* parameter) {
return false; return false;
......
...@@ -31,6 +31,7 @@ class AwVariationsServiceClient : public variations::VariationsServiceClient { ...@@ -31,6 +31,7 @@ class AwVariationsServiceClient : public variations::VariationsServiceClient {
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override; scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
network_time::NetworkTimeTracker* GetNetworkTimeTracker() override; network_time::NetworkTimeTracker* GetNetworkTimeTracker() override;
version_info::Channel GetChannel() override; version_info::Channel GetChannel() override;
bool GetSupportsPermanentConsistency() override;
bool OverridesRestrictParameter(std::string* parameter) override; bool OverridesRestrictParameter(std::string* parameter) override;
DISALLOW_COPY_AND_ASSIGN(AwVariationsServiceClient); DISALLOW_COPY_AND_ASSIGN(AwVariationsServiceClient);
......
...@@ -47,6 +47,11 @@ struct ClientFilterableState { ...@@ -47,6 +47,11 @@ struct ClientFilterableState {
// Based on base::SysInfo::IsLowEndDevice(). // Based on base::SysInfo::IsLowEndDevice().
bool is_low_end_device = false; bool is_low_end_device = false;
// Whether this platform supports experiments which retain their group
// assignments across runs.
// TODO(paulmiller): Remove this once https://crbug.com/866722 is resolved.
bool supports_permanent_consistency = true;
// The country code to use for studies configured with session consistency. // The country code to use for studies configured with session consistency.
std::string session_consistency_country; std::string session_consistency_country;
......
...@@ -12,6 +12,7 @@ static_library("service") { ...@@ -12,6 +12,7 @@ static_library("service") {
"variations_field_trial_creator.h", "variations_field_trial_creator.h",
"variations_service.cc", "variations_service.cc",
"variations_service.h", "variations_service.h",
"variations_service_client.cc",
"variations_service_client.h", "variations_service_client.h",
] ]
......
...@@ -259,6 +259,8 @@ VariationsFieldTrialCreator::GetClientFilterableStateForVersion( ...@@ -259,6 +259,8 @@ VariationsFieldTrialCreator::GetClientFilterableStateForVersion(
// evaluated, that field trial would not be able to apply for this case. // evaluated, that field trial would not be able to apply for this case.
state->is_low_end_device = base::SysInfo::IsLowEndDevice(); state->is_low_end_device = base::SysInfo::IsLowEndDevice();
#endif #endif
state->supports_permanent_consistency =
client_->GetSupportsPermanentConsistency();
state->session_consistency_country = GetLatestCountry(); state->session_consistency_country = GetLatestCountry();
state->permanent_consistency_country = LoadPermanentConsistencyCountry( state->permanent_consistency_country = LoadPermanentConsistencyCountry(
version, state->session_consistency_country); version, state->session_consistency_country);
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/variations/service/variations_service_client.h"
namespace variations {
bool VariationsServiceClient::GetSupportsPermanentConsistency() {
return true;
}
} // namespace variations
...@@ -45,6 +45,11 @@ class VariationsServiceClient { ...@@ -45,6 +45,11 @@ class VariationsServiceClient {
// Gets the channel of the embedder. // Gets the channel of the embedder.
virtual version_info::Channel GetChannel() = 0; virtual version_info::Channel GetChannel() = 0;
// Gets whether this platform supports experiments which retain their group
// assignments across runs.
// TODO(paulmiller): Remove this once https://crbug.com/866722 is resolved.
virtual bool GetSupportsPermanentConsistency();
// Returns whether the embedder overrides the value of the restrict parameter. // Returns whether the embedder overrides the value of the restrict parameter.
// |parameter| is an out-param that will contain the value of the restrict // |parameter| is an out-param that will contain the value of the restrict
// parameter if true is returned. // parameter if true is returned.
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "components/variations/client_filterable_state.h" #include "components/variations/client_filterable_state.h"
#include "components/variations/proto/study.pb.h"
namespace variations { namespace variations {
namespace { namespace {
...@@ -266,6 +267,14 @@ bool ShouldAddStudy(const Study& study, ...@@ -266,6 +267,14 @@ bool ShouldAddStudy(const Study& study,
} }
} }
// TODO(paulmiller): Remove this once https://crbug.com/866722 is resolved.
if (study.consistency() == Study_Consistency_PERMANENT &&
!client_state.supports_permanent_consistency) {
DVLOG(1) << "Filtered out study " << study.name()
<< " due to supports_permanent_consistency.";
return false;
}
DVLOG(1) << "Kept study " << study.name() << "."; DVLOG(1) << "Kept study " << study.name() << ".";
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment