diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index cb40e86f15359..3a2fb6e70ba86 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -2839,14 +2839,6 @@
-
-
diff --git a/services/tests/apexsystemservices/services/Android.bp b/services/tests/apexsystemservices/service/Android.bp
similarity index 94%
rename from services/tests/apexsystemservices/services/Android.bp
rename to services/tests/apexsystemservices/service/Android.bp
index 477ea4cdad37a..9d04f39f2237a 100644
--- a/services/tests/apexsystemservices/services/Android.bp
+++ b/services/tests/apexsystemservices/service/Android.bp
@@ -8,7 +8,7 @@ package {
}
java_library {
- name: "FakeApexSystemServices",
+ name: "FakeApexSystemService",
srcs: ["**/*.java"],
sdk_version: "system_server_current",
libs: [
diff --git a/services/tests/apexsystemservices/services/src/com/android/server/testing/FakeApexSystemService.java b/services/tests/apexsystemservices/service/src/com/android/server/testing/FakeApexSystemService.java
similarity index 100%
rename from services/tests/apexsystemservices/services/src/com/android/server/testing/FakeApexSystemService.java
rename to services/tests/apexsystemservices/service/src/com/android/server/testing/FakeApexSystemService.java
diff --git a/services/tests/apexsystemservices/services/src/com/android/server/testing/FakeApexSystemService2.java b/services/tests/apexsystemservices/services/src/com/android/server/testing/FakeApexSystemService2.java
deleted file mode 100644
index e83343b9c996d..0000000000000
--- a/services/tests/apexsystemservices/services/src/com/android/server/testing/FakeApexSystemService2.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.testing;
-
-import android.content.Context;
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-
-import com.android.server.SystemService;
-
-/**
- * A fake system service that just logs when it is started.
- */
-public class FakeApexSystemService2 extends SystemService {
-
- private static final String TAG = "FakeApexSystemService";
-
- public FakeApexSystemService2(@NonNull Context context) {
- super(context);
- }
-
- @Override
- public void onStart() {
- Log.d(TAG, "FakeApexSystemService2 onStart");
- }
-}
diff --git a/services/tests/apexsystemservices/src/com/android/server/ApexSystemServicesTestCases.java b/services/tests/apexsystemservices/src/com/android/server/ApexSystemServicesTestCases.java
index 10635a138eb96..2b453a9265bb1 100644
--- a/services/tests/apexsystemservices/src/com/android/server/ApexSystemServicesTestCases.java
+++ b/services/tests/apexsystemservices/src/com/android/server/ApexSystemServicesTestCases.java
@@ -37,15 +37,9 @@ import org.junit.rules.RuleChain;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
-import java.util.Objects;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
@RunWith(DeviceJUnit4ClassRunner.class)
public class ApexSystemServicesTestCases extends BaseHostJUnit4Test {
- private static final int REBOOT_TIMEOUT = 1 * 60 * 1000;
-
private final InstallUtilsHost mHostUtils = new InstallUtilsHost(this);
private final TemporaryFolder mTemporaryFolder = new TemporaryFolder();
private final SystemPreparer mPreparer = new SystemPreparer(mTemporaryFolder, this::getDevice);
@@ -73,7 +67,7 @@ public class ApexSystemServicesTestCases extends BaseHostJUnit4Test {
}
@Test
- public void testNoApexSystemServiceStartsWithoutApex() throws Exception {
+ public void noApexSystemServerStartsWithoutApex() throws Exception {
mPreparer.reboot();
assertThat(getFakeApexSystemServiceLogcat())
@@ -81,55 +75,20 @@ public class ApexSystemServicesTestCases extends BaseHostJUnit4Test {
}
@Test
- public void testApexSystemServiceStarts() throws Exception {
+ public void apexSystemServerStarts() throws Exception {
// Pre-install the apex
String apex = "test_com.android.server.apex";
mPreparer.pushResourceFile(apex, "/system/apex/" + apex);
// Reboot activates the apex
mPreparer.reboot();
- mDevice.waitForBootComplete(REBOOT_TIMEOUT);
-
assertThat(getFakeApexSystemServiceLogcat())
.contains("FakeApexSystemService onStart");
}
- @Test
- public void testInitOrder() throws Exception {
- // Pre-install the apex
- String apex = "test_com.android.server.apex";
- mPreparer.pushResourceFile(apex, "/system/apex/" + apex);
- // Reboot activates the apex
- mPreparer.reboot();
-
- mDevice.waitForBootComplete(REBOOT_TIMEOUT);
-
- assertThat(getFakeApexSystemServiceLogcat().lines()
- .map(ApexSystemServicesTestCases::getDebugMessage)
- .filter(Objects::nonNull)
- .collect(Collectors.toList()))
- .containsExactly(
- // Second service has a higher initOrder and must be started first
- "FakeApexSystemService2 onStart",
- "FakeApexSystemService onStart"
- )
- .inOrder();
- }
-
private String getFakeApexSystemServiceLogcat() throws DeviceNotAvailableException {
return mDevice.executeAdbCommand("logcat", "-v", "brief", "-d", "FakeApexSystemService:D",
"*:S");
}
- private static final Pattern DEBUG_MESSAGE =
- Pattern.compile("(FakeApexSystemService[0-9]* onStart)");
-
- private static String getDebugMessage(String logcatLine) {
- return DEBUG_MESSAGE.matcher(logcatLine)
- .results()
- .map(m -> m.group(1))
- .findFirst()
- .orElse(null);
- }
-
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
index 2f5993d1d9895..7f7c716bc1f05 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
@@ -61,7 +61,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.List;
+import java.util.Map;
@SmallTest
@Presubmit
@@ -136,10 +136,9 @@ public class ApexManagerTest {
mApexManager.scanApexPackagesTraced(mPackageParser2,
ParallelPackageParser.makeExecutorService());
- List services = mApexManager.getApexSystemServices();
+ Map services = mApexManager.getApexSystemServices();
assertThat(services).hasSize(1);
- assertThat(services.stream().map(ApexSystemServiceInfo::getName).findFirst().orElse(null))
- .matches("com.android.apex.test.ApexSystemService");
+ assertThat(services).containsKey("com.android.apex.test.ApexSystemService");
}
@Test