diff --git a/build.gradle b/build.gradle index f795a85a0aa9..cb0a04a3ab89 100644 --- a/build.gradle +++ b/build.gradle @@ -125,7 +125,7 @@ allprojects { buildId = getBuildId() buildToolsVersion = mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION - compileSdkVersion = tryInt(mozconfig.substs.ANDROID_COMPILE_SDK) + compileSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK) targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK) minSdkVersion = tryInt(mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION) manifestPlaceholders = [ diff --git a/build/moz.configure/android-sdk.configure b/build/moz.configure/android-sdk.configure index 6df8c78f7790..7607ed2135b8 100644 --- a/build/moz.configure/android-sdk.configure +++ b/build/moz.configure/android-sdk.configure @@ -58,8 +58,7 @@ def android_sdk_version(): # If you think you can't handle the whole set of changes, please reach out to the Release # Engineering team. return namespace( - build_tools_version="35.0.0", - compile_sdk_version="35", + build_tools_version="34.0.0", target_sdk_version="34", min_sdk_version="21", ) @@ -156,4 +155,3 @@ set_config("ANDROID_SDK_ROOT", android_sdk_root) set_config("ANDROID_BUILD_TOOLS_VERSION", android_sdk_version.build_tools_version) set_config("ANDROID_TARGET_SDK", android_sdk_version.target_sdk_version) -set_config("ANDROID_COMPILE_SDK", android_sdk_version.compile_sdk_version) diff --git a/mobile/android/android-components/.config.yml b/mobile/android/android-components/.config.yml index d59aaa2e0d05..045cdf97402f 100644 --- a/mobile/android/android-components/.config.yml +++ b/mobile/android/android-components/.config.yml @@ -3,6 +3,6 @@ componentsGroupId: "org.mozilla.components" # Synchronized build configuration for all modules jvmTargetCompatibility: 17 -compileSdkVersion: 35 +compileSdkVersion: 34 minSdkVersion: 21 targetSdkVersion: 34 diff --git a/mobile/android/android-components/components/browser/engine-system/src/main/java/mozilla/components/browser/engine/system/SystemEngineSession.kt b/mobile/android/android-components/components/browser/engine-system/src/main/java/mozilla/components/browser/engine/system/SystemEngineSession.kt index 1078a678ce0b..aaf2ec16342a 100644 --- a/mobile/android/android-components/components/browser/engine-system/src/main/java/mozilla/components/browser/engine/system/SystemEngineSession.kt +++ b/mobile/android/android-components/components/browser/engine-system/src/main/java/mozilla/components/browser/engine/system/SystemEngineSession.kt @@ -282,6 +282,7 @@ class SystemEngineSession( // Explicitly set global defaults. cacheMode = LOAD_NO_CACHE + databaseEnabled = false setDeprecatedWebSettings(this) @@ -304,8 +305,6 @@ class SystemEngineSession( webSettings.saveFormData = false // Deprecated in API18. webSettings.savePassword = false - // Deprecated in API35; default value is false. - webSettings.databaseEnabled = false } private fun setUseWideViewPort(settings: WebSettings, useWideViewPort: Boolean?) { diff --git a/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/BrowserIcons.kt b/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/BrowserIcons.kt index 1fe889fed3fd..fe44cfc6be1a 100644 --- a/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/BrowserIcons.kt +++ b/mobile/android/android-components/components/browser/icons/src/main/java/mozilla/components/browser/icons/BrowserIcons.kt @@ -341,8 +341,6 @@ class BrowserIcons constructor( sharedMemoryCache.clear() } - @Suppress("DEPRECATION") // Apps are not notified of these levels since API level 34. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=1909473 override fun onTrimMemory(level: Int) { val shouldClearMemoryCache = when (level) { // Foreground: The device is running much lower on memory. The app is running and not killable, but the diff --git a/mobile/android/android-components/components/browser/state/src/main/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddleware.kt b/mobile/android/android-components/components/browser/state/src/main/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddleware.kt index 74f212c42384..23c49d9262b9 100644 --- a/mobile/android/android-components/components/browser/state/src/main/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddleware.kt +++ b/mobile/android/android-components/components/browser/state/src/main/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddleware.kt @@ -77,8 +77,6 @@ internal class TrimMemoryMiddleware : Middleware { } } -@Suppress("DEPRECATION") // Apps are not notified of these levels since API level 34. -// See https://bugzilla.mozilla.org/show_bug.cgi?id=1909473 private fun shouldCloseEngineSessions(level: Int): Boolean { return when (level) { // Foreground: The device is running extremely low on memory. The app is not yet considered a killable diff --git a/mobile/android/android-components/components/browser/state/src/test/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddlewareTest.kt b/mobile/android/android-components/components/browser/state/src/test/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddlewareTest.kt index 271aca41427d..f0ba85d952b5 100644 --- a/mobile/android/android-components/components/browser/state/src/test/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddlewareTest.kt +++ b/mobile/android/android-components/components/browser/state/src/test/java/mozilla/components/browser/state/engine/middleware/TrimMemoryMiddlewareTest.kt @@ -192,8 +192,6 @@ class TrimMemoryMiddlewareTest { @Test fun `TrimMemoryMiddleware - TRIM_MEMORY_RUNNING_CRITICAL`() { - @Suppress("DEPRECATION") // Apps are not notified of these levels since API level 34. - // See https://bugzilla.mozilla.org/show_bug.cgi?id=1909473 store.dispatch( SystemAction.LowMemoryAction( level = ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL, diff --git a/mobile/android/android-components/components/feature/autofill/src/main/java/mozilla/components/feature/autofill/response/dataset/LoginDatasetBuilder.kt b/mobile/android/android-components/components/feature/autofill/src/main/java/mozilla/components/feature/autofill/response/dataset/LoginDatasetBuilder.kt index 4c55c0174adf..24fac38825fc 100644 --- a/mobile/android/android-components/components/feature/autofill/src/main/java/mozilla/components/feature/autofill/response/dataset/LoginDatasetBuilder.kt +++ b/mobile/android/android-components/components/feature/autofill/src/main/java/mozilla/components/feature/autofill/response/dataset/LoginDatasetBuilder.kt @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -@file:Suppress("DEPRECATION") - package mozilla.components.feature.autofill.response.dataset import android.annotation.SuppressLint diff --git a/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeatureTest.kt b/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeatureTest.kt index 607389ccd054..5f4384f2494f 100644 --- a/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeatureTest.kt +++ b/mobile/android/android-components/components/feature/customtabs/src/test/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeatureTest.kt @@ -126,7 +126,6 @@ class CustomTabsToolbarFeatureTest { assertFalse(toolbar.display.onUrlClicked.invoke()) } - @Suppress("DEPRECATION") @Test @Config(sdk = [28]) fun `initialize updates toolbar, window and text color on SDK 28`() { @@ -167,7 +166,6 @@ class CustomTabsToolbarFeatureTest { assertEquals(Color.WHITE, toolbar.display.colors.text) } - @Suppress("DEPRECATION") @Test fun `initialize updates toolbar, window and text color`() { val tab = createCustomTab( diff --git a/mobile/android/android-components/components/service/digitalassetlinks/src/main/java/mozilla/components/service/digitalassetlinks/AndroidAssetFinder.kt b/mobile/android/android-components/components/service/digitalassetlinks/src/main/java/mozilla/components/service/digitalassetlinks/AndroidAssetFinder.kt index cd23691415f3..bd4e497d3489 100644 --- a/mobile/android/android-components/components/service/digitalassetlinks/src/main/java/mozilla/components/service/digitalassetlinks/AndroidAssetFinder.kt +++ b/mobile/android/android-components/components/service/digitalassetlinks/src/main/java/mozilla/components/service/digitalassetlinks/AndroidAssetFinder.kt @@ -68,8 +68,8 @@ class AndroidAssetFinder { private fun PackageManager.getSignatures(packageName: String): Array { val packageInfo = getPackageSignatureInfo(packageName) ?: return emptyArray() - val signatures = if (SDK_INT >= Build.VERSION_CODES.P) { - val signingInfo = packageInfo.signingInfo ?: return emptyArray() + return if (SDK_INT >= Build.VERSION_CODES.P) { + val signingInfo = packageInfo.signingInfo if (signingInfo.hasMultipleSigners()) { signingInfo.apkContentsSigners } else { @@ -82,10 +82,8 @@ class AndroidAssetFinder { } } else { @Suppress("Deprecation") - packageInfo.signatures ?: emptyArray() + packageInfo.signatures } - - return signatures } @SuppressLint("PackageManagerGetSignatures") diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt index d83a2c7b4003..03975201f8c7 100644 --- a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt +++ b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/content/Context.kt @@ -24,7 +24,6 @@ import android.content.pm.PackageManager.PERMISSION_GRANTED import android.hardware.camera2.CameraManager import android.net.Uri import android.os.Build -import android.os.Build.VERSION.SDK_INT import android.os.Process import android.provider.ContactsContract import android.view.accessibility.AccessibilityManager @@ -46,10 +45,10 @@ import java.io.File /** * The (visible) version name of the application, as specified by the tag's versionName - * attribute. E.g. "2.0". Returns an empty string if versionName is null. + * attribute. E.g. "2.0". */ val Context.appVersionName: String - get() = packageManager.getPackageInfoCompat(packageName, 0).versionName ?: "" + get() = packageManager.getPackageInfoCompat(packageName, 0).versionName /** * Returns the name (label) of the application or the package name as a fallback. @@ -333,18 +332,6 @@ inline fun Context.runOnlyInMainProcess(block: () -> Unit) { fun Context.getColorFromAttr(@AttrRes attr: Int) = ContextCompat.getColor(this, theme.resolveAttribute(attr)) -/** - * Returns the color int corresponding to the Android statusBarColor attribute. - */ -@ColorInt -fun Context.getStatusBarColor() = - if (SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { - @Suppress("DEPRECATION") - ContextCompat.getColor(this, theme.resolveAttribute(android.R.attr.statusBarColor)) - } else { - null - } - /** * Returns a tinted drawable for the given resource ID. * @param resId ID of the drawable to load. diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/graphics/Bitmap.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/graphics/Bitmap.kt index e0c81c29aebd..bac132e64e1b 100644 --- a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/graphics/Bitmap.kt +++ b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/graphics/Bitmap.kt @@ -5,7 +5,6 @@ package mozilla.components.support.ktx.android.graphics import android.graphics.Bitmap -import android.graphics.Bitmap.Config import android.graphics.BitmapShader import android.graphics.Canvas import android.graphics.Paint @@ -36,7 +35,7 @@ private const val BITMAP_COMPRESSION_QUALITY = 100 * - Wrap your bitmap's ImageView with a layout that masks your view with rounded corners (e.g. CardView) */ @CheckResult -fun Bitmap.withRoundedCorners(cornerRadiusPx: Float, config: Config): Bitmap { +fun Bitmap.withRoundedCorners(cornerRadiusPx: Float): Bitmap { val roundedBitmap = Bitmap.createBitmap(width, height, config) val canvas = Canvas(roundedBitmap) val paint = Paint().apply { diff --git a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt index faf9c763786d..0e564cf6cf27 100644 --- a/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt +++ b/mobile/android/android-components/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/view/Window.kt @@ -17,7 +17,7 @@ import mozilla.components.support.utils.ColorUtils.isDark */ fun Window.setStatusBarTheme(@ColorInt color: Int) { createWindowInsetsController().isAppearanceLightStatusBars = !isDark(color) - setStatusBarColorCompat(color) + statusBarColor = color } /** @@ -29,10 +29,13 @@ fun Window.setNavigationBarTheme( @ColorInt navBarDividerColor: Int? = null, ) { navBarColor?.let { - setNavigationBarColorCompat(it) + navigationBarColor = it createWindowInsetsController().isAppearanceLightNavigationBars = !isDark(it) } - setNavigationBarDividerColorCompat(navBarDividerColor) + + if (SDK_INT >= Build.VERSION_CODES.P) { + navigationBarDividerColor = navBarDividerColor ?: 0 + } } /** @@ -41,39 +44,3 @@ fun Window.setNavigationBarTheme( fun Window.createWindowInsetsController(): WindowInsetsControllerCompat { return WindowInsetsControllerCompat(this, this.decorView) } - -/** - * Sets the status bar color. - * - * @param color The color to set as the status bar color. - */ -fun Window.setStatusBarColorCompat(@ColorInt color: Int) { - if (SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { - @Suppress("DEPRECATION") - statusBarColor = color - } -} - -/** - * Sets the navigation bar color. - * - * @param color The color to set as the navigation bar color. - */ -fun Window.setNavigationBarColorCompat(@ColorInt color: Int) { - if (SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { - @Suppress("DEPRECATION") - navigationBarColor = color - } -} - -/** - * Sets the navigation bar divider color. - * - * @param color The color to set as the navigation bar divider color. - */ -fun Window.setNavigationBarDividerColorCompat(@ColorInt color: Int?) { - if (SDK_INT >= Build.VERSION_CODES.P && SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) { - @Suppress("DEPRECATION") - navigationBarDividerColor = color ?: 0 - } -} diff --git a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/content/ContextTest.kt b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/content/ContextTest.kt index 66d03d77df76..aa6782f4f5a1 100644 --- a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/content/ContextTest.kt +++ b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/content/ContextTest.kt @@ -18,8 +18,6 @@ import android.content.Intent.EXTRA_SUBJECT import android.content.Intent.EXTRA_TEXT import android.content.Intent.EXTRA_TITLE import android.content.Intent.FLAG_ACTIVITY_NEW_TASK -import android.content.pm.PackageInfo -import android.content.pm.PackageManager import android.content.pm.PackageManager.PERMISSION_GRANTED import android.hardware.camera2.CameraManager import android.net.Uri @@ -29,7 +27,6 @@ import androidx.core.content.getSystemService import androidx.core.net.toUri import androidx.test.ext.junit.runners.AndroidJUnit4 import mozilla.components.support.ktx.R -import mozilla.components.support.test.any import mozilla.components.support.test.argumentCaptor import mozilla.components.support.test.fakes.android.FakeContext import mozilla.components.support.test.mock @@ -42,11 +39,9 @@ import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.mockito.Mockito.anyString import org.mockito.Mockito.doReturn import org.mockito.Mockito.spy import org.mockito.Mockito.verify -import org.mockito.Mockito.`when` import org.robolectric.Robolectric import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config @@ -292,44 +287,6 @@ class ContextTest { whenever(cameraManager.cameraIdList).thenThrow(AssertionError("Test")) assertFalse(context.hasCamera()) } - - @Test - fun `appVersionName returns proper value`() { - val context: Context = mock() - val packageManager: PackageManager = mock() - val packageInfo = PackageInfo().apply { versionName = "1.0.0" } - - `when`(context.packageManager).thenReturn(packageManager) - `when`(context.packageName).thenReturn("org.mozilla.app") - `when`( - packageManager.getPackageInfo( - anyString(), - any(), - ), - ).thenReturn(packageInfo) - - val versionName = context.appVersionName - assertEquals("1.0.0", versionName) - } - - @Test - fun `appVersionName returns empty string when versionName is null`() { - val context: Context = mock() - val packageManager: PackageManager = mock() - val packageInfo = PackageInfo().apply { versionName = null } - - `when`(context.packageManager).thenReturn(packageManager) - `when`(context.packageName).thenReturn("org.mozilla.app") - `when`( - packageManager.getPackageInfo( - anyString(), - any(), - ), - ).thenReturn(packageInfo) - - val versionName = context.appVersionName - assertEquals("", versionName) - } } @Implements(FileProvider::class) diff --git a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/graphics/BitmapKtTest.kt b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/graphics/BitmapKtTest.kt index 7d0d8772283a..acd57c11943a 100644 --- a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/graphics/BitmapKtTest.kt +++ b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/graphics/BitmapKtTest.kt @@ -31,12 +31,11 @@ class BitmapKtTest { fun `WHEN withRoundedCorners is called THEN returned bitmap's corners should be transparent and center with color`() { val dimen = 200 val fillColor = Color.RED - val config = Bitmap.Config.ARGB_8888 - val bitmap = Bitmap.createBitmap(dimen, dimen, config).apply { + val bitmap = Bitmap.createBitmap(dimen, dimen, Bitmap.Config.ARGB_8888).apply { eraseColor(fillColor) } - val roundedBitmap = bitmap.withRoundedCorners(40f, config) + val roundedBitmap = bitmap.withRoundedCorners(40f) fun assertCornersAreTransparent() { val cornerLocations = listOf(0, dimen - 1) diff --git a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/view/WindowTest.kt b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/view/WindowTest.kt index cedeb8595440..24e49b9ce524 100644 --- a/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/view/WindowTest.kt +++ b/mobile/android/android-components/components/support/ktx/src/test/java/mozilla/components/support/ktx/android/view/WindowTest.kt @@ -46,7 +46,6 @@ class WindowTest { @After fun teardown() = setStaticField(Build.VERSION::SDK_INT.javaField, 0) - @Suppress("DEPRECATION") @Test fun `GIVEN a color WHEN setStatusBarTheme THEN sets the status bar color`() { window.setStatusBarTheme(Color.BLUE) @@ -65,7 +64,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 8 & has nav bar color WHEN setNavigationBarTheme THEN only the nav bar color is set`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.O_MR1) window.setNavigationBarTheme(navBarColor = Color.MAGENTA) @@ -87,7 +85,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 8 & all args WHEN setNavigationBarTheme THEN only the nav bar color is set`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.O_MR1) window.setNavigationBarTheme(navBarColor = Color.MAGENTA, navBarDividerColor = Color.DKGRAY) @@ -101,7 +98,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 9 & no args WHEN setNavigationBarTheme THEN the nav bar divider color is set to default`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.P) window.setNavigationBarTheme() @@ -111,7 +107,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 9 has nav bar color WHEN setNavigationBarTheme THEN the nav bar color is set & nav bar divider color set to default`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.P) window.setNavigationBarTheme(navBarColor = Color.BLUE) @@ -121,7 +116,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 9 has nav bar divider color WHEN setNavigationBarTheme THEN only the nav bar divider color is set`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.P) window.setNavigationBarTheme(navBarDividerColor = Color.GREEN) @@ -131,7 +125,6 @@ class WindowTest { } @Test - @Suppress("DEPRECATION") fun `GIVEN Android 9 & all args WHEN setNavigationBarTheme THEN the nav bar & nav bar divider colors are set`() { setStaticField(Build.VERSION::SDK_INT.javaField, Build.VERSION_CODES.P) window.setNavigationBarTheme(navBarColor = Color.YELLOW, navBarDividerColor = Color.CYAN) diff --git a/mobile/android/android-components/docs/changelog.md b/mobile/android/android-components/docs/changelog.md index 56562e3e3677..cb0038d0676c 100644 --- a/mobile/android/android-components/docs/changelog.md +++ b/mobile/android/android-components/docs/changelog.md @@ -5,8 +5,6 @@ permalink: /changelog/ --- # 131.0 (In Development) -* **All components** - * ⚠️Increased `compileSdkVersion` to 35 (Android 15) # 130.0 diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt index 74d87261decf..3ff4b2786493 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/theme/ThemeManager.kt @@ -18,10 +18,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.colorResource import mozilla.components.support.ktx.android.content.getColorFromAttr -import mozilla.components.support.ktx.android.content.getStatusBarColor import mozilla.components.support.ktx.android.view.createWindowInsetsController -import mozilla.components.support.ktx.android.view.setNavigationBarColorCompat -import mozilla.components.support.ktx.android.view.setStatusBarColorCompat import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.browser.browsingmode.BrowsingMode @@ -90,10 +87,10 @@ abstract class ThemeManager( private fun updateLightSystemBars(window: Window, context: Context) { if (SDK_INT >= Build.VERSION_CODES.M) { - context.getStatusBarColor()?.let { window.setStatusBarColorCompat(it) } + window.statusBarColor = context.getColorFromAttr(android.R.attr.statusBarColor) window.createWindowInsetsController().isAppearanceLightStatusBars = true } else { - window.setStatusBarColorCompat(Color.BLACK) + window.statusBarColor = Color.BLACK } if (SDK_INT >= Build.VERSION_CODES.O) { @@ -116,7 +113,7 @@ abstract class ThemeManager( } private fun updateNavigationBar(window: Window, context: Context) { - window.setNavigationBarColorCompat(context.getColorFromAttr(R.attr.layer1)) + window.navigationBarColor = context.getColorFromAttr(R.attr.layer1) } } } diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/wifi/WifiConnectionMonitorTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/wifi/WifiConnectionMonitorTest.kt index f66b90b08765..7ac567d4bd26 100644 --- a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/wifi/WifiConnectionMonitorTest.kt +++ b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/wifi/WifiConnectionMonitorTest.kt @@ -18,7 +18,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mozilla.fenix.helpers.FenixRobolectricTestRunner import org.mozilla.fenix.utils.Settings -import kotlin.collections.removeFirst as removeFirstKt @RunWith(FenixRobolectricTestRunner::class) class WifiConnectionMonitorTest { @@ -180,7 +179,7 @@ class WifiConnectionMonitorTest { wifiConnectionMonitor.addOnWifiConnectedChangedListener { // Altering callbacks while looping. if (wifiConnectionMonitor.callbacks.isNotEmpty()) { - wifiConnectionMonitor.callbacks.removeFirstKt() + wifiConnectionMonitor.callbacks.removeFirst() } } diff --git a/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/SettingsMozillaMenuRobot.kt b/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/SettingsMozillaMenuRobot.kt index 9d1aaf197207..c5ce1748eb8e 100644 --- a/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/SettingsMozillaMenuRobot.kt +++ b/mobile/android/focus-android/app/src/androidTest/java/org/mozilla/focus/activity/robots/SettingsMozillaMenuRobot.kt @@ -42,7 +42,7 @@ class SettingsMozillaMenuRobot { fun verifyVersionNumbers() { val context = InstrumentationRegistry.getInstrumentation().targetContext val packageInfo = context.packageManager.getPackageInfoCompat(context.packageName, 0) - val versionName = packageInfo.versionName ?: "" + val versionName = packageInfo.versionName val gvBuildId = org.mozilla.geckoview.BuildConfig.MOZ_APP_BUILDID val gvVersion = org.mozilla.geckoview.BuildConfig.MOZ_APP_VERSION diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt index 55c17eb09fa1..4a70addc045d 100644 --- a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt +++ b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt @@ -28,11 +28,8 @@ import mozilla.components.feature.search.widget.BaseVoiceSearchActivity import mozilla.components.lib.auth.canUseBiometricFeature import mozilla.components.lib.crash.Crash import mozilla.components.support.base.feature.UserInteractionHandler -import mozilla.components.support.ktx.android.content.getStatusBarColor +import mozilla.components.support.ktx.android.content.getColorFromAttr import mozilla.components.support.ktx.android.view.createWindowInsetsController -import mozilla.components.support.ktx.android.view.setNavigationBarColorCompat -import mozilla.components.support.ktx.android.view.setNavigationBarDividerColorCompat -import mozilla.components.support.ktx.android.view.setStatusBarColorCompat import mozilla.components.support.locale.LocaleAwareAppCompatActivity import mozilla.components.support.utils.SafeIntent import mozilla.components.support.utils.StatusBarUtils @@ -110,7 +107,7 @@ open class MainActivity : LocaleAwareAppCompatActivity() { window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - window.setStatusBarColorCompat(ContextCompat.getColor(this, android.R.color.transparent)) + window.statusBarColor = ContextCompat.getColor(this, android.R.color.transparent) when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) { Configuration.UI_MODE_NIGHT_UNDEFINED, // We assume light here per Android doc's recommendation Configuration.UI_MODE_NIGHT_NO, @@ -396,21 +393,20 @@ open class MainActivity : LocaleAwareAppCompatActivity() { private fun updateLightSystemBars() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - window.context.getStatusBarColor()?.let { window.setStatusBarColorCompat(it) } + window.statusBarColor = getColorFromAttr(android.R.attr.statusBarColor) window.createWindowInsetsController().isAppearanceLightStatusBars = true } else { - window.setStatusBarColorCompat(Color.BLACK) + window.statusBarColor = Color.BLACK } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // API level can display handle light navigation bar color window.createWindowInsetsController().isAppearanceLightNavigationBars = true - window.setNavigationBarColorCompat(ContextCompat.getColor(this, android.R.color.transparent)) + window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - window.setNavigationBarDividerColorCompat( - ContextCompat.getColor(this, android.R.color.transparent), - ) + window.navigationBarDividerColor = + ContextCompat.getColor(this, android.R.color.transparent) } } } diff --git a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/SupportUtils.kt b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/SupportUtils.kt index 897ca52cb9a0..dbaf7d84aae1 100644 --- a/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/SupportUtils.kt +++ b/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/utils/SupportUtils.kt @@ -85,11 +85,11 @@ object SupportUtils { } /** - * Returns the version name of this package or an empty string if versionName is null. + * Returns the version name of this package. */ fun getAppVersion(context: Context): String { try { - return context.packageManager.getPackageInfoCompat(context.packageName, 0).versionName ?: "" + return context.packageManager.getPackageInfoCompat(context.packageName, 0).versionName } catch (e: PackageManager.NameNotFoundException) { // This should be impossible - we should always be able to get information about ourselves: throw IllegalStateException("Unable find package details for Focus", e) diff --git a/mobile/android/focus-android/app/src/test/java/org/mozilla/focus/utils/SupportUtilsTest.kt b/mobile/android/focus-android/app/src/test/java/org/mozilla/focus/utils/SupportUtilsTest.kt index 4c1aac014828..fe55d8d4f87c 100644 --- a/mobile/android/focus-android/app/src/test/java/org/mozilla/focus/utils/SupportUtilsTest.kt +++ b/mobile/android/focus-android/app/src/test/java/org/mozilla/focus/utils/SupportUtilsTest.kt @@ -4,14 +4,8 @@ package org.mozilla.focus.utils -import android.content.Context -import android.content.pm.PackageInfo -import android.content.pm.PackageManager import org.junit.Assert.assertEquals -import org.junit.Assert.assertThrows import org.junit.Test -import org.mockito.Mockito.mock -import org.mockito.Mockito.`when` import java.util.Locale class SupportUtilsTest { @@ -67,47 +61,4 @@ class SupportUtilsTest { SupportUtils.manifestoURL, ) } - - @Test - fun `appVersionName returns proper value`() { - val context: Context = mock() - val packageManager: PackageManager = mock() - val packageInfo = PackageInfo().apply { versionName = "1.0.0" } - - `when`(context.packageManager).thenReturn(packageManager) - `when`(context.packageName).thenReturn("org.mozilla.focus") - `when`(packageManager.getPackageInfo("org.mozilla.focus", 0)).thenReturn(packageInfo) - - val version = SupportUtils.getAppVersion(context) - assertEquals("1.0.0", version) - } - - @Test - fun `appVersionName returns empty string when versionName is null`() { - val context: Context = mock() - val packageManager: PackageManager = mock() - val packageInfo = PackageInfo().apply { versionName = null } - - `when`(context.packageManager).thenReturn(packageManager) - `when`(context.packageName).thenReturn("org.mozilla.focus") - `when`(packageManager.getPackageInfo("org.mozilla.focus", 0)).thenReturn(packageInfo) - - val version = SupportUtils.getAppVersion(context) - assertEquals("", version) - } - - @Test - fun `appVersionName throws IllegalStateException when package not found`() { - val context: Context = mock() - val packageManager: PackageManager = mock() - - `when`(context.packageManager).thenReturn(packageManager) - `when`(context.packageName).thenReturn("org.mozilla.focus") - `when`(packageManager.getPackageInfo("org.mozilla.focus", 0)) - .thenThrow(PackageManager.NameNotFoundException::class.java) - - assertThrows(IllegalStateException::class.java) { - SupportUtils.getAppVersion(context) - } - } } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md index 70c094be663e..2fdb65595c8c 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md @@ -16,7 +16,6 @@ exclude: true ## v131 - Added [`GeckoDisplay.windowInsetsChanged`][131.1]. - Added [`GeckoView.addWindowInsetsListener`][131.2] and [`GeckoView.removeWindowInsetsListener`][131.3] to allow listening WindowInsets changes of Activity's root window with multiple listeners. -- ⚠️Increased `compileSdkVersion` to 35 (Android 15) [131.1]: {{javadoc_uri}}/GeckoDisplay.html#windowInsetsChanged [131.2]: {{javadoc_uri}}/GeckoView.html#addWindowInsetsListener diff --git a/python/mozboot/mozboot/android-packages.txt b/python/mozboot/mozboot/android-packages.txt index eedd018ab306..a547d5dc2e75 100644 --- a/python/mozboot/mozboot/android-packages.txt +++ b/python/mozboot/mozboot/android-packages.txt @@ -1,4 +1,4 @@ emulator platform-tools -build-tools;35.0.0 -platforms;android-35 +build-tools;34.0.0 +platforms;android-34 diff --git a/testing/web-platform/tests/tools/wpt/android.py b/testing/web-platform/tests/tools/wpt/android.py index e1eef88b6096..1e2d30fb389a 100644 --- a/testing/web-platform/tests/tools/wpt/android.py +++ b/testing/web-platform/tests/tools/wpt/android.py @@ -288,8 +288,8 @@ def install(logger, dest=None, reinstall=False, prompt=True): if new_install: packages = ["platform-tools", - "build-tools;35.0.0", - "platforms;android-35", + "build-tools;34.0.0", + "platforms;android-34", "emulator"] install_android_packages(logger, paths, packages, prompt=prompt)