Closed Bug 1884442 Opened 2 years ago Closed 2 years ago

`browser.translations.automaticallyPopup` should not have a default in GeckoView `GeckoRuntimeSettings`

Categories

(Firefox for Android :: Translations, defect, P1)

defect

Tracking

()

VERIFIED FIXED
126 Branch
Tracking Status
firefox126 --- verified

People

(Reporter: olivia, Assigned: olivia)

References

Details

(Whiteboard: [fxdroid][foundation])

Attachments

(1 file, 1 obsolete file)

When testing in Fenix, closing the app clears browser.translations.automaticallyPopup back to the default. browser.translations.automaticallyPopup should not have a preferred setting in GeckoRuntimeSettings.

Component: Translation → Translations
Product: Firefox → Fenix
Assignee: nobody → ohall
Severity: -- → S3
Priority: -- → P1
Whiteboard: [fxdroid][foundation]

GeckoView should not have a default for browser.translations.automaticallyPopup.

Pushed by ohall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6901b5e67c87 Fix Default Translations Offer Pref in GeckoView r=geckoview-reviewers,calu

Backed out for causing geckoview failures on TranslationsTest

[task 2024-03-11T14:51:25.409Z] 14:51:25     INFO -  03-11 14:51:24.800 D/GeckoViewConsole( 3449): onEvent GeckoView:WebExtension:PortMessageFromApp {"message":{"id":"81a166d8-8994-4da7-bb97-12a9bd584109","args":{"oldPrefs":{"browser.translations.automaticallyPopup":true,"intl.accept_languages":"en-GB,en-US","browser.translations.geckoview.enableAllTestMocks":false,"browser.translations.enable":true,"browser.translations.simulateUnsupportedEngine":false},"newPrefs":{"browser.translations.automaticallyPopup":false,"browser.translations.geckoview.enableAllTestMocks":false}},"type":"SetPrefs"}}
[task 2024-03-11T14:51:25.409Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): Error
[task 2024-03-11T14:51:25.409Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.mozilla.geckoview.GeckoRuntimeSettings.getTranslationsOfferPopup(GeckoRuntimeSettings.java:1465)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.mozilla.geckoview.test.TranslationsTest.testOfferPopup(TranslationsTest.kt:465)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at java.lang.reflect.Method.invoke(Native Method)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
[task 2024-03-11T14:51:25.410Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.junit.rules.Verifier$1.evaluate(Verifier.java:35)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2.lambda$evaluate$0(GeckoSessionTestRule.java:1510)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2.$r8$lambda$eGWMAiU-In-hdc_ISYHPMUhHPKA(GeckoSessionTestRule.java)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2$$ExternalSyntheticLambda1.run(D8$$SyntheticClass)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:1950)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at android.os.Handler.handleCallback(Handler.java:751)
[task 2024-03-11T14:51:25.411Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at android.os.Handler.dispatchMessage(Handler.java:95)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at android.os.Looper.loop(Looper.java:154)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at java.lang.reflect.Method.invoke(Native Method)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.809 E/GeckoSessionTestRule( 3449): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.810 D/GeckoViewConsole( 3449): onEvent GeckoView:WebExtension:PortMessageFromApp {"message":{"id":"4adcfc11-0ea8-40ec-a344-399c83442ee6","args":{"oldPrefs":{"browser.translations.automaticallyPopup":true,"intl.accept_languages":"en-GB,en-US","browser.translations.geckoview.enableAllTestMocks":false,"browser.translations.enable":true,"browser.translations.simulateUnsupportedEngine":false}},"type":"RestorePrefs"}}
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.830 D/GeckoViewContent( 3449): handleEvent: DOMWindowClose
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.832 D/GeckoViewConsole( 3449): onEvent GeckoView:WebExtension:List null
[task 2024-03-11T14:51:25.412Z] 14:51:25     INFO -  03-11 14:51:24.835 I/Gecko   ( 3449): nsWindow[0x7e838d75ad00]::Show 0
[task 2024-03-11T14:51:25.413Z] 14:51:25     INFO -  03-11 14:51:24.835 E/GeckoSessionTestRule( 3449): test_end c5ee677f-bc83-49bd-9e28-2d35f3d0f059 testOfferPopup(org.mozilla.geckoview.test.TranslationsTest)
[task 2024-03-11T14:51:25.413Z] 14:51:25  WARNING -  TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.test.TranslationsTest#testOfferPopup | java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
[task 2024-03-11T14:51:25.413Z] 14:51:25     INFO -  TEST-INFO took 819ms
Flags: needinfo?(ohall)

I'm investigating something, this may be a bigger issue than I originally thought! I'll re-land or revise, probably in 126. Thanks, and appologies for not catching the failure before landing!

Flags: needinfo?(ohall)

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:olivia, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(ohall)
Flags: needinfo?(calu)

Updated to "Plan Changes"! This issue appears deeper than it originally looked.

Flags: needinfo?(ohall)
Flags: needinfo?(calu)
Attachment #9390280 - Attachment is obsolete: true

This patch fixes an issue where the Gecko pref browser.translations.automaticallyPopup
was not persisting in Android. The issue was it was being overwritten back to the
default of true. This patch stores the persistence in the Fenix layer and
ensures the right value is kept after user interaction.

Pushed by ohall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2540d7ed9536 Android preference to offer a translation persistence r=android-reviewers,giorga

Please check that when setting "offer to translate" that the value remains the same as the selected option after a hard close and reopening of the app.

(In the original bug, it was always reverting back to "on" or "true" during a hard close and reopening.)

Flags: qe-verify+
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch

Verified as fixed on the latest Fenix Nightly 126.0a1 build from 4/4 with the following devices: Xiaomi Mi8 Lite (Android 10), Google Pixel 6 (Android 14), and Realme C35 (Android 12).
When disabling the "Always offer to translate" toggle (set to OFF), the value remains the same as the selected option after a hard close and reopening of the app.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
See Also: → 1888979
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: