summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt1
-rw-r--r--core/jni/android_media_AudioFormat.h5
-rw-r--r--keystore/OWNERS3
-rw-r--r--media/java/android/media/AudioFormat.java23
-rw-r--r--media/java/android/media/AudioSystem.java2
-rw-r--r--ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java26
-rw-r--r--services/core/java/com/android/server/pm/ApexManager.java14
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java15
8 files changed, 74 insertions, 15 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index e17d128f2c5e..ce373d0cde38 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -21310,6 +21310,7 @@ package android.media {
field public static final int ENCODING_AAC_XHE = 16; // 0x10
field public static final int ENCODING_AC3 = 5; // 0x5
field public static final int ENCODING_AC4 = 17; // 0x11
+ field @FlaggedApi("android.media.audio.dolby_ac4_level4_encoding_api") public static final int ENCODING_AC4_L4 = 32; // 0x20
field public static final int ENCODING_DEFAULT = 1; // 0x1
field public static final int ENCODING_DOLBY_MAT = 19; // 0x13
field public static final int ENCODING_DOLBY_TRUEHD = 14; // 0xe
diff --git a/core/jni/android_media_AudioFormat.h b/core/jni/android_media_AudioFormat.h
index a9b19062b764..704aef3cd131 100644
--- a/core/jni/android_media_AudioFormat.h
+++ b/core/jni/android_media_AudioFormat.h
@@ -50,6 +50,7 @@
#define ENCODING_DTS_HD_MA 29
#define ENCODING_DTS_UHD_P2 30
#define ENCODING_DSD 31
+#define ENCODING_AC4_L4 32
#define ENCODING_INVALID 0
#define ENCODING_DEFAULT 1
@@ -95,6 +96,8 @@ static inline audio_format_t audioFormatToNative(int audioFormat)
return AUDIO_FORMAT_AAC_XHE;
case ENCODING_AC4:
return AUDIO_FORMAT_AC4;
+ case ENCODING_AC4_L4:
+ return AUDIO_FORMAT_AC4_L4;
case ENCODING_E_AC3_JOC:
return AUDIO_FORMAT_E_AC3_JOC;
case ENCODING_DEFAULT:
@@ -177,6 +180,8 @@ static inline int audioFormatFromNative(audio_format_t nativeFormat)
return ENCODING_AAC_XHE;
case AUDIO_FORMAT_AC4:
return ENCODING_AC4;
+ case AUDIO_FORMAT_AC4_L4:
+ return ENCODING_AC4_L4;
case AUDIO_FORMAT_E_AC3_JOC:
return ENCODING_E_AC3_JOC;
case AUDIO_FORMAT_MAT:
diff --git a/keystore/OWNERS b/keystore/OWNERS
index 689177715711..ea783e7f0c06 100644
--- a/keystore/OWNERS
+++ b/keystore/OWNERS
@@ -1,5 +1,6 @@
# Bug component: 189335
+ascull@google.com
drysdale@google.com
-eranm@google.com
jbires@google.com
+sethmo@google.com
swillden@google.com
diff --git a/media/java/android/media/AudioFormat.java b/media/java/android/media/AudioFormat.java
index c90c44152440..0da8371bc824 100644
--- a/media/java/android/media/AudioFormat.java
+++ b/media/java/android/media/AudioFormat.java
@@ -16,6 +16,9 @@
package android.media;
+import static android.media.audio.Flags.FLAG_DOLBY_AC4_LEVEL4_ENCODING_API;
+
+import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -309,7 +312,7 @@ public final class AudioFormat implements Parcelable {
public static final int ENCODING_AAC_ELD = 15;
/** Audio data format: AAC xHE compressed */
public static final int ENCODING_AAC_XHE = 16;
- /** Audio data format: AC-4 sync frame transport format */
+ /** Audio data format: AC-4 (levels 0-3) sync frame transport format */
public static final int ENCODING_AC4 = 17;
/** Audio data format: E-AC-3-JOC compressed
* E-AC-3-JOC streams can be decoded by downstream devices supporting {@link #ENCODING_E_AC3}.
@@ -375,6 +378,9 @@ public final class AudioFormat implements Parcelable {
public static final int ENCODING_DTS_UHD_P2 = 30;
/** Audio data format: Direct Stream Digital */
public static final int ENCODING_DSD = 31;
+ /** Audio data format: AC-4 level 4 sync frame transport format */
+ @FlaggedApi(FLAG_DOLBY_AC4_LEVEL4_ENCODING_API)
+ public static final int ENCODING_AC4_L4 = 32;
/** @hide */
public static String toLogFriendlyEncoding(int enc) {
@@ -413,6 +419,8 @@ public final class AudioFormat implements Parcelable {
return "ENCODING_AAC_XHE";
case ENCODING_AC4:
return "ENCODING_AC4";
+ case ENCODING_AC4_L4:
+ return "ENCODING_AC4_L4";
case ENCODING_E_AC3_JOC:
return "ENCODING_E_AC3_JOC";
case ENCODING_DOLBY_MAT:
@@ -823,6 +831,7 @@ public final class AudioFormat implements Parcelable {
case ENCODING_AAC_ELD:
case ENCODING_AAC_XHE:
case ENCODING_AC4:
+ case ENCODING_AC4_L4:
case ENCODING_E_AC3_JOC:
case ENCODING_DOLBY_MAT:
case ENCODING_OPUS:
@@ -863,6 +872,7 @@ public final class AudioFormat implements Parcelable {
case ENCODING_AAC_ELD:
case ENCODING_AAC_XHE:
case ENCODING_AC4:
+ case ENCODING_AC4_L4:
case ENCODING_E_AC3_JOC:
case ENCODING_DOLBY_MAT:
case ENCODING_OPUS:
@@ -908,6 +918,7 @@ public final class AudioFormat implements Parcelable {
case ENCODING_AAC_ELD:
case ENCODING_AAC_XHE:
case ENCODING_AC4:
+ case ENCODING_AC4_L4:
case ENCODING_E_AC3_JOC:
case ENCODING_DOLBY_MAT:
case ENCODING_OPUS:
@@ -950,6 +961,7 @@ public final class AudioFormat implements Parcelable {
case ENCODING_AAC_ELD:
case ENCODING_AAC_XHE:
case ENCODING_AC4:
+ case ENCODING_AC4_L4:
case ENCODING_E_AC3_JOC:
case ENCODING_DOLBY_MAT:
case ENCODING_OPUS:
@@ -1238,6 +1250,7 @@ public final class AudioFormat implements Parcelable {
case ENCODING_AAC_ELD:
case ENCODING_AAC_XHE:
case ENCODING_AC4:
+ case ENCODING_AC4_L4:
case ENCODING_E_AC3_JOC:
case ENCODING_DOLBY_MAT:
case ENCODING_OPUS:
@@ -1468,6 +1481,7 @@ public final class AudioFormat implements Parcelable {
ENCODING_AAC_ELD,
ENCODING_AAC_XHE,
ENCODING_AC4,
+ ENCODING_AC4_L4,
ENCODING_E_AC3_JOC,
ENCODING_DOLBY_MAT,
ENCODING_OPUS,
@@ -1506,6 +1520,7 @@ public final class AudioFormat implements Parcelable {
ENCODING_AAC_ELD,
ENCODING_AAC_XHE,
ENCODING_AC4,
+ ENCODING_AC4_L4,
ENCODING_E_AC3_JOC,
ENCODING_DOLBY_MAT,
ENCODING_OPUS,
@@ -1533,6 +1548,7 @@ public final class AudioFormat implements Parcelable {
ENCODING_AAC_LC,
ENCODING_DOLBY_TRUEHD,
ENCODING_AC4,
+ ENCODING_AC4_L4,
ENCODING_E_AC3_JOC,
ENCODING_DOLBY_MAT,
ENCODING_MPEGH_BL_L3,
@@ -1554,6 +1570,7 @@ public final class AudioFormat implements Parcelable {
ENCODING_AAC_LC,
ENCODING_DOLBY_TRUEHD,
ENCODING_AC4,
+ ENCODING_AC4_L4,
ENCODING_E_AC3_JOC,
ENCODING_DOLBY_MAT,
ENCODING_MPEGH_BL_L3,
@@ -1592,7 +1609,9 @@ public final class AudioFormat implements Parcelable {
case ENCODING_DOLBY_TRUEHD:
return "Dolby TrueHD";
case ENCODING_AC4:
- return "Dolby AC-4";
+ return "Dolby AC-4 levels 0-3";
+ case ENCODING_AC4_L4:
+ return "Dolby AC-4 level 4";
case ENCODING_E_AC3_JOC:
return "Dolby Atmos in Dolby Digital Plus";
case ENCODING_DOLBY_MAT:
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 2d0e7abbe890..7b8702fd5271 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -542,6 +542,8 @@ public class AudioSystem
return "AUDIO_FORMAT_AAC_LATM_HE_V2"; // (AAC_LATM | AAC_SUB_HE_V2)
case /* AUDIO_FORMAT_E_AC3_JOC */ 0xA000001:
return "AUDIO_FORMAT_E_AC3_JOC"; // (E_AC3 | E_AC3_SUB_JOC)
+ case /* AUDIO_FORMAT_AC4_L4 */ 0x22000001:
+ return "AUDIO_FORMAT_AC4_L4"; // (AC4 | AC4_SUB_L4)
case /* AUDIO_FORMAT_MAT_1_0 */ 0x24000001:
return "AUDIO_FORMAT_MAT_1_0"; // (MAT | MAT_SUB_1_0)
case /* AUDIO_FORMAT_MAT_2_0 */ 0x24000002:
diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
index 805b0c161cb3..4ae5bd1f7b71 100644
--- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
+++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java
@@ -21,6 +21,8 @@ import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_RESOUR
import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING;
import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERSION_JAVA_SYSPROP;
+import static org.junit.Assert.assertThrows;
+
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.app.ResourcesManager;
@@ -167,6 +169,8 @@ public class RavenwoodRuntimeEnvironmentController {
// This will let AndroidJUnit4 use the original runner.
System.setProperty("android.junit.runner",
"androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner");
+
+ assertMockitoVersion();
}
/**
@@ -381,6 +385,28 @@ public class RavenwoodRuntimeEnvironmentController {
}
}
+ private static final String MOCKITO_ERROR = "FATAL: Unsupported Mockito detected!"
+ + " Your test or its dependencies use one of the \"mockito-target-*\""
+ + " modules as static library, which is unusable on host side."
+ + " Please switch over to use \"mockito-ravenwood-prebuilt\" as shared library, or"
+ + " as a last resort, set `ravenizer: { strip_mockito: true }` in your test module.";
+
+ /**
+ * Assert the Mockito version at runtime to ensure no incorrect Mockito classes are loaded.
+ */
+ private static void assertMockitoVersion() {
+ // DexMaker should not exist
+ assertThrows(
+ MOCKITO_ERROR,
+ ClassNotFoundException.class,
+ () -> Class.forName("com.android.dx.DexMaker"));
+ // Mockito 2 should not exist
+ assertThrows(
+ MOCKITO_ERROR,
+ ClassNotFoundException.class,
+ () -> Class.forName("org.mockito.Matchers"));
+ }
+
@SuppressWarnings("unused") // Called from native code (ravenwood_sysprop.cpp)
private static void checkSystemPropertyAccess(String key, boolean write) {
boolean result = write ? sProps.isKeyWritable(key) : sProps.isKeyReadable(key);
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index 5d71439e8f46..458b46dab54c 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -592,7 +592,7 @@ public abstract class ApexManager {
return apexSessionInfo;
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
+ return null;
}
}
@@ -607,7 +607,7 @@ public abstract class ApexManager {
return result;
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
+ return new SparseArray<>(0);
}
}
@@ -619,7 +619,9 @@ public abstract class ApexManager {
return apexInfoList;
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
+ throw new PackageManagerException(
+ PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE,
+ "apexd verification failed : " + re.getMessage());
} catch (Exception e) {
throw new PackageManagerException(
PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE,
@@ -633,7 +635,7 @@ public abstract class ApexManager {
return waitForApexService().getStagedApexInfos(params);
} catch (RemoteException re) {
Slog.w(TAG, "Unable to contact apexservice" + re.getMessage());
- throw new RuntimeException(re);
+ return new ApexInfo[0];
} catch (Exception e) {
Slog.w(TAG, "Failed to collect staged apex infos" + e.getMessage());
return new ApexInfo[0];
@@ -646,7 +648,9 @@ public abstract class ApexManager {
waitForApexService().markStagedSessionReady(sessionId);
} catch (RemoteException re) {
Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
+ throw new PackageManagerException(
+ PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE,
+ "Failed to mark apexd session as ready : " + re.getMessage());
} catch (Exception e) {
throw new PackageManagerException(
PackageManager.INSTALL_FAILED_VERIFICATION_FAILURE,
diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java
index d08cdc718a82..769f071e3ddc 100644
--- a/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/pm/ApexManagerTest.java
@@ -265,19 +265,19 @@ public class ApexManagerTest {
}
@Test
- public void testSubmitStagedSession_throwRunTimeException() throws RemoteException {
+ public void testSubmitStagedSession_throwPackageManagerExceptionOnRemoteException()
+ throws RemoteException {
doThrow(RemoteException.class).when(mApexService).submitStagedSession(any(), any());
- assertThrows(RuntimeException.class,
+ assertThrows(PackageManagerException.class,
() -> mApexManager.submitStagedSession(testParamsWithChildren()));
}
@Test
- public void testGetStagedApexInfos_throwRunTimeException() throws RemoteException {
+ public void testGetStagedApexInfos_returnsEmptyOnRemoteException() throws RemoteException {
doThrow(RemoteException.class).when(mApexService).getStagedApexInfos(any());
- assertThrows(RuntimeException.class,
- () -> mApexManager.getStagedApexInfos(testParamsWithChildren()));
+ assertThat(mApexManager.getStagedApexInfos(testParamsWithChildren())).hasLength(0);
}
@Test
@@ -298,10 +298,11 @@ public class ApexManagerTest {
}
@Test
- public void testMarkStagedSessionReady_throwRunTimeException() throws RemoteException {
+ public void testMarkStagedSessionReady_throwPackageManagerExceptionOnRemoteException()
+ throws RemoteException {
doThrow(RemoteException.class).when(mApexService).markStagedSessionReady(anyInt());
- assertThrows(RuntimeException.class,
+ assertThrows(PackageManagerException.class,
() -> mApexManager.markStagedSessionReady(TEST_SESSION_ID));
}