diff options
26 files changed, 423 insertions, 263 deletions
diff --git a/core/java/android/os/ArtModuleServiceManager.java b/core/java/android/os/ArtModuleServiceManager.java index e0b631d69ca8..995094bb1318 100644 --- a/core/java/android/os/ArtModuleServiceManager.java +++ b/core/java/android/os/ArtModuleServiceManager.java @@ -37,10 +37,12 @@ public class ArtModuleServiceManager { /** A class that exposes the method to obtain each system service. */ public static final class ServiceRegisterer { @NonNull private final String mServiceName; + private final boolean mRetry; /** @hide */ - public ServiceRegisterer(@NonNull String serviceName) { + public ServiceRegisterer(@NonNull String serviceName, boolean retry) { mServiceName = serviceName; + mRetry = retry; } /** @@ -53,27 +55,47 @@ public class ArtModuleServiceManager { */ @Nullable public IBinder waitForService() { - return ServiceManager.waitForService(mServiceName); + if (mRetry) { + return ServiceManager.waitForService(mServiceName); + } + IBinder binder = ServiceManager.getService(mServiceName); + for (int remainingTimeMs = 5000; binder == null && remainingTimeMs > 0; + remainingTimeMs -= 100) { + // There can be a race: + // 1. Client A invokes "ctl.start", which starts the service. + // 2. Client A gets a service handle from `ServiceManager.getService`. + // 3. Client B invokes "ctl.start", which does nothing because the service is + // already running. + // 4. Client A drops the service handle. The service is notified that there is no + // more client at that point, so it shuts down itself. + // 5. Client B cannot get a service handle from `ServiceManager.getService` because + // the service is shut down. + // To address this problem, we invoke "ctl.start" repeatedly. + SystemProperties.set("ctl.start", mServiceName); + SystemClock.sleep(100); + binder = ServiceManager.getService(mServiceName); + } + return binder; } } /** Returns {@link ServiceRegisterer} for the "artd" service. */ @NonNull public ServiceRegisterer getArtdServiceRegisterer() { - return new ServiceRegisterer("artd"); + return new ServiceRegisterer("artd", true /* retry */); } /** Returns {@link ServiceRegisterer} for the "artd_pre_reboot" service. */ @NonNull @FlaggedApi(Flags.FLAG_USE_ART_SERVICE_V2) public ServiceRegisterer getArtdPreRebootServiceRegisterer() { - return new ServiceRegisterer("artd_pre_reboot"); + return new ServiceRegisterer("artd_pre_reboot", false /* retry */); } /** Returns {@link ServiceRegisterer} for the "dexopt_chroot_setup" service. */ @NonNull @FlaggedApi(Flags.FLAG_USE_ART_SERVICE_V2) public ServiceRegisterer getDexoptChrootSetupServiceRegisterer() { - return new ServiceRegisterer("dexopt_chroot_setup"); + return new ServiceRegisterer("dexopt_chroot_setup", true /* retry */); } } diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java index 92b630f3063a..80f39bfbdc21 100644 --- a/core/java/android/os/Handler.java +++ b/core/java/android/os/Handler.java @@ -46,13 +46,13 @@ import java.lang.reflect.Modifier; * a {@link Message} object containing a bundle of data that will be * processed by the Handler's {@link #handleMessage} method (requiring that * you implement a subclass of Handler). - * + * * <p>When posting or sending to a Handler, you can either * allow the item to be processed as soon as the message queue is ready * to do so, or specify a delay before it gets processed or absolute time for * it to be processed. The latter two allow you to implement timeouts, * ticks, and other timing-based behavior. - * + * * <p>When a * process is created for your application, its main thread is dedicated to * running a message queue that takes care of managing the top-level @@ -85,13 +85,13 @@ public class Handler { */ boolean handleMessage(@NonNull Message msg); } - + /** * Subclasses must implement this to receive messages. */ public void handleMessage(@NonNull Message msg) { } - + /** * Handle system messages here. */ @@ -343,8 +343,8 @@ public class Handler { * The default implementation will either return the class name of the * message callback if any, or the hexadecimal representation of the * message "what" field. - * - * @param message The message whose name is being queried + * + * @param message The message whose name is being queried */ @NonNull public String getMessageName(@NonNull Message message) { @@ -367,7 +367,7 @@ public class Handler { /** * Same as {@link #obtainMessage()}, except that it also sets the what member of the returned Message. - * + * * @param what Value to assign to the returned Message.what field. * @return A Message from the global message pool. */ @@ -376,12 +376,12 @@ public class Handler { { return Message.obtain(this, what); } - + /** - * - * Same as {@link #obtainMessage()}, except that it also sets the what and obj members + * + * Same as {@link #obtainMessage()}, except that it also sets the what and obj members * of the returned Message. - * + * * @param what Value to assign to the returned Message.what field. * @param obj Value to assign to the returned Message.obj field. * @return A Message from the global message pool. @@ -392,7 +392,7 @@ public class Handler { } /** - * + * * Same as {@link #obtainMessage()}, except that it also sets the what, arg1 and arg2 members of the returned * Message. * @param what Value to assign to the returned Message.what field. @@ -405,10 +405,10 @@ public class Handler { { return Message.obtain(this, what, arg1, arg2); } - + /** - * - * Same as {@link #obtainMessage()}, except that it also sets the what, obj, arg1,and arg2 values on the + * + * Same as {@link #obtainMessage()}, except that it also sets the what, obj, arg1,and arg2 values on the * returned Message. * @param what Value to assign to the returned Message.what field. * @param arg1 Value to assign to the returned Message.arg1 field. @@ -423,19 +423,19 @@ public class Handler { /** * Causes the Runnable r to be added to the message queue. - * The runnable will be run on the thread to which this handler is - * attached. - * + * The runnable will be run on the thread to which this handler is + * attached. + * * @param r The Runnable that will be executed. - * - * @return Returns true if the Runnable was successfully placed in to the + * + * @return Returns true if the Runnable was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ public final boolean post(@NonNull Runnable r) { return sendMessageDelayed(getPostMessage(r), 0); } - + /** * Causes the Runnable r to be added to the message queue, to be run * at a specific time given by <var>uptimeMillis</var>. @@ -446,8 +446,8 @@ public class Handler { * @param r The Runnable that will be executed. * @param uptimeMillis The absolute time at which the callback should run, * using the {@link android.os.SystemClock#uptimeMillis} time-base. - * - * @return Returns true if the Runnable was successfully placed in to the + * + * @return Returns true if the Runnable was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. Note that a * result of true does not mean the Runnable will be processed -- if @@ -457,7 +457,7 @@ public class Handler { public final boolean postAtTime(@NonNull Runnable r, long uptimeMillis) { return sendMessageAtTime(getPostMessage(r), uptimeMillis); } - + /** * Causes the Runnable r to be added to the message queue, to be run * at a specific time given by <var>uptimeMillis</var>. @@ -470,21 +470,21 @@ public class Handler { * {@link #removeCallbacksAndMessages}. * @param uptimeMillis The absolute time at which the callback should run, * using the {@link android.os.SystemClock#uptimeMillis} time-base. - * - * @return Returns true if the Runnable was successfully placed in to the + * + * @return Returns true if the Runnable was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. Note that a * result of true does not mean the Runnable will be processed -- if * the looper is quit before the delivery time of the message * occurs then the message will be dropped. - * + * * @see android.os.SystemClock#uptimeMillis */ public final boolean postAtTime( @NonNull Runnable r, @Nullable Object token, long uptimeMillis) { return sendMessageAtTime(getPostMessage(r, token), uptimeMillis); } - + /** * Causes the Runnable r to be added to the message queue, to be run * after the specified amount of time elapses. @@ -492,12 +492,12 @@ public class Handler { * is attached. * <b>The time-base is {@link android.os.SystemClock#uptimeMillis}.</b> * Time spent in deep sleep will add an additional delay to execution. - * + * * @param r The Runnable that will be executed. * @param delayMillis The delay (in milliseconds) until the Runnable * will be executed. - * - * @return Returns true if the Runnable was successfully placed in to the + * + * @return Returns true if the Runnable was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. Note that a * result of true does not mean the Runnable will be processed -- @@ -507,7 +507,7 @@ public class Handler { public final boolean postDelayed(@NonNull Runnable r, long delayMillis) { return sendMessageDelayed(getPostMessage(r), delayMillis); } - + /** @hide */ public final boolean postDelayed(Runnable r, int what, long delayMillis) { return sendMessageDelayed(getPostMessage(r).setWhat(what), delayMillis); @@ -547,10 +547,10 @@ public class Handler { * <b>This method is only for use in very special circumstances -- it * can easily starve the message queue, cause ordering problems, or have * other unexpected side-effects.</b> - * + * * @param r The Runnable that will be executed. - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -635,8 +635,8 @@ public class Handler { * Pushes a message onto the end of the message queue after all pending messages * before the current time. It will be received in {@link #handleMessage}, * in the thread attached to this handler. - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -646,8 +646,8 @@ public class Handler { /** * Sends a Message containing only the what value. - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -659,9 +659,9 @@ public class Handler { /** * Sends a Message containing only the what value, to be delivered * after the specified amount of time elapses. - * @see #sendMessageDelayed(android.os.Message, long) - * - * @return Returns true if the message was successfully placed in to the + * @see #sendMessageDelayed(android.os.Message, long) + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -672,11 +672,11 @@ public class Handler { } /** - * Sends a Message containing only the what value, to be delivered + * Sends a Message containing only the what value, to be delivered * at a specific time. * @see #sendMessageAtTime(android.os.Message, long) - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -691,8 +691,8 @@ public class Handler { * Enqueue a message into the message queue after all pending messages * before (current time + delayMillis). You will receive it in * {@link #handleMessage}, in the thread attached to this handler. - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. Note that a * result of true does not mean the message will be processed -- if @@ -713,12 +713,12 @@ public class Handler { * Time spent in deep sleep will add an additional delay to execution. * You will receive it in {@link #handleMessage}, in the thread attached * to this handler. - * + * * @param uptimeMillis The absolute time at which the message should be * delivered, using the * {@link android.os.SystemClock#uptimeMillis} time-base. - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. Note that a * result of true does not mean the message will be processed -- if @@ -743,8 +743,8 @@ public class Handler { * <b>This method is only for use in very special circumstances -- it * can easily starve the message queue, cause ordering problems, or have * other unexpected side-effects.</b> - * - * @return Returns true if the message was successfully placed in to the + * + * @return Returns true if the message was successfully placed in to the * message queue. Returns false on failure, usually because the * looper processing the message queue is exiting. */ @@ -798,6 +798,12 @@ public class Handler { /** * Remove any pending posts of messages with code 'what' that are in the * message queue. + * + * Note that `Message#what` is 0 unless otherwise set. + * When calling `postMessage(Runnable)` or `postAtTime(Runnable, long)`, + * the `Runnable` is internally wrapped with a `Message` whose `what` is 0. + * Calling `removeMessages(0)` will remove all messages without a `what`, + * including posted `Runnable`s. */ public final void removeMessages(int what) { mQueue.removeMessages(this, what, null); @@ -889,7 +895,7 @@ public class Handler { } // if we can get rid of this method, the handler need not remember its loop - // we could instead export a getMessageQueue() method... + // we could instead export a getMessageQueue() method... @NonNull public final Looper getLooper() { return mLooper; diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index 161951ead77f..09a43b0ac593 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -41,6 +41,9 @@ public final class Message implements Parcelable { * what this message is about. Each {@link Handler} has its own name-space * for message codes, so you do not need to worry about yours conflicting * with other handlers. + * + * If not specified, this value is 0. + * Use values other than 0 to indicate custom message codes. */ public int what; diff --git a/core/java/android/os/TransactionTooLargeException.java b/core/java/android/os/TransactionTooLargeException.java index 79892e060f49..6b7cb3310ee4 100644 --- a/core/java/android/os/TransactionTooLargeException.java +++ b/core/java/android/os/TransactionTooLargeException.java @@ -47,7 +47,7 @@ import android.os.RemoteException; * If possible, try to break up big requests into smaller pieces. * </p><p> * If you are implementing a service, it may help to impose size or complexity - * contraints on the queries that clients can perform. For example, if the result set + * constraints on the queries that clients can perform. For example, if the result set * could become large, then don't allow the client to request more than a few records * at a time. Alternately, instead of returning all of the available data all at once, * return the essential information first and make the client ask for additional information diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 7af196513cae..395848802a6f 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -623,21 +623,20 @@ public class ZygoteInit { */ private static Runnable forkSystemServer(String abiList, String socketName, ZygoteServer zygoteServer) { - long capabilities = posixCapabilitiesAsBits( - OsConstants.CAP_IPC_LOCK, - OsConstants.CAP_KILL, - OsConstants.CAP_NET_ADMIN, - OsConstants.CAP_NET_BIND_SERVICE, - OsConstants.CAP_NET_BROADCAST, - OsConstants.CAP_NET_RAW, - OsConstants.CAP_SYS_MODULE, - OsConstants.CAP_SYS_NICE, - OsConstants.CAP_SYS_PTRACE, - OsConstants.CAP_SYS_TIME, - OsConstants.CAP_SYS_TTY_CONFIG, - OsConstants.CAP_WAKE_ALARM, - OsConstants.CAP_BLOCK_SUSPEND - ); + long capabilities = + (1L << OsConstants.CAP_IPC_LOCK) | + (1L << OsConstants.CAP_KILL) | + (1L << OsConstants.CAP_NET_ADMIN) | + (1L << OsConstants.CAP_NET_BIND_SERVICE) | + (1L << OsConstants.CAP_NET_BROADCAST) | + (1L << OsConstants.CAP_NET_RAW) | + (1L << OsConstants.CAP_SYS_MODULE) | + (1L << OsConstants.CAP_SYS_NICE) | + (1L << OsConstants.CAP_SYS_PTRACE) | + (1L << OsConstants.CAP_SYS_TIME) | + (1L << OsConstants.CAP_SYS_TTY_CONFIG) | + (1L << OsConstants.CAP_WAKE_ALARM) | + (1L << OsConstants.CAP_BLOCK_SUSPEND); /* Containers run without some capabilities, so drop any caps that are not available. */ StructCapUserHeader header = new StructCapUserHeader( OsConstants._LINUX_CAPABILITY_VERSION_3, 0); @@ -734,20 +733,6 @@ public class ZygoteInit { } /** - * Gets the bit array representation of the provided list of POSIX capabilities. - */ - private static long posixCapabilitiesAsBits(int... capabilities) { - long result = 0; - for (int capability : capabilities) { - if ((capability < 0) || (capability > OsConstants.CAP_LAST_CAP)) { - throw new IllegalArgumentException(String.valueOf(capability)); - } - result |= (1L << capability); - } - return result; - } - - /** * This is the entry point for a Zygote process. It creates the Zygote server, loads resources, * and handles other tasks related to preparing the process for forking into applications. * diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index e82b2818adf8..921b77d61f4d 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -467,10 +467,25 @@ class JavaBBinderHolder public: sp<JavaBBinder> get(JNIEnv* env, jobject obj) { - AutoMutex _l(mLock); - sp<JavaBBinder> b = mBinder.promote(); - if (b == NULL) { - b = new JavaBBinder(env, obj); + sp<JavaBBinder> b; + { + AutoMutex _l(mLock); + // must take lock to promote because we set the same wp<> + // on another thread. + b = mBinder.promote(); + } + + if (b) return b; + + // b/360067751: constructor may trigger GC, so call outside lock + b = new JavaBBinder(env, obj); + + { + AutoMutex _l(mLock); + // if it was constructed on another thread in the meantime, + // return that. 'b' will just get destructed. + if (sp<JavaBBinder> b2 = mBinder.promote(); b2) return b2; + if (mVintf) { ::android::internal::Stability::markVintf(b.get()); } diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp index fba0d81d431f..7ad18b83f0d6 100644 --- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp +++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "NativeLibraryHelper" //#define LOG_NDEBUG 0 +#include <android-base/properties.h> #include <androidfw/ApkParsing.h> #include <androidfw/ZipFileRO.h> #include <androidfw/ZipUtils.h> @@ -36,6 +37,7 @@ #include <zlib.h> #include <memory> +#include <string> #include "com_android_internal_content_FileSystemUtils.h" #include "core_jni_helpers.h" @@ -125,72 +127,10 @@ sumFiles(JNIEnv*, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char return INSTALL_SUCCEEDED; } -/* - * Copy the native library if needed. - * - * This function assumes the library and path names passed in are considered safe. - */ -static install_status_t -copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntry, const char* fileName) -{ - static const size_t kPageSize = getpagesize(); - void** args = reinterpret_cast<void**>(arg); - jstring* javaNativeLibPath = (jstring*) args[0]; - jboolean extractNativeLibs = *(jboolean*) args[1]; - jboolean debuggable = *(jboolean*) args[2]; - - ScopedUtfChars nativeLibPath(env, *javaNativeLibPath); - - uint32_t uncompLen; - uint32_t when; - uint32_t crc; - - uint16_t method; - off64_t offset; - uint16_t extraFieldLength; - if (!zipFile->getEntryInfo(zipEntry, &method, &uncompLen, nullptr, &offset, &when, &crc, - &extraFieldLength)) { - ALOGE("Couldn't read zip entry info\n"); - return INSTALL_FAILED_INVALID_APK; - } - - // Always extract wrap.sh for debuggable, even if extractNativeLibs=false. This makes it - // easier to use wrap.sh because it only works when it is extracted, see - // frameworks/base/services/core/java/com/android/server/am/ProcessList.java. - bool forceExtractCurrentFile = debuggable && strcmp(fileName, "wrap.sh") == 0; - - if (!extractNativeLibs && !forceExtractCurrentFile) { - // check if library is uncompressed and page-aligned - if (method != ZipFileRO::kCompressStored) { - ALOGE("Library '%s' is compressed - will not be able to open it directly from apk.\n", - fileName); - return INSTALL_FAILED_INVALID_APK; - } - - if (offset % kPageSize != 0) { - ALOGE("Library '%s' is not PAGE(%zu)-aligned - will not be able to open it directly " - "from apk.\n", fileName, kPageSize); - return INSTALL_FAILED_INVALID_APK; - } - -#ifdef ENABLE_PUNCH_HOLES - // if library is uncompressed, punch hole in it in place - if (!punchHolesInElf64(zipFile->getZipFileName(), offset)) { - ALOGW("Failed to punch uncompressed elf file :%s inside apk : %s at offset: " - "%" PRIu64 "", - fileName, zipFile->getZipFileName(), offset); - } - - // if extra field for this zip file is present with some length, possibility is that it is - // padding added for zip alignment. Punch holes there too. - if (!punchHolesInZip(zipFile->getZipFileName(), offset, extraFieldLength)) { - ALOGW("Failed to punch apk : %s at extra field", zipFile->getZipFileName()); - } -#endif // ENABLE_PUNCH_HOLES - - return INSTALL_SUCCEEDED; - } - +static install_status_t extractNativeLibFromApk(ZipFileRO* zipFile, ZipEntryRO zipEntry, + const char* fileName, + const std::string nativeLibPath, uint32_t when, + uint32_t uncompLen, uint32_t crc) { // Build local file path const size_t fileNameLen = strlen(fileName); char localFileName[nativeLibPath.size() + fileNameLen + 2]; @@ -313,6 +253,88 @@ copyFileIfChanged(JNIEnv *env, void* arg, ZipFileRO* zipFile, ZipEntryRO zipEntr } /* + * Copy the native library if needed. + * + * This function assumes the library and path names passed in are considered safe. + */ +static install_status_t copyFileIfChanged(JNIEnv* env, void* arg, ZipFileRO* zipFile, + ZipEntryRO zipEntry, const char* fileName) { + static const size_t kPageSize = getpagesize(); + void** args = reinterpret_cast<void**>(arg); + jstring* javaNativeLibPath = (jstring*)args[0]; + jboolean extractNativeLibs = *(jboolean*)args[1]; + jboolean debuggable = *(jboolean*)args[2]; + jboolean app_compat_16kb = *(jboolean*)args[3]; + install_status_t ret = INSTALL_SUCCEEDED; + + ScopedUtfChars nativeLibPath(env, *javaNativeLibPath); + + uint32_t uncompLen; + uint32_t when; + uint32_t crc; + + uint16_t method; + off64_t offset; + uint16_t extraFieldLength; + if (!zipFile->getEntryInfo(zipEntry, &method, &uncompLen, nullptr, &offset, &when, &crc, + &extraFieldLength)) { + ALOGE("Couldn't read zip entry info\n"); + return INSTALL_FAILED_INVALID_APK; + } + + // Always extract wrap.sh for debuggable, even if extractNativeLibs=false. This makes it + // easier to use wrap.sh because it only works when it is extracted, see + // frameworks/base/services/core/java/com/android/server/am/ProcessList.java. + bool forceExtractCurrentFile = debuggable && strcmp(fileName, "wrap.sh") == 0; + + if (!extractNativeLibs && !forceExtractCurrentFile) { + // check if library is uncompressed and page-aligned + if (method != ZipFileRO::kCompressStored) { + ALOGE("Library '%s' is compressed - will not be able to open it directly from apk.\n", + fileName); + return INSTALL_FAILED_INVALID_APK; + } + + if (offset % kPageSize != 0) { + // If the library is zip-aligned correctly for 4kb devices and app compat is + // enabled, on 16kb devices fallback to extraction + if (offset % 0x1000 == 0 && app_compat_16kb) { + ALOGI("16kB AppCompat: Library '%s' is not PAGE(%zu)-aligned - falling back to " + "extraction from apk\n", + fileName, kPageSize); + return extractNativeLibFromApk(zipFile, zipEntry, fileName, nativeLibPath.c_str(), + when, uncompLen, crc); + } + + ALOGE("Library '%s' is not PAGE(%zu)-aligned - will not be able to open it directly " + "from apk.\n", + fileName, kPageSize); + return INSTALL_FAILED_INVALID_APK; + } + +#ifdef ENABLE_PUNCH_HOLES + // if library is uncompressed, punch hole in it in place + if (!punchHolesInElf64(zipFile->getZipFileName(), offset)) { + ALOGW("Failed to punch uncompressed elf file :%s inside apk : %s at offset: " + "%" PRIu64 "", + fileName, zipFile->getZipFileName(), offset); + } + + // if extra field for this zip file is present with some length, possibility is that it is + // padding added for zip alignment. Punch holes there too. + if (!punchHolesInZip(zipFile->getZipFileName(), offset, extraFieldLength)) { + ALOGW("Failed to punch apk : %s at extra field", zipFile->getZipFileName()); + } +#endif // ENABLE_PUNCH_HOLES + + return INSTALL_SUCCEEDED; + } + + return extractNativeLibFromApk(zipFile, zipEntry, fileName, nativeLibPath.c_str(), when, + uncompLen, crc); +} + +/* * An iterator over all shared libraries in a zip file. An entry is * considered to be a shared library if all of the conditions below are * satisfied : @@ -498,12 +520,24 @@ static int findSupportedAbi(JNIEnv* env, jlong apkHandle, jobjectArray supported return status; } +static inline bool app_compat_16kb_enabled() { + static const size_t kPageSize = getpagesize(); + + // App compat is only applicable on 16kb-page-size devices. + if (kPageSize != 0x4000) { + return false; + } + + return android::base::GetBoolProperty("bionic.linker.16kb.app_compat.enabled", false); +} + static jint com_android_internal_content_NativeLibraryHelper_copyNativeBinaries(JNIEnv *env, jclass clazz, jlong apkHandle, jstring javaNativeLibPath, jstring javaCpuAbi, jboolean extractNativeLibs, jboolean debuggable) { - void* args[] = { &javaNativeLibPath, &extractNativeLibs, &debuggable }; + jboolean app_compat_16kb = app_compat_16kb_enabled(); + void* args[] = { &javaNativeLibPath, &extractNativeLibs, &debuggable, &app_compat_16kb }; return (jint) iterateOverNativeFiles(env, apkHandle, javaCpuAbi, debuggable, copyFileIfChanged, reinterpret_cast<void*>(args)); } diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java index 038d0081ead8..122e86a1da8b 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java @@ -852,7 +852,8 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen @NonNull TaskContainer taskContainer) { // Update all TaskFragments in the Task. Make a copy of the list since some may be // removed on updating. - final List<TaskFragmentContainer> containers = taskContainer.getTaskFragmentContainers(); + final List<TaskFragmentContainer> containers + = new ArrayList<>(taskContainer.getTaskFragmentContainers()); for (int i = containers.size() - 1; i >= 0; i--) { final TaskFragmentContainer container = containers.get(i); // Wait until onTaskFragmentAppeared to update new container. diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/ScreenshotUtils.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/ScreenshotUtils.java index fad3dee1f927..1929729eb1ad 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/ScreenshotUtils.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/ScreenshotUtils.java @@ -42,6 +42,7 @@ public class ScreenshotUtils { .setSourceCrop(crop) .setCaptureSecureLayers(true) .setAllowProtected(true) + .setHintForSeamlessTransition(true) .build())); } @@ -78,6 +79,9 @@ public class ScreenshotUtils { mTransaction.setColorSpace(mScreenshot, buffer.getColorSpace()); mTransaction.reparent(mScreenshot, mParentSurfaceControl); mTransaction.setLayer(mScreenshot, mLayer); + if (buffer.containsHdrLayers()) { + mTransaction.setDimmingEnabled(mScreenshot, false); + } mTransaction.show(mScreenshot); mTransaction.apply(); } diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp index 43a70c176a83..5a4cff0c319e 100644 --- a/libs/androidfw/Asset.cpp +++ b/libs/androidfw/Asset.cpp @@ -309,9 +309,8 @@ Asset::Asset(void) return NULL; } - // We succeeded, so relinquish control of dataMap pAsset->mAccessMode = mode; - return std::move(pAsset); + return pAsset; } /* @@ -328,9 +327,8 @@ Asset::Asset(void) return NULL; } - // We succeeded, so relinquish control of dataMap pAsset->mAccessMode = mode; - return std::move(pAsset); + return pAsset; } /* diff --git a/media/native/midi/Android.bp b/media/native/midi/Android.bp index a991a71fd3f1..7acb8c744ba7 100644 --- a/media/native/midi/Android.bp +++ b/media/native/midi/Android.bp @@ -74,8 +74,4 @@ ndk_library { symbol_file: "libamidi.map.txt", first_version: "29", - export_header_libs: [ - "amidi", - ], - } diff --git a/native/android/Android.bp b/native/android/Android.bp index 7f3792d06795..597e8843f91f 100644 --- a/native/android/Android.bp +++ b/native/android/Android.bp @@ -27,9 +27,6 @@ ndk_library { symbol_file: "libandroid.map.txt", first_version: "9", unversioned_until: "current", - export_header_libs: [ - "libandroid_headers", - ], } cc_defaults { diff --git a/nfc/api/system-current.txt b/nfc/api/system-current.txt index 717e01e18dbd..0f97b2c8d443 100644 --- a/nfc/api/system-current.txt +++ b/nfc/api/system-current.txt @@ -73,6 +73,7 @@ package android.nfc { method public void onApplyRouting(@NonNull java.util.function.Consumer<java.lang.Boolean>); method public void onBootFinished(int); method public void onBootStarted(); + method public void onCardEmulationActivated(boolean); method public void onDisable(@NonNull java.util.function.Consumer<java.lang.Boolean>); method public void onDisableFinished(int); method public void onDisableStarted(); @@ -81,6 +82,8 @@ package android.nfc { method public void onEnableStarted(); method public void onHceEventReceived(int); method public void onNdefRead(@NonNull java.util.function.Consumer<java.lang.Boolean>); + method public void onRfDiscoveryStarted(boolean); + method public void onRfFieldActivated(boolean); method public void onRoutingChanged(); method public void onStateUpdated(int); method public void onTagConnected(boolean, @NonNull android.nfc.Tag); diff --git a/nfc/java/android/nfc/INfcAdapter.aidl b/nfc/java/android/nfc/INfcAdapter.aidl index 6c0f93354683..e2ec95215d1a 100644 --- a/nfc/java/android/nfc/INfcAdapter.aidl +++ b/nfc/java/android/nfc/INfcAdapter.aidl @@ -62,7 +62,7 @@ interface INfcAdapter void dispatch(in Tag tag); - void setReaderMode (IBinder b, IAppCallback callback, int flags, in Bundle extras); + void setReaderMode (IBinder b, IAppCallback callback, int flags, in Bundle extras, String pkg); void addNfcUnlockHandler(INfcUnlockHandler unlockHandler, in int[] techList); void removeNfcUnlockHandler(INfcUnlockHandler unlockHandler); @@ -100,7 +100,7 @@ interface INfcAdapter void unregisterWlcStateListener(in INfcWlcStateListener listener); WlcListenerDeviceInfo getWlcListenerDeviceInfo(); - void updateDiscoveryTechnology(IBinder b, int pollFlags, int listenFlags); + void updateDiscoveryTechnology(IBinder b, int pollFlags, int listenFlags, String pkg); void notifyPollingLoop(in PollingFrame frame); void notifyHceDeactivated(); diff --git a/nfc/java/android/nfc/INfcOemExtensionCallback.aidl b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl index c19a44ba0ff1..b65c83773618 100644 --- a/nfc/java/android/nfc/INfcOemExtensionCallback.aidl +++ b/nfc/java/android/nfc/INfcOemExtensionCallback.aidl @@ -37,4 +37,7 @@ interface INfcOemExtensionCallback { void onTagDispatch(in ResultReceiver isSkipped); void onRoutingChanged(); void onHceEventReceived(int action); + void onCardEmulationActivated(boolean isActivated); + void onRfFieldActivated(boolean isActivated); + void onRfDiscoveryStarted(boolean isDiscoveryStarted); } diff --git a/nfc/java/android/nfc/NfcActivityManager.java b/nfc/java/android/nfc/NfcActivityManager.java index 0eb846d6c72a..909eca7b0c9d 100644 --- a/nfc/java/android/nfc/NfcActivityManager.java +++ b/nfc/java/android/nfc/NfcActivityManager.java @@ -236,7 +236,8 @@ public final class NfcActivityManager extends IAppCallback.Stub public void setReaderMode(Binder token, int flags, Bundle extras) { if (DBG) Log.d(TAG, "Setting reader mode"); - NfcAdapter.callService(() -> NfcAdapter.sService.setReaderMode(token, this, flags, extras)); + NfcAdapter.callService(() -> NfcAdapter.sService.setReaderMode( + token, this, flags, extras, mAdapter.getContext().getPackageName())); } /** @@ -395,7 +396,8 @@ public final class NfcActivityManager extends IAppCallback.Stub private void changeDiscoveryTech(Binder token, int pollTech, int listenTech) { NfcAdapter.callService( - () -> NfcAdapter.sService.updateDiscoveryTechnology(token, pollTech, listenTech)); + () -> NfcAdapter.sService.updateDiscoveryTechnology( + token, pollTech, listenTech, mAdapter.getContext().getPackageName())); } } diff --git a/nfc/java/android/nfc/NfcAdapter.java b/nfc/java/android/nfc/NfcAdapter.java index 525e2c58a82c..22ae612b5cfc 100644 --- a/nfc/java/android/nfc/NfcAdapter.java +++ b/nfc/java/android/nfc/NfcAdapter.java @@ -1731,7 +1731,8 @@ public final class NfcAdapter { } Binder token = new Binder(); int flags = enable ? ENABLE_POLLING_FLAGS : DISABLE_POLLING_FLAGS; - callService(() -> sService.setReaderMode(token, null, flags, null)); + callService(() -> sService.setReaderMode( + token, null, flags, null, mContext.getPackageName())); } /** @@ -1804,7 +1805,8 @@ public final class NfcAdapter { || (listenTechnology & FLAG_SET_DEFAULT_TECH) == FLAG_SET_DEFAULT_TECH)) { Binder token = new Binder(); callService( () -> - sService.updateDiscoveryTechnology(token, pollTechnology, listenTechnology)); + sService.updateDiscoveryTechnology( + token, pollTechnology, listenTechnology, mContext.getPackageName())); } else { mNfcActivityManager.setDiscoveryTech(activity, pollTechnology, listenTechnology); } diff --git a/nfc/java/android/nfc/NfcOemExtension.java b/nfc/java/android/nfc/NfcOemExtension.java index 6c02edd0eafa..632f693c4fad 100644 --- a/nfc/java/android/nfc/NfcOemExtension.java +++ b/nfc/java/android/nfc/NfcOemExtension.java @@ -32,7 +32,9 @@ import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; @@ -40,6 +42,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; @@ -58,10 +61,13 @@ public final class NfcOemExtension { private static final int OEM_EXTENSION_RESPONSE_THRESHOLD_MS = 2000; private final NfcAdapter mAdapter; private final NfcOemExtensionCallback mOemNfcExtensionCallback; + private boolean mIsRegistered = false; + private final Map<Callback, Executor> mCallbackMap = new HashMap<>(); private final Context mContext; - private Executor mExecutor = null; - private Callback mCallback = null; private final Object mLock = new Object(); + private boolean mCardEmulationActivated = false; + private boolean mRfFieldActivated = false; + private boolean mRfDiscoveryStarted = false; /** * Event that Host Card Emulation is activated. @@ -215,6 +221,32 @@ public final class NfcOemExtension { * @param action Flag indicating actions to activate, start and stop cpu boost. */ void onHceEventReceived(@HostCardEmulationAction int action); + + /** + * Notifies NFC is activated in listen mode. + * NFC Forum NCI-2.3 ch.5.2.6 specification + * + * <p>NFCC is ready to communicate with a Card reader + * + * @param isActivated true, if card emulation activated, else de-activated. + */ + void onCardEmulationActivated(boolean isActivated); + + /** + * Notifies the Remote NFC Endpoint RF Field is activated. + * NFC Forum NCI-2.3 ch.5.3 specification + * + * @param isActivated true, if RF Field is ON, else RF Field is OFF. + */ + void onRfFieldActivated(boolean isActivated); + + /** + * Notifies the NFC RF discovery is started or in the IDLE state. + * NFC Forum NCI-2.3 ch.5.2 specification + * + * @param isDiscoveryStarted true, if RF discovery started, else RF state is Idle. + */ + void onRfDiscoveryStarted(boolean isDiscoveryStarted); } @@ -229,7 +261,12 @@ public final class NfcOemExtension { /** * Register an {@link Callback} to listen for NFC oem extension callbacks + * Multiple clients can register and callbacks will be invoked asynchronously. + * * <p>The provided callback will be invoked by the given {@link Executor}. + * As part of {@link #registerCallback(Executor, Callback)} the + * {@link Callback} will be invoked with current NFC state + * before the {@link #registerCallback(Executor, Callback)} function completes. * * @param executor an {@link Executor} to execute given callback * @param callback oem implementation of {@link Callback} @@ -239,15 +276,35 @@ public final class NfcOemExtension { public void registerCallback(@NonNull @CallbackExecutor Executor executor, @NonNull Callback callback) { synchronized (mLock) { - if (mCallback != null) { + if (executor == null || callback == null) { + Log.e(TAG, "Executor and Callback must not be null!"); + throw new IllegalArgumentException(); + } + + if (mCallbackMap.containsKey(callback)) { Log.e(TAG, "Callback already registered. Unregister existing callback before" + "registering"); throw new IllegalArgumentException(); } - NfcAdapter.callService(() -> { - NfcAdapter.sService.registerOemExtensionCallback(mOemNfcExtensionCallback); - mCallback = callback; - mExecutor = executor; + mCallbackMap.put(callback, executor); + if (!mIsRegistered) { + NfcAdapter.callService(() -> { + NfcAdapter.sService.registerOemExtensionCallback(mOemNfcExtensionCallback); + mIsRegistered = true; + }); + } else { + updateNfCState(callback, executor); + } + } + } + + private void updateNfCState(Callback callback, Executor executor) { + if (callback != null) { + Log.i(TAG, "updateNfCState"); + executor.execute(() -> { + callback.onCardEmulationActivated(mCardEmulationActivated); + callback.onRfFieldActivated(mRfFieldActivated); + callback.onRfDiscoveryStarted(mRfDiscoveryStarted); }); } } @@ -266,15 +323,19 @@ public final class NfcOemExtension { @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void unregisterCallback(@NonNull Callback callback) { synchronized (mLock) { - if (mCallback == null || mCallback != callback) { + if (!mCallbackMap.containsKey(callback) || !mIsRegistered) { Log.e(TAG, "Callback not registered"); throw new IllegalArgumentException(); } - NfcAdapter.callService(() -> { - NfcAdapter.sService.unregisterOemExtensionCallback(mOemNfcExtensionCallback); - mCallback = null; - mExecutor = null; - }); + if (mCallbackMap.size() == 1) { + NfcAdapter.callService(() -> { + NfcAdapter.sService.unregisterOemExtensionCallback(mOemNfcExtensionCallback); + mIsRegistered = false; + mCallbackMap.remove(callback); + }); + } else { + mCallbackMap.remove(callback); + } } } @@ -322,90 +383,133 @@ public final class NfcOemExtension { } 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); - } - } + mCallbackMap.forEach((cb, ex) -> + handleVoid2ArgCallback(connected, tag, cb::onTagConnected, ex)); + } + + @Override + public void onCardEmulationActivated(boolean isActivated) throws RemoteException { + mCardEmulationActivated = isActivated; + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(isActivated, cb::onCardEmulationActivated, ex)); + } + + @Override + public void onRfFieldActivated(boolean isActivated) throws RemoteException { + mRfFieldActivated = isActivated; + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(isActivated, cb::onRfFieldActivated, ex)); + } + + @Override + public void onRfDiscoveryStarted(boolean isDiscoveryStarted) throws RemoteException { + mRfDiscoveryStarted = isDiscoveryStarted; + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(isDiscoveryStarted, cb::onRfDiscoveryStarted, ex)); } + @Override public void onStateUpdated(int state) throws RemoteException { - handleVoidCallback(state, mCallback::onStateUpdated); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(state, cb::onStateUpdated, ex)); } + @Override public void onApplyRouting(ResultReceiver isSkipped) throws RemoteException { - handleVoidCallback( - new ReceiverWrapper(isSkipped), mCallback::onApplyRouting); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback( + new ReceiverWrapper(isSkipped), cb::onApplyRouting, ex)); } @Override public void onNdefRead(ResultReceiver isSkipped) throws RemoteException { - handleVoidCallback( - new ReceiverWrapper(isSkipped), mCallback::onNdefRead); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback( + new ReceiverWrapper(isSkipped), cb::onNdefRead, ex)); } @Override public void onEnable(ResultReceiver isAllowed) throws RemoteException { - handleVoidCallback( - new ReceiverWrapper(isAllowed), mCallback::onEnable); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback( + new ReceiverWrapper(isAllowed), cb::onEnable, ex)); } @Override public void onDisable(ResultReceiver isAllowed) throws RemoteException { - handleVoidCallback( - new ReceiverWrapper(isAllowed), mCallback::onDisable); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback( + new ReceiverWrapper(isAllowed), cb::onDisable, ex)); } @Override public void onBootStarted() throws RemoteException { - handleVoidCallback(null, (Object input) -> mCallback.onBootStarted()); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(null, (Object input) -> cb.onBootStarted(), ex)); } @Override public void onEnableStarted() throws RemoteException { - handleVoidCallback(null, (Object input) -> mCallback.onEnableStarted()); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(null, (Object input) -> cb.onEnableStarted(), ex)); } @Override public void onDisableStarted() throws RemoteException { - handleVoidCallback(null, (Object input) -> mCallback.onDisableStarted()); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(null, (Object input) -> cb.onDisableStarted(), ex)); } @Override public void onBootFinished(int status) throws RemoteException { - handleVoidCallback(status, mCallback::onBootFinished); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(status, cb::onBootFinished, ex)); } @Override public void onEnableFinished(int status) throws RemoteException { - handleVoidCallback(status, mCallback::onEnableFinished); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(status, cb::onEnableFinished, ex)); } @Override public void onDisableFinished(int status) throws RemoteException { - handleVoidCallback(status, mCallback::onDisableFinished); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(status, cb::onDisableFinished, ex)); } @Override public void onTagDispatch(ResultReceiver isSkipped) throws RemoteException { - handleVoidCallback( - new ReceiverWrapper(isSkipped), mCallback::onTagDispatch); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback( + new ReceiverWrapper(isSkipped), cb::onTagDispatch, ex)); } @Override public void onRoutingChanged() throws RemoteException { - handleVoidCallback(null, (Object input) -> mCallback.onRoutingChanged()); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(null, (Object input) -> cb.onRoutingChanged(), ex)); } @Override public void onHceEventReceived(int action) throws RemoteException { - handleVoidCallback(action, mCallback::onHceEventReceived); + mCallbackMap.forEach((cb, ex) -> + handleVoidCallback(action, cb::onHceEventReceived, ex)); } - private <T> void handleVoidCallback(T input, Consumer<T> callbackMethod) { + private <T> void handleVoidCallback( + T input, Consumer<T> callbackMethod, Executor executor) { synchronized (mLock) { - if (mCallback == null || mExecutor == null) { - return; + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> callbackMethod.accept(input)); + } catch (RuntimeException ex) { + throw ex; + } finally { + Binder.restoreCallingIdentity(identity); } + } + } + + private <T1, T2> void handleVoid2ArgCallback( + T1 input1, T2 input2, BiConsumer<T1, T2> callbackMethod, Executor executor) { + synchronized (mLock) { final long identity = Binder.clearCallingIdentity(); try { - mExecutor.execute(() -> callbackMethod.accept(input)); + executor.execute(() -> callbackMethod.accept(input1, input2)); + } catch (RuntimeException ex) { + throw ex; } finally { Binder.restoreCallingIdentity(identity); } @@ -415,17 +519,12 @@ public final class NfcOemExtension { private <S, T> S handleNonVoidCallbackWithInput( S defaultValue, T input, Function<T, S> callbackMethod) throws RemoteException { synchronized (mLock) { - if (mCallback == null) { - return defaultValue; - } final long identity = Binder.clearCallingIdentity(); S result = defaultValue; try { ExecutorService executor = Executors.newSingleThreadExecutor(); - FutureTask<S> futureTask = new FutureTask<>( - () -> callbackMethod.apply(input) - ); - executor.submit(futureTask); + FutureTask<S> futureTask = new FutureTask<>(() -> callbackMethod.apply(input)); + var unused = executor.submit(futureTask); try { result = futureTask.get( OEM_EXTENSION_RESPONSE_THRESHOLD_MS, TimeUnit.MILLISECONDS); @@ -447,17 +546,12 @@ public final class NfcOemExtension { private <T> T handleNonVoidCallbackWithoutInput(T defaultValue, Supplier<T> callbackMethod) throws RemoteException { synchronized (mLock) { - if (mCallback == null) { - return defaultValue; - } final long identity = Binder.clearCallingIdentity(); T result = defaultValue; try { ExecutorService executor = Executors.newSingleThreadExecutor(); - FutureTask<T> futureTask = new FutureTask<>( - callbackMethod::get - ); - executor.submit(futureTask); + FutureTask<T> futureTask = new FutureTask<>(callbackMethod::get); + var unused = executor.submit(futureTask); try { result = futureTask.get( OEM_EXTENSION_RESPONSE_THRESHOLD_MS, TimeUnit.MILLISECONDS); diff --git a/nfc/java/android/nfc/flags.aconfig b/nfc/java/android/nfc/flags.aconfig index 468147fc6f33..9a4ee2fa22ab 100644 --- a/nfc/java/android/nfc/flags.aconfig +++ b/nfc/java/android/nfc/flags.aconfig @@ -140,3 +140,11 @@ flag { description: "Enable override and recover routing table" bug: "329043523" } + +flag { + name: "nfc_watchdog" + is_exported: true + namespace: "nfc" + description: "Enable watchdog for the NFC system process" + bug: "362937338" +}
\ No newline at end of file diff --git a/ravenwood/OWNERS b/ravenwood/OWNERS index a90328c2e8c6..3d465205e3fc 100644 --- a/ravenwood/OWNERS +++ b/ravenwood/OWNERS @@ -1,7 +1,9 @@ set noparent -jsharkey@google.com omakoto@google.com +topjohnwu@google.com +hackbod@google.com #{LAST_RESORT_SUGGESTION} + per-file ravenwood-annotation-allowed-classes.txt = dplotnikov@google.com per-file texts/ravenwood-annotation-allowed-classes.txt = dplotnikov@google.com diff --git a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java index d0b8990e37c4..f44b85273af6 100644 --- a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java +++ b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java @@ -142,7 +142,6 @@ class RebootEscrowManager { ERROR_KEYSTORE_FAILURE, ERROR_NO_NETWORK, ERROR_TIMEOUT_EXHAUSTED, - ERROR_NO_REBOOT_ESCROW_DATA, }) @Retention(RetentionPolicy.SOURCE) @interface RebootEscrowErrorCode { @@ -158,7 +157,6 @@ class RebootEscrowManager { static final int ERROR_KEYSTORE_FAILURE = 7; static final int ERROR_NO_NETWORK = 8; static final int ERROR_TIMEOUT_EXHAUSTED = 9; - static final int ERROR_NO_REBOOT_ESCROW_DATA = 10; private @RebootEscrowErrorCode int mLoadEscrowDataErrorCode = ERROR_NONE; @@ -507,9 +505,6 @@ class RebootEscrowManager { if (rebootEscrowUsers.isEmpty()) { Slog.i(TAG, "No reboot escrow data found for users," + " skipping loading escrow data"); - setLoadEscrowDataErrorCode(ERROR_NO_REBOOT_ESCROW_DATA, retryHandler); - reportMetricOnRestoreComplete( - /* success= */ false, /* attemptCount= */ 1, retryHandler); clearMetricsStorage(); return; } diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 200d004805c7..d9fa1b80b44f 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -5435,18 +5435,18 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile } if (!paths.getOverlayPaths().isEmpty()) { pw.print(prefix); - pw.println(" "); + pw.print(" "); pw.print(libOverlayPaths.getKey()); pw.println(" overlay paths:"); for (String path : paths.getOverlayPaths()) { pw.print(prefix); - pw.print(" "); + pw.print(" "); pw.println(path); } } if (!paths.getResourceDirs().isEmpty()) { pw.print(prefix); - pw.println(" "); + pw.print(" "); pw.print(libOverlayPaths.getKey()); pw.println(" legacy overlay paths:"); for (String path : paths.getResourceDirs()) { diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java index 226e5fe3a6b6..93029920dea5 100644 --- a/services/core/java/com/android/server/power/ThermalManagerService.java +++ b/services/core/java/com/android/server/power/ThermalManagerService.java @@ -54,6 +54,7 @@ import android.os.ShellCallback; import android.os.ShellCommand; import android.os.SystemClock; import android.os.Temperature; +import android.os.Trace; import android.util.ArrayMap; import android.util.EventLog; import android.util.Slog; @@ -247,6 +248,7 @@ public class ThermalManagerService extends SystemService { private void setStatusLocked(int newStatus) { if (newStatus != mStatus) { + Trace.traceCounter(Trace.TRACE_TAG_POWER, "ThermalManagerService.status", newStatus); mStatus = newStatus; notifyStatusListenersLocked(); } diff --git a/services/core/java/com/android/server/wm/OWNERS b/services/core/java/com/android/server/wm/OWNERS index 60454fc5d7c6..5d2c50c8aaca 100644 --- a/services/core/java/com/android/server/wm/OWNERS +++ b/services/core/java/com/android/server/wm/OWNERS @@ -24,6 +24,7 @@ pdwilliams@google.com per-file Background*Start* = set noparent per-file Background*Start* = file:/BAL_OWNERS per-file Background*Start* = ogunwale@google.com, louischang@google.com +per-file BackgroundLaunchProcessController.java = file:/BAL_OWNERS # File related to activity callers per-file ActivityCallerState.java = file:/core/java/android/app/COMPONENT_CALLER_OWNERS diff --git a/services/tests/appfunctions/OWNERS b/services/tests/appfunctions/OWNERS new file mode 100644 index 000000000000..7fa891736efe --- /dev/null +++ b/services/tests/appfunctions/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 1627156 +include platform/frameworks/base:/core/java/android/app/appfunctions/OWNERS diff --git a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java index 17b499e112bc..d6f7e21a2069 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java @@ -625,25 +625,10 @@ public class RebootEscrowManagerTests { // pretend reboot happens here when(mInjected.getBootCount()).thenReturn(1); - ArgumentCaptor<Boolean> metricsSuccessCaptor = ArgumentCaptor.forClass(Boolean.class); - ArgumentCaptor<Integer> metricsErrorCodeCaptor = ArgumentCaptor.forClass(Integer.class); - doNothing() - .when(mInjected) - .reportMetric( - metricsSuccessCaptor.capture(), - metricsErrorCodeCaptor.capture(), - eq(2) /* Server based */, - eq(1) /* attempt count */, - anyInt(), - eq(0) /* vbmeta status */, - anyInt()); + mService.loadRebootEscrowDataIfAvailable(null); verify(mServiceConnection, never()).unwrap(any(), anyLong()); verify(mCallbacks, never()).onRebootEscrowRestored(anyByte(), any(), anyInt()); - assertFalse(metricsSuccessCaptor.getValue()); - assertEquals( - Integer.valueOf(RebootEscrowManager.ERROR_NO_REBOOT_ESCROW_DATA), - metricsErrorCodeCaptor.getValue()); } @Test |