Merge "Use consistent helper class for keystore authorization" into main
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index a126c52..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Copyright (C) 2008 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.
-#
-LOCAL_PATH := $(call my-dir)
-
-# TODO: Empty this file after all subdirectories' Android.mk have been
-# converted to Android.bp to avoid using any newly added Android.mk.
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/apex/jobscheduler/OWNERS b/apex/jobscheduler/OWNERS
index 58434f1..22b6489 100644
--- a/apex/jobscheduler/OWNERS
+++ b/apex/jobscheduler/OWNERS
@@ -2,7 +2,6 @@
ctate@google.com
dplotnikov@google.com
jji@google.com
-kwekua@google.com
omakoto@google.com
suprabh@google.com
varunshah@google.com
diff --git a/apex/jobscheduler/framework/java/android/app/job/OWNERS b/apex/jobscheduler/framework/java/android/app/job/OWNERS
index b4a45f5..0b1e559 100644
--- a/apex/jobscheduler/framework/java/android/app/job/OWNERS
+++ b/apex/jobscheduler/framework/java/android/app/job/OWNERS
@@ -4,4 +4,3 @@
omakoto@google.com
ctate@android.com
ctate@google.com
-kwekua@google.com
diff --git a/apex/jobscheduler/service/java/com/android/server/tare/OWNERS b/apex/jobscheduler/service/java/com/android/server/tare/OWNERS
index 96ec75f..b5c568b 100644
--- a/apex/jobscheduler/service/java/com/android/server/tare/OWNERS
+++ b/apex/jobscheduler/service/java/com/android/server/tare/OWNERS
@@ -1,5 +1,4 @@
dplotnikov@google.com
-kwekua@google.com
mwachens@google.com
suprabh@google.com
-yamasani@google.com
\ No newline at end of file
+yamasani@google.com
diff --git a/api/Android.bp b/api/Android.bp
index 76cdf21..65baf78 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -378,6 +378,18 @@
],
}
+soong_config_module_type {
+ name: "non_updatable_exportable_droidstubs",
+ module_type: "droidstubs",
+ config_namespace: "ANDROID",
+ bool_variables: [
+ "release_hidden_api_exportable_stubs",
+ ],
+ properties: [
+ "dists",
+ ],
+}
+
// We resolve dependencies on APIs in modules by depending on a prebuilt of the whole
// platform (sdk_system_current_android). That prebuilt does not include module-lib APIs,
// so use the prebuilt module-lib stubs for modules that export module-lib stubs that the
diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp
index d94890e..65ec4d4 100644
--- a/api/StubLibraries.bp
+++ b/api/StubLibraries.bp
@@ -27,7 +27,12 @@
// These modules provide source files for the stub libraries
/////////////////////////////////////////////////////////////////////
-droidstubs {
+soong_config_module_type_import {
+ from: "frameworks/base/api/Android.bp",
+ module_types: ["non_updatable_exportable_droidstubs"],
+}
+
+non_updatable_exportable_droidstubs {
name: "api-stubs-docs-non-updatable",
defaults: [
"android-non-updatable-stubs-defaults",
@@ -54,15 +59,35 @@
targets: ["sdk"],
dir: "apistubs/android/public/api",
dest: "android-non-updatable.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/public/api",
dest: "android-non-updatable-removed.txt",
- tag: ".removed-api.txt",
},
],
+ soong_config_variables: {
+ release_hidden_api_exportable_stubs: {
+ dists: [
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ ],
+ conditions_default: {
+ dists: [
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ ],
+ },
+ },
+ },
api_surface: "public",
}
@@ -86,7 +111,7 @@
"\\)",
]
-droidstubs {
+non_updatable_exportable_droidstubs {
name: "system-api-stubs-docs-non-updatable",
defaults: [
"android-non-updatable-stubs-defaults",
@@ -114,19 +139,39 @@
targets: ["sdk"],
dir: "apistubs/android/system/api",
dest: "android-non-updatable.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/system/api",
dest: "android-non-updatable-removed.txt",
- tag: ".removed-api.txt",
},
],
+ soong_config_variables: {
+ release_hidden_api_exportable_stubs: {
+ dists: [
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ ],
+ conditions_default: {
+ dists: [
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ ],
+ },
+ },
+ },
api_surface: "system",
}
-droidstubs {
+non_updatable_exportable_droidstubs {
name: "test-api-stubs-docs-non-updatable",
defaults: [
"android-non-updatable-stubs-defaults",
@@ -149,31 +194,61 @@
targets: ["sdk"],
dir: "apistubs/android/test/api",
dest: "android.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/test/api",
dest: "removed.txt",
- tag: ".removed-api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/test/api",
dest: "android-non-updatable.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/test/api",
dest: "android-non-updatable-removed.txt",
- tag: ".removed-api.txt",
},
],
+ soong_config_variables: {
+ release_hidden_api_exportable_stubs: {
+ dists: [
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ ],
+ conditions_default: {
+ dists: [
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ ],
+ },
+ },
+ },
api_surface: "test",
}
-droidstubs {
+non_updatable_exportable_droidstubs {
name: "module-lib-api-stubs-docs-non-updatable",
defaults: [
"android-non-updatable-stubs-defaults",
@@ -201,15 +276,35 @@
targets: ["sdk"],
dir: "apistubs/android/module-lib/api",
dest: "android-non-updatable.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/module-lib/api",
dest: "android-non-updatable-removed.txt",
- tag: ".removed-api.txt",
},
],
+ soong_config_variables: {
+ release_hidden_api_exportable_stubs: {
+ dists: [
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ ],
+ conditions_default: {
+ dists: [
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ ],
+ },
+ },
+ },
api_surface: "module-lib",
}
diff --git a/api/coverage/tools/ExtractFlaggedApis.kt b/api/coverage/tools/ExtractFlaggedApis.kt
index caa1929..d5adfd0 100644
--- a/api/coverage/tools/ExtractFlaggedApis.kt
+++ b/api/coverage/tools/ExtractFlaggedApis.kt
@@ -16,51 +16,69 @@
package android.platform.coverage
+import com.android.tools.metalava.model.ClassItem
+import com.android.tools.metalava.model.MethodItem
import com.android.tools.metalava.model.text.ApiFile
import java.io.File
import java.io.FileWriter
/** Usage: extract-flagged-apis <api text file> <output .pb file> */
fun main(args: Array<String>) {
- var cb = ApiFile.parseApi(listOf(File(args[0])))
- var builder = FlagApiMap.newBuilder()
+ val cb = ApiFile.parseApi(listOf(File(args[0])))
+ val builder = FlagApiMap.newBuilder()
for (pkg in cb.getPackages().packages) {
- var packageName = pkg.qualifiedName()
+ val packageName = pkg.qualifiedName()
pkg.allClasses()
.filter { it.methods().size > 0 }
.forEach {
- for (method in it.methods()) {
- val flagValue =
- method.modifiers
- .findAnnotation("android.annotation.FlaggedApi")
- ?.findAttribute("value")
- ?.value
- ?.value()
- if (flagValue != null && flagValue is String) {
- var api =
- JavaMethod.newBuilder()
- .setPackageName(packageName)
- .setClassName(it.fullName())
- .setMethodName(method.name())
- for (param in method.parameters()) {
- api.addParameters(param.type().toTypeString())
- }
- if (builder.containsFlagToApi(flagValue)) {
- var updatedApis =
- builder
- .getFlagToApiOrThrow(flagValue)
- .toBuilder()
- .addJavaMethods(api)
- .build()
- builder.putFlagToApi(flagValue, updatedApis)
- } else {
- var apis = FlaggedApis.newBuilder().addJavaMethods(api).build()
- builder.putFlagToApi(flagValue, apis)
- }
- }
- }
+ extractFlaggedApisFromClass(it, it.methods(), packageName, builder)
+ extractFlaggedApisFromClass(it, it.constructors(), packageName, builder)
}
}
val flagApiMap = builder.build()
FileWriter(args[1]).use { it.write(flagApiMap.toString()) }
}
+
+fun extractFlaggedApisFromClass(
+ classItem: ClassItem,
+ methods: List<MethodItem>,
+ packageName: String,
+ builder: FlagApiMap.Builder
+) {
+ val classFlag =
+ classItem.modifiers
+ .findAnnotation("android.annotation.FlaggedApi")
+ ?.findAttribute("value")
+ ?.value
+ ?.value() as? String
+ for (method in methods) {
+ val methodFlag =
+ method.modifiers
+ .findAnnotation("android.annotation.FlaggedApi")
+ ?.findAttribute("value")
+ ?.value
+ ?.value() as? String
+ ?: classFlag
+ val api =
+ JavaMethod.newBuilder()
+ .setPackageName(packageName)
+ .setClassName(classItem.fullName())
+ .setMethodName(method.name())
+ for (param in method.parameters()) {
+ api.addParameters(param.type().toTypeString())
+ }
+ if (methodFlag != null) {
+ addFlaggedApi(builder, api, methodFlag)
+ }
+ }
+}
+
+fun addFlaggedApi(builder: FlagApiMap.Builder, api: JavaMethod.Builder, flag: String) {
+ if (builder.containsFlagToApi(flag)) {
+ val updatedApis = builder.getFlagToApiOrThrow(flag).toBuilder().addJavaMethods(api).build()
+ builder.putFlagToApi(flag, updatedApis)
+ } else {
+ val apis = FlaggedApis.newBuilder().addJavaMethods(api).build()
+ builder.putFlagToApi(flag, apis)
+ }
+}
diff --git a/cmds/incident_helper/OWNERS b/cmds/incident_helper/OWNERS
index cede4ea..29f44ab 100644
--- a/cmds/incident_helper/OWNERS
+++ b/cmds/incident_helper/OWNERS
@@ -1,3 +1,2 @@
joeo@google.com
-kwekua@google.com
yanmin@google.com
diff --git a/core/java/android/appwidget/OWNERS b/core/java/android/appwidget/OWNERS
index 554b0de..1910833 100644
--- a/core/java/android/appwidget/OWNERS
+++ b/core/java/android/appwidget/OWNERS
@@ -1,4 +1,5 @@
-pinyaoting@google.com
+fengjial@google.com
sihua@google.com
+pinyaoting@google.com
suprabh@google.com
sunnygoyal@google.com
diff --git a/core/java/android/hardware/devicestate/OWNERS b/core/java/android/hardware/devicestate/OWNERS
new file mode 100644
index 0000000..d9b0e2e
--- /dev/null
+++ b/core/java/android/hardware/devicestate/OWNERS
@@ -0,0 +1 @@
+include /services/core/java/com/android/server/devicestate/OWNERS
diff --git a/core/java/android/net/IVpnManager.aidl b/core/java/android/net/IVpnManager.aidl
index f302378..5149967 100644
--- a/core/java/android/net/IVpnManager.aidl
+++ b/core/java/android/net/IVpnManager.aidl
@@ -60,6 +60,12 @@
LegacyVpnInfo getLegacyVpnInfo(int userId);
boolean updateLockdownVpn();
+ /** Profile store APIs */
+ byte[] getFromVpnProfileStore(String name);
+ boolean putIntoVpnProfileStore(String name, in byte[] blob);
+ boolean removeFromVpnProfileStore(String name);
+ String[] listFromVpnProfileStore(String prefix);
+
/** General system APIs */
VpnConfig getVpnConfig(int userId);
void factoryReset();
diff --git a/core/java/android/net/VpnManager.java b/core/java/android/net/VpnManager.java
index ff47f3f..c50bc56 100644
--- a/core/java/android/net/VpnManager.java
+++ b/core/java/android/net/VpnManager.java
@@ -717,4 +717,81 @@
throw e.rethrowFromSystemServer();
}
}
+
+ /**
+ * Get the vpn profile owned by the calling uid with the given name from the vpn database.
+ *
+ * <p>Note this method should not be used for platform VPN profiles. </p>
+ *
+ * @param name The name of the profile to retrieve.
+ * @return the unstructured blob for the matching vpn profile.
+ * Returns null if no profile with a matching name was found.
+ * @hide
+ */
+ @Nullable
+ public byte[] getFromVpnProfileStore(@NonNull String name) {
+ try {
+ return mService.getFromVpnProfileStore(name);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Put the given vpn profile owned by the calling uid with the given name into the vpn database.
+ * Existing profiles with the same name will be replaced.
+ *
+ * <p>Note this method should not be used for platform VPN profiles.
+ * To update a platform VPN, use provisionVpnProfile() instead. </p>
+ *
+ * @param name The name of the profile to put.
+ * @param blob The profile.
+ * @return true if the profile was successfully added. False otherwise.
+ * @hide
+ */
+ public boolean putIntoVpnProfileStore(@NonNull String name, @NonNull byte[] blob) {
+ try {
+ return mService.putIntoVpnProfileStore(name, blob);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Removes the vpn profile owned by the calling uid with the given name from the vpn database.
+ *
+ * <p>Note this method should not be used for platform VPN profiles.
+ * To remove a platform VPN, use deleteVpnProfile() instead.</p>
+ *
+ * @param name The name of the profile to be removed.
+ * @return true if a profile was removed. False if no profile with a matching name was found.
+ * @hide
+ */
+ public boolean removeFromVpnProfileStore(@NonNull String name) {
+ try {
+ return mService.removeFromVpnProfileStore(name);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Returns a list of the name suffixes of the vpn profiles owned by the calling uid in the vpn
+ * database matching the given prefix, sorted in ascending order.
+ *
+ * <p>Note this method should not be used for platform VPN profiles. </p>
+ *
+ * @param prefix The prefix to match.
+ * @return an array of strings representing the name suffixes stored in the profile database
+ * matching the given prefix. The return value may be empty but never null.
+ * @hide
+ */
+ @NonNull
+ public String[] listFromVpnProfileStore(@NonNull String prefix) {
+ try {
+ return mService.listFromVpnProfileStore(prefix);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 04d6f61..f785cca 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -210,6 +210,7 @@
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public boolean hasSwappedOutPss;
+ // LINT.IfChange
/** @hide */
public static final int HEAP_UNKNOWN = 0;
/** @hide */
@@ -311,6 +312,7 @@
public static final int OTHER_ART_APP = 30;
/** @hide */
public static final int OTHER_ART_BOOT = 31;
+ // LINT.ThenChange(/system/memory/libmeminfo/include/meminfo/androidprocheaps.h)
/** @hide */
public static final int OTHER_DVK_STAT_ART_START = OTHER_ART_APP - NUM_OTHER_STATS;
/** @hide */
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index cbbe785..6dd0a90 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -1247,7 +1247,7 @@
* surface has no buffer or crop, the surface is boundless and only constrained
* by the size of its parent bounds.
*
- * @param session The surface session, must not be null.
+ * @param session The surface session.
* @param name The surface name, must not be null.
* @param w The surface initial width.
* @param h The surface initial height.
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 45bb629..8c6bf79 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -301,6 +301,7 @@
"libdebuggerd_client",
"libutils",
"libbinder",
+ "libbinderdebug",
"libbinder_ndk",
"libui",
"libgraphicsenv",
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index a98f947..3c2dccd 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -16,97 +16,51 @@
#define LOG_TAG "android.os.Debug"
+#include "android_os_Debug.h"
+
+#include <android-base/file.h>
+#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <android-base/strings.h>
#include <assert.h>
+#include <binderdebug/BinderDebug.h>
+#include <bionic/malloc.h>
#include <ctype.h>
+#include <debuggerd/client.h>
+#include <dmabufinfo/dmabuf_sysfs_stats.h>
+#include <dmabufinfo/dmabufinfo.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
+#include <log/log.h>
#include <malloc.h>
+#include <meminfo/androidprocheaps.h>
+#include <meminfo/procmeminfo.h>
+#include <meminfo/sysmeminfo.h>
+#include <memtrack/memtrack.h>
+#include <memunreachable/memunreachable.h>
+#include <nativehelper/JNIPlatformHelp.h>
+#include <nativehelper/ScopedUtfChars.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
+#include <utils/String8.h>
+#include <utils/misc.h>
+#include <vintf/KernelConfigs.h>
#include <iomanip>
#include <string>
#include <vector>
-#include <android-base/logging.h>
-#include <android-base/properties.h>
-#include <bionic/malloc.h>
-#include <debuggerd/client.h>
-#include <log/log.h>
-#include <utils/misc.h>
-#include <utils/String8.h>
-
-#include <nativehelper/JNIPlatformHelp.h>
-#include <nativehelper/ScopedUtfChars.h>
#include "jni.h"
-#include <dmabufinfo/dmabuf_sysfs_stats.h>
-#include <dmabufinfo/dmabufinfo.h>
-#include <meminfo/procmeminfo.h>
-#include <meminfo/sysmeminfo.h>
-#include <memtrack/memtrack.h>
-#include <memunreachable/memunreachable.h>
-#include <android-base/strings.h>
-#include "android_os_Debug.h"
-#include <vintf/KernelConfigs.h>
namespace android
{
-enum {
- HEAP_UNKNOWN,
- HEAP_DALVIK,
- HEAP_NATIVE,
-
- HEAP_DALVIK_OTHER,
- HEAP_STACK,
- HEAP_CURSOR,
- HEAP_ASHMEM,
- HEAP_GL_DEV,
- HEAP_UNKNOWN_DEV,
- HEAP_SO,
- HEAP_JAR,
- HEAP_APK,
- HEAP_TTF,
- HEAP_DEX,
- HEAP_OAT,
- HEAP_ART,
- HEAP_UNKNOWN_MAP,
- HEAP_GRAPHICS,
- HEAP_GL,
- HEAP_OTHER_MEMTRACK,
-
- // Dalvik extra sections (heap).
- HEAP_DALVIK_NORMAL,
- HEAP_DALVIK_LARGE,
- HEAP_DALVIK_ZYGOTE,
- HEAP_DALVIK_NON_MOVING,
-
- // Dalvik other extra sections.
- HEAP_DALVIK_OTHER_LINEARALLOC,
- HEAP_DALVIK_OTHER_ACCOUNTING,
- HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE,
- HEAP_DALVIK_OTHER_APP_CODE_CACHE,
- HEAP_DALVIK_OTHER_COMPILER_METADATA,
- HEAP_DALVIK_OTHER_INDIRECT_REFERENCE_TABLE,
-
- // Boot vdex / app dex / app vdex
- HEAP_DEX_BOOT_VDEX,
- HEAP_DEX_APP_DEX,
- HEAP_DEX_APP_VDEX,
-
- // App art, boot art.
- HEAP_ART_APP,
- HEAP_ART_BOOT,
-
- _NUM_HEAP,
- _NUM_EXCLUSIVE_HEAP = HEAP_OTHER_MEMTRACK+1,
- _NUM_CORE_HEAP = HEAP_NATIVE+1
-};
+using namespace android::meminfo;
struct stat_fields {
jfieldID pss_field;
@@ -146,18 +100,6 @@
static jfieldID otherStats_field;
static jfieldID hasSwappedOutPss_field;
-struct stats_t {
- int pss;
- int swappablePss;
- int rss;
- int privateDirty;
- int sharedDirty;
- int privateClean;
- int sharedClean;
- int swappedOut;
- int swappedOutPss;
-};
-
#define BINDER_STATS "/proc/binder/stats"
static jlong android_os_Debug_getNativeHeapSize(JNIEnv *env, jobject clazz)
@@ -240,190 +182,14 @@
return err;
}
-static bool load_maps(int pid, stats_t* stats, bool* foundSwapPss)
-{
- *foundSwapPss = false;
- uint64_t prev_end = 0;
- int prev_heap = HEAP_UNKNOWN;
-
- std::string smaps_path = base::StringPrintf("/proc/%d/smaps", pid);
- auto vma_scan = [&](const meminfo::Vma& vma) {
- int which_heap = HEAP_UNKNOWN;
- int sub_heap = HEAP_UNKNOWN;
- bool is_swappable = false;
- std::string name;
- if (base::EndsWith(vma.name, " (deleted)")) {
- name = vma.name.substr(0, vma.name.size() - strlen(" (deleted)"));
- } else {
- name = vma.name;
- }
-
- uint32_t namesz = name.size();
- if (base::StartsWith(name, "[heap]")) {
- which_heap = HEAP_NATIVE;
- } else if (base::StartsWith(name, "[anon:libc_malloc]")) {
- which_heap = HEAP_NATIVE;
- } else if (base::StartsWith(name, "[anon:scudo:")) {
- which_heap = HEAP_NATIVE;
- } else if (base::StartsWith(name, "[anon:GWP-ASan")) {
- which_heap = HEAP_NATIVE;
- } else if (base::StartsWith(name, "[stack")) {
- which_heap = HEAP_STACK;
- } else if (base::StartsWith(name, "[anon:stack_and_tls:")) {
- which_heap = HEAP_STACK;
- } else if (base::EndsWith(name, ".so")) {
- which_heap = HEAP_SO;
- is_swappable = true;
- } else if (base::EndsWith(name, ".jar")) {
- which_heap = HEAP_JAR;
- is_swappable = true;
- } else if (base::EndsWith(name, ".apk")) {
- which_heap = HEAP_APK;
- is_swappable = true;
- } else if (base::EndsWith(name, ".ttf")) {
- which_heap = HEAP_TTF;
- is_swappable = true;
- } else if ((base::EndsWith(name, ".odex")) ||
- (namesz > 4 && strstr(name.c_str(), ".dex") != nullptr)) {
- which_heap = HEAP_DEX;
- sub_heap = HEAP_DEX_APP_DEX;
- is_swappable = true;
- } else if (base::EndsWith(name, ".vdex")) {
- which_heap = HEAP_DEX;
- // Handle system@framework@boot and system/framework/boot|apex
- if ((strstr(name.c_str(), "@boot") != nullptr) ||
- (strstr(name.c_str(), "/boot") != nullptr) ||
- (strstr(name.c_str(), "/apex") != nullptr)) {
- sub_heap = HEAP_DEX_BOOT_VDEX;
- } else {
- sub_heap = HEAP_DEX_APP_VDEX;
- }
- is_swappable = true;
- } else if (base::EndsWith(name, ".oat")) {
- which_heap = HEAP_OAT;
- is_swappable = true;
- } else if (base::EndsWith(name, ".art") || base::EndsWith(name, ".art]")) {
- which_heap = HEAP_ART;
- // Handle system@framework@boot* and system/framework/boot|apex*
- if ((strstr(name.c_str(), "@boot") != nullptr) ||
- (strstr(name.c_str(), "/boot") != nullptr) ||
- (strstr(name.c_str(), "/apex") != nullptr)) {
- sub_heap = HEAP_ART_BOOT;
- } else {
- sub_heap = HEAP_ART_APP;
- }
- is_swappable = true;
- } else if (base::StartsWith(name, "/dev/")) {
- which_heap = HEAP_UNKNOWN_DEV;
- if (base::StartsWith(name, "/dev/kgsl-3d0")) {
- which_heap = HEAP_GL_DEV;
- } else if (base::StartsWith(name, "/dev/ashmem/CursorWindow")) {
- which_heap = HEAP_CURSOR;
- } else if (base::StartsWith(name, "/dev/ashmem/jit-zygote-cache")) {
- which_heap = HEAP_DALVIK_OTHER;
- sub_heap = HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE;
- } else if (base::StartsWith(name, "/dev/ashmem")) {
- which_heap = HEAP_ASHMEM;
- }
- } else if (base::StartsWith(name, "/memfd:jit-cache")) {
- which_heap = HEAP_DALVIK_OTHER;
- sub_heap = HEAP_DALVIK_OTHER_APP_CODE_CACHE;
- } else if (base::StartsWith(name, "/memfd:jit-zygote-cache")) {
- which_heap = HEAP_DALVIK_OTHER;
- sub_heap = HEAP_DALVIK_OTHER_ZYGOTE_CODE_CACHE;
- } else if (base::StartsWith(name, "[anon:")) {
- which_heap = HEAP_UNKNOWN;
- if (base::StartsWith(name, "[anon:dalvik-")) {
- which_heap = HEAP_DALVIK_OTHER;
- if (base::StartsWith(name, "[anon:dalvik-LinearAlloc")) {
- sub_heap = HEAP_DALVIK_OTHER_LINEARALLOC;
- } else if (base::StartsWith(name, "[anon:dalvik-alloc space") ||
- base::StartsWith(name, "[anon:dalvik-main space")) {
- // This is the regular Dalvik heap.
- which_heap = HEAP_DALVIK;
- sub_heap = HEAP_DALVIK_NORMAL;
- } else if (base::StartsWith(name,
- "[anon:dalvik-large object space") ||
- base::StartsWith(
- name, "[anon:dalvik-free list large object space")) {
- which_heap = HEAP_DALVIK;
- sub_heap = HEAP_DALVIK_LARGE;
- } else if (base::StartsWith(name, "[anon:dalvik-non moving space")) {
- which_heap = HEAP_DALVIK;
- sub_heap = HEAP_DALVIK_NON_MOVING;
- } else if (base::StartsWith(name, "[anon:dalvik-zygote space")) {
- which_heap = HEAP_DALVIK;
- sub_heap = HEAP_DALVIK_ZYGOTE;
- } else if (base::StartsWith(name, "[anon:dalvik-indirect ref")) {
- sub_heap = HEAP_DALVIK_OTHER_INDIRECT_REFERENCE_TABLE;
- } else if (base::StartsWith(name, "[anon:dalvik-jit-code-cache") ||
- base::StartsWith(name, "[anon:dalvik-data-code-cache")) {
- sub_heap = HEAP_DALVIK_OTHER_APP_CODE_CACHE;
- } else if (base::StartsWith(name, "[anon:dalvik-CompilerMetadata")) {
- sub_heap = HEAP_DALVIK_OTHER_COMPILER_METADATA;
- } else {
- sub_heap = HEAP_DALVIK_OTHER_ACCOUNTING; // Default to accounting.
- }
- }
- } else if (namesz > 0) {
- which_heap = HEAP_UNKNOWN_MAP;
- } else if (vma.start == prev_end && prev_heap == HEAP_SO) {
- // bss section of a shared library
- which_heap = HEAP_SO;
- }
-
- prev_end = vma.end;
- prev_heap = which_heap;
-
- const meminfo::MemUsage& usage = vma.usage;
- if (usage.swap_pss > 0 && *foundSwapPss != true) {
- *foundSwapPss = true;
- }
-
- uint64_t swapable_pss = 0;
- if (is_swappable && (usage.pss > 0)) {
- float sharing_proportion = 0.0;
- if ((usage.shared_clean > 0) || (usage.shared_dirty > 0)) {
- sharing_proportion = (usage.pss - usage.uss) / (usage.shared_clean + usage.shared_dirty);
- }
- swapable_pss = (sharing_proportion * usage.shared_clean) + usage.private_clean;
- }
-
- stats[which_heap].pss += usage.pss;
- stats[which_heap].swappablePss += swapable_pss;
- stats[which_heap].rss += usage.rss;
- stats[which_heap].privateDirty += usage.private_dirty;
- stats[which_heap].sharedDirty += usage.shared_dirty;
- stats[which_heap].privateClean += usage.private_clean;
- stats[which_heap].sharedClean += usage.shared_clean;
- stats[which_heap].swappedOut += usage.swap;
- stats[which_heap].swappedOutPss += usage.swap_pss;
- if (which_heap == HEAP_DALVIK || which_heap == HEAP_DALVIK_OTHER ||
- which_heap == HEAP_DEX || which_heap == HEAP_ART) {
- stats[sub_heap].pss += usage.pss;
- stats[sub_heap].swappablePss += swapable_pss;
- stats[sub_heap].rss += usage.rss;
- stats[sub_heap].privateDirty += usage.private_dirty;
- stats[sub_heap].sharedDirty += usage.shared_dirty;
- stats[sub_heap].privateClean += usage.private_clean;
- stats[sub_heap].sharedClean += usage.shared_clean;
- stats[sub_heap].swappedOut += usage.swap;
- stats[sub_heap].swappedOutPss += usage.swap_pss;
- }
- return true;
- };
-
- return meminfo::ForEachVmaFromFile(smaps_path, vma_scan);
-}
-
static jboolean android_os_Debug_getDirtyPagesPid(JNIEnv *env, jobject clazz,
jint pid, jobject object)
{
bool foundSwapPss;
- stats_t stats[_NUM_HEAP];
+ AndroidHeapStats stats[_NUM_HEAP];
memset(&stats, 0, sizeof(stats));
- if (!load_maps(pid, stats, &foundSwapPss)) {
+ if (!ExtractAndroidHeapStats(pid, stats, &foundSwapPss)) {
return JNI_FALSE;
}
@@ -815,6 +581,15 @@
return false;
}
+ std::string binderState;
+ android::status_t status = android::getBinderTransactions(pid, binderState);
+ if (status == android::OK) {
+ if (!android::base::WriteStringToFd(binderState, fd)) {
+ PLOG(ERROR) << "Failed to dump binder state info for pid: " << pid;
+ }
+ } else {
+ PLOG(ERROR) << "Failed to get binder state info for pid: " << pid << " status: " << status;
+ }
int res = dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd);
if (fdatasync(fd.get()) != 0) {
PLOG(ERROR) << "Failed flushing trace.";
diff --git a/core/proto/OWNERS b/core/proto/OWNERS
index 00d90cc..1a95520 100644
--- a/core/proto/OWNERS
+++ b/core/proto/OWNERS
@@ -11,7 +11,6 @@
# Frameworks
ogunwale@google.com
jjaggi@google.com
-kwekua@google.com
roosa@google.com
per-file package_item_info.proto = file:/PACKAGE_MANAGER_OWNERS
per-file usagestatsservice.proto, usagestatsservice_v2.proto = file:/core/java/android/app/usage/OWNERS
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index d7b5914..9d4b426 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -304,7 +304,7 @@
_ZipEntryRO *zipEntry = reinterpret_cast<_ZipEntryRO*>(entry);
const int32_t error = ExtractEntryToFile(mHandle, &(zipEntry->entry), fd);
if (error) {
- ALOGW("ExtractToMemory failed with %s", ErrorCodeString(error));
+ ALOGW("ExtractToFile failed with %s", ErrorCodeString(error));
return false;
}
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 2018a39..17c4a77 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -2364,12 +2364,16 @@
}
// at the moment no codecs support detachable surface
+ boolean canDetach = GetFlag(() -> android.media.codec.Flags.nullOutputSurfaceSupport());
if (GetFlag(() -> android.media.codec.Flags.nullOutputSurface())) {
// Detached surface flag is only meaningful if surface is null. Otherwise, it is
// ignored.
- if (surface == null && (flags & CONFIGURE_FLAG_DETACHED_SURFACE) != 0) {
+ if (surface == null && (flags & CONFIGURE_FLAG_DETACHED_SURFACE) != 0 && !canDetach) {
throw new IllegalArgumentException("Codec does not support detached surface");
}
+ } else {
+ // don't allow detaching if API is disabled
+ canDetach = false;
}
String[] keys = null;
@@ -2411,6 +2415,14 @@
}
native_configure(keys, values, surface, crypto, descramblerBinder, flags);
+
+ if (canDetach) {
+ // If we were able to configure native codec with a detached surface
+ // we now know that we have a surface.
+ if (surface == null && (flags & CONFIGURE_FLAG_DETACHED_SURFACE) != 0) {
+ mHasSurface = true;
+ }
+ }
}
/**
@@ -2455,12 +2467,19 @@
if (!mHasSurface) {
throw new IllegalStateException("codec was not configured for an output surface");
}
+
// note: we still have a surface in detached mode, so keep mHasSurface
// we also technically allow calling detachOutputSurface multiple times in a row
- throw new IllegalStateException("codec does not support detaching output surface");
- // native_detachSurface();
+
+ if (GetFlag(() -> android.media.codec.Flags.nullOutputSurfaceSupport())) {
+ native_detachOutputSurface();
+ } else {
+ throw new IllegalStateException("codec does not support detaching output surface");
+ }
}
+ private native void native_detachOutputSurface();
+
/**
* Create a persistent input surface that can be used with codecs that normally have an input
* surface, such as video encoders. A persistent input can be reused by subsequent
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 0fc80dd..82561f9 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -389,6 +389,14 @@
return err;
}
+status_t JMediaCodec::detachOutputSurface() {
+ status_t err = mCodec->detachOutputSurface();
+ if (err == OK) {
+ mSurfaceTextureClient.clear();
+ }
+ return err;
+}
+
status_t JMediaCodec::createInputSurface(
sp<IGraphicBufferProducer>* bufferProducer) {
return mCodec->createInputSurface(bufferProducer);
@@ -1798,6 +1806,20 @@
throwExceptionAsNecessary(env, err, codec);
}
+static void android_media_MediaCodec_native_detachOutputSurface(
+ JNIEnv *env,
+ jobject thiz) {
+ sp<JMediaCodec> codec = getMediaCodec(env, thiz);
+
+ if (codec == NULL || codec->initCheck() != OK) {
+ throwExceptionAsNecessary(env, INVALID_OPERATION, codec);
+ return;
+ }
+
+ status_t err = codec->detachOutputSurface();
+ throwExceptionAsNecessary(env, err, codec);
+}
+
sp<PersistentSurface> android_media_MediaCodec_getPersistentInputSurface(
JNIEnv* env, jobject object) {
sp<PersistentSurface> persistentSurface;
@@ -4107,6 +4129,10 @@
"(Landroid/view/Surface;)V",
(void *)android_media_MediaCodec_native_setSurface },
+ { "native_detachOutputSurface",
+ "()V",
+ (void *)android_media_MediaCodec_native_detachOutputSurface },
+
{ "createInputSurface", "()Landroid/view/Surface;",
(void *)android_media_MediaCodec_createInputSurface },
diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h
index abb23f5..c9b6b7f6 100644
--- a/media/jni/android_media_MediaCodec.h
+++ b/media/jni/android_media_MediaCodec.h
@@ -80,6 +80,8 @@
status_t setSurface(
const sp<IGraphicBufferProducer> &surface);
+ status_t detachOutputSurface();
+
status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
status_t setInputSurface(const sp<PersistentSurface> &surface);
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 4b63fbf..55b5e81 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -367,7 +367,7 @@
void ASurfaceTransaction_setVisibility(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl,
- int8_t visibility) {
+ ASurfaceTransactionVisibility visibility) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
@@ -496,7 +496,7 @@
void ASurfaceTransaction_setBufferTransparency(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl,
- int8_t transparency) {
+ ASurfaceTransactionTransparency transparency) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt
index ece8851..79373a5 100644
--- a/nfc/api/system-current.txt
+++ b/nfc/api/system-current.txt
@@ -9,6 +9,7 @@
method @FlaggedApi("android.nfc.enable_nfc_reader_option") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableReaderOption(boolean);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean enableSecureNfc(boolean);
method @FlaggedApi("android.nfc.enable_nfc_mainline") public int getAdapterState();
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @NonNull public android.nfc.NfcOemExtension getNfcOemExtension();
method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public java.util.Map<java.lang.String,java.lang.Boolean> getTagIntentAppPreferenceForUser(int);
method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOn();
method @RequiresPermission(android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON) public boolean isControllerAlwaysOnSupported();
@@ -46,6 +47,16 @@
method @FlaggedApi("android.nfc.nfc_vendor_cmd") public void onVendorNciResponse(@IntRange(from=0, to=15) int, int, @NonNull byte[]);
}
+ @FlaggedApi("android.nfc.nfc_oem_extension") public final class NfcOemExtension {
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void clearPreference();
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.nfc.NfcOemExtension.Callback);
+ method @FlaggedApi("android.nfc.nfc_oem_extension") @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void unregisterCallback(@NonNull android.nfc.NfcOemExtension.Callback);
+ }
+
+ public static interface NfcOemExtension.Callback {
+ method public void onTagConnected(boolean, @NonNull android.nfc.Tag);
+ }
+
}
package android.nfc.cardemulation {
diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl
index 8fea5af..bde63c3 100644
--- a/nfc/java/android/nfc/INfcAdapter.aidl
+++ b/nfc/java/android/nfc/INfcAdapter.aidl
@@ -28,6 +28,7 @@
import android.nfc.INfcTag;
import android.nfc.INfcCardEmulation;
import android.nfc.INfcFCardEmulation;
+import android.nfc.INfcOemExtensionCallback;
import android.nfc.INfcUnlockHandler;
import android.nfc.ITagRemovedCallback;
import android.nfc.INfcDta;
@@ -91,4 +92,7 @@
int sendVendorNciMessage(int mt, int gid, int oid, in byte[] payload);
void registerVendorExtensionCallback(in INfcVendorNciCallback callbacks);
void unregisterVendorExtensionCallback(in INfcVendorNciCallback callbacks);
+ void registerOemExtensionCallback(INfcOemExtensionCallback callbacks);
+ void unregisterOemExtensionCallback(INfcOemExtensionCallback callbacks);
+ void clearPreference();
}
diff --git a/nfc/java/android/nfc/INfcOemExtensionCallback.aidl b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl
new file mode 100644
index 0000000..6c9096d
--- /dev/null
+++ b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2024 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 android.nfc;
+
+import android.nfc.Tag;
+
+/**
+ * @hide
+ */
+interface INfcOemExtensionCallback {
+ void onTagConnected(boolean connected, in Tag tag);
+}
diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java
index 40bbe74..7e0a111 100644
--- a/nfc/java/android/nfc/NfcAdapter.java
+++ b/nfc/java/android/nfc/NfcAdapter.java
@@ -556,6 +556,7 @@
final Context mContext;
final HashMap<NfcUnlockHandler, INfcUnlockHandler> mNfcUnlockHandlers;
final Object mLock;
+ final NfcOemExtension mNfcOemExtension;
ITagRemovedCallback mTagRemovedListener; // protected by mLock
@@ -864,6 +865,7 @@
mLock = new Object();
mControllerAlwaysOnListener = new NfcControllerAlwaysOnListener(getService());
mNfcVendorNciCallbackListener = new NfcVendorNciCallbackListener(getService());
+ mNfcOemExtension = new NfcOemExtension(mContext, this);
}
/**
@@ -2919,4 +2921,19 @@
void onVendorNciNotification(
@IntRange(from = 9, to = 15) int gid, int oid, @NonNull byte[] payload);
}
+
+ /**
+ * Returns an instance of {@link NfcOemExtension} associated with {@link NfcAdapter} instance.
+ * @hide
+ */
+ @SystemApi
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @NonNull public NfcOemExtension getNfcOemExtension() {
+ synchronized (sLock) {
+ if (!sHasNfcFeature) {
+ throw new UnsupportedOperationException();
+ }
+ }
+ return mNfcOemExtension;
+ }
}
diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java
new file mode 100644
index 0000000..1eff58c
--- /dev/null
+++ b/nfc/java/android/nfc/NfcOemExtension.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2024 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 android.nfc;
+
+import android.annotation.CallbackExecutor;
+import android.annotation.FlaggedApi;
+import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
+import android.annotation.SystemApi;
+import android.content.Context;
+import android.os.Binder;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Used for OEM extension APIs.
+ * This class holds all the APIs and callbacks defined for OEMs/vendors to extend the NFC stack
+ * for their proprietary features.
+ *
+ * @hide
+ */
+@FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+@SystemApi
+public final class NfcOemExtension {
+ private static final String TAG = "NfcOemExtension";
+ private static final int OEM_EXTENSION_RESPONSE_THRESHOLD_MS = 2000;
+ private final NfcAdapter mAdapter;
+ private final NfcOemExtensionCallback mOemNfcExtensionCallback;
+ private final Context mContext;
+ private Executor mExecutor = null;
+ private Callback mCallback = null;
+ private final Object mLock = new Object();
+
+ /**
+ * Interface for Oem extensions for NFC.
+ */
+ public interface Callback {
+ /**
+ * Notify Oem to tag is connected or not
+ * ex - if tag is connected notify cover and Nfctest app if app is in testing mode
+ *
+ * @param connected status of the tag true if tag is connected otherwise false
+ * @param tag Tag details
+ */
+ void onTagConnected(boolean connected, @NonNull Tag tag);
+ }
+
+
+ /**
+ * Constructor to be used only by {@link NfcAdapter}.
+ * @hide
+ */
+ public NfcOemExtension(@NonNull Context context, @NonNull NfcAdapter adapter) {
+ mContext = context;
+ mAdapter = adapter;
+ mOemNfcExtensionCallback = new NfcOemExtensionCallback();
+ }
+
+ /**
+ * Register an {@link Callback} to listen for UWB oem extension callbacks
+ * <p>The provided callback will be invoked by the given {@link Executor}.
+ *
+ * @param executor an {@link Executor} to execute given callback
+ * @param callback oem implementation of {@link Callback}
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ public void registerCallback(@NonNull @CallbackExecutor Executor executor,
+ @NonNull Callback callback) {
+ synchronized (mLock) {
+ if (mCallback != null) {
+ Log.e(TAG, "Callback already registered. Unregister existing callback before"
+ + "registering");
+ throw new IllegalArgumentException();
+ }
+ try {
+ NfcAdapter.sService.registerOemExtensionCallback(mOemNfcExtensionCallback);
+ mCallback = callback;
+ mExecutor = executor;
+ } catch (RemoteException e) {
+ mAdapter.attemptDeadServiceRecovery(e);
+ }
+ }
+ }
+
+ /**
+ * Unregister the specified {@link Callback}
+ *
+ * <p>The same {@link Callback} object used when calling
+ * {@link #registerCallback(Executor, Callback)} must be used.
+ *
+ * <p>Callbacks are automatically unregistered when an application process goes away
+ *
+ * @param callback oem implementation of {@link Callback}
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ public void unregisterCallback(@NonNull Callback callback) {
+ synchronized (mLock) {
+ if (mCallback == null || mCallback != callback) {
+ Log.e(TAG, "Callback not registered");
+ throw new IllegalArgumentException();
+ }
+ try {
+ NfcAdapter.sService.unregisterOemExtensionCallback(mOemNfcExtensionCallback);
+ mCallback = null;
+ mExecutor = null;
+ } catch (RemoteException e) {
+ mAdapter.attemptDeadServiceRecovery(e);
+ }
+ }
+ }
+
+ /**
+ * Clear NfcService preference, interface method to clear NFC preference values on OEM specific
+ * events. For ex: on soft reset, Nfc default values needs to be overridden by OEM defaults.
+ */
+ @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
+ @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
+ public void clearPreference() {
+ try {
+ NfcAdapter.sService.clearPreference();
+ } catch (RemoteException e) {
+ mAdapter.attemptDeadServiceRecovery(e);
+ }
+ }
+
+ private final class NfcOemExtensionCallback extends INfcOemExtensionCallback.Stub {
+ @Override
+ public void onTagConnected(boolean connected, Tag tag) throws RemoteException {
+ synchronized (mLock) {
+ if (mCallback == null || mExecutor == null) {
+ return;
+ }
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mExecutor.execute(() -> mCallback.onTagConnected(connected, tag));
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+ }
+ }
+}
diff --git a/nfc/java/android/nfc/flags.aconfig b/nfc/java/android/nfc/flags.aconfig
index 44924ae..5879595 100644
--- a/nfc/java/android/nfc/flags.aconfig
+++ b/nfc/java/android/nfc/flags.aconfig
@@ -76,3 +76,11 @@
description: "Enable NFC vendor command support"
bug: "289879306"
}
+
+flag {
+ name: "nfc_oem_extension"
+ is_exported: true
+ namespace: "nfc"
+ description: "Enable NFC OEM extension support"
+ bug: "331206243"
+}
diff --git a/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java b/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java
index a8d8f9a..6f20adf 100644
--- a/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java
+++ b/packages/CrashRecovery/services/java/com/android/server/PackageWatchdog.java
@@ -39,15 +39,15 @@
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.AtomicFile;
+import android.util.LongArrayQueue;
import android.util.Slog;
import android.util.Xml;
-import android.utils.BackgroundThread;
-import android.utils.LongArrayQueue;
-import android.utils.XmlUtils;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
+import com.android.internal.util.XmlUtils;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
@@ -137,17 +137,6 @@
static final int DEFAULT_BOOT_LOOP_TRIGGER_COUNT = 5;
static final long DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS = TimeUnit.MINUTES.toMillis(10);
- // Boot loop at which packageWatchdog starts first mitigation
- private static final String BOOT_LOOP_THRESHOLD =
- "persist.device_config.configuration.boot_loop_threshold";
- @VisibleForTesting
- static final int DEFAULT_BOOT_LOOP_THRESHOLD = 15;
- // Once boot_loop_threshold is surpassed next mitigation would be triggered after
- // specified number of reboots.
- private static final String BOOT_LOOP_MITIGATION_INCREMENT =
- "persist.device_config.configuration..boot_loop_mitigation_increment";
- @VisibleForTesting
- static final int DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT = 2;
// Threshold level at which or above user might experience significant disruption.
private static final String MAJOR_USER_IMPACT_LEVEL_THRESHOLD =
@@ -253,15 +242,8 @@
mConnectivityModuleConnector = connectivityModuleConnector;
mSystemClock = clock;
mNumberOfNativeCrashPollsRemaining = NUMBER_OF_NATIVE_CRASH_POLLS;
- if (Flags.recoverabilityDetection()) {
- mBootThreshold = new BootThreshold(DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS,
- SystemProperties.getInt(BOOT_LOOP_MITIGATION_INCREMENT,
- DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT));
- } else {
- mBootThreshold = new BootThreshold(DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS);
- }
+ mBootThreshold = new BootThreshold(DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
+ DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS);
loadFromFile();
sPackageWatchdog = this;
@@ -526,10 +508,16 @@
/**
* Called when the system server boots. If the system server is detected to be in a boot loop,
* query each observer and perform the mitigation action with the lowest user impact.
+ *
+ * Note: PackageWatchdog considers system_server restart loop as bootloop. Full reboots
+ * are not counted in bootloop.
*/
@SuppressWarnings("GuardedBy")
public void noteBoot() {
synchronized (mLock) {
+ // if boot count has reached threshold, start mitigation.
+ // We wait until threshold number of restarts only for the first time. Perform
+ // mitigations for every restart after that.
boolean mitigate = mBootThreshold.incrementAndTest();
if (mitigate) {
if (!Flags.recoverabilityDetection()) {
@@ -557,17 +545,13 @@
}
if (currentObserverToNotify != null) {
if (Flags.recoverabilityDetection()) {
- if (currentObserverImpact < getUserImpactLevelLimit()
- || (currentObserverImpact >= getUserImpactLevelLimit()
- && mBootThreshold.getCount() >= getBootLoopThreshold())) {
- int currentObserverMitigationCount =
- currentObserverInternal.getBootMitigationCount() + 1;
- currentObserverInternal.setBootMitigationCount(
- currentObserverMitigationCount);
- saveAllObserversBootMitigationCountToMetadata(METADATA_FILE);
- currentObserverToNotify.executeBootLoopMitigation(
- currentObserverMitigationCount);
- }
+ int currentObserverMitigationCount =
+ currentObserverInternal.getBootMitigationCount() + 1;
+ currentObserverInternal.setBootMitigationCount(
+ currentObserverMitigationCount);
+ saveAllObserversBootMitigationCountToMetadata(METADATA_FILE);
+ currentObserverToNotify.executeBootLoopMitigation(
+ currentObserverMitigationCount);
} else {
mBootThreshold.setMitigationCount(mitigationCount);
mBootThreshold.saveMitigationCountToMetadata();
@@ -647,11 +631,6 @@
DEFAULT_MAJOR_USER_IMPACT_LEVEL_THRESHOLD);
}
- private int getBootLoopThreshold() {
- return SystemProperties.getInt(BOOT_LOOP_THRESHOLD,
- DEFAULT_BOOT_LOOP_THRESHOLD);
- }
-
/** Possible severity values of the user impact of a {@link PackageHealthObserver#execute}. */
@Retention(SOURCE)
@IntDef(value = {PackageHealthObserverImpact.USER_IMPACT_LEVEL_0,
@@ -1827,16 +1806,10 @@
private final int mBootTriggerCount;
private final long mTriggerWindow;
- private final int mBootMitigationIncrement;
BootThreshold(int bootTriggerCount, long triggerWindow) {
- this(bootTriggerCount, triggerWindow, /*bootMitigationIncrement=*/ 1);
- }
-
- BootThreshold(int bootTriggerCount, long triggerWindow, int bootMitigationIncrement) {
this.mBootTriggerCount = bootTriggerCount;
this.mTriggerWindow = triggerWindow;
- this.mBootMitigationIncrement = bootMitigationIncrement;
}
public void reset() {
@@ -1915,6 +1888,7 @@
} else {
readMitigationCountFromMetadataIfNecessary();
}
+
final long now = mSystemClock.uptimeMillis();
if (now - getStart() < 0) {
Slog.e(TAG, "Window was less than zero. Resetting start to current time.");
@@ -1939,20 +1913,32 @@
setCount(count);
EventLogTags.writeRescueNote(Process.ROOT_UID, count, window);
if (Flags.recoverabilityDetection()) {
- boolean mitigate = (count >= mBootTriggerCount)
- && (count - mBootTriggerCount) % mBootMitigationIncrement == 0;
- return mitigate;
+ // After a reboot (e.g. by WARM_REBOOT or mainline rollback) we apply
+ // mitigations without waiting for DEFAULT_BOOT_LOOP_TRIGGER_COUNT.
+ return (count >= mBootTriggerCount)
+ || (performedMitigationsDuringWindow() && count > 1);
}
return count >= mBootTriggerCount;
}
}
@GuardedBy("mLock")
+ private boolean performedMitigationsDuringWindow() {
+ for (ObserverInternal observerInternal: mAllObservers.values()) {
+ if (observerInternal.getBootMitigationCount() > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @GuardedBy("mLock")
private void resetAllObserversBootMitigationCount() {
for (int i = 0; i < mAllObservers.size(); i++) {
final ObserverInternal observer = mAllObservers.valueAt(i);
observer.setBootMitigationCount(0);
}
+ saveAllObserversBootMitigationCountToMetadata(METADATA_FILE);
}
@GuardedBy("mLock")
diff --git a/packages/CrashRecovery/services/java/com/android/server/RescueParty.java b/packages/CrashRecovery/services/java/com/android/server/RescueParty.java
index 7093ba4..271d552 100644
--- a/packages/CrashRecovery/services/java/com/android/server/RescueParty.java
+++ b/packages/CrashRecovery/services/java/com/android/server/RescueParty.java
@@ -31,6 +31,7 @@
import android.crashrecovery.flags.Flags;
import android.os.Build;
import android.os.Environment;
+import android.os.FileUtils;
import android.os.PowerManager;
import android.os.RecoverySystem;
import android.os.SystemClock;
@@ -43,11 +44,10 @@
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
-import android.utils.ArrayUtils;
-import android.utils.FileUtils;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.ArrayUtils;
import com.android.server.PackageWatchdog.FailureReasons;
import com.android.server.PackageWatchdog.PackageHealthObserver;
import com.android.server.PackageWatchdog.PackageHealthObserverImpact;
@@ -139,7 +139,7 @@
static final String NAMESPACE_TO_PACKAGE_MAPPING_FLAG =
"namespace_to_package_mapping";
@VisibleForTesting
- static final long DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN = 10;
+ static final long DEFAULT_FACTORY_RESET_THROTTLE_DURATION_MIN = 1440;
private static final String NAME = "rescue-party-observer";
diff --git a/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java b/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java
deleted file mode 100644
index fa4d6af..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/ArrayUtils.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.utils;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
-import java.io.File;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Copied over from frameworks/base/core/java/com/android/internal/util/ArrayUtils.java
- *
- * @hide
- */
-public class ArrayUtils {
- private ArrayUtils() { /* cannot be instantiated */ }
- public static final File[] EMPTY_FILE = new File[0];
-
-
- /**
- * Return first index of {@code value} in {@code array}, or {@code -1} if
- * not found.
- */
- public static <T> int indexOf(@Nullable T[] array, T value) {
- if (array == null) return -1;
- for (int i = 0; i < array.length; i++) {
- if (Objects.equals(array[i], value)) return i;
- }
- return -1;
- }
-
- /** @hide */
- public static @NonNull File[] defeatNullable(@Nullable File[] val) {
- return (val != null) ? val : EMPTY_FILE;
- }
-
- /**
- * Checks if given array is null or has zero elements.
- */
- public static boolean isEmpty(@Nullable int[] array) {
- return array == null || array.length == 0;
- }
-
- /**
- * True if the byte array is null or has length 0.
- */
- public static boolean isEmpty(@Nullable byte[] array) {
- return array == null || array.length == 0;
- }
-
- /**
- * Converts from List of bytes to byte array
- * @param list
- * @return byte[]
- */
- public static byte[] toPrimitive(List<byte[]> list) {
- if (list.size() == 0) {
- return new byte[0];
- }
- int byteLen = list.get(0).length;
- byte[] array = new byte[list.size() * byteLen];
- for (int i = 0; i < list.size(); i++) {
- for (int j = 0; j < list.get(i).length; j++) {
- array[i * byteLen + j] = list.get(i)[j];
- }
- }
- return array;
- }
-
- /**
- * Adds value to given array if not already present, providing set-like
- * behavior.
- */
- public static @NonNull int[] appendInt(@Nullable int[] cur, int val) {
- return appendInt(cur, val, false);
- }
-
- /**
- * Adds value to given array.
- */
- public static @NonNull int[] appendInt(@Nullable int[] cur, int val,
- boolean allowDuplicates) {
- if (cur == null) {
- return new int[] { val };
- }
- final int n = cur.length;
- if (!allowDuplicates) {
- for (int i = 0; i < n; i++) {
- if (cur[i] == val) {
- return cur;
- }
- }
- }
- int[] ret = new int[n + 1];
- System.arraycopy(cur, 0, ret, 0, n);
- ret[n] = val;
- return ret;
- }
-}
diff --git a/packages/CrashRecovery/services/java/com/android/utils/BackgroundThread.java b/packages/CrashRecovery/services/java/com/android/utils/BackgroundThread.java
deleted file mode 100644
index afcf689..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/BackgroundThread.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * * Copyright (C) 2024 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 android.utils;
-
-import android.annotation.NonNull;
-import android.os.Handler;
-import android.os.HandlerThread;
-
-import com.android.internal.annotations.GuardedBy;
-
-import java.util.concurrent.Executor;
-
-/**
- * Thread for asynchronous event processing. This thread is configured as
- * {@link android.os.Process#THREAD_PRIORITY_BACKGROUND}, which means fewer CPU
- * resources will be dedicated to it, and it will "have less chance of impacting
- * the responsiveness of the user interface."
- * <p>
- * This thread is best suited for tasks that the user is not actively waiting
- * for, or for tasks that the user expects to be executed eventually.
- *
- * @see com.android.internal.os.BackgroundThread
- *
- * TODO: b/326916057 depend on modules-utils-backgroundthread instead
- * @hide
- */
-public final class BackgroundThread extends HandlerThread {
- private static final Object sLock = new Object();
-
- @GuardedBy("sLock")
- private static BackgroundThread sInstance;
- @GuardedBy("sLock")
- private static Handler sHandler;
- @GuardedBy("sLock")
- private static HandlerExecutor sHandlerExecutor;
-
- private BackgroundThread() {
- super(BackgroundThread.class.getName(), android.os.Process.THREAD_PRIORITY_BACKGROUND);
- }
-
- @GuardedBy("sLock")
- private static void ensureThreadLocked() {
- if (sInstance == null) {
- sInstance = new BackgroundThread();
- sInstance.start();
- sHandler = new Handler(sInstance.getLooper());
- sHandlerExecutor = new HandlerExecutor(sHandler);
- }
- }
-
- /**
- * Get the singleton instance of this class.
- *
- * @return the singleton instance of this class
- */
- @NonNull
- public static BackgroundThread get() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sInstance;
- }
- }
-
- /**
- * Get the singleton {@link Handler} for this class.
- *
- * @return the singleton {@link Handler} for this class.
- */
- @NonNull
- public static Handler getHandler() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sHandler;
- }
- }
-
- /**
- * Get the singleton {@link Executor} for this class.
- *
- * @return the singleton {@link Executor} for this class.
- */
- @NonNull
- public static Executor getExecutor() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sHandlerExecutor;
- }
- }
-}
diff --git a/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java b/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java
deleted file mode 100644
index e4923bf..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/FileUtils.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.utils;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Bits and pieces copied from hidden API of android.os.FileUtils.
- *
- * @hide
- */
-public class FileUtils {
- /**
- * Read a text file into a String, optionally limiting the length.
- *
- * @param file to read (will not seek, so things like /proc files are OK)
- * @param max length (positive for head, negative of tail, 0 for no limit)
- * @param ellipsis to add of the file was truncated (can be null)
- * @return the contents of the file, possibly truncated
- * @throws IOException if something goes wrong reading the file
- * @hide
- */
- public static @Nullable String readTextFile(@Nullable File file, @Nullable int max,
- @Nullable String ellipsis) throws IOException {
- InputStream input = new FileInputStream(file);
- // wrapping a BufferedInputStream around it because when reading /proc with unbuffered
- // input stream, bytes read not equal to buffer size is not necessarily the correct
- // indication for EOF; but it is true for BufferedInputStream due to its implementation.
- BufferedInputStream bis = new BufferedInputStream(input);
- try {
- long size = file.length();
- if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes
- if (size > 0 && (max == 0 || size < max)) max = (int) size;
- byte[] data = new byte[max + 1];
- int length = bis.read(data);
- if (length <= 0) return "";
- if (length <= max) return new String(data, 0, length);
- if (ellipsis == null) return new String(data, 0, max);
- return new String(data, 0, max) + ellipsis;
- } else if (max < 0) { // "tail" mode: keep the last N
- int len;
- boolean rolled = false;
- byte[] last = null;
- byte[] data = null;
- do {
- if (last != null) rolled = true;
- byte[] tmp = last;
- last = data;
- data = tmp;
- if (data == null) data = new byte[-max];
- len = bis.read(data);
- } while (len == data.length);
-
- if (last == null && len <= 0) return "";
- if (last == null) return new String(data, 0, len);
- if (len > 0) {
- rolled = true;
- System.arraycopy(last, len, last, 0, last.length - len);
- System.arraycopy(data, 0, last, last.length - len, len);
- }
- if (ellipsis == null || !rolled) return new String(last);
- return ellipsis + new String(last);
- } else { // "cat" mode: size unknown, read it all in streaming fashion
- ByteArrayOutputStream contents = new ByteArrayOutputStream();
- int len;
- byte[] data = new byte[1024];
- do {
- len = bis.read(data);
- if (len > 0) contents.write(data, 0, len);
- } while (len == data.length);
- return contents.toString();
- }
- } finally {
- bis.close();
- input.close();
- }
- }
-
- /**
- * Perform an fsync on the given FileOutputStream. The stream at this
- * point must be flushed but not yet closed.
- *
- * @hide
- */
- public static boolean sync(FileOutputStream stream) {
- try {
- if (stream != null) {
- stream.getFD().sync();
- }
- return true;
- } catch (IOException e) {
- }
- return false;
- }
-
- /**
- * List the files in the directory or return empty file.
- *
- * @hide
- */
- public static @NonNull File[] listFilesOrEmpty(@Nullable File dir) {
- return (dir != null) ? ArrayUtils.defeatNullable(dir.listFiles())
- : ArrayUtils.EMPTY_FILE;
- }
-}
diff --git a/packages/CrashRecovery/services/java/com/android/utils/HandlerExecutor.java b/packages/CrashRecovery/services/java/com/android/utils/HandlerExecutor.java
deleted file mode 100644
index fdb15e2..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/HandlerExecutor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.utils;
-
-import android.annotation.NonNull;
-import android.os.Handler;
-
-import java.util.Objects;
-import java.util.concurrent.Executor;
-import java.util.concurrent.RejectedExecutionException;
-
-/**
- * An adapter {@link Executor} that posts all executed tasks onto the given
- * {@link Handler}.
- *
- * TODO: b/326916057 depend on modules-utils-backgroundthread instead
- * @hide
- */
-public class HandlerExecutor implements Executor {
- private final Handler mHandler;
-
- public HandlerExecutor(@NonNull Handler handler) {
- mHandler = Objects.requireNonNull(handler);
- }
-
- @Override
- public void execute(Runnable command) {
- if (!mHandler.post(command)) {
- throw new RejectedExecutionException(mHandler + " is shutting down");
- }
- }
-}
diff --git a/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java b/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java
deleted file mode 100644
index 5cdc253..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/LongArrayQueue.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.utils;
-
-import libcore.util.EmptyArray;
-
-import java.util.NoSuchElementException;
-
-/**
- * Copied from frameworks/base/core/java/android/util/LongArrayQueue.java
- *
- * @hide
- */
-public class LongArrayQueue {
-
- private long[] mValues;
- private int mSize;
- private int mHead;
- private int mTail;
-
- private long[] newUnpaddedLongArray(int num) {
- return new long[num];
- }
- /**
- * Initializes a queue with the given starting capacity.
- *
- * @param initialCapacity the capacity.
- */
- public LongArrayQueue(int initialCapacity) {
- if (initialCapacity == 0) {
- mValues = EmptyArray.LONG;
- } else {
- mValues = newUnpaddedLongArray(initialCapacity);
- }
- mSize = 0;
- mHead = mTail = 0;
- }
-
- /**
- * Initializes a queue with default starting capacity.
- */
- public LongArrayQueue() {
- this(16);
- }
-
- /** @hide */
- public static int growSize(int currentSize) {
- return currentSize <= 4 ? 8 : currentSize * 2;
- }
-
- private void grow() {
- if (mSize < mValues.length) {
- throw new IllegalStateException("Queue not full yet!");
- }
- final int newSize = growSize(mSize);
- final long[] newArray = newUnpaddedLongArray(newSize);
- final int r = mValues.length - mHead; // Number of elements on and to the right of head.
- System.arraycopy(mValues, mHead, newArray, 0, r);
- System.arraycopy(mValues, 0, newArray, r, mHead);
- mValues = newArray;
- mHead = 0;
- mTail = mSize;
- }
-
- /**
- * Returns the number of elements in the queue.
- */
- public int size() {
- return mSize;
- }
-
- /**
- * Removes all elements from this queue.
- */
- public void clear() {
- mSize = 0;
- mHead = mTail = 0;
- }
-
- /**
- * Adds a value to the tail of the queue.
- *
- * @param value the value to be added.
- */
- public void addLast(long value) {
- if (mSize == mValues.length) {
- grow();
- }
- mValues[mTail] = value;
- mTail = (mTail + 1) % mValues.length;
- mSize++;
- }
-
- /**
- * Removes an element from the head of the queue.
- *
- * @return the element at the head of the queue.
- * @throws NoSuchElementException if the queue is empty.
- */
- public long removeFirst() {
- if (mSize == 0) {
- throw new NoSuchElementException("Queue is empty!");
- }
- final long ret = mValues[mHead];
- mHead = (mHead + 1) % mValues.length;
- mSize--;
- return ret;
- }
-
- /**
- * Returns the element at the given position from the head of the queue, where 0 represents the
- * head of the queue.
- *
- * @param position the position from the head of the queue.
- * @return the element found at the given position.
- * @throws IndexOutOfBoundsException if {@code position} < {@code 0} or
- * {@code position} >= {@link #size()}
- */
- public long get(int position) {
- if (position < 0 || position >= mSize) {
- throw new IndexOutOfBoundsException("Index " + position
- + " not valid for a queue of size " + mSize);
- }
- final int index = (mHead + position) % mValues.length;
- return mValues[index];
- }
-
- /**
- * Returns the element at the head of the queue, without removing it.
- *
- * @return the element at the head of the queue.
- * @throws NoSuchElementException if the queue is empty
- */
- public long peekFirst() {
- if (mSize == 0) {
- throw new NoSuchElementException("Queue is empty!");
- }
- return mValues[mHead];
- }
-
- /**
- * Returns the element at the tail of the queue.
- *
- * @return the element at the tail of the queue.
- * @throws NoSuchElementException if the queue is empty.
- */
- public long peekLast() {
- if (mSize == 0) {
- throw new NoSuchElementException("Queue is empty!");
- }
- final int index = (mTail == 0) ? mValues.length - 1 : mTail - 1;
- return mValues[index];
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- if (mSize <= 0) {
- return "{}";
- }
-
- final StringBuilder buffer = new StringBuilder(mSize * 64);
- buffer.append('{');
- buffer.append(get(0));
- for (int i = 1; i < mSize; i++) {
- buffer.append(", ");
- buffer.append(get(i));
- }
- buffer.append('}');
- return buffer.toString();
- }
-}
diff --git a/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java b/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java
deleted file mode 100644
index dbbef61..0000000
--- a/packages/CrashRecovery/services/java/com/android/utils/XmlUtils.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2024 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 android.utils;
-
-import android.annotation.NonNull;
-import android.system.ErrnoException;
-import android.system.Os;
-
-import com.android.modules.utils.TypedXmlPullParser;
-
-import libcore.util.XmlObjectFactory;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Copied over partly from frameworks/base/core/java/com/android/internal/util/XmlUtils.java
- *
- * @hide
- */
-public class XmlUtils {
-
- private static final String STRING_ARRAY_SEPARATOR = ":";
-
- /** @hide */
- public static final void beginDocument(XmlPullParser parser, String firstElementName)
- throws XmlPullParserException, IOException {
- int type;
- while ((type = parser.next()) != parser.START_TAG
- && type != parser.END_DOCUMENT) {
- // Do nothing
- }
-
- if (type != parser.START_TAG) {
- throw new XmlPullParserException("No start tag found");
- }
-
- if (!parser.getName().equals(firstElementName)) {
- throw new XmlPullParserException("Unexpected start tag: found " + parser.getName()
- + ", expected " + firstElementName);
- }
- }
-
- /** @hide */
- public static boolean nextElementWithin(XmlPullParser parser, int outerDepth)
- throws IOException, XmlPullParserException {
- for (;;) {
- int type = parser.next();
- if (type == XmlPullParser.END_DOCUMENT
- || (type == XmlPullParser.END_TAG && parser.getDepth() == outerDepth)) {
- return false;
- }
- if (type == XmlPullParser.START_TAG
- && parser.getDepth() == outerDepth + 1) {
- return true;
- }
- }
- }
-
- private static XmlPullParser newPullParser() {
- try {
- XmlPullParser parser = XmlObjectFactory.newXmlPullParser();
- parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
- parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
- return parser;
- } catch (XmlPullParserException e) {
- throw new AssertionError();
- }
- }
-
- /** @hide */
- public static @NonNull TypedXmlPullParser resolvePullParser(@NonNull InputStream in)
- throws IOException {
- final byte[] magic = new byte[4];
- if (in instanceof FileInputStream) {
- try {
- Os.pread(((FileInputStream) in).getFD(), magic, 0, magic.length, 0);
- } catch (ErrnoException e) {
- throw e.rethrowAsIOException();
- }
- } else {
- if (!in.markSupported()) {
- in = new BufferedInputStream(in);
- }
- in.mark(8);
- in.read(magic);
- in.reset();
- }
-
- final TypedXmlPullParser xml;
- xml = (TypedXmlPullParser) newPullParser();
- try {
- xml.setInput(in, "UTF_8");
- } catch (XmlPullParserException e) {
- throw new IOException(e);
- }
- return xml;
- }
-}
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 999507b..d50b596 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -229,7 +229,6 @@
extra_check_modules: ["SystemUILintChecker"],
warning_checks: ["MissingApacheLicenseDetector"],
},
- skip_jarjar_repackage: true,
}
filegroup {
@@ -335,7 +334,6 @@
"platform-test-annotations",
"notification_flags_lib",
],
- skip_jarjar_repackage: true,
}
android_library {
@@ -385,7 +383,6 @@
test: true,
extra_check_modules: ["SystemUILintChecker"],
},
- skip_jarjar_repackage: true,
}
android_app {
diff --git a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
index 3349345..c429329 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/carrier/ShadeCarrierGroupController.java
@@ -345,9 +345,7 @@
}
}
- if (mStatusBarPipelineFlags.useNewShadeCarrierGroupMobileIcons()) {
- Log.d(TAG, "ignoring old pipeline callback because new mobile icon is enabled");
- } else {
+ if (!mStatusBarPipelineFlags.useNewShadeCarrierGroupMobileIcons()) {
for (int i = 0; i < SIM_SLOTS; i++) {
mCarrierGroups[i].updateState(mInfos[i], singleCarrier);
}
diff --git a/services/Android.bp b/services/Android.bp
index 474d501..32a8bbb 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -248,6 +248,11 @@
// API stub
// =============================================================
+soong_config_module_type_import {
+ from: "frameworks/base/api/Android.bp",
+ module_types: ["non_updatable_exportable_droidstubs"],
+}
+
stubs_defaults {
name: "services-stubs-default",
installable: false,
@@ -263,10 +268,12 @@
filter_packages: ["com.android."],
}
-droidstubs {
+non_updatable_exportable_droidstubs {
name: "services-non-updatable-stubs",
srcs: [":services-non-updatable-sources"],
- defaults: ["services-stubs-default"],
+ defaults: [
+ "services-stubs-default",
+ ],
check_api: {
current: {
api_file: "api/current.txt",
@@ -283,14 +290,34 @@
targets: ["sdk"],
dir: "apistubs/android/system-server/api",
dest: "android-non-updatable.txt",
- tag: ".api.txt",
},
{
targets: ["sdk"],
dir: "apistubs/android/system-server/api",
dest: "android-non-updatable-removed.txt",
- tag: ".removed-api.txt",
},
],
+ soong_config_variables: {
+ release_hidden_api_exportable_stubs: {
+ dists: [
+ {
+ tag: ".exportable.api.txt",
+ },
+ {
+ tag: ".exportable.removed-api.txt",
+ },
+ ],
+ conditions_default: {
+ dists: [
+ {
+ tag: ".api.txt",
+ },
+ {
+ tag: ".removed-api.txt",
+ },
+ ],
+ },
+ },
+ },
api_surface: "system-server",
}
diff --git a/services/core/java/com/android/server/VpnManagerService.java b/services/core/java/com/android/server/VpnManagerService.java
index 1d1e2d9..626fa70 100644
--- a/services/core/java/com/android/server/VpnManagerService.java
+++ b/services/core/java/com/android/server/VpnManagerService.java
@@ -1007,6 +1007,71 @@
}
}
+ /**
+ * Get the vpn profile owned by the calling uid with the given name from the vpn database.
+ *
+ * <p>Note this method should not be used for platform VPN profiles. </p>
+ *
+ * @param name The name of the profile to retrieve.
+ * @return the unstructured blob for the matching vpn profile.
+ * Returns null if no profile with a matching name was found.
+ * @hide
+ */
+ @Override
+ @Nullable
+ public byte[] getFromVpnProfileStore(@NonNull String name) {
+ return mVpnProfileStore.get(name);
+ }
+
+ /**
+ * Put the given vpn profile owned by the calling uid with the given name into the vpn database.
+ * Existing profiles with the same name will be replaced.
+ *
+ * <p>Note this method should not be used for platform VPN profiles.
+ * To update a platform VPN, use provisionVpnProfile() instead. </p>
+ *
+ * @param name The name of the profile to put.
+ * @param blob The profile.
+ * @return true if the profile was successfully added. False otherwise.
+ * @hide
+ */
+ @Override
+ public boolean putIntoVpnProfileStore(@NonNull String name, @NonNull byte[] blob) {
+ return mVpnProfileStore.put(name, blob);
+ }
+
+ /**
+ * Removes the vpn profile owned by the calling uid with the given name from the vpn database.
+ *
+ * <p>Note this method should not be used for platform VPN profiles.
+ * To remove a platform VPN, use deleteVpnProfile() instead.</p>
+ *
+ * @param name The name of the profile to be removed.
+ * @return true if a profile was removed. False if no profile with a matching name was found.
+ * @hide
+ */
+ @Override
+ public boolean removeFromVpnProfileStore(@NonNull String name) {
+ return mVpnProfileStore.remove(name);
+ }
+
+ /**
+ * Returns a list of the name suffixes of the vpn profiles owned by the calling uid in the vpn
+ * database matching the given prefix, sorted in ascending order.
+ *
+ * <p>Note this method should not be used for platform VPN profiles. </p>
+ *
+ * @param prefix The prefix to match.
+ * @return an array of strings representing the name suffixes stored in the profile database
+ * matching the given prefix. The return value may be empty but never null.
+ * @hide
+ */
+ @Override
+ @NonNull
+ public String[] listFromVpnProfileStore(@NonNull String prefix) {
+ return mVpnProfileStore.list(prefix);
+ }
+
private void ensureRunningOnHandlerThread() {
if (mHandler.getLooper().getThread() != Thread.currentThread()) {
throw new IllegalStateException(
diff --git a/services/core/java/com/android/server/am/LmkdStatsReporter.java b/services/core/java/com/android/server/am/LmkdStatsReporter.java
index 8266299..b55f35d 100644
--- a/services/core/java/com/android/server/am/LmkdStatsReporter.java
+++ b/services/core/java/com/android/server/am/LmkdStatsReporter.java
@@ -34,7 +34,6 @@
static final String TAG = TAG_WITH_CLASS_NAME ? "LmkdStatsReporter" : TAG_AM;
public static final int KILL_OCCURRED_MSG_SIZE = 80;
- public static final int STATE_CHANGED_MSG_SIZE = 8;
private static final int PRESSURE_AFTER_KILL = 0;
private static final int NOT_RESPONDING = 1;
@@ -80,16 +79,6 @@
}
}
- /**
- * Processes the LMK_STATE_CHANGED packet
- * Logs the change in LMKD state which is used as start/stop boundaries for logging
- * LMK_KILL_OCCURRED event.
- * Code: LMK_STATE_CHANGED = 54
- */
- public static void logStateChanged(int state) {
- FrameworkStatsLog.write(FrameworkStatsLog.LMK_STATE_CHANGED, state);
- }
-
private static int mapKillReason(int reason) {
switch (reason) {
case PRESSURE_AFTER_KILL:
diff --git a/services/core/java/com/android/server/am/OWNERS b/services/core/java/com/android/server/am/OWNERS
index bf7cc10..11db302 100644
--- a/services/core/java/com/android/server/am/OWNERS
+++ b/services/core/java/com/android/server/am/OWNERS
@@ -9,7 +9,6 @@
sudheersai@google.com
suprabh@google.com
varunshah@google.com
-kwekua@google.com
bookatz@google.com
jji@google.com
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 65c2cc5..4dfa71b 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -349,7 +349,8 @@
// LMK_PROCKILL
// LMK_UPDATE_PROPS
// LMK_KILL_OCCURRED
- // LMK_STATE_CHANGED
+ // LMK_START_MONITORING
+ // LMK_BOOT_COMPLETED
static final byte LMK_TARGET = 0;
static final byte LMK_PROCPRIO = 1;
static final byte LMK_PROCREMOVE = 2;
@@ -359,8 +360,8 @@
static final byte LMK_PROCKILL = 6; // Note: this is an unsolicited command
static final byte LMK_UPDATE_PROPS = 7;
static final byte LMK_KILL_OCCURRED = 8; // Msg to subscribed clients on kill occurred event
- static final byte LMK_STATE_CHANGED = 9; // Msg to subscribed clients on state changed
static final byte LMK_START_MONITORING = 9; // Start monitoring if delayed earlier
+ static final byte LMK_BOOT_COMPLETED = 10;
// Low Memory Killer Daemon command codes.
// These must be kept in sync with async_event_type definitions in lmkd.h
@@ -960,14 +961,6 @@
foregroundServices.first,
foregroundServices.second);
return true;
- case LMK_STATE_CHANGED:
- if (receivedLen
- != LmkdStatsReporter.STATE_CHANGED_MSG_SIZE) {
- return false;
- }
- final int state = inputData.readInt();
- LmkdStatsReporter.logStateChanged(state);
- return true;
default:
return false;
}
diff --git a/services/core/java/com/android/server/devicestate/OWNERS b/services/core/java/com/android/server/devicestate/OWNERS
index ae79fc0..43f3f0c 100644
--- a/services/core/java/com/android/server/devicestate/OWNERS
+++ b/services/core/java/com/android/server/devicestate/OWNERS
@@ -1,3 +1,4 @@
ogunwale@google.com
akulian@google.com
-darryljohnson@google.com
+lihongyu@google.com
+kennethford@google.com
diff --git a/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java b/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
index 0f40ca0..2783fef 100644
--- a/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
+++ b/services/core/java/com/android/server/graphics/fonts/UpdatableFontDir.java
@@ -198,8 +198,7 @@
File signatureFile = new File(dir, FONT_SIGNATURE_FILE);
if (!signatureFile.exists()) {
Slog.i(TAG, "The signature file is missing.");
- FileUtils.deleteContentsAndDir(dir);
- continue;
+ return;
}
byte[] signature;
try {
@@ -224,10 +223,36 @@
FontFileInfo fontFileInfo = validateFontFile(fontFile, signature);
if (fontConfig == null) {
- fontConfig = getSystemFontConfig();
+ // Use preinstalled font config for checking revision number.
+ fontConfig = mConfigSupplier.apply(Collections.emptyMap());
}
addFileToMapIfSameOrNewer(fontFileInfo, fontConfig, true /* deleteOldFile */);
}
+
+ // Treat as error if post script name of font family was not installed.
+ for (int i = 0; i < config.fontFamilies.size(); ++i) {
+ FontUpdateRequest.Family family = config.fontFamilies.get(i);
+ for (int j = 0; j < family.getFonts().size(); ++j) {
+ FontUpdateRequest.Font font = family.getFonts().get(j);
+ if (mFontFileInfoMap.containsKey(font.getPostScriptName())) {
+ continue;
+ }
+
+ if (fontConfig == null) {
+ fontConfig = mConfigSupplier.apply(Collections.emptyMap());
+ }
+
+ if (getFontByPostScriptName(font.getPostScriptName(), fontConfig) != null) {
+ continue;
+ }
+
+ Slog.e(TAG, "Unknown font that has PostScript name "
+ + font.getPostScriptName() + " is requested in FontFamily "
+ + family.getName());
+ return;
+ }
+ }
+
success = true;
} catch (Throwable t) {
// If something happened during loading system fonts, clear all contents in finally
@@ -239,6 +264,7 @@
mFontFileInfoMap.clear();
mLastModifiedMillis = 0;
FileUtils.deleteContents(mFilesDir);
+ mConfigFile.delete();
}
}
}
@@ -487,8 +513,7 @@
return shouldAddToMap;
}
- private long getPreinstalledFontRevision(FontFileInfo info, FontConfig fontConfig) {
- String psName = info.getPostScriptName();
+ private FontConfig.Font getFontByPostScriptName(String psName, FontConfig fontConfig) {
FontConfig.Font targetFont = null;
for (int i = 0; i < fontConfig.getFontFamilies().size(); i++) {
FontConfig.FontFamily family = fontConfig.getFontFamilies().get(i);
@@ -513,6 +538,13 @@
}
}
}
+ return targetFont;
+ }
+
+ private long getPreinstalledFontRevision(FontFileInfo info, FontConfig fontConfig) {
+ String psName = info.getPostScriptName();
+ FontConfig.Font targetFont = getFontByPostScriptName(psName, fontConfig);
+
if (targetFont == null) {
return -1;
}
diff --git a/services/core/java/com/android/server/power/batterysaver/OWNERS b/services/core/java/com/android/server/power/batterysaver/OWNERS
index cf23bea..dc2d0b3 100644
--- a/services/core/java/com/android/server/power/batterysaver/OWNERS
+++ b/services/core/java/com/android/server/power/batterysaver/OWNERS
@@ -1,3 +1,2 @@
-kwekua@google.com
omakoto@google.com
-yamasani@google.com
\ No newline at end of file
+yamasani@google.com
diff --git a/services/core/java/com/android/server/utils/quota/OWNERS b/services/core/java/com/android/server/utils/quota/OWNERS
index a2943f3..469acb2 100644
--- a/services/core/java/com/android/server/utils/quota/OWNERS
+++ b/services/core/java/com/android/server/utils/quota/OWNERS
@@ -1,4 +1,3 @@
dplotnikov@google.com
-kwekua@google.com
omakoto@google.com
yamasani@google.com
diff --git a/services/tests/VpnTests/java/com/android/server/VpnManagerServiceTest.java b/services/tests/VpnTests/java/com/android/server/VpnManagerServiceTest.java
index ecc70e3..8495de4 100644
--- a/services/tests/VpnTests/java/com/android/server/VpnManagerServiceTest.java
+++ b/services/tests/VpnTests/java/com/android/server/VpnManagerServiceTest.java
@@ -397,4 +397,35 @@
// Even lockdown is enabled but no Vpn is created for SECONDARY_USER.
assertNull(mService.getVpnLockdownAllowlist(SECONDARY_USER.id));
}
+
+ @Test
+ public void testGetFromVpnProfileStore() {
+ final String name = Credentials.VPN + TEST_VPN_PKG;
+ mService.getFromVpnProfileStore(name);
+ verify(mVpnProfileStore).get(name);
+ }
+
+ @Test
+ public void testPutIntoVpnProfileStore() {
+ final String name = Credentials.VPN + TEST_VPN_PKG;
+ final VpnProfile vpnProfile = new VpnProfile(TEST_VPN_PKG);
+ final byte[] encodedProfile = vpnProfile.encode();
+
+ mService.putIntoVpnProfileStore(name, encodedProfile);
+ verify(mVpnProfileStore).put(name, encodedProfile);
+ }
+
+ @Test
+ public void testRemoveFromVpnProfileStore() {
+ final String name = Credentials.VPN + TEST_VPN_PKG;
+ mService.removeFromVpnProfileStore(name);
+ verify(mVpnProfileStore).remove(name);
+ }
+
+ @Test
+ public void testListFromVpnProfileStore() {
+ final String name = Credentials.VPN + TEST_VPN_PKG;
+ mService.listFromVpnProfileStore(name);
+ verify(mVpnProfileStore).list(name);
+ }
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/OWNERS b/services/tests/mockingservicestests/src/com/android/server/OWNERS
index f801560..0eb8639 100644
--- a/services/tests/mockingservicestests/src/com/android/server/OWNERS
+++ b/services/tests/mockingservicestests/src/com/android/server/OWNERS
@@ -1,5 +1,5 @@
per-file *Alarm* = file:/apex/jobscheduler/OWNERS
per-file *AppStateTracker* = file:/apex/jobscheduler/OWNERS
per-file *DeviceIdleController* = file:/apex/jobscheduler/OWNERS
-per-file SensitiveContentProtectionManagerServiceTest.java = file:/core/java/android/permission/OWNERS
+per-file SensitiveContentProtectionManagerService* = file:/core/java/android/permission/OWNERS
per-file RescuePartyTest.java = file:/packages/CrashRecovery/OWNERS
diff --git a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
index 682569f..697548c 100644
--- a/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java
@@ -1111,16 +1111,9 @@
// mock properties in BootThreshold
try {
- if (Flags.recoverabilityDetection()) {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS,
- PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT));
- } else {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
+ mSpyBootThreshold = spy(watchdog.new BootThreshold(
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS));
- }
mCrashRecoveryPropertiesMap = new HashMap<>();
doAnswer((Answer<Integer>) invocationOnMock -> {
diff --git a/services/tests/servicestests/src/com/android/server/contentcapture/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/contentcapture/TEST_MAPPING
index dae8f93..0946229 100644
--- a/services/tests/servicestests/src/com/android/server/contentcapture/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/contentcapture/TEST_MAPPING
@@ -1,23 +1,6 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.contentcapture"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
- }
- ],
- "postsubmit": [
- {
- // b/331020193, Move to presubmit early april 2024
"name": "FrameworksServicesTests_contentcapture"
}
]
diff --git a/services/tests/servicestests/src/com/android/server/contentprotection/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/contentprotection/TEST_MAPPING
index 32729a8..1ad7baa 100644
--- a/services/tests/servicestests/src/com/android/server/contentprotection/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/contentprotection/TEST_MAPPING
@@ -1,23 +1,6 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.contentprotection"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
- }
- ],
- "postsubmit": [
- {
- // b/331020193, Move to presubmit early april 2024
"name": "FrameworksServicesTests_contentprotection"
}
]
diff --git a/services/tests/servicestests/src/com/android/server/graphics/fonts/UpdatableFontDirTest.java b/services/tests/servicestests/src/com/android/server/graphics/fonts/UpdatableFontDirTest.java
index 3de167e..5fb15e9 100644
--- a/services/tests/servicestests/src/com/android/server/graphics/fonts/UpdatableFontDirTest.java
+++ b/services/tests/servicestests/src/com/android/server/graphics/fonts/UpdatableFontDirTest.java
@@ -1001,6 +1001,563 @@
assertThat(mUpdatableFontFilesDir.list()).hasLength(0);
}
+ private UpdatableFontDir createNewUpdateDir() {
+ UpdatableFontDir dir = new UpdatableFontDir(
+ mUpdatableFontFilesDir, mParser, mFakeFsverityUtil,
+ mConfigFile, mCurrentTimeSupplier, mConfigSupplier);
+ dir.loadFontFileMap();
+ return dir;
+ }
+
+ private UpdatableFontDir installTestFontFamilies(int version) {
+ UpdatableFontDir dir = createNewUpdateDir();
+ try {
+ dir.update(Arrays.asList(
+ newFontUpdateRequest("foo.ttf," + version + ",foo", GOOD_SIGNATURE),
+ newFontUpdateRequest("bar.ttf," + version + ",bar", GOOD_SIGNATURE),
+ newAddFontFamilyRequest("<family name='foobar'>"
+ + " <font>foo.ttf</font>"
+ + " <font>bar.ttf</font>"
+ + "</family>")));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return dir;
+ }
+
+ private UpdatableFontDir installTestFontFile(int numFonts, int version) {
+ UpdatableFontDir dir = createNewUpdateDir();
+ List<FontUpdateRequest> requests = new ArrayList<>();
+ if (numFonts <= 0 || numFonts > 3) {
+ throw new IllegalArgumentException("numFont must be 1, 2 or 3");
+ }
+ try {
+ requests.add(newFontUpdateRequest("foo.ttf," + version + ",foo", GOOD_SIGNATURE));
+ if (numFonts >= 2) {
+ requests.add(newFontUpdateRequest("bar.ttf," + version + ",bar", GOOD_SIGNATURE));
+ }
+ if (numFonts == 3) {
+ requests.add(newFontUpdateRequest("baz.ttf," + version + ",baz", GOOD_SIGNATURE));
+ }
+ dir.update(requests);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return dir;
+ }
+
+ private List<File> collectSignatureFiles() {
+ return Arrays.stream(mUpdatableFontFilesDir.listFiles())
+ .map((file) -> file.listFiles((unused, s) -> s.endsWith(".fsv_sig")))
+ .flatMap(Arrays::stream)
+ .toList();
+ }
+
+ private List<File> collectFontFiles() {
+ return Arrays.stream(mUpdatableFontFilesDir.listFiles())
+ .map((file) -> file.listFiles((unused, s) -> s.endsWith(".ttf")))
+ .flatMap(Arrays::stream)
+ .toList();
+ }
+
+ private void removeAll(List<File> files) {
+ files.forEach((File file) -> {
+ if (file.isDirectory()) {
+ removeAll(List.of(file.listFiles()));
+ } else {
+ assertThat(file.delete()).isTrue();
+ }
+ });
+ }
+
+ private void assertTestFontFamilyInstalled(UpdatableFontDir dir, int version) {
+ try {
+ assertNamedFamilyExists(dir.getSystemFontConfig(), "foobar");
+ assertThat(dir.getFontFamilyMap()).containsKey("foobar");
+ assertThat(dir.getFontFamilyMap().get("foobar").getFamilies().size()).isEqualTo(1);
+ FontConfig.FontFamily foobar = dir.getFontFamilyMap().get("foobar").getFamilies()
+ .get(0);
+ assertThat(foobar.getFontList()).hasSize(2);
+ assertThat(foobar.getFontList().get(0).getFile())
+ .isEqualTo(dir.getPostScriptMap().get("foo"));
+ assertThat(mParser.getRevision(dir.getPostScriptMap().get("foo"))).isEqualTo(version);
+ assertThat(foobar.getFontList().get(1).getFile())
+ .isEqualTo(dir.getPostScriptMap().get("bar"));
+ assertThat(mParser.getRevision(dir.getPostScriptMap().get("bar"))).isEqualTo(version);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void assertTestFontInstalled(UpdatableFontDir dir, int version) {
+ try {
+ assertThat(dir.getPostScriptMap().containsKey("foo")).isTrue();
+ assertThat(mParser.getRevision(dir.getPostScriptMap().get("foo"))).isEqualTo(version);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ public void signatureMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete one signature file
+ assertThat(collectSignatureFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1);
+
+ // Delete one signature file
+ assertThat(collectSignatureFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf and bar.ttf
+ installTestFontFile(2 /* numFonts */, 1 /* version */);
+
+ // Delete one signature file
+ assertThat(collectSignatureFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf and bar.ttf
+ installTestFontFile(2 /* numFonts */, 1 /* version */);
+
+ // Delete one signature file
+ assertThat(collectSignatureFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(2 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureAllMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all signature files
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureAllMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all signature files
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureAllMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all signature files
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void signatureAllMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all signature files
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete one font file
+ assertThat(collectFontFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1);
+
+ // Delete one font file
+ assertThat(collectFontFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf and bar.ttf
+ installTestFontFile(2 /* numFonts */, 1 /* version */);
+
+ // Delete one font file
+ assertThat(collectFontFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf and bar.ttf
+ installTestFontFile(2 /* numFonts */, 1 /* version */);
+
+ // Delete one font file
+ assertThat(collectFontFiles().get(0).delete()).isTrue();
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(2 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontAllMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontAllMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontAllMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontAllMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontDirAllMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(List.of(mUpdatableFontFilesDir.listFiles()));
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontDirAllMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(List.of(mUpdatableFontFilesDir.listFiles()));
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontDirAllMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(List.of(mUpdatableFontFilesDir.listFiles()));
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void fontDirAllMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(List.of(mUpdatableFontFilesDir.listFiles()));
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void dirContentAllMissingCase_fontFamilyInstalled_fontFamilyInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void dirContentAllMissingCase_fontFamilyInstalled_fontInstallLater() {
+ // Install font families, foo.ttf, bar.ttf.
+ installTestFontFamilies(1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void dirContentAllMissingCase_fontFileInstalled_fontFamilyInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFamilies(2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontFamilyInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontFamilyInstalled(nextDir, 2 /* version */);
+ }
+
+ @Test
+ public void dirContentAllMissingCase_fontFileInstalled_fontFileInstallLater() {
+ // Install font file, foo.ttf
+ installTestFontFile(1 /* numFonts */, 1 /* version */);
+
+ // Delete all font files
+ removeAll(collectFontFiles());
+ removeAll(collectSignatureFiles());
+
+ // New instance of UpdatableFontDir, this emulate a device reboot.
+ UpdatableFontDir dir = installTestFontFile(1 /* numFonts */, 2 /* version */);
+
+ // Make sure the font installation succeeds.
+ assertTestFontInstalled(dir, 2 /* version */);
+
+ // Make sure after the reboot, the configuration remains.
+ UpdatableFontDir nextDir = createNewUpdateDir();
+ assertTestFontInstalled(nextDir, 2 /* version */);
+ }
+
private FontUpdateRequest newFontUpdateRequest(String content, String signature)
throws Exception {
File file = File.createTempFile("font", "ttf", mCacheDir);
diff --git a/services/tests/servicestests/src/com/android/server/location/contexthub/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/location/contexthub/TEST_MAPPING
index dc8f934..58f5bb3 100644
--- a/services/tests/servicestests/src/com/android/server/location/contexthub/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/location/contexthub/TEST_MAPPING
@@ -1,29 +1,11 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.location.contexthub."
- },
- {
- "include-annotation": "android.platform.test.annotations.Presubmit"
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- }
- ]
+ "name": "FrameworksServicesTests_contexthub_presubmit"
}
],
"postsubmit": [
{
- // b/331020193, Move to presubmit early april 2024
- "name": "FrameworksServicesTests_contexthub_presubmit"
- },
- {
"name": "FrameworksServicesTests",
"options": [
{
diff --git a/services/tests/servicestests/src/com/android/server/om/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/om/TEST_MAPPING
index 41c4383..944c1df 100644
--- a/services/tests/servicestests/src/com/android/server/om/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/om/TEST_MAPPING
@@ -1,12 +1,7 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.om."
- }
- ]
+ "name": "FrameworksServicesTests_om"
},
{
"name": "PackageManagerServiceHostTests",
@@ -16,11 +11,5 @@
}
]
}
- ],
- "postsubmit": [
- {
- // b/331020193, Move to presubmit early april 2024
- "name": "FrameworksServicesTests_om"
- }
]
}
diff --git a/services/tests/servicestests/src/com/android/server/os/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/os/TEST_MAPPING
index 06e7002..2138da9 100644
--- a/services/tests/servicestests/src/com/android/server/os/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/os/TEST_MAPPING
@@ -1,17 +1,6 @@
{
"presubmit": [
{
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.os."
- }
- ]
- }
- ],
- "postsubmit": [
- {
- // b/331020193, Move to presubmit early april 2024
"name": "FrameworksServicesTests_os"
}
]
diff --git a/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING
index f4e724f..861562d 100644
--- a/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/pm/TEST_MAPPING
@@ -21,7 +21,7 @@
"postsubmit": [
{
// Presubmit is intentional here while testing with SLO checker.
- // b/331020193, Move to presubmit early april 2024
+ // Tests are flaky, waiting to bypass.
"name": "FrameworksServicesTests_pm_presubmit"
},
{
diff --git a/services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING b/services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING
index 7e7393c..eb7453d 100644
--- a/services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING
+++ b/services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING
@@ -1,21 +1,7 @@
{
- "presubmit": [
- {
- "name": "FrameworksServicesTests",
- "options": [
- {
- "include-filter": "com.android.server.recoverysystem."
- },
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- }
- ]
- }
- ],
- "postsubmit": [
- {
- // b/331020193, Move to presubmit early april 2024
- "name": "FrameworksServicesTests_recoverysystem"
- }
- ]
-}
\ No newline at end of file
+ "presubmit": [
+ {
+ "name": "FrameworksServicesTests_recoverysystem"
+ }
+ ]
+}
diff --git a/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java b/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java
index 081da11..489ef44 100644
--- a/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java
+++ b/tests/PackageWatchdog/src/com/android/server/CrashRecoveryTest.java
@@ -66,6 +66,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.MockitoSession;
import org.mockito.quality.Strictness;
@@ -220,43 +221,36 @@
RescuePartyObserver rescuePartyObserver = setUpRescuePartyObserver(watchdog);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(1);
- int bootCounter = 0;
+
for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) {
watchdog.noteBoot();
- bootCounter += 1;
}
+
verify(rescuePartyObserver).executeBootLoopMitigation(1);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- bootCounter += 1;
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(2);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(3);
- int bootLoopThreshold = PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - bootCounter;
- for (int i = 0; i < bootLoopThreshold; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(3);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(4);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(4);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(5);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(5);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(6);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(6);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(7);
}
@@ -268,11 +262,11 @@
setUpRollbackPackageHealthObserver(watchdog);
verify(rollbackObserver, never()).executeBootLoopMitigation(1);
- int bootCounter = 0;
+
for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) {
watchdog.noteBoot();
- bootCounter += 1;
}
+
verify(rollbackObserver).executeBootLoopMitigation(1);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
@@ -280,19 +274,16 @@
when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_HIGH,
ROLLBACK_INFO_MANUAL));
- int bootLoopThreshold = PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - bootCounter;
- for (int i = 0; i < bootLoopThreshold; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rollbackObserver).executeBootLoopMitigation(2);
verify(rollbackObserver, never()).executeBootLoopMitigation(3);
// Update the list of available rollbacks after executing bootloop mitigation once
when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_MANUAL));
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rollbackObserver, never()).executeBootLoopMitigation(3);
}
@@ -305,27 +296,21 @@
verify(rescuePartyObserver, never()).executeBootLoopMitigation(1);
verify(rollbackObserver, never()).executeBootLoopMitigation(1);
- int bootCounter = 0;
for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) {
watchdog.noteBoot();
- bootCounter += 1;
}
verify(rescuePartyObserver).executeBootLoopMitigation(1);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(2);
verify(rollbackObserver, never()).executeBootLoopMitigation(1);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- bootCounter += 1;
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(2);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(3);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- bootCounter += 1;
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver, never()).executeBootLoopMitigation(3);
verify(rollbackObserver).executeBootLoopMitigation(1);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
@@ -333,43 +318,46 @@
when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_HIGH,
ROLLBACK_INFO_MANUAL));
- int bootLoopThreshold = PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - bootCounter;
- for (int i = 0; i < bootLoopThreshold; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(3);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(4);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(4);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(5);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(5);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(6);
verify(rollbackObserver, never()).executeBootLoopMitigation(2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver, never()).executeBootLoopMitigation(6);
verify(rollbackObserver).executeBootLoopMitigation(2);
verify(rollbackObserver, never()).executeBootLoopMitigation(3);
// Update the list of available rollbacks after executing bootloop mitigation
when(mRollbackManager.getAvailableRollbacks()).thenReturn(List.of(ROLLBACK_INFO_MANUAL));
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; i++) {
- watchdog.noteBoot();
- }
+ watchdog.noteBoot();
+
verify(rescuePartyObserver).executeBootLoopMitigation(6);
verify(rescuePartyObserver, never()).executeBootLoopMitigation(7);
verify(rollbackObserver, never()).executeBootLoopMitigation(3);
+
+ moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS + 1);
+ Mockito.reset(rescuePartyObserver);
+
+ for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT; i++) {
+ watchdog.noteBoot();
+ }
+ verify(rescuePartyObserver).executeBootLoopMitigation(1);
+ verify(rescuePartyObserver, never()).executeBootLoopMitigation(2);
}
RollbackPackageHealthObserver setUpRollbackPackageHealthObserver(PackageWatchdog watchdog) {
@@ -506,16 +494,9 @@
}
try {
- if (Flags.recoverabilityDetection()) {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS,
- PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT));
- } else {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
+ mSpyBootThreshold = spy(watchdog.new BootThreshold(
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS));
- }
doAnswer((Answer<Integer>) invocationOnMock -> {
String storedValue = mCrashRecoveryPropertiesMap
@@ -640,5 +621,16 @@
public long uptimeMillis() {
return mUpTimeMillis;
}
+ public void moveTimeForward(long milliSeconds) {
+ mUpTimeMillis += milliSeconds;
+ }
+ }
+
+ private void moveTimeForwardAndDispatch(long milliSeconds) {
+ // Exhaust all due runnables now which shouldn't be executed after time-leap
+ mTestLooper.dispatchAll();
+ mTestClock.moveTimeForward(milliSeconds);
+ mTestLooper.moveTimeForward(milliSeconds);
+ mTestLooper.dispatchAll();
}
}
diff --git a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
index 4f27e06..093923f 100644
--- a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
+++ b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
@@ -45,13 +45,13 @@
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.DeviceConfig;
import android.util.AtomicFile;
+import android.util.LongArrayQueue;
import android.util.Xml;
-import android.utils.LongArrayQueue;
-import android.utils.XmlUtils;
import androidx.test.InstrumentationRegistry;
import com.android.dx.mockito.inline.extended.ExtendedMockito;
+import com.android.internal.util.XmlUtils;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.server.PackageWatchdog.HealthCheckState;
@@ -1224,7 +1224,7 @@
PackageWatchdog watchdog = createWatchdog();
TestObserver bootObserver = new TestObserver(OBSERVER_NAME_1);
watchdog.registerHealthObserver(bootObserver);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD; i++) {
+ for (int i = 0; i < 15; i++) {
watchdog.noteBoot();
}
assertThat(bootObserver.mitigatedBootLoop()).isTrue();
@@ -1262,22 +1262,6 @@
}
/**
- * Ensure that boot loop mitigation is not done when the number of boots does not meet the
- * threshold.
- */
- @Test
- public void testBootLoopDetection_doesNotMeetThresholdRecoverabilityHighImpact() {
- PackageWatchdog watchdog = createWatchdog();
- TestObserver bootObserver = new TestObserver(OBSERVER_NAME_1,
- PackageHealthObserverImpact.USER_IMPACT_LEVEL_80);
- watchdog.registerHealthObserver(bootObserver);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - 1; i++) {
- watchdog.noteBoot();
- }
- assertThat(bootObserver.mitigatedBootLoop()).isFalse();
- }
-
- /**
* Ensure that boot loop mitigation is done for the observer with the lowest user impact
*/
@Test
@@ -1306,7 +1290,7 @@
bootObserver2.setImpact(PackageHealthObserverImpact.USER_IMPACT_LEVEL_30);
watchdog.registerHealthObserver(bootObserver1);
watchdog.registerHealthObserver(bootObserver2);
- for (int i = 0; i < PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD; i++) {
+ for (int i = 0; i < 15; i++) {
watchdog.noteBoot();
}
assertThat(bootObserver1.mitigatedBootLoop()).isTrue();
@@ -1349,9 +1333,7 @@
watchdog.noteBoot();
}
for (int i = 0; i < 4; i++) {
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; j++) {
watchdog.noteBoot();
- }
}
moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS + 1);
@@ -1360,38 +1342,7 @@
watchdog.noteBoot();
}
for (int i = 0; i < 4; i++) {
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; j++) {
watchdog.noteBoot();
- }
- }
-
- assertThat(bootObserver.mBootMitigationCounts).isEqualTo(List.of(1, 2, 3, 4, 1, 2, 3, 4));
- }
-
- @Test
- public void testMultipleBootLoopMitigationRecoverabilityHighImpact() {
- PackageWatchdog watchdog = createWatchdog();
- TestObserver bootObserver = new TestObserver(OBSERVER_NAME_1,
- PackageHealthObserverImpact.USER_IMPACT_LEVEL_80);
- watchdog.registerHealthObserver(bootObserver);
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - 1; j++) {
- watchdog.noteBoot();
- }
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; j++) {
- watchdog.noteBoot();
- }
- }
-
- moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS + 1);
-
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_THRESHOLD - 1; j++) {
- watchdog.noteBoot();
- }
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT; j++) {
- watchdog.noteBoot();
- }
}
assertThat(bootObserver.mBootMitigationCounts).isEqualTo(List.of(1, 2, 3, 4, 1, 2, 3, 4));
@@ -1642,8 +1593,7 @@
mSpyBootThreshold = spy(watchdog.new BootThreshold(
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS,
- PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT));
+ PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS));
watchdog.saveAllObserversBootMitigationCountToMetadata(filePath);
@@ -1798,16 +1748,9 @@
mCrashRecoveryPropertiesMap = new HashMap<>();
try {
- if (Flags.recoverabilityDetection()) {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
- PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS,
- PackageWatchdog.DEFAULT_BOOT_LOOP_MITIGATION_INCREMENT));
- } else {
- mSpyBootThreshold = spy(watchdog.new BootThreshold(
+ mSpyBootThreshold = spy(watchdog.new BootThreshold(
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_COUNT,
PackageWatchdog.DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS));
- }
doAnswer((Answer<Integer>) invocationOnMock -> {
String storedValue = mCrashRecoveryPropertiesMap
diff --git a/tests/UsbManagerTests/Android.bp b/tests/UsbManagerTests/Android.bp
index c02d8e9..a0bb84d 100644
--- a/tests/UsbManagerTests/Android.bp
+++ b/tests/UsbManagerTests/Android.bp
@@ -21,6 +21,7 @@
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
+ default_team: "trendy_team_android_usb",
}
android_test {
diff --git a/tests/UsbTests/Android.bp b/tests/UsbTests/Android.bp
index 92c2711..c4ebdec 100644
--- a/tests/UsbTests/Android.bp
+++ b/tests/UsbTests/Android.bp
@@ -21,6 +21,7 @@
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
+ default_team: "trendy_team_android_usb",
}
android_test {