Skip to content

Commit

Permalink
[Android] Removed stack layout code
Browse files Browse the repository at this point in the history
Resolves brave/brave-browser#21005

Chromium change:
chromium/chromium@94a231f

Remove unused rendering code in TabLayout
Follow up to https://chromium-review.googlesource.com/c/chromium/src/+/3388174
and continues to simplify the Tab rendering logic for phones.

Also deletes anything related to tilting/rotating and card backs for the
tabs.

Bug: 1287653
  • Loading branch information
samartnik authored and mkarolin committed Feb 17, 2022
1 parent 816acd7 commit e3abd22
Show file tree
Hide file tree
Showing 27 changed files with 0 additions and 6,237 deletions.
4 changes: 0 additions & 4 deletions android/brave_java_resources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -924,20 +924,16 @@ brave_java_resources = [
"java/res/values-h748dp/dimens.xml",
"java/res/values-h765dp/dimens.xml",
"java/res/values-h820dp/dimens.xml",
"java/res/values-hdpi/brave_dimens.xml",
"java/res/values-night/brave_colors.xml",
"java/res/values-night/brave_styles.xml",
"java/res/values-sw600dp/brave_dimens.xml",
"java/res/values-v21/brave_styles.xml",
"java/res/values-xhdpi/brave_dimens.xml",
"java/res/values-xxhdpi/brave_dimens.xml",
"java/res/values/array.xml",
"java/res/values/brave_attrs.xml",
"java/res/values/brave_colors.xml",
"java/res/values/brave_dimens.xml",
"java/res/values/brave_ids.xml",
"java/res/values/brave_styles.xml",
"java/res/values/brave_values.xml",
"java/res/xml/appearance_preferences.xml",
"java/res/xml/background_images_preferences.xml",
"java/res/xml/brave_download_preferences.xml",
Expand Down
8 changes: 0 additions & 8 deletions android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/brave_news/models/FeedItemsCard.java",
"../../brave/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsBottomSheetDialogFragment.java",
"../../brave/android/java/org/chromium/chrome/browser/brave_stats/BraveStatsUtil.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/BraveLayoutManagerChrome.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayout.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/StackLayoutBase.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/stack/OverlappingStack.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/stack/Stack.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackAnimation.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackTab.java",
"../../brave/android/java/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackViewAnimation.java",
"../../brave/android/java/org/chromium/chrome/browser/crypto_wallet/AssetRatioServiceFactory.java",
"../../brave/android/java/org/chromium/chrome/browser/crypto_wallet/BlockchainRegistryFactory.java",
"../../brave/android/java/org/chromium/chrome/browser/crypto_wallet/BraveWalletServiceFactory.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,14 @@
package org.chromium.chrome.browser.tasks.tab_management;

import android.annotation.SuppressLint;
import android.content.Context;

import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.BravePreferenceKeys;
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;

public class BraveTabUiFeatureUtilities {
private static final String TAB_GROUP_AUTO_CREATION_PREFERENCE =
"Chrome.Flags.FieldTrialParamCached.TabGridLayoutAndroid:enable_tab_group_auto_creation";

/**
* @return Whether the Grid Tab Switcher UI is enabled and available for use.
*/
public static boolean isGridTabSwitcherEnabled(Context context) {
if (!isTabGroupsAndroidEnabled(context)) {
return false;
}
return TabUiFeatureUtilities.isGridTabSwitcherEnabled(context);
}

/**
* @return Whether the tab group feature is enabled and available for use.
*/
public static boolean isTabGroupsAndroidEnabled(Context context) {
// For backward compatibility we take value of Tab Grid feature if BRAVE_TAB_GROUPS_ENABLED
// setting hasn't been created. We don't want to rely on Tab Grid feature itself since it
// can be removed in the upstream going forward.
if (!SharedPreferencesManager.getInstance().contains(
BravePreferenceKeys.BRAVE_TAB_GROUPS_ENABLED)) {
SharedPreferencesManager.getInstance().writeBoolean(
BravePreferenceKeys.BRAVE_TAB_GROUPS_ENABLED,
CachedFeatureFlags.isEnabled(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID));
}

if (!SharedPreferencesManager.getInstance().readBoolean(
BravePreferenceKeys.BRAVE_TAB_GROUPS_ENABLED, true)) {
return false;
}

return TabUiFeatureUtilities.isTabGroupsAndroidEnabled(context);
}

@SuppressLint("VisibleForTests")
public static void maybeOverrideEnableTabGroupAutoCreationPreference() {
if (TabUiFeatureUtilities.ENABLE_TAB_GROUP_AUTO_CREATION.getValue()) {
Expand Down
14 changes: 0 additions & 14 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,6 @@
*** getModel(...);
}

-keep class org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromePhone

-keep class org.chromium.chrome.browser.compositor.layouts.BraveLayoutManagerChrome

-keep class org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities {
*** isGridTabSwitcherEnabled(...);
*** isTabGroupsAndroidEnabled(...);
}

-keep class org.chromium.chrome.browser.tasks.tab_management.BraveTabUiFeatureUtilities {
*** isGridTabSwitcherEnabled(...);
*** isTabGroupsAndroidEnabled(...);
}

-keep class org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl {
public <init>(...);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
import org.chromium.chrome.browser.compositor.layouts.Layout;
import org.chromium.chrome.browser.compositor.layouts.LayoutManagerChrome;
import org.chromium.chrome.browser.compositor.layouts.LayoutManagerImpl;
import org.chromium.chrome.browser.compositor.layouts.phone.StackLayout;
import org.chromium.chrome.browser.crypto_wallet.activities.BraveWalletActivity;
import org.chromium.chrome.browser.dependency_injection.ChromeActivityComponent;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
Expand Down Expand Up @@ -1177,13 +1176,6 @@ private void SetUpdatePreferences() {
editor.apply();
}

public void hideOverview(LayoutManagerChrome layoutManager) {
Layout activeLayout = layoutManager.getActiveLayout();
if (activeLayout instanceof StackLayout) {
((StackLayout) activeLayout).commitOutstandingModelState(LayoutManagerImpl.time());
}
}

public ObservableSupplier<BrowserControlsManager> getBrowserControlsManagerSupplier() {
return mBrowserControlsManagerSupplier;
}
Expand Down

This file was deleted.

Loading

0 comments on commit e3abd22

Please sign in to comment.