summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:16:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:16:27 +0000
commitc10c12ce84bcc08d00d37be3f19a8fc23ac535ba (patch)
tree1a07e6b5389c49f68e13bebdf70843884669a31f /mobile/android/geckoview
parentAdding upstream version 127.0.1. (diff)
downloadfirefox-900d52f11297f53a91f131a13a8965d29b5a8c55.tar.xz
firefox-900d52f11297f53a91f131a13a8965d29b5a8c55.zip
Adding upstream version 127.0.2.upstream/127.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/geckoview')
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
index aaf8810bbb..444ee633b6 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/LollipopAsyncCodec.java
@@ -8,6 +8,7 @@ import android.media.MediaCodec;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCrypto;
import android.media.MediaFormat;
+import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -134,7 +135,18 @@ import org.mozilla.gecko.util.HardwareCodecCapabilityUtils;
}
/* package */ LollipopAsyncCodec(final String name) throws IOException {
- mCodec = MediaCodec.createByCodecName(name);
+ // Create the codec.
+ // We wrap the call to MediaCodec.createByCodecName in a pair of
+ // clearCallingIdentity / restoreCallingIdentity, so that the resource
+ // gets attributed to this process and not to whichever process was calling us.
+ // This works around a battery usage attribution bug in Android 14+,
+ // see bug 1902077.
+ final long token = Binder.clearCallingIdentity();
+ try {
+ mCodec = MediaCodec.createByCodecName(name);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
}
@Override