0

Always update ap for new installs, but do not update brand

This CL always updates `ap` for legacy on-demand COM
`IAppBundleWeb::createApp`, and stops updating the `brand` for new
installs through `UpdateServiceImpl::Install`.

Bug: 1523813
Change-Id: I0a5019808469f9e73fdbb7adb1178f7e9bb7de7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5270604
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Auto-Submit: S Ganesh <ganesh@chromium.org>
Commit-Queue: S Ganesh <ganesh@chromium.org>
Reviewed-by: Joshua Pawlicki <waffles@chromium.org>
Commit-Queue: Joshua Pawlicki <waffles@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1256486}
This commit is contained in:
S. Ganesh
2024-02-05 23:34:40 +00:00
committed by Chromium LUCI CQ
parent 49a4b4da9b
commit 946089c280
3 changed files with 19 additions and 18 deletions

@ -375,31 +375,32 @@ class AppWebImpl : public IDispatchImpl<IAppWeb> {
auto result = base::MakeRefCounted<RegisterAppResult>();
AppServerWin::PostRpcTask(base::BindOnce(
[](AppWebImplPtr obj, const std::wstring& brand_code,
const std::wstring& ap, scoped_refptr<RegisterAppResult> result) {
[](AppWebImplPtr obj, scoped_refptr<RegisterAppResult> result) {
const base::ScopedClosureRunner signal_event(base::BindOnce(
[](scoped_refptr<RegisterAppResult> result) {
result->completion_event.Signal();
},
result));
scoped_refptr<PersistedData> persisted_data =
GetAppServerWinInstance()->config()->GetUpdaterPersistedData();
if (persisted_data->GetProductVersion(obj->app_id_).IsValid()) {
return;
}
// Pre-register the app if there is no registration for it. This app
// registration is removed later if the app install does not happen.
result->new_install = true;
// Always update ap.
RegistrationRequest request;
request.app_id = obj->app_id_;
request.version = base::Version(kNullVersion);
request.brand_code = base::WideToASCII(brand_code);
request.ap = base::WideToASCII(ap);
request.ap = obj->ap_;
// Pre-register the app with a version of "0.0.0.0" if there is no
// registration for it. This app registration is removed later if
// the app install does not happen.
scoped_refptr<PersistedData> persisted_data =
GetAppServerWinInstance()->config()->GetUpdaterPersistedData();
if (!persisted_data->GetProductVersion(obj->app_id_).IsValid()) {
result->new_install = true;
request.brand_code = obj->brand_code_;
request.version = base::Version(kNullVersion);
}
persisted_data->RegisterApp(request);
},
AppWebImplPtr(this), brand_code, ap, result));
AppWebImplPtr(this), result));
if (!result->completion_event.TimedWait(base::Seconds(60))) {
return E_FAIL;

@ -889,10 +889,9 @@ void UpdateServiceImpl::Install(const RegistrationRequest& registration,
// registration is removed later if the app install encounters an error.
config_->GetUpdaterPersistedData()->RegisterApp(registration);
} else {
// Update brand and ap.
// Update ap.
RegistrationRequest request;
request.app_id = registration.app_id;
request.brand_code = registration.brand_code;
request.ap = registration.ap;
config_->GetUpdaterPersistedData()->RegisterApp(request);
}

@ -41,7 +41,8 @@ Google-branded builds assume the first case.
##### Brand code
The brand code is a string of up to 4 characters long. The brand code is
persisted during the install, over-installs, and updates.
persisted during the first install of the app. Over-installs and updates do not
modify the brand code.
On macOS, the brand code (as well as AP parameter and the app version) can be
specified using a path to a plist file and a key within that plist file. When