Bug 1880777 - Stop hidding the "Install add-on from file" option on Android < 10. r=amejiamarmol,android-reviewers
This reverts "Bug 1868940 - Cannot install an add-on a from local file on Android <10." Differential Revision: https://phabricator.services.mozilla.com/D225493
This commit is contained in:
@@ -761,10 +761,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||
@VisibleForTesting
|
||||
internal fun setupInstallAddonFromFilePreference(settings: Settings) {
|
||||
with(requirePreference<Preference>(R.string.pref_key_install_local_addon)) {
|
||||
// Below Android 10, the OS doesn't seem to recognize
|
||||
// the "application/x-xpinstall" mime type (for XPI files).
|
||||
isVisible =
|
||||
settings.showSecretDebugMenuThisSession && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
isVisible = settings.showSecretDebugMenuThisSession
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.os.Build
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.preference.Preference
|
||||
@@ -100,7 +99,6 @@ class SettingsFragmentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@org.robolectric.annotation.Config(sdk = [Build.VERSION_CODES.Q])
|
||||
fun `Install add-on from file pref is visible if debug menu active and feature is enabled`() = runTestOnMain {
|
||||
val settingsFragment = SettingsFragment()
|
||||
val activity = Robolectric.buildActivity(FragmentActivity::class.java).create().get()
|
||||
@@ -127,29 +125,6 @@ class SettingsFragmentTest {
|
||||
unmockkObject(Config)
|
||||
}
|
||||
|
||||
@Test
|
||||
@org.robolectric.annotation.Config(sdk = [Build.VERSION_CODES.P])
|
||||
fun `Install add-on from file pref is invisible below Android 10`() = runTestOnMain {
|
||||
val settingsFragment = SettingsFragment()
|
||||
val activity = Robolectric.buildActivity(FragmentActivity::class.java).create().get()
|
||||
|
||||
activity.supportFragmentManager.beginTransaction()
|
||||
.add(settingsFragment, "test")
|
||||
.commitNow()
|
||||
|
||||
advanceUntilIdle()
|
||||
|
||||
val preference = settingsFragment.findPreference<Preference>(
|
||||
settingsFragment.getPreferenceKey(R.string.pref_key_install_local_addon),
|
||||
)
|
||||
|
||||
val settings: Settings = mockk(relaxed = true)
|
||||
|
||||
every { settings.showSecretDebugMenuThisSession } returns true
|
||||
settingsFragment.setupInstallAddonFromFilePreference(settings)
|
||||
assertFalse(preference!!.isVisible)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Add-on collection override pref is visible if already configured and feature is enabled`() = runTestOnMain {
|
||||
val settingsFragment = SettingsFragment()
|
||||
|
||||
Reference in New Issue
Block a user