Commit 6215c6bf authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove ApiCompatibilityUtils.getActivityNewDocumentFlag()

It's not needed since KitKat support has been removed.

Bug: none
Change-Id: Id3602b3b942899aae5fcf6a074cf82f34b7cf6b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380339Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802672}
parent 79016035
......@@ -411,14 +411,6 @@ public class ApiCompatibilityUtils {
return manager.isScreenOn();
}
@SuppressWarnings("deprecation")
public static int getActivityNewDocumentFlag() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return ApisL.FLAG_ACTIVITY_NEW_DOCUMENT;
}
return Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
}
/**
* @see android.provider.Settings.Secure#SKIP_FIRST_USE_HINTS
*/
......
......@@ -416,8 +416,7 @@ public class IntentUtils {
/** Returns whether the intent starts an activity in a new task or a new document. */
public static boolean isIntentForNewTaskOrNewDocument(Intent intent) {
int testFlags =
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag();
int testFlags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
return (intent.getFlags() & testFlags) != 0;
}
......
......@@ -22,7 +22,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.PackageManagerUtils;
import org.chromium.base.StrictModeContext;
......@@ -252,7 +251,7 @@ public class ShareHelper extends org.chromium.components.browser_ui.share.ShareH
*/
public static Intent createShareFileAppCompatibilityIntent(String fileContentType) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.addFlags(ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.setType(fileContentType);
return intent;
}
......@@ -264,7 +263,7 @@ public class ShareHelper extends org.chromium.components.browser_ui.share.ShareH
*/
public static Intent getShareImageIntent(Uri imageUri) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.addFlags(ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.setType("image/jpeg");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, imageUri);
......
......@@ -12,7 +12,6 @@ import android.provider.Browser;
import androidx.annotation.Nullable;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.browser.ChromeTabbedActivity;
......@@ -187,8 +186,7 @@ public class TabDelegate extends AsyncTabCreator {
@Override
public void createNewStandaloneFrame(Intent intent) {
assert intent != null;
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
IntentHandler.startActivityForTrustedIntent(intent);
}
}
......@@ -93,8 +93,7 @@ public class WebappLauncherActivity extends Activity {
Intent sourceIntent, @NonNull String webApkPackageName, @NonNull String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setPackage(webApkPackageName);
intent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
Bundle extras = sourceIntent.getExtras();
if (extras != null) {
intent.putExtras(extras);
......@@ -282,8 +281,7 @@ public class WebappLauncherActivity extends Activity {
appContext.getPackageName(), ChromeLauncherActivity.class.getName());
launchIntent.putExtra(ShortcutHelper.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, true);
launchIntent.putExtra(ShortcutHelper.EXTRA_SOURCE, webappSource);
launchIntent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag());
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
Log.e(TAG, "Shortcut (%s) opened in Chrome.", webappUrl);
......@@ -350,8 +348,7 @@ public class WebappLauncherActivity extends Activity {
launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION
| Intent.FLAG_ACTIVITY_FORWARD_RESULT);
} else {
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| ApiCompatibilityUtils.getActivityNewDocumentFlag()
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
......
......@@ -19,7 +19,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.ActivityState;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
......@@ -101,8 +100,7 @@ public final class WebApkActivityTest {
// Move WebAPK to the background by launching Chrome.
Intent intent = new Intent(InstrumentationRegistry.getTargetContext(), mainClass);
intent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
InstrumentationRegistry.getTargetContext().startActivity(intent);
ChromeActivityTestRule.waitFor(mainClass);
......
......@@ -11,7 +11,6 @@ import org.hamcrest.Matchers;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.test.util.ScalableTimeout;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider;
......@@ -77,8 +76,7 @@ public class WebApkActivityTestRule extends ChromeActivityTestRule<WebappActivit
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, webApkInfo.webApkPackageName());
intent.putExtra(ShortcutHelper.EXTRA_ID, webApkInfo.id());
intent.putExtra(ShortcutHelper.EXTRA_URL, webApkInfo.url());
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
return intent;
}
}
......@@ -289,10 +289,10 @@ public class ShareHelper {
*/
public static void shareWithUi(ShareParams params) {
if (TargetChosenReceiver.isSupported()) {
// On L+ open system share sheet.
// On LMR1+ open system share sheet.
shareWithSystemSheet(params);
} else {
// On K and below open custom share dialog.
// On L and below open custom share dialog.
showCompatShareDialog(params);
}
}
......@@ -305,7 +305,6 @@ public class ShareHelper {
public static void shareDirectly(
@NonNull ShareParams params, @NonNull ComponentName component) {
Intent intent = getShareLinkIntent(params);
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
intent.setComponent(component);
fireIntent(params.getWindow(), intent, null);
}
......@@ -317,8 +316,8 @@ public class ShareHelper {
final String action =
isMultipleFileShare ? Intent.ACTION_SEND_MULTIPLE : Intent.ACTION_SEND;
Intent intent = new Intent(action);
intent.addFlags(ApiCompatibilityUtils.getActivityNewDocumentFlag()
| Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_FORWARD_RESULT
| Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
intent.putExtra(EXTRA_TASK_ID, params.getWindow().getActivity().get().getTaskId());
Uri screenshotUri = params.getScreenshotUri();
......@@ -366,7 +365,7 @@ public class ShareHelper {
*/
public static Intent getShareLinkAppCompatibilityIntent() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.addFlags(ApiCompatibilityUtils.getActivityNewDocumentFlag());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.putExtra(Intent.EXTRA_SUBJECT, "");
intent.putExtra(Intent.EXTRA_TEXT, "");
intent.setType("text/plain");
......
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