Commit 5a8335c1 authored by Xi Han's avatar Xi Han Committed by Commit Bot

[WebAPKs] Remove ICON_URL and ICON_MURMUR2_HASH.

Bug: 665549
Change-Id: I89109434b4d9491c479667e86e9df543fb52a801
Reviewed-on: https://chromium-review.googlesource.com/827730Reviewed-by: default avatarPeter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524370}
parent ab76e7b1
...@@ -318,17 +318,7 @@ public class WebApkInfo extends WebappInfo { ...@@ -318,17 +318,7 @@ public class WebApkInfo extends WebappInfo {
Map<String, String> iconUrlAndIconMurmur2HashMap = new HashMap<String, String>(); Map<String, String> iconUrlAndIconMurmur2HashMap = new HashMap<String, String>();
String iconUrlsAndIconMurmur2Hashes = metaData.getString( String iconUrlsAndIconMurmur2Hashes = metaData.getString(
WebApkMetaDataKeys.ICON_URLS_AND_ICON_MURMUR2_HASHES); WebApkMetaDataKeys.ICON_URLS_AND_ICON_MURMUR2_HASHES);
if (TextUtils.isEmpty(iconUrlsAndIconMurmur2Hashes)) { if (TextUtils.isEmpty(iconUrlsAndIconMurmur2Hashes)) return iconUrlAndIconMurmur2HashMap;
// Open old WebAPKs which support single icon only.
// TODO(hanxi): crbug.com/665549. Clean up the following code after all the old WebAPKs
// are updated.
String iconUrl = metaData.getString(WebApkMetaDataKeys.ICON_URL);
if (TextUtils.isEmpty(iconUrl)) {
return iconUrlAndIconMurmur2HashMap;
}
iconUrlAndIconMurmur2HashMap.put(iconUrl, getIconMurmur2HashFromMetaData(metaData));
return iconUrlAndIconMurmur2HashMap;
}
// Parse the metadata tag which contains "URL1 hash1 URL2 hash2 URL3 hash3..." pairs and // Parse the metadata tag which contains "URL1 hash1 URL2 hash2 URL3 hash3..." pairs and
// create a hash map. // create a hash map.
...@@ -345,23 +335,6 @@ public class WebApkInfo extends WebappInfo { ...@@ -345,23 +335,6 @@ public class WebApkInfo extends WebappInfo {
return iconUrlAndIconMurmur2HashMap; return iconUrlAndIconMurmur2HashMap;
} }
/**
* Extracts icon murmur2 hash from the WebAPK's meta data. Return value is a string because the
* hash can take values up to 2^64-1 which is greater than {@link Long#MAX_VALUE}.
* Note: keep this function for supporting old WebAPKs which have single icon only.
* @param metaData WebAPK meta data to extract the hash from.
* @return The hash. An empty string if the hash could not be extracted.
*/
private static String getIconMurmur2HashFromMetaData(Bundle metaData) {
String value = metaData.getString(WebApkMetaDataKeys.ICON_MURMUR2_HASH);
// The value should be terminated with 'L' to force the value to be a string.
if (value == null || !value.endsWith("L")) {
return "";
}
return value.substring(0, value.length() - 1);
}
/** /**
* Returns the WebDisplayMode which matches {@link displayMode}. * Returns the WebDisplayMode which matches {@link displayMode}.
* @param displayMode One of https://www.w3.org/TR/appmanifest/#dfn-display-modes-values * @param displayMode One of https://www.w3.org/TR/appmanifest/#dfn-display-modes-values
......
...@@ -113,8 +113,8 @@ public class WebApkInfoTest { ...@@ -113,8 +113,8 @@ public class WebApkInfoTest {
bundle.putInt(WebApkMetaDataKeys.SHELL_APK_VERSION, SHELL_APK_VERSION); bundle.putInt(WebApkMetaDataKeys.SHELL_APK_VERSION, SHELL_APK_VERSION);
bundle.putString(WebApkMetaDataKeys.WEB_MANIFEST_URL, MANIFEST_URL); bundle.putString(WebApkMetaDataKeys.WEB_MANIFEST_URL, MANIFEST_URL);
bundle.putString(WebApkMetaDataKeys.START_URL, START_URL); bundle.putString(WebApkMetaDataKeys.START_URL, START_URL);
bundle.putString(WebApkMetaDataKeys.ICON_URL, ICON_URL); bundle.putString(WebApkMetaDataKeys.ICON_URLS_AND_ICON_MURMUR2_HASHES,
bundle.putString(WebApkMetaDataKeys.ICON_MURMUR2_HASH, ICON_MURMUR2_HASH + "L"); ICON_URL + " " + ICON_MURMUR2_HASH);
WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle); WebApkTestHelper.registerWebApkWithMetaData(WEBAPK_PACKAGE_NAME, bundle);
Intent intent = new Intent(); Intent intent = new Intent();
......
...@@ -23,9 +23,6 @@ public final class WebApkMetaDataKeys { ...@@ -23,9 +23,6 @@ public final class WebApkMetaDataKeys {
public static final String THEME_COLOR = "org.chromium.webapk.shell_apk.themeColor"; public static final String THEME_COLOR = "org.chromium.webapk.shell_apk.themeColor";
public static final String BACKGROUND_COLOR = "org.chromium.webapk.shell_apk.backgroundColor"; public static final String BACKGROUND_COLOR = "org.chromium.webapk.shell_apk.backgroundColor";
public static final String ICON_ID = "org.chromium.webapk.shell_apk.iconId"; public static final String ICON_ID = "org.chromium.webapk.shell_apk.iconId";
// TODO(hanxi): crbug.com/665549. Remove {@link ICON_URL} and {@link ICON_MURMUR2_HASH}.
public static final String ICON_URL = "org.chromium.webapk.shell_apk.iconUrl";
public static final String ICON_MURMUR2_HASH = "org.chromium.webapk.shell_apk.iconMurmur2Hash";
public static final String ICON_URLS_AND_ICON_MURMUR2_HASHES = public static final String ICON_URLS_AND_ICON_MURMUR2_HASHES =
"org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes"; "org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment