Commit de58c823 authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

📎 Remove unneeded TWA feature flags.

Trusted Web Activities have been launched since Chrome 72 and
Permission Auto-Enrolment has been launched since Chrome 75.

Bug: 1017688
Change-Id: I98420357ee6fee95ef78df85a55f48f3f897695d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878199
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710304}
parent 10de5546
...@@ -17,14 +17,8 @@ import android.graphics.Bitmap; ...@@ -17,14 +17,8 @@ import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.RemoteException; import android.os.RemoteException;
import androidx.annotation.Nullable;
import androidx.browser.trusted.TrustedWebActivityService;
import androidx.browser.trusted.TrustedWebActivityServiceConnectionManager;
import androidx.browser.trusted.TrustedWebActivityServiceWrapper;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityUmaRecorder.DelegatedNotificationSmallIconFallback; import org.chromium.chrome.browser.browserservices.TrustedWebActivityUmaRecorder.DelegatedNotificationSmallIconFallback;
import org.chromium.chrome.browser.browserservices.permissiondelegation.NotificationPermissionUpdater; import org.chromium.chrome.browser.browserservices.permissiondelegation.NotificationPermissionUpdater;
import org.chromium.chrome.browser.notifications.NotificationBuilderBase; import org.chromium.chrome.browser.notifications.NotificationBuilderBase;
...@@ -38,6 +32,11 @@ import java.util.Set; ...@@ -38,6 +32,11 @@ import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import androidx.annotation.Nullable;
import androidx.browser.trusted.TrustedWebActivityService;
import androidx.browser.trusted.TrustedWebActivityServiceConnectionManager;
import androidx.browser.trusted.TrustedWebActivityServiceWrapper;
/** /**
* Uses a Trusted Web Activity client to display notifications. * Uses a Trusted Web Activity client to display notifications.
*/ */
...@@ -190,8 +189,6 @@ public class TrustedWebActivityClient { ...@@ -190,8 +189,6 @@ public class TrustedWebActivityClient {
*/ */
public static @Nullable Intent createLaunchIntentForTwa(Context appContext, String url, public static @Nullable Intent createLaunchIntentForTwa(Context appContext, String url,
List<ResolveInfo> resolveInfosForUrl) { List<ResolveInfo> resolveInfosForUrl) {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) return null;
Origin origin = new Origin(url); Origin origin = new Origin(url);
// Trusted Web Activities only work with https so we can shortcut here. // Trusted Web Activities only work with https so we can shortcut here.
......
...@@ -11,13 +11,10 @@ import android.content.Context; ...@@ -11,13 +11,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.WorkerThread;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.PackageManagerUtils; import org.chromium.base.PackageManagerUtils;
import org.chromium.base.task.PostTask; import org.chromium.base.task.PostTask;
import org.chromium.chrome.browser.ChromeApplication; import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics; import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics;
import org.chromium.chrome.browser.browserservices.Origin; import org.chromium.chrome.browser.browserservices.Origin;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient; import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient;
...@@ -27,6 +24,8 @@ import javax.inject.Inject; ...@@ -27,6 +24,8 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import androidx.annotation.WorkerThread;
/** /**
* This class updates the notification permission for an Origin based on the notification permission * This class updates the notification permission for an Origin based on the notification permission
* that the linked TWA has in Android. It also reverts the notification permission back to that the * that the linked TWA has in Android. It also reverts the notification permission back to that the
...@@ -60,11 +59,6 @@ public class NotificationPermissionUpdater { ...@@ -60,11 +59,6 @@ public class NotificationPermissionUpdater {
* - Otherwise, it does nothing. * - Otherwise, it does nothing.
*/ */
public void onOriginVerified(Origin origin, String packageName) { public void onOriginVerified(Origin origin, String packageName) {
if (!ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_NOTIFICATION_DELEGATION_ENROLMENT)) {
return;
}
// If the client doesn't handle browsable Intents for the URL, we don't do anything special // If the client doesn't handle browsable Intents for the URL, we don't do anything special
// for the origin's notifications. // for the origin's notifications.
if (!appHandlesBrowsableIntent(packageName, origin.uri())) { if (!appHandlesBrowsableIntent(packageName, origin.uri())) {
...@@ -88,11 +82,6 @@ public class NotificationPermissionUpdater { ...@@ -88,11 +82,6 @@ public class NotificationPermissionUpdater {
* app was installed. * app was installed.
*/ */
public void onClientAppUninstalled(Origin origin) { public void onClientAppUninstalled(Origin origin) {
if (ChromeFeatureList.isInitialized() && !ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_NOTIFICATION_DELEGATION_ENROLMENT)) {
return;
}
// See if there is any other app installed that could handle the notifications (and update // See if there is any other app installed that could handle the notifications (and update
// to that apps notification permission if it exists). // to that apps notification permission if it exists).
boolean couldConnect = mTrustedWebActivityClient.checkNotificationPermission(origin, boolean couldConnect = mTrustedWebActivityClient.checkNotificationPermission(origin,
......
...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.browserservices.trustedwebactivityui.control ...@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.browserservices.trustedwebactivityui.control
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.base.ObserverList; import org.chromium.base.ObserverList;
import org.chromium.base.Promise; import org.chromium.base.Promise;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.browserservices.Origin; import org.chromium.chrome.browser.browserservices.Origin;
import org.chromium.chrome.browser.browserservices.trustedwebactivityui.TrustedWebActivityModel; import org.chromium.chrome.browser.browserservices.trustedwebactivityui.TrustedWebActivityModel;
...@@ -81,10 +80,6 @@ public class Verifier implements NativeInitObserver { ...@@ -81,10 +80,6 @@ public class Verifier implements NativeInitObserver {
@Override @Override
public void onDidFinishNavigation(Tab tab, NavigationHandle navigation) { public void onDidFinishNavigation(Tab tab, NavigationHandle navigation) {
if (!navigation.hasCommitted() || !navigation.isInMainFrame()) return; if (!navigation.hasCommitted() || !navigation.isInMainFrame()) return;
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) {
assert false : "Shouldn't observe navigation when TWAs are disabled";
return;
}
verifyVisitedOrigin(new Origin(navigation.getUrl())); verifyVisitedOrigin(new Origin(navigation.getUrl()));
} }
}; };
...@@ -150,11 +145,6 @@ public class Verifier implements NativeInitObserver { ...@@ -150,11 +145,6 @@ public class Verifier implements NativeInitObserver {
@Override @Override
public void onFinishNativeInitialization() { public void onFinishNativeInitialization() {
Origin initialOrigin = new Origin(mIntentDataProvider.getUrlToLoad()); Origin initialOrigin = new Origin(mIntentDataProvider.getUrlToLoad());
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) {
mTabObserverRegistrar.unregisterTabObserver(mVerifyOnPageLoadObserver);
updateState(initialOrigin, VerificationStatus.FAILURE);
return;
}
collectTrustedOrigins(initialOrigin); collectTrustedOrigins(initialOrigin);
verifyVisitedOrigin(initialOrigin); verifyVisitedOrigin(initialOrigin);
......
...@@ -184,9 +184,7 @@ const base::Feature* kFeaturesExposedToJava[] = { ...@@ -184,9 +184,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kTabSwitcherLongpressMenu, &kTabSwitcherLongpressMenu,
&kTabSwitcherOnReturn, &kTabSwitcherOnReturn,
&kTabToGTSAnimation, &kTabToGTSAnimation,
&kTrustedWebActivity,
&kTrustedWebActivityPostMessage, &kTrustedWebActivityPostMessage,
&kTrustedWebActivityNotificationDelegationEnrolment,
&kStartSurfaceAndroid, &kStartSurfaceAndroid,
&kUmaBackgroundSessions, &kUmaBackgroundSessions,
&kUpdateNotificationSchedulingIntegration, &kUpdateNotificationSchedulingIntegration,
...@@ -561,16 +559,9 @@ const base::Feature kTabSwitcherOnReturn{"TabSwitcherOnReturn", ...@@ -561,16 +559,9 @@ const base::Feature kTabSwitcherOnReturn{"TabSwitcherOnReturn",
const base::Feature kTabToGTSAnimation{"TabToGTSAnimation", const base::Feature kTabToGTSAnimation{"TabToGTSAnimation",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivity{"TrustedWebActivity",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivityPostMessage{ const base::Feature kTrustedWebActivityPostMessage{
"TrustedWebActivityPostMessage", base::FEATURE_DISABLED_BY_DEFAULT}; "TrustedWebActivityPostMessage", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivityNotificationDelegationEnrolment{
"TrustedWebActivityNotificationDelegationAutoEnrolment",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kStartSurfaceAndroid{"StartSurfaceAndroid", const base::Feature kStartSurfaceAndroid{"StartSurfaceAndroid",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -115,9 +115,7 @@ extern const base::Feature kTabReparenting; ...@@ -115,9 +115,7 @@ extern const base::Feature kTabReparenting;
extern const base::Feature kTabSwitcherLongpressMenu; extern const base::Feature kTabSwitcherLongpressMenu;
extern const base::Feature kTabSwitcherOnReturn; extern const base::Feature kTabSwitcherOnReturn;
extern const base::Feature kTabToGTSAnimation; extern const base::Feature kTabToGTSAnimation;
extern const base::Feature kTrustedWebActivity;
extern const base::Feature kTrustedWebActivityPostMessage; extern const base::Feature kTrustedWebActivityPostMessage;
extern const base::Feature kTrustedWebActivityNotificationDelegationEnrolment;
extern const base::Feature kStartSurfaceAndroid; extern const base::Feature kStartSurfaceAndroid;
extern const base::Feature kUmaBackgroundSessions; extern const base::Feature kUmaBackgroundSessions;
extern const base::Feature kUpdateNotificationSchedulingIntegration; extern const base::Feature kUpdateNotificationSchedulingIntegration;
......
...@@ -120,14 +120,11 @@ scoped_refptr<RefcountedKeyedService> ...@@ -120,14 +120,11 @@ scoped_refptr<RefcountedKeyedService>
HostContentSettingsMap::NOTIFICATION_ANDROID_PROVIDER, HostContentSettingsMap::NOTIFICATION_ANDROID_PROVIDER,
std::move(channels_provider)); std::move(channels_provider));
if (base::FeatureList::IsEnabled(chrome::android::
kTrustedWebActivityNotificationDelegationEnrolment)) {
auto webapp_provider = std::make_unique<InstalledWebappProvider>(); auto webapp_provider = std::make_unique<InstalledWebappProvider>();
settings_map->RegisterProvider( settings_map->RegisterProvider(
HostContentSettingsMap::INSTALLED_WEBAPP_PROVIDER, HostContentSettingsMap::INSTALLED_WEBAPP_PROVIDER,
std::move(webapp_provider)); std::move(webapp_provider));
} }
}
#endif // defined (OS_ANDROID) #endif // defined (OS_ANDROID)
return settings_map; return settings_map;
} }
......
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