Merge "Skip legacy BackgroundDexOptService unit tests when ART Service is in use." into udc-dev am: b234b657a1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22163313
Change-Id: I83eb4b7462c7f864bc6a62b7afb3f3ae62b5d011
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java
index cbe65f3..68c8abf 100644
--- a/services/core/java/com/android/server/pm/Installer.java
+++ b/services/core/java/com/android/server/pm/Installer.java
@@ -1179,7 +1179,7 @@
// TODO(b/260124949): Remove the legacy dexopt code paths, i.e. this exception and all code
// that may throw it.
public LegacyDexoptDisabledException() {
- super("Invalid call to legacy dexopt installd method while ART Service is in use.");
+ super("Invalid call to legacy dexopt method while ART Service is in use.");
}
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/BackgroundDexOptServiceUnitTest.java b/services/tests/mockingservicestests/src/com/android/server/pm/BackgroundDexOptServiceUnitTest.java
index d5aa7fe..9a7ee4d 100644
--- a/services/tests/mockingservicestests/src/com/android/server/pm/BackgroundDexOptServiceUnitTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/pm/BackgroundDexOptServiceUnitTest.java
@@ -47,6 +47,7 @@
import android.os.HandlerThread;
import android.os.PowerManager;
import android.os.Process;
+import android.os.SystemProperties;
import android.util.Log;
import com.android.internal.util.IndentingPrintWriter;
@@ -56,6 +57,7 @@
import com.android.server.pm.dex.DexoptOptions;
import org.junit.After;
+import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -126,6 +128,10 @@
@Before
public void setUp() throws Exception {
+ // These tests are only applicable to the legacy BackgroundDexOptService and cannot be run
+ // when ART Service is enabled.
+ Assume.assumeFalse(SystemProperties.getBoolean("dalvik.vm.useartservice", false));
+
when(mInjector.getCallingUid()).thenReturn(Process.FIRST_APPLICATION_UID);
when(mInjector.getContext()).thenReturn(mContext);
when(mInjector.getDexOptHelper()).thenReturn(mDexOptHelper);