diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /mobile/android/geckoview/src/main/java/org/mozilla/gecko | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz firefox-adbda400be353e676059e335c3c0aaf99e719475.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/geckoview/src/main/java/org/mozilla/gecko')
6 files changed, 48 insertions, 17 deletions
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java index 99be57fc12..3672428a98 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/AndroidGamepadManager.java @@ -159,9 +159,9 @@ public class AndroidGamepadManager { /* package */ static void doStart(final Context context) { ThreadUtils.assertOnUiThread(); if (!sStarted) { + sStarted = true; scanForGamepads(); addDeviceListener(context); - sStarted = true; } } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java index 568fc3a0bb..bcd5762a92 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java @@ -46,7 +46,6 @@ import android.os.Looper; import android.os.PowerManager; import android.os.Vibrator; import android.provider.Settings; -import android.text.TextUtils; import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Display; @@ -1527,20 +1526,6 @@ public class GeckoAppShell { } } - private static String getLanguageTag(final Locale locale) { - final StringBuilder out = new StringBuilder(locale.getLanguage()); - final String country = locale.getCountry(); - final String variant = locale.getVariant(); - if (!TextUtils.isEmpty(country)) { - out.append('-').append(country); - } - if (!TextUtils.isEmpty(variant)) { - out.append('-').append(variant); - } - // e.g. "en", "en-US", or "en-US-POSIX". - return out.toString(); - } - @WrapForJNI public static String[] getDefaultLocales() { // XXX We may have to convert some language codes such as "id" vs "in". diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoDragAndDrop.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoDragAndDrop.java index 9c1473d4e7..d529449d5a 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoDragAndDrop.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoDragAndDrop.java @@ -42,7 +42,11 @@ public class GeckoDragAndDrop { private final Bitmap mBitmap; public DrawDragImage(final Bitmap bitmap) { - mBitmap = bitmap; + if (bitmap != null && bitmap.getWidth() > 0 && bitmap.getHeight() > 0) { + mBitmap = bitmap; + return; + } + mBitmap = null; } @Override diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java index 120098a931..56fd0d9853 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/InputMethods.java @@ -6,11 +6,13 @@ package org.mozilla.gecko; import android.content.Context; +import android.os.Build; import android.provider.Settings.Secure; import android.view.View; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import java.util.Collection; +import java.util.Locale; public final class InputMethods { public static final String METHOD_ANDROID_LATINIME = "com.android.inputmethod.latin/.LatinIME"; @@ -99,6 +101,13 @@ public final class InputMethods { return METHOD_SONY.equals(inputMethod); } + // Workaround for bug 1818268 - Unexpected crash on Galaxy J7 + public static boolean dontOverrideCommitText() { + return Build.VERSION.SDK_INT == 23 + && Build.MANUFACTURER.toLowerCase(Locale.ROOT).equals("samsung") + && Build.MODEL.startsWith("SM-J700F"); + } + // TODO: Replace usages by definition in EditorInfoCompat once available (bug 1385726). public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 0x1000000; } diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java index 1bfab37063..4ab8b10f9f 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java @@ -23,6 +23,7 @@ public final class MediaDrmProxy { private static final String WIDEVINE_KEY_SYSTEM = "com.widevine.alpha"; @WrapForJNI private static final String AAC = "audio/mp4a-latm"; @WrapForJNI private static final String AVC = "video/avc"; + @WrapForJNI private static final String AV1 = "video/av01"; @WrapForJNI private static final String VORBIS = "audio/vorbis"; @WrapForJNI private static final String VP8 = "video/x-vnd.on2.vp8"; @WrapForJNI private static final String VP9 = "video/x-vnd.on2.vp9"; diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/LocaleUtils.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/LocaleUtils.java new file mode 100644 index 0000000000..8e4addc7b0 --- /dev/null +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/LocaleUtils.java @@ -0,0 +1,32 @@ +/* -*- Mode: Java; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- */ +/* vim: set ts=2 et sw=2: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +package org.mozilla.gecko.util; + +import android.text.TextUtils; +import java.util.Locale; + +public class LocaleUtils { + // Locale.getLanguage() may return legacy language code until Java 17 + // https://developer.android.com/reference/java/util/Locale#legacy_language_codes + public static String getLanguageTagForAcceptLanguage(final Locale locale) { + String language = locale.getLanguage(); + if (language.equals("in")) { + language = "id"; + } else if (language.equals("iw")) { + language = "he"; + } else if (language.equals("ji")) { + language = "yi"; + } + final StringBuilder out = new StringBuilder(language); + final String country = locale.getCountry(); + if (!TextUtils.isEmpty(country)) { + out.append('-').append(country); + } + // e.g. "en", "en-US" + return out.toString(); + } +} |