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

Unified Diff: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc

Issue 2944553003: cros: Enable Ext4 migration in ARC kiosk mode. (Closed)
Patch Set: Add UMA. 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/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
index c57c266e14fed3fefc6324165c9d2ee17e779c61..aa13f5cfa167883e7702162013687315a9c1bff1 100644
--- a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc
@@ -71,6 +71,7 @@ enum class FirstScreen {
FIRST_SCREEN_READY = 0,
FIRST_SCREEN_RESUME = 1,
FIRST_SCREEN_LOW_STORAGE = 2,
+ FIRST_SCREEN_ARC_KIOSK = 3,
FIRST_SCREEN_COUNT
};
@@ -98,6 +99,10 @@ enum class MigrationResult {
REQUEST_FAILURE_IN_RESUMED_MIGRATION = 5,
MOUNT_FAILURE_IN_NEW_MIGRATION = 6,
MOUNT_FAILURE_IN_RESUMED_MIGRATION = 7,
+ SUCCESS_IN_ARC_KIOSK_MIGRATION = 8,
+ GENERAL_FAILURE_IN_ARC_KIOSK_MIGRATION = 9,
+ REQUEST_FAILURE_IN_ARC_KIOSK_MIGRATION = 10,
+ MOUNT_FAILURE_IN_ARC_KIOSK_MIGRATION = 11,
COUNT
};
@@ -109,6 +114,8 @@ enum class RemoveCryptohomeResult {
SUCCESS_IN_RESUMED_MIGRATION = 1,
FAILURE_IN_NEW_MIGRATION = 2,
FAILURE_IN_RESUMED_MIGRATION = 3,
+ SUCCESS_IN_ARC_KIOSK_MIGRATION = 4,
+ FAILURE_IN_ARC_KIOSK_MIGRATION = 5,
COUNT
};
@@ -133,18 +140,81 @@ void RecordMigrationResult(MigrationResult migration_result) {
MigrationResult::COUNT);
}
-void RecordRemoveCryptohomeResult(bool success, bool is_resumed_migration) {
- RemoveCryptohomeResult result =
- success ? (is_resumed_migration
- ? RemoveCryptohomeResult::SUCCESS_IN_RESUMED_MIGRATION
- : RemoveCryptohomeResult::SUCCESS_IN_NEW_MIGRATION)
- : (is_resumed_migration
- ? RemoveCryptohomeResult::FAILURE_IN_RESUMED_MIGRATION
- : RemoveCryptohomeResult::FAILURE_IN_NEW_MIGRATION);
+void RecordMigrationResultSuccess(bool resume, bool arc_kiosk) {
+ if (arc_kiosk)
+ RecordMigrationResult(MigrationResult::SUCCESS_IN_ARC_KIOSK_MIGRATION);
+ else if (resume)
+ RecordMigrationResult(MigrationResult::SUCCESS_IN_RESUMED_MIGRATION);
+ else
+ RecordMigrationResult(MigrationResult::SUCCESS_IN_NEW_MIGRATION);
+}
+
+void RecordMigrationResultGeneralFailure(bool resume, bool arc_kiosk) {
+ if (arc_kiosk) {
+ RecordMigrationResult(
+ MigrationResult::GENERAL_FAILURE_IN_ARC_KIOSK_MIGRATION);
+ } else if (resume) {
+ RecordMigrationResult(
+ MigrationResult::GENERAL_FAILURE_IN_RESUMED_MIGRATION);
+ } else {
+ RecordMigrationResult(MigrationResult::GENERAL_FAILURE_IN_NEW_MIGRATION);
+ }
+}
+
+void RecordMigrationResultRequestFailure(bool resume, bool arc_kiosk) {
+ if (arc_kiosk) {
+ RecordMigrationResult(
+ MigrationResult::REQUEST_FAILURE_IN_ARC_KIOSK_MIGRATION);
+ } else if (resume) {
+ RecordMigrationResult(
+ MigrationResult::REQUEST_FAILURE_IN_RESUMED_MIGRATION);
+ } else {
+ RecordMigrationResult(MigrationResult::REQUEST_FAILURE_IN_NEW_MIGRATION);
+ }
+}
+
+void RecordMigrationResultMountFailure(bool resume, bool arc_kiosk) {
+ if (arc_kiosk) {
+ RecordMigrationResult(
+ MigrationResult::MOUNT_FAILURE_IN_ARC_KIOSK_MIGRATION);
+ } else if (resume) {
+ RecordMigrationResult(MigrationResult::MOUNT_FAILURE_IN_RESUMED_MIGRATION);
+ } else {
+ RecordMigrationResult(MigrationResult::MOUNT_FAILURE_IN_NEW_MIGRATION);
+ }
+}
+
+void RecordRemoveCryptohomeResult(RemoveCryptohomeResult result) {
UMA_HISTOGRAM_ENUMERATION(kUmaNameRemoveCryptohomeResult, result,
RemoveCryptohomeResult::COUNT);
}
+void RecordRemoveCryptohomeResultSuccess(bool resume, bool arc_kiosk) {
+ if (arc_kiosk) {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::SUCCESS_IN_ARC_KIOSK_MIGRATION);
+ } else if (resume) {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::SUCCESS_IN_RESUMED_MIGRATION);
+ } else {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::SUCCESS_IN_NEW_MIGRATION);
+ }
+}
+
+void RecordRemoveCryptohomeResultFailure(bool resume, bool arc_kiosk) {
+ if (arc_kiosk) {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::FAILURE_IN_ARC_KIOSK_MIGRATION);
+ } else if (resume) {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::FAILURE_IN_RESUMED_MIGRATION);
+ } else {
+ RecordRemoveCryptohomeResult(
+ RemoveCryptohomeResult::FAILURE_IN_NEW_MIGRATION);
+ }
+}
+
} // namespace
namespace chromeos {
@@ -194,6 +264,14 @@ void EncryptionMigrationScreenHandler::SetContinueLoginCallback(
}
void EncryptionMigrationScreenHandler::SetupInitialView() {
+ // If old encryption is detected in ARC kiosk mode, skip all checks (user
+ // confirmation, battery level, and remaining space) and start migration
+ // immediately.
+ if (IsArcKiosk()) {
+ RecordFirstScreen(FirstScreen::FIRST_SCREEN_ARC_KIOSK);
+ StartMigration();
+ return;
+ }
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
CheckAvailableStorage();
}
@@ -414,11 +492,21 @@ void EncryptionMigrationScreenHandler::StartMigration() {
// Mount the existing eCryptfs vault to a temporary location for migration.
cryptohome::MountParameters mount(false);
mount.to_migrate_from_ecryptfs = true;
- cryptohome::HomedirMethods::GetInstance()->MountEx(
- cryptohome::Identification(user_context_.GetAccountId()),
- cryptohome::Authorization(GetAuthKey()), mount,
- base::Bind(&EncryptionMigrationScreenHandler::OnMountExistingVault,
- weak_ptr_factory_.GetWeakPtr()));
+ if (IsArcKiosk()) {
+ mount.public_mount = true;
+ cryptohome::HomedirMethods::GetInstance()->MountEx(
+ cryptohome::Identification(user_context_.GetAccountId()),
+ cryptohome::Authorization(cryptohome::KeyDefinition()), mount,
+ base::Bind(&EncryptionMigrationScreenHandler::OnMountExistingVault,
+ weak_ptr_factory_.GetWeakPtr()));
+
+ } else {
+ cryptohome::HomedirMethods::GetInstance()->MountEx(
+ cryptohome::Identification(user_context_.GetAccountId()),
+ cryptohome::Authorization(GetAuthKey()), mount,
+ base::Bind(&EncryptionMigrationScreenHandler::OnMountExistingVault,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
}
void EncryptionMigrationScreenHandler::OnMountExistingVault(
@@ -426,9 +514,7 @@ void EncryptionMigrationScreenHandler::OnMountExistingVault(
cryptohome::MountError return_code,
const std::string& mount_hash) {
if (!success || return_code != cryptohome::MOUNT_ERROR_NONE) {
- RecordMigrationResult(
- should_resume_ ? MigrationResult::MOUNT_FAILURE_IN_RESUMED_MIGRATION
- : MigrationResult::MOUNT_FAILURE_IN_NEW_MIGRATION);
+ RecordMigrationResultMountFailure(should_resume_, IsArcKiosk());
UpdateUIState(UIState::MIGRATION_FAILED);
return;
}
@@ -480,7 +566,11 @@ void EncryptionMigrationScreenHandler::OnRemoveCryptohome(
cryptohome::MountError return_code) {
LOG_IF(ERROR, !success) << "Removing cryptohome failed. return code: "
<< return_code;
- RecordRemoveCryptohomeResult(success, should_resume_);
+ if (success)
+ RecordRemoveCryptohomeResultSuccess(should_resume_, IsArcKiosk());
+ else
+ RecordRemoveCryptohomeResultFailure(should_resume_, IsArcKiosk());
+
UpdateUIState(UIState::MIGRATION_FAILED);
}
@@ -499,6 +589,10 @@ cryptohome::KeyDefinition EncryptionMigrationScreenHandler::GetAuthKey() {
cryptohome::PRIV_DEFAULT);
}
+bool EncryptionMigrationScreenHandler::IsArcKiosk() const {
+ return user_context_.GetUserType() == user_manager::USER_TYPE_ARC_KIOSK_APP;
+}
+
void EncryptionMigrationScreenHandler::OnMigrationProgress(
cryptohome::DircryptoMigrationStatus status,
uint64_t current,
@@ -512,9 +606,7 @@ void EncryptionMigrationScreenHandler::OnMigrationProgress(
CallJS("setMigrationProgress", static_cast<double>(current) / total);
break;
case cryptohome::DIRCRYPTO_MIGRATION_SUCCESS:
- RecordMigrationResult(should_resume_
- ? MigrationResult::SUCCESS_IN_RESUMED_MIGRATION
- : MigrationResult::SUCCESS_IN_NEW_MIGRATION);
+ RecordMigrationResultSuccess(should_resume_, IsArcKiosk());
// If the battery level decreased during migration, record the consumed
// battery level.
if (*current_battery_percent_ < initial_battery_percent_) {
@@ -527,9 +619,7 @@ void EncryptionMigrationScreenHandler::OnMigrationProgress(
DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
break;
case cryptohome::DIRCRYPTO_MIGRATION_FAILED:
- RecordMigrationResult(
- should_resume_ ? MigrationResult::GENERAL_FAILURE_IN_RESUMED_MIGRATION
- : MigrationResult::GENERAL_FAILURE_IN_NEW_MIGRATION);
+ RecordMigrationResultGeneralFailure(should_resume_, IsArcKiosk());
// Stop listening to the progress updates.
DBusThreadManager::Get()
->GetCryptohomeClient()
@@ -546,9 +636,7 @@ void EncryptionMigrationScreenHandler::OnMigrationProgress(
void EncryptionMigrationScreenHandler::OnMigrationRequested(bool success) {
if (!success) {
LOG(ERROR) << "Requesting MigrateToDircrypto failed.";
- RecordMigrationResult(
- should_resume_ ? MigrationResult::REQUEST_FAILURE_IN_RESUMED_MIGRATION
- : MigrationResult::REQUEST_FAILURE_IN_NEW_MIGRATION);
+ RecordMigrationResultRequestFailure(should_resume_, IsArcKiosk());
UpdateUIState(UIState::MIGRATION_FAILED);
}
}
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698