Commit a80ba084 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android Refactor] Remove unused WebApkInfo#badgeIcon()

BUG=None

Change-Id: I91ef942b5349e1682660b3040a89d3fc7ecfe425
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094000Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749186}
parent bd02bc29
...@@ -19,11 +19,6 @@ public class WebApkExtras { ...@@ -19,11 +19,6 @@ public class WebApkExtras {
*/ */
public final String webApkPackageName; public final String webApkPackageName;
/**
* Badge icon to use for notifications.
*/
public final WebappIcon badgeIcon;
/** /**
* Icon to use for the splash screen. * Icon to use for the splash screen.
*/ */
...@@ -101,7 +96,7 @@ public class WebApkExtras { ...@@ -101,7 +96,7 @@ public class WebApkExtras {
} }
public static WebApkExtras createEmpty() { public static WebApkExtras createEmpty() {
return new WebApkExtras(null /* webApkPackageName */, new WebappIcon(), new WebappIcon(), return new WebApkExtras(null /* webApkPackageName */, new WebappIcon(),
false /* isSplashIconMaskable */, 0 /* shellApkVersion */, null /* manifestUrl */, false /* isSplashIconMaskable */, 0 /* shellApkVersion */, null /* manifestUrl */,
null /* manifestStartUrl */, WebApkDistributor.OTHER, null /* manifestStartUrl */, WebApkDistributor.OTHER,
null /* iconUrlToMurmur2HashMap */, new ShareTarget(), null /* iconUrlToMurmur2HashMap */, new ShareTarget(),
...@@ -109,14 +104,13 @@ public class WebApkExtras { ...@@ -109,14 +104,13 @@ public class WebApkExtras {
0 /* webApkVersionCode */); 0 /* webApkVersionCode */);
} }
public WebApkExtras(String webApkPackageName, WebappIcon badgeIcon, WebappIcon splashIcon, public WebApkExtras(String webApkPackageName, WebappIcon splashIcon,
boolean isSplashIconMaskable, int shellApkVersion, String manifestUrl, boolean isSplashIconMaskable, int shellApkVersion, String manifestUrl,
String manifestStartUrl, @WebApkDistributor int distributor, String manifestStartUrl, @WebApkDistributor int distributor,
Map<String, String> iconUrlToMurmur2HashMap, ShareTarget shareTarget, Map<String, String> iconUrlToMurmur2HashMap, ShareTarget shareTarget,
boolean isSplashProvidedByWebApk, List<ShortcutItem> shortcutItems, boolean isSplashProvidedByWebApk, List<ShortcutItem> shortcutItems,
int webApkVersionCode) { int webApkVersionCode) {
this.webApkPackageName = webApkPackageName; this.webApkPackageName = webApkPackageName;
this.badgeIcon = badgeIcon;
this.splashIcon = splashIcon; this.splashIcon = splashIcon;
this.isSplashIconMaskable = isSplashIconMaskable; this.isSplashIconMaskable = isSplashIconMaskable;
this.shellApkVersion = shellApkVersion; this.shellApkVersion = shellApkVersion;
......
...@@ -134,7 +134,6 @@ public class WebApkInfo extends WebappInfo { ...@@ -134,7 +134,6 @@ public class WebApkInfo extends WebappInfo {
* @param url URL that the WebAPK should navigate to when launched. * @param url URL that the WebAPK should navigate to when launched.
* @param scope Scope for the WebAPK. * @param scope Scope for the WebAPK.
* @param primaryIcon Primary icon to show for the WebAPK. * @param primaryIcon Primary icon to show for the WebAPK.
* @param badgeIcon Badge icon to use for notifications.
* @param splashIcon Splash icon to use for the splash screen. * @param splashIcon Splash icon to use for the splash screen.
* @param name Name of the WebAPK. * @param name Name of the WebAPK.
* @param shortName The short name of the WebAPK. * @param shortName The short name of the WebAPK.
...@@ -165,21 +164,20 @@ public class WebApkInfo extends WebappInfo { ...@@ -165,21 +164,20 @@ public class WebApkInfo extends WebappInfo {
* @param webApkVersionCode WebAPK's version code. * @param webApkVersionCode WebAPK's version code.
*/ */
public static WebApkInfo create(String url, String scope, WebappIcon primaryIcon, public static WebApkInfo create(String url, String scope, WebappIcon primaryIcon,
WebappIcon badgeIcon, WebappIcon splashIcon, String name, String shortName, WebappIcon splashIcon, String name, String shortName, @WebDisplayMode int displayMode,
@WebDisplayMode int displayMode, int orientation, int source, long themeColor, int orientation, int source, long themeColor, long backgroundColor,
long backgroundColor, int defaultBackgroundColor, boolean isPrimaryIconMaskable, int defaultBackgroundColor, boolean isPrimaryIconMaskable, boolean isSplashIconMaskable,
boolean isSplashIconMaskable, String webApkPackageName, int shellApkVersion, String webApkPackageName, int shellApkVersion, String manifestUrl,
String manifestUrl, String manifestStartUrl, @WebApkDistributor int distributor, String manifestStartUrl, @WebApkDistributor int distributor,
Map<String, String> iconUrlToMurmur2HashMap, ShareTarget shareTarget, Map<String, String> iconUrlToMurmur2HashMap, ShareTarget shareTarget,
boolean forceNavigation, boolean isSplashProvidedByWebApk, ShareData shareData, boolean forceNavigation, boolean isSplashProvidedByWebApk, ShareData shareData,
List<ShortcutItem> shortcutItems, int webApkVersionCode) { List<ShortcutItem> shortcutItems, int webApkVersionCode) {
return create(WebApkIntentDataProviderFactory.create(url, scope, primaryIcon, badgeIcon, return create(WebApkIntentDataProviderFactory.create(url, scope, primaryIcon, splashIcon,
splashIcon, name, shortName, displayMode, orientation, source, themeColor, name, shortName, displayMode, orientation, source, themeColor, backgroundColor,
backgroundColor, defaultBackgroundColor, isPrimaryIconMaskable, defaultBackgroundColor, isPrimaryIconMaskable, isSplashIconMaskable,
isSplashIconMaskable, webApkPackageName, shellApkVersion, manifestUrl, webApkPackageName, shellApkVersion, manifestUrl, manifestStartUrl, distributor,
manifestStartUrl, distributor, iconUrlToMurmur2HashMap, shareTarget, iconUrlToMurmur2HashMap, shareTarget, forceNavigation, isSplashProvidedByWebApk,
forceNavigation, isSplashProvidedByWebApk, shareData, shortcutItems, shareData, shortcutItems, webApkVersionCode));
webApkVersionCode));
} }
private static WebApkInfo create(@Nullable BrowserServicesIntentDataProvider provider) { private static WebApkInfo create(@Nullable BrowserServicesIntentDataProvider provider) {
...@@ -190,13 +188,6 @@ public class WebApkInfo extends WebappInfo { ...@@ -190,13 +188,6 @@ public class WebApkInfo extends WebappInfo {
super(provider); super(provider);
} }
/**
* Returns the badge icon in Bitmap form.
*/
public WebappIcon badgeIcon() {
return getWebApkExtras().badgeIcon;
}
/** /**
* Returns the splash icon in Bitmap form. * Returns the splash icon in Bitmap form.
*/ */
......
...@@ -296,7 +296,6 @@ public class WebApkIntentDataProviderFactory { ...@@ -296,7 +296,6 @@ public class WebApkIntentDataProviderFactory {
boolean isPrimaryIconMaskable = boolean isPrimaryIconMaskable =
primaryMaskableIconId != 0 && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O); primaryMaskableIconId != 0 && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
int badgeIconId = IntentUtils.safeGetInt(bundle, WebApkMetaDataKeys.BADGE_ICON_ID, 0);
int splashIconId = IntentUtils.safeGetInt(bundle, WebApkMetaDataKeys.SPLASH_ID, 0); int splashIconId = IntentUtils.safeGetInt(bundle, WebApkMetaDataKeys.SPLASH_ID, 0);
int isSplashIconMaskableBooleanId = IntentUtils.safeGetInt( int isSplashIconMaskableBooleanId = IntentUtils.safeGetInt(
...@@ -324,7 +323,6 @@ public class WebApkIntentDataProviderFactory { ...@@ -324,7 +323,6 @@ public class WebApkIntentDataProviderFactory {
return create(url, scope, return create(url, scope,
new WebappIcon(webApkPackageName, new WebappIcon(webApkPackageName,
isPrimaryIconMaskable ? primaryMaskableIconId : primaryIconId), isPrimaryIconMaskable ? primaryMaskableIconId : primaryIconId),
new WebappIcon(webApkPackageName, badgeIconId),
new WebappIcon(webApkPackageName, splashIconId), name, shortName, displayMode, new WebappIcon(webApkPackageName, splashIconId), name, shortName, displayMode,
orientation, source, themeColor, backgroundColor, defaultBackgroundColor, orientation, source, themeColor, backgroundColor, defaultBackgroundColor,
isPrimaryIconMaskable, isSplashIconMaskable, webApkPackageName, shellApkVersion, isPrimaryIconMaskable, isSplashIconMaskable, webApkPackageName, shellApkVersion,
...@@ -338,7 +336,6 @@ public class WebApkIntentDataProviderFactory { ...@@ -338,7 +336,6 @@ public class WebApkIntentDataProviderFactory {
* @param url URL that the WebAPK should navigate to when launched. * @param url URL that the WebAPK should navigate to when launched.
* @param scope Scope for the WebAPK. * @param scope Scope for the WebAPK.
* @param primaryIcon Primary icon to show for the WebAPK. * @param primaryIcon Primary icon to show for the WebAPK.
* @param badgeIcon Badge icon to use for notifications.
* @param splashIcon Splash icon to use for the splash screen. * @param splashIcon Splash icon to use for the splash screen.
* @param name Name of the WebAPK. * @param name Name of the WebAPK.
* @param shortName The short name of the WebAPK. * @param shortName The short name of the WebAPK.
...@@ -371,14 +368,14 @@ public class WebApkIntentDataProviderFactory { ...@@ -371,14 +368,14 @@ public class WebApkIntentDataProviderFactory {
* @param webApkVersionCode WebAPK's version code. * @param webApkVersionCode WebAPK's version code.
*/ */
public static BrowserServicesIntentDataProvider create(String url, String scope, public static BrowserServicesIntentDataProvider create(String url, String scope,
WebappIcon primaryIcon, WebappIcon badgeIcon, WebappIcon splashIcon, String name, WebappIcon primaryIcon, WebappIcon splashIcon, String name, String shortName,
String shortName, @WebDisplayMode int displayMode, int orientation, int source, @WebDisplayMode int displayMode, int orientation, int source, long themeColor,
long themeColor, long backgroundColor, int defaultBackgroundColor, long backgroundColor, int defaultBackgroundColor, boolean isPrimaryIconMaskable,
boolean isPrimaryIconMaskable, boolean isSplashIconMaskable, String webApkPackageName, boolean isSplashIconMaskable, String webApkPackageName, int shellApkVersion,
int shellApkVersion, String manifestUrl, String manifestStartUrl, String manifestUrl, String manifestStartUrl, @WebApkDistributor int distributor,
@WebApkDistributor int distributor, Map<String, String> iconUrlToMurmur2HashMap, Map<String, String> iconUrlToMurmur2HashMap, ShareTarget shareTarget,
ShareTarget shareTarget, boolean forceNavigation, boolean isSplashProvidedByWebApk, boolean forceNavigation, boolean isSplashProvidedByWebApk, ShareData shareData,
ShareData shareData, List<ShortcutItem> shortcutItems, int webApkVersionCode) { List<ShortcutItem> shortcutItems, int webApkVersionCode) {
if (manifestStartUrl == null || webApkPackageName == null) { if (manifestStartUrl == null || webApkPackageName == null) {
Log.e(TAG, "Incomplete data provided: " + manifestStartUrl + ", " + webApkPackageName); Log.e(TAG, "Incomplete data provided: " + manifestStartUrl + ", " + webApkPackageName);
return null; return null;
...@@ -399,10 +396,6 @@ public class WebApkIntentDataProviderFactory { ...@@ -399,10 +396,6 @@ public class WebApkIntentDataProviderFactory {
primaryIcon = new WebappIcon(); primaryIcon = new WebappIcon();
} }
if (badgeIcon == null) {
badgeIcon = new WebappIcon();
}
if (splashIcon == null) { if (splashIcon == null) {
splashIcon = new WebappIcon(); splashIcon = new WebappIcon();
} }
...@@ -416,7 +409,7 @@ public class WebApkIntentDataProviderFactory { ...@@ -416,7 +409,7 @@ public class WebApkIntentDataProviderFactory {
shortName, displayMode, orientation, source, shortName, displayMode, orientation, source,
WebappIntentUtils.colorFromLongColor(backgroundColor), defaultBackgroundColor, WebappIntentUtils.colorFromLongColor(backgroundColor), defaultBackgroundColor,
false /* isIconGenerated */, isPrimaryIconMaskable, forceNavigation); false /* isIconGenerated */, isPrimaryIconMaskable, forceNavigation);
WebApkExtras webApkExtras = new WebApkExtras(webApkPackageName, badgeIcon, splashIcon, WebApkExtras webApkExtras = new WebApkExtras(webApkPackageName, splashIcon,
isSplashIconMaskable, shellApkVersion, manifestUrl, manifestStartUrl, distributor, isSplashIconMaskable, shellApkVersion, manifestUrl, manifestStartUrl, distributor,
iconUrlToMurmur2HashMap, shareTarget, isSplashProvidedByWebApk, shortcutItems, iconUrlToMurmur2HashMap, shareTarget, isSplashProvidedByWebApk, shortcutItems,
webApkVersionCode); webApkVersionCode);
......
...@@ -141,10 +141,9 @@ public class WebApkUpdateDataFetcher extends EmptyTabObserver { ...@@ -141,10 +141,9 @@ public class WebApkUpdateDataFetcher extends EmptyTabObserver {
int defaultBackgroundColor = SplashLayout.getDefaultBackgroundColor(appContext); int defaultBackgroundColor = SplashLayout.getDefaultBackgroundColor(appContext);
WebApkInfo info = WebApkInfo.create(mOldInfo.url(), scopeUrl, WebApkInfo info = WebApkInfo.create(mOldInfo.url(), scopeUrl,
new WebappIcon(primaryIconBitmap), null /* badgeIcon*/, new WebappIcon(primaryIconBitmap), new WebappIcon(splashIconBitmap), name,
new WebappIcon(splashIconBitmap), name, shortName, displayMode, orientation, shortName, displayMode, orientation, mOldInfo.source(), themeColor, backgroundColor,
mOldInfo.source(), themeColor, backgroundColor, defaultBackgroundColor, defaultBackgroundColor, isPrimaryIconMaskable, false /* isSplashIconMaskable */,
isPrimaryIconMaskable, false /* isSplashIconMaskable */,
mOldInfo.webApkPackageName(), mOldInfo.shellApkVersion(), mOldInfo.manifestUrl(), mOldInfo.webApkPackageName(), mOldInfo.shellApkVersion(), mOldInfo.manifestUrl(),
manifestStartUrl, WebApkDistributor.BROWSER, iconUrlToMurmur2HashMap, shareTarget, manifestStartUrl, WebApkDistributor.BROWSER, iconUrlToMurmur2HashMap, shareTarget,
mOldInfo.shouldForceNavigation(), mOldInfo.isSplashProvidedByWebApk(), null, mOldInfo.shouldForceNavigation(), mOldInfo.isSplashProvidedByWebApk(), null,
......
...@@ -176,7 +176,7 @@ public class WebApkUpdateManagerTest { ...@@ -176,7 +176,7 @@ public class WebApkUpdateManagerTest {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
WebappDataStorage storage = WebappDataStorage storage =
WebappRegistry.getInstance().getWebappDataStorage(WEBAPK_ID); WebappRegistry.getInstance().getWebappDataStorage(WEBAPK_ID);
WebApkInfo info = WebApkInfo.create("", creationData.scope, null, null, null, WebApkInfo info = WebApkInfo.create("", creationData.scope, null, null,
creationData.name, creationData.shortName, creationData.displayMode, creationData.name, creationData.shortName, creationData.displayMode,
creationData.orientation, 0, creationData.themeColor, creationData.orientation, 0, creationData.themeColor,
creationData.backgroundColor, 0, creationData.isPrimaryIconMaskable, creationData.backgroundColor, 0, creationData.isPrimaryIconMaskable,
......
...@@ -249,7 +249,6 @@ public class WebApkInfoTest { ...@@ -249,7 +249,6 @@ public class WebApkInfoTest {
Assert.assertEquals(PRIMARY_MASKABLE_ICON_ID, info.icon().resourceIdForTesting()); Assert.assertEquals(PRIMARY_MASKABLE_ICON_ID, info.icon().resourceIdForTesting());
Assert.assertEquals(true, info.isIconAdaptive()); Assert.assertEquals(true, info.isIconAdaptive());
Assert.assertEquals(null, info.badgeIcon().bitmap());
Assert.assertEquals(null, info.splashIcon().bitmap()); Assert.assertEquals(null, info.splashIcon().bitmap());
WebApkInfo.ShareTarget shareTarget = info.shareTarget(); WebApkInfo.ShareTarget shareTarget = info.shareTarget();
......
...@@ -86,8 +86,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -86,8 +86,6 @@ public class WebApkUpdateManagerUnitTest {
private static final String SHORT_NAME = "Short Name"; private static final String SHORT_NAME = "Short Name";
private static final String PRIMARY_ICON_URL = "/icon.png"; private static final String PRIMARY_ICON_URL = "/icon.png";
private static final String PRIMARY_ICON_MURMUR2_HASH = "3"; private static final String PRIMARY_ICON_MURMUR2_HASH = "3";
private static final String BADGE_ICON_URL = "/badge.png";
private static final String BADGE_ICON_MURMUR2_HASH = "4";
private static final @WebDisplayMode int DISPLAY_MODE = WebDisplayMode.UNDEFINED; private static final @WebDisplayMode int DISPLAY_MODE = WebDisplayMode.UNDEFINED;
private static final int ORIENTATION = ScreenOrientationValues.DEFAULT; private static final int ORIENTATION = ScreenOrientationValues.DEFAULT;
private static final long THEME_COLOR = 1L; private static final long THEME_COLOR = 1L;
...@@ -131,8 +129,8 @@ public class WebApkUpdateManagerUnitTest { ...@@ -131,8 +129,8 @@ public class WebApkUpdateManagerUnitTest {
@Override @Override
public void storeWebApkUpdateRequestToFile(String updateRequestPath, String startUrl, public void storeWebApkUpdateRequestToFile(String updateRequestPath, String startUrl,
String scope, String name, String shortName, String primaryIconUrl, String scope, String name, String shortName, String primaryIconUrl,
Bitmap primaryIcon, boolean isPrimaryIconMaskable, String badgeIconUrl, Bitmap primaryIcon, boolean isPrimaryIconMaskable, String splashIconUrl,
Bitmap badgeIcon, String[] iconUrls, String[] iconHashes, Bitmap splashIcon, String[] iconUrls, String[] iconHashes,
@WebDisplayMode int displayMode, int orientation, long themeColor, @WebDisplayMode int displayMode, int orientation, long themeColor,
long backgroundColor, String shareTargetAction, String shareTargetParamTitle, long backgroundColor, String shareTargetAction, String shareTargetParamTitle,
String shareTargetParamText, boolean shareTargetParamIsMethodPost, String shareTargetParamText, boolean shareTargetParamIsMethodPost,
...@@ -207,7 +205,7 @@ public class WebApkUpdateManagerUnitTest { ...@@ -207,7 +205,7 @@ public class WebApkUpdateManagerUnitTest {
@Override @Override
protected void storeWebApkUpdateRequestToFile(String updateRequestPath, WebApkInfo info, protected void storeWebApkUpdateRequestToFile(String updateRequestPath, WebApkInfo info,
String primaryIconUrl, String badgeIconUrl, boolean isManifestStale, String primaryIconUrl, String splashIconUrl, boolean isManifestStale,
@WebApkUpdateReason int updateReason, Callback<Boolean> callback) { @WebApkUpdateReason int updateReason, Callback<Boolean> callback) {
mStoreUpdateRequestCallback = callback; mStoreUpdateRequestCallback = callback;
mUpdateName = info.name(); mUpdateName = info.name();
...@@ -229,8 +227,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -229,8 +227,6 @@ public class WebApkUpdateManagerUnitTest {
public Map<String, String> iconUrlToMurmur2HashMap; public Map<String, String> iconUrlToMurmur2HashMap;
public String primaryIconUrl; public String primaryIconUrl;
public Bitmap primaryIcon; public Bitmap primaryIcon;
public String badgeIconUrl;
public Bitmap badgeIcon;
public @WebDisplayMode int displayMode; public @WebDisplayMode int displayMode;
public int orientation; public int orientation;
public long themeColor; public long themeColor;
...@@ -355,12 +351,9 @@ public class WebApkUpdateManagerUnitTest { ...@@ -355,12 +351,9 @@ public class WebApkUpdateManagerUnitTest {
manifestData.iconUrlToMurmur2HashMap = new HashMap<>(); manifestData.iconUrlToMurmur2HashMap = new HashMap<>();
manifestData.iconUrlToMurmur2HashMap.put(PRIMARY_ICON_URL, PRIMARY_ICON_MURMUR2_HASH); manifestData.iconUrlToMurmur2HashMap.put(PRIMARY_ICON_URL, PRIMARY_ICON_MURMUR2_HASH);
manifestData.iconUrlToMurmur2HashMap.put(BADGE_ICON_URL, BADGE_ICON_MURMUR2_HASH);
manifestData.primaryIconUrl = PRIMARY_ICON_URL; manifestData.primaryIconUrl = PRIMARY_ICON_URL;
manifestData.primaryIcon = createBitmap(Color.GREEN); manifestData.primaryIcon = createBitmap(Color.GREEN);
manifestData.badgeIconUrl = BADGE_ICON_URL;
manifestData.badgeIcon = createBitmap(Color.BLUE);
manifestData.displayMode = DISPLAY_MODE; manifestData.displayMode = DISPLAY_MODE;
manifestData.orientation = ORIENTATION; manifestData.orientation = ORIENTATION;
manifestData.themeColor = THEME_COLOR; manifestData.themeColor = THEME_COLOR;
...@@ -383,9 +376,9 @@ public class WebApkUpdateManagerUnitTest { ...@@ -383,9 +376,9 @@ public class WebApkUpdateManagerUnitTest {
final String kPackageName = "org.random.webapk"; final String kPackageName = "org.random.webapk";
return WebApkInfo.create("", manifestData.scopeUrl, return WebApkInfo.create("", manifestData.scopeUrl,
new WebappIcon(manifestData.primaryIcon), new WebappIcon(manifestData.badgeIcon), new WebappIcon(manifestData.primaryIcon), null, manifestData.name,
null, manifestData.name, manifestData.shortName, manifestData.displayMode, manifestData.shortName, manifestData.displayMode, manifestData.orientation, -1,
manifestData.orientation, -1, manifestData.themeColor, manifestData.backgroundColor, manifestData.themeColor, manifestData.backgroundColor,
manifestData.defaultBackgroundColor, false /* isPrimaryIconMaskable */, manifestData.defaultBackgroundColor, false /* isPrimaryIconMaskable */,
false /* isSplashIconMaskable*/, kPackageName, -1, WEB_MANIFEST_URL, false /* isSplashIconMaskable*/, kPackageName, -1, WEB_MANIFEST_URL,
manifestData.startUrl, WebApkDistributor.BROWSER, manifestData.startUrl, WebApkDistributor.BROWSER,
...@@ -443,9 +436,9 @@ public class WebApkUpdateManagerUnitTest { ...@@ -443,9 +436,9 @@ public class WebApkUpdateManagerUnitTest {
private static void onGotManifestData( private static void onGotManifestData(
WebApkUpdateManager updateManager, ManifestData fetchedManifestData) { WebApkUpdateManager updateManager, ManifestData fetchedManifestData) {
String primaryIconUrl = randomIconUrl(fetchedManifestData); String primaryIconUrl = randomIconUrl(fetchedManifestData);
String badgeIconUrl = randomIconUrl(fetchedManifestData); String splashIconUrl = randomIconUrl(fetchedManifestData);
updateManager.onGotManifestData( updateManager.onGotManifestData(
infoFromManifestData(fetchedManifestData), primaryIconUrl, badgeIconUrl); infoFromManifestData(fetchedManifestData), primaryIconUrl, splashIconUrl);
} }
/** /**
...@@ -501,7 +494,7 @@ public class WebApkUpdateManagerUnitTest { ...@@ -501,7 +494,7 @@ public class WebApkUpdateManagerUnitTest {
updateIfNeeded(WEBAPK_PACKAGE_NAME, updateManager, androidManifestData.shortcuts); updateIfNeeded(WEBAPK_PACKAGE_NAME, updateManager, androidManifestData.shortcuts);
assertTrue(updateManager.updateCheckStarted()); assertTrue(updateManager.updateCheckStarted());
updateManager.onGotManifestData(infoFromManifestData(fetchedManifestData), updateManager.onGotManifestData(infoFromManifestData(fetchedManifestData),
fetchedManifestData.primaryIconUrl, fetchedManifestData.badgeIconUrl); fetchedManifestData.primaryIconUrl, null);
return updateManager.updateRequested(); return updateManager.updateRequested();
} }
...@@ -962,20 +955,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -962,20 +955,6 @@ public class WebApkUpdateManagerUnitTest {
assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData)); assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData));
} }
/**
* Test that an upgrade is requested when:
* - WebAPK was generated using icon at {@link BADGE_ICON_URL} from Web Manifest.
* - Bitmap at {@link BADGE_ICON_URL} has changed.
*/
@Test
public void testBadgeIconChangeShouldUpgrade() {
ManifestData fetchedData = defaultManifestData();
fetchedData.iconUrlToMurmur2HashMap.put(
fetchedData.badgeIconUrl, BADGE_ICON_MURMUR2_HASH + "1");
fetchedData.badgeIcon = createBitmap(Color.GREEN);
assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData));
}
/** /**
* Test that an upgrade is requested when: * Test that an upgrade is requested when:
* - WebAPK is generated using icon at {@link PRIMARY_ICON_URL} from Web Manifest. * - WebAPK is generated using icon at {@link PRIMARY_ICON_URL} from Web Manifest.
...@@ -990,20 +969,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -990,20 +969,6 @@ public class WebApkUpdateManagerUnitTest {
assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData)); assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData));
} }
/**
* Test that an upgrade is requested when:
* - WebAPK is generated using icon at {@link BADGE_ICON_URL} from Web Manifest.
* - A new icon URL is added to the Web Manifest. And InstallableManager selects the new icon as
* the badge icon.
*/
@Test
public void testBadgeIconUrlChangeShouldUpgrade() {
ManifestData fetchedData = defaultManifestData();
fetchedData.iconUrlToMurmur2HashMap.put("/badge2.png", "44");
fetchedData.badgeIconUrl = "/badge2.png";
assertTrue(checkUpdateNeededForFetchedManifest(defaultManifestData(), fetchedData));
}
/** /**
* Test that an upgrade is not requested if: * Test that an upgrade is not requested if:
* - icon URL is added to the Web Manifest * - icon URL is added to the Web Manifest
...@@ -1040,7 +1005,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -1040,7 +1005,6 @@ public class WebApkUpdateManagerUnitTest {
ManifestData androidManifestData = defaultManifestData(); ManifestData androidManifestData = defaultManifestData();
androidManifestData.primaryIconUrl = iconUrl1; androidManifestData.primaryIconUrl = iconUrl1;
androidManifestData.badgeIconUrl = badgeUrl1;
androidManifestData.iconUrlToMurmur2HashMap.clear(); androidManifestData.iconUrlToMurmur2HashMap.clear();
androidManifestData.iconUrlToMurmur2HashMap.put(iconUrl1, hash1); androidManifestData.iconUrlToMurmur2HashMap.put(iconUrl1, hash1);
androidManifestData.iconUrlToMurmur2HashMap.put(iconUrl2, hash2); androidManifestData.iconUrlToMurmur2HashMap.put(iconUrl2, hash2);
...@@ -1049,7 +1013,6 @@ public class WebApkUpdateManagerUnitTest { ...@@ -1049,7 +1013,6 @@ public class WebApkUpdateManagerUnitTest {
ManifestData fetchedManifestData = defaultManifestData(); ManifestData fetchedManifestData = defaultManifestData();
fetchedManifestData.primaryIconUrl = iconUrl2; fetchedManifestData.primaryIconUrl = iconUrl2;
fetchedManifestData.badgeIconUrl = badgeUrl2;
fetchedManifestData.iconUrlToMurmur2HashMap.clear(); fetchedManifestData.iconUrlToMurmur2HashMap.clear();
fetchedManifestData.iconUrlToMurmur2HashMap.put(iconUrl1, null); fetchedManifestData.iconUrlToMurmur2HashMap.put(iconUrl1, null);
fetchedManifestData.iconUrlToMurmur2HashMap.put(iconUrl2, hash2); fetchedManifestData.iconUrlToMurmur2HashMap.put(iconUrl2, hash2);
......
...@@ -34,7 +34,6 @@ public final class WebApkMetaDataKeys { ...@@ -34,7 +34,6 @@ public final class WebApkMetaDataKeys {
"org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes"; "org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes";
public static final String WEB_MANIFEST_URL = "org.chromium.webapk.shell_apk.webManifestUrl"; public static final String WEB_MANIFEST_URL = "org.chromium.webapk.shell_apk.webManifestUrl";
public static final String DISTRIBUTOR = "org.chromium.webapk.shell_apk.distributor"; public static final String DISTRIBUTOR = "org.chromium.webapk.shell_apk.distributor";
public static final String BADGE_ICON_ID = "org.chromium.webapk.shell_apk.badgeIconId";
public static final String SHARE_ACTION = "org.chromium.webapk.shell_apk.shareAction"; public static final String SHARE_ACTION = "org.chromium.webapk.shell_apk.shareAction";
public static final String SHARE_METHOD = "org.chromium.webapk.shell_apk.shareMethod"; public static final String SHARE_METHOD = "org.chromium.webapk.shell_apk.shareMethod";
public static final String SHARE_ENCTYPE = "org.chromium.webapk.shell_apk.shareEnctype"; public static final String SHARE_ENCTYPE = "org.chromium.webapk.shell_apk.shareEnctype";
......
...@@ -149,7 +149,6 @@ ...@@ -149,7 +149,6 @@
<meta-data android:name="org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes" android:value="{{{icon_urls_and_icon_murmur2_hashes}}}" /> <meta-data android:name="org.chromium.webapk.shell_apk.iconUrlsAndIconMurmur2Hashes" android:value="{{{icon_urls_and_icon_murmur2_hashes}}}" />
<meta-data android:name="org.chromium.webapk.shell_apk.webManifestUrl" android:value="{{{web_manifest_url}}}" /> <meta-data android:name="org.chromium.webapk.shell_apk.webManifestUrl" android:value="{{{web_manifest_url}}}" />
{{#badge_icon_id}}<meta-data android:name="org.chromium.webapk.shell_apk.badgeIconId" android:resource="{{{badge_icon_id}}}" />{{/badge_icon_id}}
<service <service
android:name="org.chromium.webapk.shell_apk.WebApkServiceFactory" android:name="org.chromium.webapk.shell_apk.WebApkServiceFactory"
android:exported="true" android:exported="true"
......
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes # //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect # Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk # Chrome.apk
current_shell_apk_version = 122 current_shell_apk_version = 124
...@@ -50,7 +50,7 @@ public class WebApkInfoBuilder { ...@@ -50,7 +50,7 @@ public class WebApkInfoBuilder {
* Builds {@link WebApkInfo} object using options that have been set. * Builds {@link WebApkInfo} object using options that have been set.
*/ */
public WebApkInfo build() { public WebApkInfo build() {
return WebApkInfo.create(mUrl, mScope, null, null, null, null, null, mDisplayMode, return WebApkInfo.create(mUrl, mScope, null, null, null, null, mDisplayMode,
ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, Color.WHITE, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, Color.WHITE,
......
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