Backed out changeset 7ae3f62621b8 (bug 1790516) for causing gv-junit-fis failures on GeckoInputStreamTest#multipleWriters. CLOSED TREE

This commit is contained in:
Tamas Szentpeteri 2024-09-05 18:40:17 +03:00
parent 8b4e89419f
commit e5d3610c6d
12 changed files with 6 additions and 39 deletions

View File

@ -11,7 +11,6 @@ import android.os.Looper.getMainLooper
import android.os.Message
import android.view.WindowManager
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import kotlinx.coroutines.ExperimentalCoroutinesApi
import mozilla.components.browser.engine.gecko.ext.geckoTrackingProtectionPermission
import mozilla.components.browser.engine.gecko.ext.isExcludedForTrackingProtection
@ -79,7 +78,6 @@ import org.mockito.Mockito.spy
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoInteractions
import org.mozilla.gecko.util.HardwareUtils
import org.mozilla.geckoview.AllowOrDeny
import org.mozilla.geckoview.ContentBlocking
import org.mozilla.geckoview.GeckoResult
@ -135,7 +133,6 @@ class GeckoEngineSessionTest {
private lateinit var scrollDelegate: ArgumentCaptor<GeckoSession.ScrollDelegate>
private lateinit var contentBlockingDelegate: ArgumentCaptor<ContentBlocking.Delegate>
private lateinit var historyDelegate: ArgumentCaptor<GeckoSession.HistoryDelegate>
private var context = InstrumentationRegistry.getInstrumentation().targetContext
@Suppress("DEPRECATION")
// Deprecation will be handled in https://github.com/mozilla-mobile/android-components/issues/8514
@ -170,7 +167,6 @@ class GeckoEngineSessionTest {
geckoSession = mockGeckoSession()
geckoSessionProvider = { geckoSession }
HardwareUtils.init(context)
}
private fun captureDelegates() {

View File

@ -1903,8 +1903,3 @@ sealed class AppLifecycleAction : BrowserAction() {
*/
object PauseAction : AppLifecycleAction()
}
/**
* Toggles the global default for desktop browsing mode.
*/
data object ToggleDesktopMode : BrowserAction()

View File

@ -30,7 +30,6 @@ import mozilla.components.browser.state.action.ShareInternetResourceAction
import mozilla.components.browser.state.action.SystemAction
import mozilla.components.browser.state.action.TabGroupAction
import mozilla.components.browser.state.action.TabListAction
import mozilla.components.browser.state.action.ToggleDesktopMode
import mozilla.components.browser.state.action.TrackingProtectionAction
import mozilla.components.browser.state.action.TranslationsAction
import mozilla.components.browser.state.action.UndoAction
@ -80,7 +79,6 @@ internal object BrowserStateReducer {
is DebugAction -> DebugReducer.reduce(state, action)
is ExtensionsProcessAction -> ExtensionsProcessStateReducer.reduce(state, action)
is AwesomeBarAction -> AwesomeBarStateReducer.reduce(state, action)
is ToggleDesktopMode -> state.copy(desktopMode = !state.desktopMode)
}
}
}

View File

@ -36,7 +36,6 @@ import java.util.Locale
* @property locale The current locale of the app. Will be null when following the system default.
* @property awesomeBarState Holds state for interactions with the [AwesomeBar].
* @property translationEngine Holds translation state that applies to the browser.
* @property desktopMode Whether or not browsing is in desktop mode by default for any newly opened tabs.
*/
data class BrowserState(
val tabs: List<TabSessionState> = emptyList(),
@ -57,5 +56,4 @@ data class BrowserState(
val extensionsProcessDisabled: Boolean = false,
val awesomeBarState: AwesomeBarState = AwesomeBarState(),
val translationEngine: TranslationsBrowserState = TranslationsBrowserState(),
val desktopMode: Boolean = false,
) : State

View File

@ -9,7 +9,6 @@ import mozilla.components.browser.state.action.BrowserAction
import mozilla.components.browser.state.action.InitAction
import mozilla.components.browser.state.action.RestoreCompleteAction
import mozilla.components.browser.state.action.TabListAction
import mozilla.components.browser.state.action.ToggleDesktopMode
import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.createTab
import mozilla.components.lib.state.Middleware
@ -93,13 +92,4 @@ class BrowserStoreTest {
store.dispatch(RestoreCompleteAction).joinBlocking()
assertTrue(store.state.restoreComplete)
}
@Test
fun `ToggleDesktopMode updates state`() {
val store = BrowserStore()
assertFalse(store.state.desktopMode)
store.dispatch(ToggleDesktopMode).joinBlocking()
assertTrue(store.state.desktopMode)
}
}

View File

@ -180,7 +180,6 @@ class TabsUseCases(
initialLoadFlags = flags,
initialAdditionalHeaders = additionalHeaders,
historyMetadata = historyMetadata,
desktopMode = store.state.desktopMode,
)
store.dispatch(TabListAction.AddTabAction(tab, select = selectTab))

View File

@ -10,9 +10,6 @@ permalink: /changelog/
* **All components**
* ⚠Increased `compileSdkVersion` to 35 (Android 15)
* **browser-store**
* Adds `desktopMode` property to the `BrowserStore` to know whether or not browsing is in desktop mode. [Bug 1790516](https://bugzilla.mozilla.org/show_bug.cgi?id=1790516)
# 130.0
* **ui-widgets**

View File

@ -1138,7 +1138,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
components.core.store.dispatch(ContentAction.UpdateDesktopModeAction(tabId, true))
// Reset preference value after opening the tab in desktop mode
settings().openNextTabInDesktopMode = components.core.store.state.desktopMode
settings().openNextTabInDesktopMode = false
}
@VisibleForTesting

View File

@ -99,7 +99,6 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.components.search.SearchMigration
import org.mozilla.fenix.downloads.DownloadService
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.isTablet
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.gecko.GeckoProvider
import org.mozilla.fenix.historymetadata.DefaultHistoryMetadataService
@ -327,7 +326,6 @@ class Core(
search = SearchState(
applicationSearchEngines = applicationSearchEngines,
),
desktopMode = context.isTablet(),
),
middleware = middlewareList + EngineMiddleware.create(
engine,

View File

@ -44,7 +44,6 @@ import org.mozilla.fenix.components.toolbar.ToolbarPosition
import org.mozilla.fenix.components.toolbar.navbar.shouldAddNavigationBar
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.isTablet
import org.mozilla.fenix.nimbus.CookieBannersSection
import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.nimbus.HomeScreenSection
@ -1628,8 +1627,8 @@ class Settings(private val appContext: Context) : PreferencesHolder {
* If set to true, next opened tab from home screen will be opened in desktop mode.
*/
var openNextTabInDesktopMode by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_open_next_tab_desktop_mode_is_tablet),
default = appContext.isTablet(),
appContext.getPreferenceKey(R.string.pref_key_open_next_tab_desktop_mode),
default = false,
)
var signedInFxaAccount by booleanPreference(

View File

@ -359,7 +359,7 @@
<string name="pref_key_return_to_browser" translatable="false">pref_key_return_to_browser</string>
<string name="pref_key_open_next_tab_desktop_mode_is_tablet" translatable="false">pref_key_open_next_tab_desktop_mode_is_tablet</string>
<string name="pref_key_open_next_tab_desktop_mode" translatable="false">pref_key_open_next_tab_desktop_mode</string>
<!-- Pocket -->
<string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string>

View File

@ -16,7 +16,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Collection;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.util.GeckoBundle;
@AnyThread
@ -230,7 +229,7 @@ public final class GeckoSessionSettings implements Parcelable {
/** The user agent mode is mobile device */
public static final int USER_AGENT_MODE_MOBILE = 0;
/** The user agent mode is desktop device */
/** The user agent mobe is desktop device */
public static final int USER_AGENT_MODE_DESKTOP = 1;
/** The user agent mode is VR device */
@ -377,9 +376,7 @@ public final class GeckoSessionSettings implements Parcelable {
mBundle.putBoolean(ALLOW_JAVASCRIPT.name, true);
mBundle.putBoolean(FULL_ACCESSIBILITY_TREE.name, false);
mBundle.putBoolean(IS_EXTENSION_POPUP.name, false);
mBundle.putInt(
USER_AGENT_MODE.name,
GeckoAppShell.isTablet() ? USER_AGENT_MODE_DESKTOP : USER_AGENT_MODE_MOBILE);
mBundle.putInt(USER_AGENT_MODE.name, USER_AGENT_MODE_MOBILE);
mBundle.putString(USER_AGENT_OVERRIDE.name, null);
mBundle.putInt(VIEWPORT_MODE.name, VIEWPORT_MODE_MOBILE);
mBundle.putInt(DISPLAY_MODE.name, DISPLAY_MODE_BROWSER);