2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

[fenix] Target Android 11

This commit is contained in:
Arturo Mejia 2021-02-03 16:24:53 -05:00
parent 507b4aaf8b
commit 59b50be098
15 changed files with 47 additions and 40 deletions

View File

@ -58,8 +58,7 @@ android {
def deepLinkSchemeValue = "fenix-dev" def deepLinkSchemeValue = "fenix-dev"
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\"" buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
manifestPlaceholders = [ manifestPlaceholders = [
"deepLinkScheme": deepLinkSchemeValue, "deepLinkScheme": deepLinkSchemeValue
"requestLegacyExternalStorage": true
] ]
// Build flag for "Mozilla Online" variants. See `Config.isMozillaOnline`. // Build flag for "Mozilla Online" variants. See `Config.isMozillaOnline`.
@ -94,19 +93,13 @@ android {
applicationIdSuffix ".fenix.debug" applicationIdSuffix ".fenix.debug"
resValue "bool", "IS_DEBUG", "true" resValue "bool", "IS_DEBUG", "true"
pseudoLocalesEnabled true pseudoLocalesEnabled true
def deepLinkSchemeValue = "fenix-dev"
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
manifestPlaceholders = [
"deepLinkScheme": deepLinkSchemeValue,
"requestLegacyExternalStorage": false
]
} }
nightly releaseTemplate >> { nightly releaseTemplate >> {
applicationIdSuffix ".fenix" applicationIdSuffix ".fenix"
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
def deepLinkSchemeValue = "fenix-nightly" def deepLinkSchemeValue = "fenix-nightly"
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\"" buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue, "requestLegacyExternalStorage": false] manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue]
} }
beta releaseTemplate >> { beta releaseTemplate >> {
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
@ -122,8 +115,7 @@ android {
// - https://issuetracker.google.com/issues/36924841 // - https://issuetracker.google.com/issues/36924841
// - https://issuetracker.google.com/issues/36905922 // - https://issuetracker.google.com/issues/36905922
"sharedUserId": "org.mozilla.firefox.sharedID", "sharedUserId": "org.mozilla.firefox.sharedID",
"deepLinkScheme": deepLinkSchemeValue, "deepLinkScheme": deepLinkSchemeValue
"requestLegacyExternalStorage": true
] ]
} }
release releaseTemplate >> { release releaseTemplate >> {
@ -140,8 +132,7 @@ android {
// - https://issuetracker.google.com/issues/36924841 // - https://issuetracker.google.com/issues/36924841
// - https://issuetracker.google.com/issues/36905922 // - https://issuetracker.google.com/issues/36905922
"sharedUserId": "org.mozilla.firefox.sharedID", "sharedUserId": "org.mozilla.firefox.sharedID",
"deepLinkScheme": deepLinkSchemeValue, "deepLinkScheme": deepLinkSchemeValue
"requestLegacyExternalStorage": true
] ]
} }
} }

View File

@ -23,7 +23,6 @@
android:allowBackup="false" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:requestLegacyExternalStorage="${requestLegacyExternalStorage}"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/NormalTheme" android:theme="@style/NormalTheme"

View File

@ -17,6 +17,8 @@ import mozilla.components.concept.base.crash.Breadcrumb
*/ */
fun Activity.enterToImmersiveMode() { fun Activity.enterToImmersiveMode() {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17804
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION

View File

@ -100,6 +100,8 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
super.onStop() super.onStop()
// https://github.com/mozilla-mobile/fenix/issues/14279 // https://github.com/mozilla-mobile/fenix/issues/14279
// Let's reset back to the default behavior after we're done searching // Let's reset back to the default behavior after we're done searching
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17805
@Suppress("DEPRECATION")
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
} }

View File

@ -59,12 +59,12 @@ class PerformanceActivityLifecycleCallbacks(
} }
} }
override fun onActivityStarted(activity: Activity?) {} override fun onActivityStarted(activity: Activity) {}
override fun onActivityStopped(activity: Activity?) {} override fun onActivityStopped(activity: Activity) {}
override fun onActivityResumed(activity: Activity?) {} override fun onActivityResumed(activity: Activity) {}
override fun onActivityPaused(activity: Activity?) {} override fun onActivityPaused(activity: Activity) {}
override fun onActivitySaveInstanceState(activity: Activity?, bundle: Bundle?) {} override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {}
override fun onActivityDestroyed(activity: Activity?) {} override fun onActivityDestroyed(activity: Activity) {}
companion object { companion object {
/** /**

View File

@ -44,23 +44,23 @@ class VisibilityLifecycleCallback(private val activityManager: ActivityManager?)
return false return false
} }
override fun onActivityStarted(activity: Activity?) { override fun onActivityStarted(activity: Activity) {
activitiesInStartedState++ activitiesInStartedState++
} }
override fun onActivityStopped(activity: Activity?) { override fun onActivityStopped(activity: Activity) {
activitiesInStartedState-- activitiesInStartedState--
} }
override fun onActivityResumed(activity: Activity?) {} override fun onActivityResumed(activity: Activity) {}
override fun onActivityPaused(activity: Activity?) {} override fun onActivityPaused(activity: Activity) {}
override fun onActivityCreated(activity: Activity?, bundle: Bundle?) {} override fun onActivityCreated(activity: Activity, bundle: Bundle?) {}
override fun onActivitySaveInstanceState(activity: Activity?, bundle: Bundle?) {} override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {}
override fun onActivityDestroyed(activity: Activity?) {} override fun onActivityDestroyed(activity: Activity) {}
companion object { companion object {
/** /**

View File

@ -130,11 +130,11 @@ class SitePermissionsDetailsExceptionsFragment : PreferenceFragmentCompat() {
AlertDialog.Builder(requireContext()).apply { AlertDialog.Builder(requireContext()).apply {
setMessage(R.string.confirm_clear_permissions_site) setMessage(R.string.confirm_clear_permissions_site)
setTitle(R.string.clear_permissions) setTitle(R.string.clear_permissions)
setPositiveButton(android.R.string.yes) { dialog: DialogInterface, _ -> setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _ ->
clearSitePermissions() clearSitePermissions()
dialog.dismiss() dialog.dismiss()
} }
setNegativeButton(android.R.string.no) { dialog: DialogInterface, _ -> setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _ ->
dialog.cancel() dialog.cancel()
} }
}.show() }.show()

View File

@ -95,11 +95,11 @@ class SitePermissionsExceptionsFragment :
AlertDialog.Builder(requireContext()).apply { AlertDialog.Builder(requireContext()).apply {
setMessage(R.string.confirm_clear_permissions_on_all_sites) setMessage(R.string.confirm_clear_permissions_on_all_sites)
setTitle(R.string.clear_permissions) setTitle(R.string.clear_permissions)
setPositiveButton(android.R.string.yes) { dialog: DialogInterface, _ -> setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _ ->
deleteAllSitePermissions() deleteAllSitePermissions()
dialog.dismiss() dialog.dismiss()
} }
setNegativeButton(android.R.string.no) { dialog: DialogInterface, _ -> setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _ ->
dialog.cancel() dialog.cancel()
} }
}.show() }.show()

View File

@ -159,11 +159,11 @@ class SitePermissionsManageExceptionsPhoneFeatureFragment : Fragment() {
AlertDialog.Builder(requireContext()).apply { AlertDialog.Builder(requireContext()).apply {
setMessage(R.string.confirm_clear_permission_site) setMessage(R.string.confirm_clear_permission_site)
setTitle(R.string.clear_permission) setTitle(R.string.clear_permission)
setPositiveButton(android.R.string.yes) { dialog: DialogInterface, _ -> setPositiveButton(android.R.string.ok) { dialog: DialogInterface, _ ->
clearPermissions() clearPermissions()
dialog.dismiss() dialog.dismiss()
} }
setNegativeButton(android.R.string.no) { dialog: DialogInterface, _ -> setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _ ->
dialog.cancel() dialog.cancel()
} }
}.show() }.show()

View File

@ -47,8 +47,8 @@ class ShareViewModel(application: Application) : AndroidViewModel(application) {
@VisibleForTesting @VisibleForTesting
internal val networkCallback = object : ConnectivityManager.NetworkCallback() { internal val networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onLost(network: Network?) = reloadDevices(network) override fun onLost(network: Network) = reloadDevices(network)
override fun onAvailable(network: Network?) = reloadDevices(network) override fun onAvailable(network: Network) = reloadDevices(network)
private fun reloadDevices(network: Network?) { private fun reloadDevices(network: Network?) {
viewModelScope.launch(ioDispatcher) { viewModelScope.launch(ioDispatcher) {

View File

@ -245,12 +245,16 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), UserInteractionHandler
} }
view.tabLayout.setOnApplyWindowInsetsListener { v, insets -> view.tabLayout.setOnApplyWindowInsetsListener { v, insets ->
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17807
@Suppress("DEPRECATION")
v.updatePadding( v.updatePadding(
left = insets.left(), left = insets.left(),
right = insets.right(), right = insets.right(),
bottom = insets.bottom() bottom = insets.bottom()
) )
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17807
@Suppress("DEPRECATION")
tabTrayView.view.tab_wrapper.updatePadding( tabTrayView.view.tab_wrapper.updatePadding(
bottom = insets.bottom() bottom = insets.bottom()
) )

View File

@ -76,7 +76,8 @@ abstract class ThemeManager {
private fun updateLightSystemBars(window: Window, context: Context) { private fun updateLightSystemBars(window: Window, context: Context) {
if (SDK_INT >= Build.VERSION_CODES.M) { if (SDK_INT >= Build.VERSION_CODES.M) {
window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor) window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor)
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_STATUS_BAR window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
} else { } else {
@ -85,6 +86,8 @@ abstract class ThemeManager {
if (SDK_INT >= Build.VERSION_CODES.O) { if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color // API level can display handle light navigation bar color
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility =
window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR window.decorView.systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
updateNavigationBar(window, context) updateNavigationBar(window, context)
@ -93,12 +96,16 @@ abstract class ThemeManager {
private fun clearLightSystemBars(window: Window) { private fun clearLightSystemBars(window: Window) {
if (SDK_INT >= Build.VERSION_CODES.M) { if (SDK_INT >= Build.VERSION_CODES.M) {
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
} }
if (SDK_INT >= Build.VERSION_CODES.O) { if (SDK_INT >= Build.VERSION_CODES.O) {
// API level can display handle light navigation bar color // API level can display handle light navigation bar color
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17808
@Suppress("DEPRECATION")
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and window.decorView.systemUiVisibility = window.decorView.systemUiVisibility and
SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv() SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv()
} }

View File

@ -34,12 +34,12 @@ class WifiConnectionMonitor(app: Application) {
private var isRegistered = false private var isRegistered = false
private val frameworkListener = object : ConnectivityManager.NetworkCallback() { private val frameworkListener = object : ConnectivityManager.NetworkCallback() {
override fun onLost(network: Network?) { override fun onLost(network: Network) {
notifyListeners(false) notifyListeners(false)
lastKnownStateWasAvailable = false lastKnownStateWasAvailable = false
} }
override fun onAvailable(network: Network?) { override fun onAvailable(network: Network) {
notifyListeners(true) notifyListeners(true)
lastKnownStateWasAvailable = true lastKnownStateWasAvailable = true
} }

View File

@ -18,6 +18,8 @@ import org.robolectric.Shadows.shadowOf
@RunWith(FenixRobolectricTestRunner::class) @RunWith(FenixRobolectricTestRunner::class)
class ActivityTest { class ActivityTest {
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17804
@Suppress("DEPRECATION")
@Test @Test
fun testEnterImmersiveMode() { fun testEnterImmersiveMode() {
val activity = Robolectric.buildActivity(Activity::class.java).create().get() val activity = Robolectric.buildActivity(Activity::class.java).create().get()

View File

@ -13,9 +13,9 @@ import java.util.Locale
object Config { object Config {
// Synchronized build configuration for all modules // Synchronized build configuration for all modules
const val compileSdkVersion = 29 const val compileSdkVersion = 30
const val minSdkVersion = 21 const val minSdkVersion = 21
const val targetSdkVersion = 29 const val targetSdkVersion = 30
@JvmStatic @JvmStatic
private fun generateDebugVersionName(): String { private fun generateDebugVersionName(): String {