[fenix] For https://github.com/mozilla-mobile/fenix/issues/19922 Fix the default autoplay setting to be block audio only

pull/600/head
Arturo Mejia 3 years ago
parent 16b1b94fbe
commit ca851a38be

@ -99,9 +99,9 @@ enum class PhoneFeature(val androidPermissionsList: Array<String>) : Parcelable
LOCATION -> R.string.pref_key_phone_feature_location LOCATION -> R.string.pref_key_phone_feature_location
MICROPHONE -> R.string.pref_key_phone_feature_microphone MICROPHONE -> R.string.pref_key_phone_feature_microphone
NOTIFICATION -> R.string.pref_key_phone_feature_notification NOTIFICATION -> R.string.pref_key_phone_feature_notification
AUTOPLAY -> R.string.pref_key_browser_feature_autoplay_audible_v1 AUTOPLAY -> R.string.pref_key_browser_feature_autoplay_v2
AUTOPLAY_AUDIBLE -> R.string.pref_key_browser_feature_autoplay_audible_v1 AUTOPLAY_AUDIBLE -> R.string.pref_key_browser_feature_autoplay_audible_v2
AUTOPLAY_INAUDIBLE -> R.string.pref_key_browser_feature_autoplay_inaudible_v1 AUTOPLAY_INAUDIBLE -> R.string.pref_key_browser_feature_autoplay_inaudible_v2
PERSISTENT_STORAGE -> R.string.pref_key_browser_feature_persistent_storage PERSISTENT_STORAGE -> R.string.pref_key_browser_feature_persistent_storage
MEDIA_KEY_SYSTEM_ACCESS -> R.string.pref_key_browser_feature_media_key_system_access MEDIA_KEY_SYSTEM_ACCESS -> R.string.pref_key_browser_feature_media_key_system_access
} }

@ -837,11 +837,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
camera = getSitePermissionsPhoneFeatureAction(PhoneFeature.CAMERA), camera = getSitePermissionsPhoneFeatureAction(PhoneFeature.CAMERA),
autoplayAudible = getSitePermissionsPhoneFeatureAutoplayAction( autoplayAudible = getSitePermissionsPhoneFeatureAutoplayAction(
feature = PhoneFeature.AUTOPLAY_AUDIBLE, feature = PhoneFeature.AUTOPLAY_AUDIBLE,
default = AutoplayAction.ALLOWED default = AutoplayAction.BLOCKED
), ),
autoplayInaudible = getSitePermissionsPhoneFeatureAutoplayAction( autoplayInaudible = getSitePermissionsPhoneFeatureAutoplayAction(
feature = PhoneFeature.AUTOPLAY_INAUDIBLE, feature = PhoneFeature.AUTOPLAY_INAUDIBLE,
default = AutoplayAction.BLOCKED default = AutoplayAction.ALLOWED
), ),
persistentStorage = getSitePermissionsPhoneFeatureAction(PhoneFeature.PERSISTENT_STORAGE), persistentStorage = getSitePermissionsPhoneFeatureAction(PhoneFeature.PERSISTENT_STORAGE),
mediaKeySystemAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS) mediaKeySystemAccess = getSitePermissionsPhoneFeatureAction(PhoneFeature.MEDIA_KEY_SYSTEM_ACCESS)

@ -115,9 +115,9 @@
<string name="pref_key_show_site_exceptions" translatable="false">pref_key_show_site_exceptions</string> <string name="pref_key_show_site_exceptions" translatable="false">pref_key_show_site_exceptions</string>
<string name="pref_key_recommended_settings" translatable="false">pref_key_recommended_settings</string> <string name="pref_key_recommended_settings" translatable="false">pref_key_recommended_settings</string>
<string name="pref_key_custom_settings" translatable="false">pref_key_custom_settings</string> <string name="pref_key_custom_settings" translatable="false">pref_key_custom_settings</string>
<string name="pref_key_browser_feature_autoplay_v1" translatable="false">pref_key_browser_feature_autoplay_v1</string> <string name="pref_key_browser_feature_autoplay_v2" translatable="false">pref_key_browser_feature_autoplay_v2</string>
<string name="pref_key_browser_feature_autoplay_audible_v1" translatable="false">pref_key_browser_feature_autoplay_v1</string> <string name="pref_key_browser_feature_autoplay_audible_v2" translatable="false">pref_key_browser_feature_autoplay_v2</string>
<string name="pref_key_browser_feature_autoplay_inaudible_v1" translatable="false">pref_key_browser_feature_autoplay_inaudible_v1</string> <string name="pref_key_browser_feature_autoplay_inaudible_v2" translatable="false">pref_key_browser_feature_autoplay_inaudible_v2</string>
<string name="pref_key_browser_feature_persistent_storage" translatable="false">pref_key_browser_feature_persistent_storage</string> <string name="pref_key_browser_feature_persistent_storage" translatable="false">pref_key_browser_feature_persistent_storage</string>
<string name="pref_key_browser_feature_media_key_system_access" translatable="false">pref_key_browser_feature_media_key_system_access</string> <string name="pref_key_browser_feature_media_key_system_access" translatable="false">pref_key_browser_feature_media_key_system_access</string>
<string name="pref_key_phone_feature_camera" translatable="false">pref_key_phone_feature_camera</string> <string name="pref_key_phone_feature_camera" translatable="false">pref_key_phone_feature_camera</string>

@ -42,7 +42,7 @@
<androidx.preference.Preference <androidx.preference.Preference
android:icon="@drawable/ic_autoplay" android:icon="@drawable/ic_autoplay"
android:key="@string/pref_key_browser_feature_autoplay_v1" android:key="@string/pref_key_browser_feature_autoplay_v2"
android:title="@string/preference_browser_feature_autoplay" android:title="@string/preference_browser_feature_autoplay"
android:summary="@string/preference_option_phone_feature_ask_to_allow"/> android:summary="@string/preference_option_phone_feature_ask_to_allow"/>

@ -7,7 +7,7 @@
<androidx.preference.Preference <androidx.preference.Preference
android:icon="@drawable/ic_autoplay_enabled" android:icon="@drawable/ic_autoplay_enabled"
android:key="@string/pref_key_browser_feature_autoplay_audible_v1" android:key="@string/pref_key_browser_feature_autoplay_v2"
android:title="@string/preference_browser_feature_autoplay" android:title="@string/preference_browser_feature_autoplay"
android:summary="@string/preference_option_autoplay_blocked3"/> android:summary="@string/preference_option_autoplay_blocked3"/>

@ -74,14 +74,9 @@ class PhoneFeatureTest {
assertEquals(R.string.pref_key_phone_feature_location, PhoneFeature.LOCATION.getPreferenceId()) assertEquals(R.string.pref_key_phone_feature_location, PhoneFeature.LOCATION.getPreferenceId())
assertEquals(R.string.pref_key_phone_feature_microphone, PhoneFeature.MICROPHONE.getPreferenceId()) assertEquals(R.string.pref_key_phone_feature_microphone, PhoneFeature.MICROPHONE.getPreferenceId())
assertEquals(R.string.pref_key_phone_feature_notification, PhoneFeature.NOTIFICATION.getPreferenceId()) assertEquals(R.string.pref_key_phone_feature_notification, PhoneFeature.NOTIFICATION.getPreferenceId())
assertEquals(R.string.pref_key_browser_feature_autoplay_audible_v1, PhoneFeature.AUTOPLAY_AUDIBLE.getPreferenceId()) assertEquals(R.string.pref_key_browser_feature_autoplay_audible_v2, PhoneFeature.AUTOPLAY_AUDIBLE.getPreferenceId())
assertEquals(R.string.pref_key_browser_feature_autoplay_inaudible_v1, PhoneFeature.AUTOPLAY_INAUDIBLE.getPreferenceId()) assertEquals(R.string.pref_key_browser_feature_autoplay_inaudible_v2, PhoneFeature.AUTOPLAY_INAUDIBLE.getPreferenceId())
assertEquals(R.string.pref_key_browser_feature_autoplay_audible_v1, PhoneFeature.AUTOPLAY.getPreferenceId()) assertEquals(R.string.pref_key_browser_feature_autoplay_v2, PhoneFeature.AUTOPLAY.getPreferenceId())
assertEquals(
"pref_key_browser_feature_autoplay_inaudible_v1",
PhoneFeature.AUTOPLAY_INAUDIBLE.getPreferenceKey(testContext)
)
} }
@Test @Test

@ -33,8 +33,8 @@ class SettingsTest {
location = ASK_TO_ALLOW, location = ASK_TO_ALLOW,
microphone = ASK_TO_ALLOW, microphone = ASK_TO_ALLOW,
notification = ASK_TO_ALLOW, notification = ASK_TO_ALLOW,
autoplayAudible = AutoplayAction.ALLOWED, autoplayAudible = AutoplayAction.BLOCKED,
autoplayInaudible = AutoplayAction.BLOCKED, autoplayInaudible = AutoplayAction.ALLOWED,
persistentStorage = ASK_TO_ALLOW, persistentStorage = ASK_TO_ALLOW,
mediaKeySystemAccess = ASK_TO_ALLOW mediaKeySystemAccess = ASK_TO_ALLOW
) )
@ -601,12 +601,12 @@ class SettingsTest {
val settings = Settings(testContext) val settings = Settings(testContext)
assertEquals( assertEquals(
AutoplayAction.ALLOWED, AutoplayAction.BLOCKED,
settings.getSitePermissionsCustomSettingsRules().autoplayAudible settings.getSitePermissionsCustomSettingsRules().autoplayAudible
) )
assertEquals( assertEquals(
AutoplayAction.BLOCKED, AutoplayAction.ALLOWED,
settings.getSitePermissionsCustomSettingsRules().autoplayInaudible settings.getSitePermissionsCustomSettingsRules().autoplayInaudible
) )
} }

Loading…
Cancel
Save