Merge "Adds kennethford@ and lihongyu@ to devicestate package OWNERS" 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/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/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/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 8a55616..445880c 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3188,6 +3188,16 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
+ * {@link #hasSystemFeature}: This device is capable of launching apps in automotive display
+ * compatibility mode.
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.FEATURE)
+ public static final String FEATURE_CAR_DISPLAY_COMPATIBILITY =
+ "android.software.car.display_compatibility";
+
+ /**
+ * Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature(String, int)}: If this feature is supported, the device supports
* {@link android.security.identity.IdentityCredentialStore} implemented in secure hardware
* at the given feature version.
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/os/Parcel.java b/core/java/android/os/Parcel.java
index 8e860c3..0c70750 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -572,6 +572,11 @@
}
res.mReadWriteHelper = ReadWriteHelper.DEFAULT;
}
+
+ if (res.mNativePtr == 0) {
+ Log.e(TAG, "Obtained Parcel object has null native pointer. Invalid state.");
+ }
+
return res;
}
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/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/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/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/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/AccessibilityMenuService.java b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/AccessibilityMenuService.java
index 085fc29..b05d2ae 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/AccessibilityMenuService.java
+++ b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/AccessibilityMenuService.java
@@ -387,6 +387,10 @@
unregisterReceiver(mToggleMenuReceiver);
mPrefs.unregisterOnSharedPreferenceChangeListener(mSharedPreferenceChangeListener);
sInitialized = false;
+ if (mA11yMenuLayout != null) {
+ mA11yMenuLayout.clearLayout();
+ mA11yMenuLayout = null;
+ }
return super.onUnbind(intent);
}
diff --git a/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuOverlayLayout.java b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuOverlayLayout.java
index edd6a48..1be04f8 100644
--- a/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuOverlayLayout.java
+++ b/packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuOverlayLayout.java
@@ -151,6 +151,14 @@
return mLayout;
}
+ public void clearLayout() {
+ if (mLayout != null) {
+ mWindowManager.removeView(mLayout);
+ mLayout.setOnTouchListener(null);
+ mLayout = null;
+ }
+ }
+
/** Updates view layout with new layout parameters only. */
public void updateViewLayout() {
if (mLayout == null || mLayoutParameter == null) {
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/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 65c2cc5..e876527 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -349,7 +349,7 @@
// LMK_PROCKILL
// LMK_UPDATE_PROPS
// LMK_KILL_OCCURRED
- // LMK_STATE_CHANGED
+ // LMK_START_MONITORING
static final byte LMK_TARGET = 0;
static final byte LMK_PROCPRIO = 1;
static final byte LMK_PROCREMOVE = 2;
@@ -359,7 +359,6 @@
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
// Low Memory Killer Daemon command codes.
@@ -960,14 +959,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/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);
+ }
}