Skip to content

Commit

Permalink
arc: Add ArcVmDataMigrationStrategy policy
Browse files Browse the repository at this point in the history
This policy will be used to control the data migration strategy for ARC
VM devices migrating from virtio-fs to virtio-blk.

Currently the policy supports only two values i.e. 0 (default) which
means do not show the migration UI and 1 which means to show the
migration UI and let the user decide. We can add more values in the
future to customize the migration flow.

Bug: b/288615363
Test: deploy to DUT and verify new policy in chrome://policy
Test: verify the perf in chrome://prefs-internals
Test: override the policy by placing a json file in
/etc/opt/chrome/policies/managed/ and verify the updated policy in
chrome://policy

BYPASS_POLICY_COMPATIBILITY_CHECK=Backporting the policy

(cherry picked from commit ca54eb4)

Change-Id: I204ddf360c97777f4104a22706075ab637f146be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4642778
Reviewed-by: Victor-Gabriel Savu <vsavu@google.com>
Auto-Submit: Muhammad Hasan Khan <mhasank@chromium.org>
Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
Reviewed-by: Youkichi Hosoi <youkichihosoi@chromium.org>
Reviewed-by: Josh Horwich <jhorwich@chromium.org>
Reviewed-by: Bartosz Fabianowski <bartfab@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1162285}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4644304
Reviewed-by: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/branch-heads/5845@{#195}
Cr-Branched-From: 5a5dff6-refs/heads/main@{#1160321}
  • Loading branch information
hasankhan authored and Chromium LUCI CQ committed Jun 28, 2023
1 parent 531297b commit 442fa70
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ash/components/arc/arc_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ const char kWebViewProcessStarted[] = "arc.webview.started";
const char kArcInitialLocationSettingSyncRequired[] =
"arc.initial.location.setting.sync.required";

// An integer preference to indicate the strategy of ARCVM /data migration for
// enterprise user.
const char kArcVmDataMigrationStrategy[] = "arc.vm_data_migration_strategy";

void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
// Sorted in lexicographical order.
RegisterDailyMetricsPrefs(registry);
Expand Down Expand Up @@ -236,6 +240,9 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(
kArcVmDataMigrationStatus,
static_cast<int>(ArcVmDataMigrationStatus::kUnnotified));
registry->RegisterIntegerPref(
kArcVmDataMigrationStrategy,
static_cast<int>(ArcVmDataMigrationStrategy::kDoNotPrompt));
}

} // namespace prefs
Expand Down
1 change: 1 addition & 0 deletions ash/components/arc/arc_prefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ ARC_EXPORT extern const char kArcVmDataMigrationStatus[];
ARC_EXPORT extern const char kArcIsManaged[];
ARC_EXPORT extern const char kEcryptfsMigrationStrategy[];
ARC_EXPORT extern const char kEngagementPrefsPrefix[];
ARC_EXPORT extern const char kArcVmDataMigrationStrategy[];

// Local state prefs in lexicographical order.
ARC_EXPORT extern const char kAnrPendingCount[];
Expand Down
9 changes: 9 additions & 0 deletions ash/components/arc/session/arc_vm_data_migration_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ enum class ArcVmDataMigrationFinishReason {
kMaxValue = kMigrationFailure,
};

enum class ArcVmDataMigrationStrategy {
// The user should not be prompted to go through /data migration.
kDoNotPrompt = 0,
// The user should be prompted to go through /data migration via
// a notification.
kPrompt = 1,
kMaxValue = kPrompt,
};

std::ostream& operator<<(std::ostream& os, ArcVmDataMigrationStatus status);

} // namespace arc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,9 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{ key::kReportAppUsageCollectionRateMs,
ash::reporting::kReportAppUsageCollectionRateMs,
base::Value::Type::INTEGER },
{ key::kArcVmDataMigrationStrategy,
arc::prefs::kArcVmDataMigrationStrategy,
base::Value::Type::INTEGER },
#endif // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_LINUX)
Expand Down
5 changes: 5 additions & 0 deletions components/policy/resources/templates/policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,11 @@ policies:
1118: PhysicalKeyboardAutocorrect
1119: PhysicalKeyboardPredictiveWriting
1120: ColorCorrectionEnabled
1121: ''
1122: ''
1123: ''
1124: ''
1125: ArcVmDataMigrationStrategy
atomic_groups:
1: Homepage
2: RemoteAccess
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
caption: Migration strategy for ARC VM Data Migration
desc: |-
Setting the policy specifies the action to take when the user's ARC data directory was created with virtio-fs. Unless virtio-fs data is migrated to virtio-blk, Android apps might run slower on ARC VM.
Setting the policy to:
* <ph name="DO_NOT_PROMPT">DoNotPrompt</ph> means do not ask the user to go through the migration flow. This is the default value when policy is unset.
* <ph name="PROMPT">Prompt</ph> (or an unsupported value) means that, at sign-in, user is prompted to go through the data migration flow. This can take up to 10 minutes.
This policy only applies to ARM devices migrating to ARCVM.
device_only: false
default: 0
example_value: 1
features:
dynamic_refresh: false
per_profile: false
items:
- caption: Do not prompt users to migrate.
name: DoNotPrompt
value: 0
- caption: Prompt users to migrate.
name: Prompt
value: 1
owners:
- youkichihosoi@chromium.org
- mhasank@chromium.org
- arc-commercial@google.com
schema:
enum:
- 0
- 1
type: integer
supported_on:
- chrome_os:114-
tags: []
type: int-enum
36 changes: 36 additions & 0 deletions components/policy/test/data/policy_test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -23635,5 +23635,41 @@
}
}
]
},
"ArcVmDataMigrationStrategy": {
"os": [
"chromeos_ash"
],
"policy_pref_mapping_tests": [
{
"note": "Default value (no policies set).",
"policies": {},
"prefs": {
"arc.vm_data_migration_strategy": {
"default_value": 0
}
}
},
{
"policies": {
"ArcVmDataMigrationStrategy": 0
},
"prefs": {
"arc.vm_data_migration_strategy": {
"value": 0
}
}
},
{
"policies": {
"ArcVmDataMigrationStrategy": 1
},
"prefs": {
"arc.vm_data_migration_strategy": {
"value": 1
}
}
}
]
}
}
1 change: 1 addition & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33776,6 +33776,7 @@ Called by update_document_policy_enum.py.-->
<int value="1118" label="PhysicalKeyboardAutocorrect"/>
<int value="1119" label="PhysicalKeyboardPredictiveWriting"/>
<int value="1120" label="ColorCorrectionEnabled"/>
<int value="1125" label="ArcVmDataMigrationStrategy"/>
</enum>

<enum name="EnterprisePoliciesSources">
Expand Down

0 comments on commit 442fa70

Please sign in to comment.