Commit 80b779e6 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android Webapps/CCT] Finish Kitkat deprecation

This CL finishes removing Kitkat-specific logic in webapps and CCT code.

BUG=1068178

Change-Id: I87070083cb0b89278d13855457823c9f9cea0e96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166809Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763669}
parent 0b2ed011
...@@ -10,7 +10,6 @@ import android.content.ComponentName; ...@@ -10,7 +10,6 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -62,7 +61,6 @@ import org.chromium.content_public.browser.LoadUrlParams; ...@@ -62,7 +61,6 @@ import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.common.BrowserControlsState; import org.chromium.content_public.common.BrowserControlsState;
import org.chromium.content_public.common.ResourceRequestBody; import org.chromium.content_public.common.ResourceRequestBody;
import org.chromium.ui.mojom.WindowOpenDisposition; import org.chromium.ui.mojom.WindowOpenDisposition;
import org.chromium.webapk.lib.client.WebApkNavigationClient;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -263,18 +261,8 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -263,18 +261,8 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
WebappInfo webappInfo = webappActivity.getWebappInfo(); WebappInfo webappInfo = webappActivity.getWebappInfo();
if (webappInfo.isForWebApk()) { if (webappInfo.isForWebApk()) {
Intent activateIntent = null; Intent activateIntent = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activateIntent = new Intent(ACTION_ACTIVATE_WEBAPK);
activateIntent = new Intent(ACTION_ACTIVATE_WEBAPK); activateIntent.setPackage(ContextUtils.getApplicationContext().getPackageName());
activateIntent.setPackage(
ContextUtils.getApplicationContext().getPackageName());
} else {
// For WebAPKs with new-style splash screen we cannot activate the WebAPK by
// sending an intent because that would relaunch the WebAPK.
assert !webappInfo.isSplashProvidedByWebApk();
activateIntent = WebApkNavigationClient.createLaunchWebApkIntent(
webappInfo.webApkPackageName(), startUrl, false /* forceNavigation */);
}
IntentUtils.safeStartActivity(mActivity, activateIntent); IntentUtils.safeStartActivity(mActivity, activateIntent);
return; return;
} }
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -85,8 +84,7 @@ public class CustomTabTaskDescriptionHelper implements NativeInitObserver, Destr ...@@ -85,8 +84,7 @@ public class CustomTabTaskDescriptionHelper implements NativeInitObserver, Destr
@Override @Override
public void onFinishNativeInitialization() { public void onFinishNativeInitialization() {
WebappExtras webappExtras = mIntentDataProvider.getWebappExtras(); WebappExtras webappExtras = mIntentDataProvider.getWebappExtras();
boolean canUpdate = (webappExtras != null boolean canUpdate = (webappExtras != null || usesSeparateTask());
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && usesSeparateTask()));
if (!canUpdate) return; if (!canUpdate) return;
mDefaultThemeColor = ApiCompatibilityUtils.getColor( mDefaultThemeColor = ApiCompatibilityUtils.getColor(
......
...@@ -28,10 +28,6 @@ public class CustomTabNavigationBarController { ...@@ -28,10 +28,6 @@ public class CustomTabNavigationBarController {
*/ */
public static void updateNavigationBarColor(Activity activity, public static void updateNavigationBarColor(Activity activity,
BrowserServicesIntentDataProvider intentDataProvider) { BrowserServicesIntentDataProvider intentDataProvider) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return; // Window#setNavigationBar not available.
}
Integer color = intentDataProvider.getNavigationBarColor(); Integer color = intentDataProvider.getNavigationBarColor();
if (color == null) return; if (color == null) return;
......
...@@ -71,10 +71,8 @@ import org.chromium.base.metrics.RecordHistogram; ...@@ -71,10 +71,8 @@ import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.PostTask; import org.chromium.base.task.PostTask;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.base.test.util.RetryOnFailure; import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.R; import org.chromium.chrome.R;
...@@ -895,7 +893,7 @@ public class CustomTabActivityTest { ...@@ -895,7 +893,7 @@ public class CustomTabActivityTest {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
assertEquals(expectedColor, assertEquals(expectedColor,
mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor()); mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { } else {
assertEquals(ColorUtils.getDarkenedColorForStatusBar(expectedColor), assertEquals(ColorUtils.getDarkenedColorForStatusBar(expectedColor),
mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor()); mCustomTabActivityTestRule.getActivity().getWindow().getStatusBarColor());
} }
...@@ -1300,7 +1298,6 @@ public class CustomTabActivityTest { ...@@ -1300,7 +1298,6 @@ public class CustomTabActivityTest {
@Test @Test
@SmallTest @SmallTest
@RetryOnFailure @RetryOnFailure
@MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // Details in https://crbug.com/709681.
public void testPageLoadMetricsAreSent() throws Exception { public void testPageLoadMetricsAreSent() throws Exception {
checkPageLoadMetrics(true); checkPageLoadMetrics(true);
} }
...@@ -1603,7 +1600,6 @@ public class CustomTabActivityTest { ...@@ -1603,7 +1600,6 @@ public class CustomTabActivityTest {
@SmallTest @SmallTest
@RetryOnFailure @RetryOnFailure
@DisabledTest(message = "https://crbug.com/692025") @DisabledTest(message = "https://crbug.com/692025")
@MinAndroidSdkLevel(Build.VERSION_CODES.LOLLIPOP) // Details in https://crbug.com/709681.
public void testPostMessageReceivedFromPageWithLateRequest() throws Exception { public void testPostMessageReceivedFromPageWithLateRequest() throws Exception {
final CallbackHelper messageChannelHelper = new CallbackHelper(); final CallbackHelper messageChannelHelper = new CallbackHelper();
final CallbackHelper onPostMessageHelper = new CallbackHelper(); final CallbackHelper onPostMessageHelper = new CallbackHelper();
...@@ -2292,24 +2288,7 @@ public class CustomTabActivityTest { ...@@ -2292,24 +2288,7 @@ public class CustomTabActivityTest {
@Test @Test
@SmallTest @SmallTest
@DisableIf.Build(sdk_is_greater_than = 20) public void testLaunchCustomTabWithColorSchemeDark() {
public void testLaunchCustomTabWithColorSchemeDark_Kitkat() {
Intent intent = createMinimalCustomTabIntent();
addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK);
mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
final CustomTabActivity cctActivity = mCustomTabActivityTestRule.getActivity();
Assert.assertNotNull(cctActivity.getNightModeStateProvider());
Assert.assertFalse("Night mode should be disabled on K with dark color scheme set.",
cctActivity.getNightModeStateProvider().isInNightMode());
}
@Test
@SmallTest
@DisableIf.Build(sdk_is_less_than = 21)
public void testLaunchCustomTabWithColorSchemeDark_PostKitkat() {
Intent intent = createMinimalCustomTabIntent(); Intent intent = createMinimalCustomTabIntent();
addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK); addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK);
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
import android.support.test.filters.MediumTest; import android.support.test.filters.MediumTest;
...@@ -22,7 +21,6 @@ import org.chromium.base.ActivityState; ...@@ -22,7 +21,6 @@ import org.chromium.base.ActivityState;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.LaunchIntentDispatcher; import org.chromium.chrome.browser.LaunchIntentDispatcher;
...@@ -104,8 +102,6 @@ public class CustomTabFromChromeExternalNavigationTest { ...@@ -104,8 +102,6 @@ public class CustomTabFromChromeExternalNavigationTest {
@Test @Test
@Feature("CustomTabFromChrome") @Feature("CustomTabFromChrome")
@LargeTest @LargeTest
@DisableIf.Build(message = "Flaky on K, https://crbug.com/962974",
sdk_is_less_than = Build.VERSION_CODES.LOLLIPOP)
public void public void
testIntentWithRedirectToApp() { testIntentWithRedirectToApp() {
final String redirectUrl = "https://maps.google.com/maps?q=1600+amphitheatre+parkway"; final String redirectUrl = "https://maps.google.com/maps?q=1600+amphitheatre+parkway";
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.customtabs;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
...@@ -219,7 +218,6 @@ public class CustomTabTaskDescriptionHelperTest { ...@@ -219,7 +218,6 @@ public class CustomTabTaskDescriptionHelperTest {
/** /**
* Fetches the task description color from the ActivityManager. * Fetches the task description color from the ActivityManager.
*/ */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static int fetchTaskDescriptionColor(Activity activity) throws Exception { private static int fetchTaskDescriptionColor(Activity activity) throws Exception {
ActivityManager.TaskDescription taskDescription = ActivityManager.TaskDescription taskDescription =
(ActivityManager.TaskDescription) fetchTaskDescription(activity); (ActivityManager.TaskDescription) fetchTaskDescription(activity);
...@@ -229,14 +227,12 @@ public class CustomTabTaskDescriptionHelperTest { ...@@ -229,14 +227,12 @@ public class CustomTabTaskDescriptionHelperTest {
/** /**
* Fetches the task description label from the ActivityManager. * Fetches the task description label from the ActivityManager.
*/ */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static String fetchTaskDescriptionLabel(Activity activity) throws Exception { private static String fetchTaskDescriptionLabel(Activity activity) throws Exception {
ActivityManager.TaskDescription taskDescription = ActivityManager.TaskDescription taskDescription =
(ActivityManager.TaskDescription) fetchTaskDescription(activity); (ActivityManager.TaskDescription) fetchTaskDescription(activity);
return (taskDescription == null) ? null : taskDescription.getLabel(); return (taskDescription == null) ? null : taskDescription.getLabel();
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Object fetchTaskDescription(Activity activity) throws Exception { private static Object fetchTaskDescription(Activity activity) throws Exception {
return TestThreadUtils.runOnUiThreadBlocking(() -> { return TestThreadUtils.runOnUiThreadBlocking(() -> {
try { try {
......
...@@ -503,7 +503,6 @@ public class CustomTabsConnectionTest { ...@@ -503,7 +503,6 @@ public class CustomTabsConnectionTest {
@Test @Test
@SmallTest @SmallTest
public void testGetSchedulerGroup() throws Exception { public void testGetSchedulerGroup() throws Exception {
Assume.assumeTrue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
// After M, /proc is mounted with hidepid=2, so even though the test still passes, it // After M, /proc is mounted with hidepid=2, so even though the test still passes, it
// is not useful in practice. See crbug.com/973368 for details. // is not useful in practice. See crbug.com/973368 for details.
Assume.assumeTrue(Build.VERSION.SDK_INT < Build.VERSION_CODES.M); Assume.assumeTrue(Build.VERSION.SDK_INT < Build.VERSION_CODES.M);
......
...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.webapps; ...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.webapps;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
...@@ -86,8 +85,6 @@ public final class WebApkActivityTest { ...@@ -86,8 +85,6 @@ public final class WebApkActivityTest {
@LargeTest @LargeTest
@Test @Test
public void testActivateWebApkLPlus() throws Exception { public void testActivateWebApkLPlus() throws Exception {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
// Launch WebAPK. // Launch WebAPK.
WebappActivity webApkActivity = mActivityTestRule.startWebApkActivity(createWebApkInfo( WebappActivity webApkActivity = mActivityTestRule.startWebApkActivity(createWebApkInfo(
getTestServerUrl("manifest_test_page.html"), getTestServerUrl("/"))); getTestServerUrl("manifest_test_page.html"), getTestServerUrl("/")));
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
package org.chromium.chrome.browser.webapps; package org.chromium.chrome.browser.webapps;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
...@@ -82,11 +81,9 @@ public class WebappSplashScreenTest { ...@@ -82,11 +81,9 @@ public class WebappSplashScreenTest {
@Test @Test
@SmallTest @SmallTest
@Feature({"StatusBar", "Webapps"}) @Feature({"StatusBar", "Webapps"})
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
public void testThemeColorWhenNotSpecified() { public void testThemeColorWhenNotSpecified() {
mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); mActivityTestRule.startWebappActivityAndWaitForSplashScreen();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
// Status bar color should be white on M+ to match CCTs and WebAPK shell. // Status bar color should be white on M+ to match CCTs and WebAPK shell.
int expectedColor = Color.WHITE; int expectedColor = Color.WHITE;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.webapps; package org.chromium.chrome.browser.webapps;
import android.content.Context; import android.content.Context;
import android.os.Build;
import org.junit.After; import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
...@@ -76,8 +75,6 @@ public class WebappDirectoryManagerTest { ...@@ -76,8 +75,6 @@ public class WebappDirectoryManagerTest {
@Test @Test
@Feature({"Webapps"}) @Feature({"Webapps"})
public void testDeletesObsoleteDirectories() { public void testDeletesObsoleteDirectories() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
// Seed the base directory with folders that correspond to pre-L web apps. // Seed the base directory with folders that correspond to pre-L web apps.
File baseDirectory = mContext.getDataDir(); File baseDirectory = mContext.getDataDir();
File webappDirectory = new File(baseDirectory, "app_WebappActivity"); File webappDirectory = new File(baseDirectory, "app_WebappActivity");
......
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