commit d794b4c0915eef7b155575a74416a5c0bff6fb6f parent d46a5580b1dde33842fef9cbd3bcd21e77c1c9c3 Author: Ryan VanderMeulen <rvandermeulen@mozilla.com> Date: Thu, 30 Oct 2025 11:50:56 +0000 Bug 1991789 - Remove unnecessary GetApiVersion checks and NewApi suppressions. r=geckoview-reviewers,gfx-reviewers,jnicol,ohall Differential Revision: https://phabricator.services.mozilla.com/D270353 Diffstat:
8 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp @@ -354,13 +354,6 @@ bool gfxAndroidPlatform::RequiresLinearZoom() { return gfxPlatform::RequiresLinearZoom(); } -bool gfxAndroidPlatform::CheckVariationFontSupport() { - // Don't attempt to use variations on Android API versions up to Marshmallow, - // because the system freetype version is too old and the parent process may - // access it during printing (bug 1845174). - return jni::GetAPIVersion() > 23; -} - class AndroidVsyncSource final : public VsyncSource, public widget::AndroidVsync::Observer { public: diff --git a/gfx/thebes/gfxAndroidPlatform.h b/gfx/thebes/gfxAndroidPlatform.h @@ -40,7 +40,7 @@ class gfxAndroidPlatform final : public gfxPlatform { already_AddRefed<mozilla::gfx::VsyncSource> CreateGlobalHardwareVsyncSource() override; - static bool CheckVariationFontSupport(); + static bool CheckVariationFontSupport() { return true; } // From Android 12, Font API doesn't read XML files only. To handle updated // font, initializing font API causes that it analyzes all font files. So we diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp @@ -3126,10 +3126,10 @@ void gfxPlatform::InitWebGLConfig() { // On android, enable out-of-process WebGL only when GPU process exists. gfxVars::SetAllowWebglOop(allowWebGLOop && gfxConfig::IsEnabled(Feature::GPU_PROCESS)); - // Enable gl::SharedSurface of AndroidHardwareBuffer when API version is 26+ - // and out-of-process WebGL is enabled. + // Enable gl::SharedSurface of AndroidHardwareBuffer when out-of-process + // WebGL is enabled. #ifdef MOZ_WIDGET_ANDROID - if (gfxVars::AllowWebglOop() && jni::GetAPIVersion() >= 26 && + if (gfxVars::AllowWebglOop() && StaticPrefs::webgl_out_of_process_enable_ahardwarebuffer_AtStartup()) { gfxVars::SetUseAHardwareBufferSharedSurfaceWebglOop(true); } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/ServiceAllocator.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/ServiceAllocator.java @@ -4,7 +4,6 @@ package org.mozilla.gecko.process; -import android.annotation.SuppressLint; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -540,7 +539,6 @@ import org.mozilla.gecko.util.XPCOMEventTarget; * @param type The type of service. * @return Integer encapsulating the service ID, or null if no ID is necessary. */ - @SuppressLint("NewApi") // Linter cannot follow our hasQApis() checks private String allocate(@NonNull final GeckoProcessType type) { XPCOMEventTarget.assertOnLauncherThread(); if (!GeckoProcessManager.isContent(type)) { diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java @@ -6,7 +6,6 @@ package org.mozilla.gecko.util; -import android.annotation.SuppressLint; import android.media.MediaCodec; import android.media.MediaCodecInfo; import android.media.MediaCodecInfo.CodecCapabilities; @@ -182,7 +181,6 @@ public final class HardwareCodecCapabilityUtils { return mimeTypes.toArray(new String[0]); } - @SuppressLint("NewApi") private static boolean isHardwareAccelerated( final MediaCodecInfo aCodecInfo, final String[] aHwPrefixes) { // By public API. @@ -351,7 +349,6 @@ public final class HardwareCodecCapabilityUtils { } @WrapForJNI - @SuppressLint("NewApi") public static boolean decodes10Bit(final String aMimeType) { if (Build.VERSION.SDK_INT < 24) { // Be conservative when we cannot get supported profile. @@ -383,7 +380,6 @@ public final class HardwareCodecCapabilityUtils { return false; } - @SuppressLint("NewApi") private static boolean is10BitVP9Profile(final int profile) { if (Build.VERSION.SDK_INT < 24) { // Be conservative when we cannot get supported profile. @@ -402,7 +398,6 @@ public final class HardwareCodecCapabilityUtils { || (profile == MediaCodecInfo.CodecProfileLevel.VP9Profile3HDR10Plus)); } - @SuppressLint("NewApi") private static boolean is10BitHEVCProfile(final int profile) { if (profile == MediaCodecInfo.CodecProfileLevel.HEVCProfileMain10) { return true; @@ -416,7 +411,6 @@ public final class HardwareCodecCapabilityUtils { || (profile == MediaCodecInfo.CodecProfileLevel.HEVCProfileMain10HDR10Plus); } - @SuppressLint("NewApi") private static boolean is10BitAV1Profile(final int profile) { if (Build.VERSION.SDK_INT < 29) { // Be conservative when we cannot get supported profile. diff --git a/widget/android/nsDragService.cpp b/widget/android/nsDragService.cpp @@ -64,10 +64,6 @@ static nsWindow* GetWindow(dom::Document* aDocument) { nsresult nsDragSession::InvokeDragSessionImpl( nsIWidget* aWidget, nsIArray* aTransferableArray, const Maybe<CSSIntRegion>& aRegion, uint32_t aActionType) { - if (jni::GetAPIVersion() < 24) { - return NS_ERROR_NOT_AVAILABLE; - } - uint32_t count = 0; aTransferableArray->GetLength(&count); if (count != 1) { diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp @@ -3518,10 +3518,6 @@ static int32_t GetCursorType(nsCursor aCursor) { } void nsWindow::SetCursor(const Cursor& aCursor) { - if (mozilla::jni::GetAPIVersion() < 24) { - return; - } - // Only change cursor if it's actually been changed if (!mUpdateCursor && mCursor == aCursor) { return; diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp @@ -1678,7 +1678,7 @@ class AndroidMemoryReporter final : public nsIMemoryReporter { NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData, bool aAnonymize) override { - if (!jni::IsAvailable() || jni::GetAPIVersion() < 23) { + if (!jni::IsAvailable()) { return NS_OK; }