Skip to content

Commit

Permalink
Add a disable-arc-data-wipe flag.
Browse files Browse the repository at this point in the history
This flag prevents ARC user data from being wiped if the user has opted
out.  This is primarily intended for testing cases.

BUG=625559
TEST=Manual testing on device

Review-Url: https://codereview.chromium.org/2118143003
Cr-Commit-Position: refs/heads/master@{#403841}
  • Loading branch information
dspaid authored and Commit bot committed Jul 6, 2016
1 parent 22beefb commit 874a570
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions chrome/browser/chromeos/login/chrome_restart_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void DeriveCommandLine(const GURL& start_url,
chromeos::switches::kConsumerDeviceManagementUrl,
chromeos::switches::kDbusStub,
chromeos::switches::kDbusUnstubClients,
chromeos::switches::kDisableArcDataWipe,
chromeos::switches::kDisableArcOptInVerification,
chromeos::switches::kDisableLoginAnimations,
chromeos::switches::kEnableArc,
Expand Down
3 changes: 3 additions & 0 deletions chromeos/chromeos_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const char kDerelictDetectionTimeout[] = "derelict-detection-timeout";
// Time in seconds before a derelict machines starts demo mode.
const char kDerelictIdleTimeout[] = "derelict-idle-timeout";

// Disables android user data wipe on opt out.
const char kDisableArcDataWipe[] = "disable-arc-data-wipe";

// Disables ARC Opt-in verification process and ARC is enabled by default.
const char kDisableArcOptInVerification[] = "disable-arc-opt-in-verification";

Expand Down
1 change: 1 addition & 0 deletions chromeos/chromeos_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CHROMEOS_EXPORT extern const char kDbusStub[];
CHROMEOS_EXPORT extern const char kDbusUnstubClients[];
CHROMEOS_EXPORT extern const char kDerelictDetectionTimeout[];
CHROMEOS_EXPORT extern const char kDerelictIdleTimeout[];
CHROMEOS_EXPORT extern const char kDisableArcDataWipe[];
CHROMEOS_EXPORT extern const char kDisableArcOptInVerification[];
CHROMEOS_EXPORT extern const char kDisableBootAnimation[];
CHROMEOS_EXPORT extern const char kDisableCloudImport[];
Expand Down
7 changes: 6 additions & 1 deletion components/arc/user_data/arc_user_data_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "components/arc/user_data/arc_user_data_service.h"

#include "base/command_line.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/session_manager_client.h"
Expand Down Expand Up @@ -49,8 +51,11 @@ void ArcUserDataService::ClearIfDisabled() {
LOG(ERROR) << "ARC instance not stopped, user data can't be cleared";
return;
}
if (arc_enabled_pref_->GetValue())
if (arc_enabled_pref_->GetValue() ||
base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kDisableArcDataWipe)) {
return;
}
const cryptohome::Identification cryptohome_id(primary_user_account_id_);
chromeos::SessionManagerClient* session_manager_client =
chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
Expand Down

0 comments on commit 874a570

Please sign in to comment.