Skip to content

Commit

Permalink
[AppIdentity]: Add threshold for icon updates.
Browse files Browse the repository at this point in the history
This change adds a feature flag for specifying a threshold
for icon changes that are allowed to proceed.

Also fix a typo with WEB_APK_ALLOW_ICON_UPDATE.

Bug: 1494429
Change-Id: Ibea746a1157abab02b7a56b572ed852c71bb9134
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4956839
Reviewed-by: Glenn Hartmann <hartmanng@chromium.org>
Reviewed-by: Ella Ge <eirage@chromium.org>
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1217185}
  • Loading branch information
Finnur Thorarinsson authored and Chromium LUCI CQ committed Oct 30, 2023
1 parent 1bf87ea commit 0c749f8
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 123 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions chrome/browser/flags/android/chrome_feature_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ const base::Feature* const kFeaturesExposedToJava[] = {
&content_creation::kWebNotesStylizeEnabled,
&kWebApkAllowIconUpdate,
&kWebApkBackupAndRestoreBackend,
&kWebApkIconUpdateThreshold,
&kWebApkInstallService,
&features::kDnsOverHttps,
&notifications::features::kUseChimeAndroidSdk,
Expand Down Expand Up @@ -1199,6 +1200,10 @@ BASE_FEATURE(kWebApkAllowIconUpdate,
"WebApkAllowIconUpdate",
base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kWebApkIconUpdateThreshold,
"WebApkIconUpdateThreshold",
base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kWebApkBackupAndRestoreBackend,
"WebApkBackupAndRestoreBackend",
base::FEATURE_DISABLED_BY_DEFAULT);
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/flags/android/chrome_feature_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ BASE_DECLARE_FEATURE(kVoiceButtonInTopToolbar);
BASE_DECLARE_FEATURE(kWebOtpCrossDeviceSimpleString);
BASE_DECLARE_FEATURE(kWebApkAllowIconUpdate);
BASE_DECLARE_FEATURE(kWebApkBackupAndRestoreBackend);
BASE_DECLARE_FEATURE(kWebApkIconUpdateThreshold);
BASE_DECLARE_FEATURE(kWebApkInstallService);

// For FeatureParam, Alphabetical:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ public static Map<String, String> getFieldTrialParamsForFeature(String featureNa
public static final String VOICE_BUTTON_IN_TOP_TOOLBAR = "VoiceButtonInTopToolbar";
public static final String VOICE_SEARCH_AUDIO_CAPTURE_POLICY = "VoiceSearchAudioCapturePolicy";
public static final String WEBNOTES_STYLIZE = "WebNotesStylize";
public static final String WEB_APK_ALLOW_ICON_UPDATA = "WebApkAllowIconUpdate";
public static final String WEB_APK_ALLOW_ICON_UPDATE = "WebApkAllowIconUpdate";
public static final String WEB_APK_ICON_UPDATE_THRESHOLD = "WebApkIconUpdateThreshold";
public static final String WEB_APK_INSTALL_SERVICE = "WebApkInstallService";
public static final String WEB_APP_AMBIENT_BADGE_SUPRESS_FIRST_VISIT =
"AmbientBadgeSuppressFirstVisit";
Expand Down
2 changes: 2 additions & 0 deletions components/webapk/webapk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ message WebApk {
SPLASH_ICON_HASH_DIFFERS = 17;
DARK_BACKGROUND_COLOR_DIFFERS = 18;
DARK_THEME_COLOR_DIFFERS = 19;
PRIMARY_ICON_CHANGE_BELOW_THRESHOLD = 20;
PRIMARY_ICON_CHANGE_SHELL_UPDATE = 21;

reserved 4;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ webapk::WebApk_UpdateReason ConvertUpdateReasonToProtoEnum(
return webapk::WebApk::DARK_BACKGROUND_COLOR_DIFFERS;
case WebApkUpdateReason::DARK_THEME_COLOR_DIFFERS:
return webapk::WebApk::DARK_THEME_COLOR_DIFFERS;
case WebApkUpdateReason::PRIMARY_ICON_CHANGE_BELOW_THRESHOLD:
return webapk::WebApk::PRIMARY_ICON_CHANGE_BELOW_THRESHOLD;
case WebApkUpdateReason::PRIMARY_ICON_CHANGE_SHELL_UPDATE:
return webapk::WebApk::PRIMARY_ICON_CHANGE_SHELL_UPDATE;
}
}

Expand Down
2 changes: 2 additions & 0 deletions components/webapps/browser/android/webapk/webapk_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ enum class WebApkUpdateReason {
SHORTCUTS_DIFFER,
DARK_BACKGROUND_COLOR_DIFFERS,
DARK_THEME_COLOR_DIFFERS,
PRIMARY_ICON_CHANGE_BELOW_THRESHOLD,
PRIMARY_ICON_CHANGE_SHELL_UPDATE,
};

// A Java counterpart will be generated for this enum.
Expand Down

0 comments on commit 0c749f8

Please sign in to comment.