diff options
| -rw-r--r-- | Android.bp | 11 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 1 | ||||
| -rw-r--r-- | core/java/android/view/accessibility/AccessibilityManager.java | 2 | ||||
| -rw-r--r-- | core/jni/AndroidRuntime.cpp | 22 | ||||
| -rw-r--r-- | core/proto/android/os/system_properties.proto | 3 | ||||
| -rw-r--r-- | core/tests/utiltests/Android.bp | 38 | ||||
| -rw-r--r-- | core/tests/utiltests/Android.mk | 33 | ||||
| -rw-r--r-- | libs/hwui/renderthread/VulkanSurface.cpp | 154 | ||||
| -rw-r--r-- | libs/hwui/renderthread/VulkanSurface.h | 11 | ||||
| -rw-r--r-- | services/core/java/com/android/server/uri/UriGrantsManagerService.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityStack.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityTaskManagerService.java | 6 |
12 files changed, 135 insertions, 160 deletions
diff --git a/Android.bp b/Android.bp index 727842e063dc..490de6e1e44e 100644 --- a/Android.bp +++ b/Android.bp @@ -842,6 +842,7 @@ java_library { java_library { name: "framework-annotation-proc", defaults: ["framework-defaults"], + installable: false, // Use UsedByApps annotation processor plugins: ["unsupportedappusage-annotation-processor"], } @@ -1880,3 +1881,13 @@ aidl_mapping { srcs: [":framework-defaults"], output: "framework-aidl-mappings.txt", } + +genrule { + name: "framework-annotation-proc-index", + srcs: [":framework-annotation-proc"], + cmd: "unzip -qp $(in) unsupportedappusage/unsupportedappusage_index.csv > $(out)", + out: ["unsupportedappusage_index.csv"], + dist: { + targets: ["droidcore"], + }, +} diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index a2994af37e3e..cf858f585c85 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -8397,6 +8397,7 @@ public class PackageParser { PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0, Collections.emptySet(), state); pi.applicationInfo.sourceDir = apexFile.getPath(); + pi.applicationInfo.publicSourceDir = apexFile.getPath(); if (apexInfo.isFactory) { pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM; } else { diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index 882e6fd8e328..2e9d881f72f9 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -184,7 +184,7 @@ public final class AccessibilityManager { boolean mIsTouchExplorationEnabled; - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768939) + @UnsupportedAppUsage(trackingBug = 123768939L) boolean mIsHighTextContrastEnabled; AccessibilityPolicy mAccessibilityPolicy; diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 5611cc401021..dad4a28c4fcb 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -899,20 +899,16 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p addOption("-Ximage-compiler-option"); addOption("--compiler-filter=speed-profile"); } else { - // Make sure there is a preloaded-classes file. - if (!hasFile("/system/etc/preloaded-classes")) { - ALOGE("Missing preloaded-classes file, /system/etc/preloaded-classes not found: %s\n", - strerror(errno)); - return -1; - } - addOption("-Ximage-compiler-option"); - addOption("--image-classes=/system/etc/preloaded-classes"); + ALOGE("Missing boot-image.prof file, /system/etc/boot-image.prof not found: %s\n", + strerror(errno)); + return -1; + } - // If there is a dirty-image-objects file, push it. - if (hasFile("/system/etc/dirty-image-objects")) { - addOption("-Ximage-compiler-option"); - addOption("--dirty-image-objects=/system/etc/dirty-image-objects"); - } + + // If there is a dirty-image-objects file, push it. + if (hasFile("/system/etc/dirty-image-objects")) { + addOption("-Ximage-compiler-option"); + addOption("--dirty-image-objects=/system/etc/dirty-image-objects"); } property_get("dalvik.vm.image-dex2oat-flags", dex2oatImageFlagsBuf, ""); diff --git a/core/proto/android/os/system_properties.proto b/core/proto/android/os/system_properties.proto index d06e1a6c1ccd..7e26952a92da 100644 --- a/core/proto/android/os/system_properties.proto +++ b/core/proto/android/os/system_properties.proto @@ -497,8 +497,7 @@ message SystemPropertiesProto { } optional Telephony telephony = 38; - optional string url_legal = 39; - optional string url_legal_android_privacy = 40; + reserved 39, 40; // Removed url_legal* props message Vendor { optional string build_date = 1; diff --git a/core/tests/utiltests/Android.bp b/core/tests/utiltests/Android.bp new file mode 100644 index 000000000000..f13885e22b22 --- /dev/null +++ b/core/tests/utiltests/Android.bp @@ -0,0 +1,38 @@ +//######################################################################## +// Build FrameworksUtilTests package +//######################################################################## + +android_test { + name: "FrameworksUtilTests", + + // We only want this apk build for tests. + + // Include all test java files. + srcs: ["src/**/*.java"] + ["src/android/util/IRemoteMemoryIntArray.aidl"], + + jni_libs: [ + "libmemoryintarraytest", + "libcutils", + "libc++", + ], + + static_libs: [ + "androidx.test.rules", + "frameworks-base-testutils", + "mockito-target-minus-junit4", + "androidx.test.ext.junit", + ], + + libs: [ + "android.test.runner", + "android.test.base", + "android.test.mock", + ], + + platform_apis: true, + + certificate: "platform", + + test_suites: ["device-tests"], + +} diff --git a/core/tests/utiltests/Android.mk b/core/tests/utiltests/Android.mk deleted file mode 100644 index 9ef73e9aad93..000000000000 --- a/core/tests/utiltests/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -######################################################################### -# Build FrameworksUtilTests package -######################################################################### - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# We only want this apk build for tests. -LOCAL_MODULE_TAGS := tests - -# Include all test java files. -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_SRC_FILES += src/android/util/IRemoteMemoryIntArray.aidl - -LOCAL_JNI_SHARED_LIBRARIES := libmemoryintarraytest libcutils libc++ - -LOCAL_STATIC_JAVA_LIBRARIES := \ - androidx.test.rules \ - frameworks-base-testutils \ - mockito-target-minus-junit4 \ - androidx.test.ext.junit - -LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base android.test.mock - -LOCAL_PACKAGE_NAME := FrameworksUtilTests -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_CERTIFICATE := platform - -LOCAL_COMPATIBILITY_SUITE := device-tests - -include $(BUILD_PACKAGE) - diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp index 4f64da79c3fb..bbffb359aebe 100644 --- a/libs/hwui/renderthread/VulkanSurface.cpp +++ b/libs/hwui/renderthread/VulkanSurface.cpp @@ -27,15 +27,6 @@ namespace android { namespace uirenderer { namespace renderthread { -static bool IsTransformSupported(int transform) { - // For now, only support pure rotations, not flip or flip-and-rotate, until we have - // more time to test them and build sample code. As far as I know we never actually - // use anything besides pure rotations anyway. - return transform == 0 || transform == NATIVE_WINDOW_TRANSFORM_ROT_90 || - transform == NATIVE_WINDOW_TRANSFORM_ROT_180 || - transform == NATIVE_WINDOW_TRANSFORM_ROT_270; -} - static int InvertTransform(int transform) { switch (transform) { case NATIVE_WINDOW_TRANSFORM_ROT_90: @@ -68,28 +59,6 @@ static SkMatrix GetPreTransformMatrix(SkISize windowSize, int transform) { return SkMatrix::I(); } -void VulkanSurface::ComputeWindowSizeAndTransform(WindowInfo* windowInfo, const SkISize& minSize, - const SkISize& maxSize) { - SkISize& windowSize = windowInfo->size; - - // clamp width & height to handle currentExtent of -1 and protect us from broken hints - if (windowSize.width() < minSize.width() || windowSize.width() > maxSize.width() || - windowSize.height() < minSize.height() || windowSize.height() > maxSize.height()) { - int width = std::min(maxSize.width(), std::max(minSize.width(), windowSize.width())); - int height = std::min(maxSize.height(), std::max(minSize.height(), windowSize.height())); - ALOGE("Invalid Window Dimensions [%d, %d]; clamping to [%d, %d]", windowSize.width(), - windowSize.height(), width, height); - windowSize.set(width, height); - } - - windowInfo->actualSize = windowSize; - if (windowInfo->transform & NATIVE_WINDOW_TRANSFORM_ROT_90) { - windowInfo->actualSize.set(windowSize.height(), windowSize.width()); - } - - windowInfo->preTransform = GetPreTransformMatrix(windowInfo->size, windowInfo->transform); -} - static bool ConnectAndSetWindowDefaults(ANativeWindow* window) { ATRACE_CALL(); @@ -125,6 +94,24 @@ static bool ConnectAndSetWindowDefaults(ANativeWindow* window) { return false; } + // Let consumer drive the size of the buffers. + err = native_window_set_buffers_dimensions(window, 0, 0); + if (err != 0) { + ALOGE("native_window_set_buffers_dimensions(0,0) failed: %s (%d)", strerror(-err), err); + return false; + } + + // Enable auto prerotation, so when buffer size is driven by the consumer + // and the transform hint specifies a 90 or 270 degree rotation, the width + // and height used for buffer pre-allocation and dequeueBuffer will be + // additionally swapped. + err = native_window_set_auto_prerotation(window, true); + if (err != 0) { + ALOGE("VulkanSurface::UpdateWindow() native_window_set_auto_prerotation failed: %s (%d)", + strerror(-err), err); + return false; + } + return true; } @@ -132,10 +119,6 @@ VulkanSurface* VulkanSurface::Create(ANativeWindow* window, ColorMode colorMode, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, GrContext* grContext, const VulkanManager& vkManager, uint32_t extraBuffers) { - // TODO(http://b/134182502) - const SkISize minSize = SkISize::Make(1, 1); - const SkISize maxSize = SkISize::Make(4096, 4096); - // Connect and set native window to default configurations. if (!ConnectAndSetWindowDefaults(window)) { return nullptr; @@ -144,7 +127,7 @@ VulkanSurface* VulkanSurface::Create(ANativeWindow* window, ColorMode colorMode, // Initialize WindowInfo struct. WindowInfo windowInfo; if (!InitializeWindowInfoStruct(window, colorMode, colorType, colorSpace, vkManager, - extraBuffers, minSize, maxSize, &windowInfo)) { + extraBuffers, &windowInfo)) { return nullptr; } @@ -153,15 +136,14 @@ VulkanSurface* VulkanSurface::Create(ANativeWindow* window, ColorMode colorMode, return nullptr; } - return new VulkanSurface(window, windowInfo, minSize, maxSize, grContext); + return new VulkanSurface(window, windowInfo, grContext); } bool VulkanSurface::InitializeWindowInfoStruct(ANativeWindow* window, ColorMode colorMode, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const VulkanManager& vkManager, - uint32_t extraBuffers, const SkISize& minSize, - const SkISize& maxSize, WindowInfo* outWindowInfo) { + uint32_t extraBuffers, WindowInfo* outWindowInfo) { ATRACE_CALL(); int width, height; @@ -185,7 +167,13 @@ bool VulkanSurface::InitializeWindowInfoStruct(ANativeWindow* window, ColorMode } outWindowInfo->transform = query_value; - ComputeWindowSizeAndTransform(outWindowInfo, minSize, maxSize); + outWindowInfo->actualSize = outWindowInfo->size; + if (outWindowInfo->transform & NATIVE_WINDOW_TRANSFORM_ROT_90) { + outWindowInfo->actualSize.set(outWindowInfo->size.height(), outWindowInfo->size.width()); + } + + outWindowInfo->preTransform = + GetPreTransformMatrix(outWindowInfo->size, outWindowInfo->transform); err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { @@ -290,15 +278,6 @@ bool VulkanSurface::UpdateWindow(ANativeWindow* window, const WindowInfo& window return false; } - const SkISize& size = windowInfo.actualSize; - err = native_window_set_buffers_dimensions(window, size.width(), size.height()); - if (err != 0) { - ALOGE("VulkanSurface::UpdateWindow() native_window_set_buffers_dimensions(%d,%d) " - "failed: %s (%d)", - size.width(), size.height(), strerror(-err), err); - return false; - } - // native_window_set_buffers_transform() expects the transform the app is requesting that // the compositor perform during composition. With native windows, pre-transform works by // rendering with the same transform the compositor is applying (as in Vulkan), but @@ -331,12 +310,8 @@ bool VulkanSurface::UpdateWindow(ANativeWindow* window, const WindowInfo& window } VulkanSurface::VulkanSurface(ANativeWindow* window, const WindowInfo& windowInfo, - SkISize minWindowSize, SkISize maxWindowSize, GrContext* grContext) - : mNativeWindow(window) - , mWindowInfo(windowInfo) - , mGrContext(grContext) - , mMinWindowSize(minWindowSize) - , mMaxWindowSize(maxWindowSize) {} + GrContext* grContext) + : mNativeWindow(window), mWindowInfo(windowInfo), mGrContext(grContext) {} VulkanSurface::~VulkanSurface() { releaseBuffers(); @@ -379,56 +354,49 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() { // value at the end of the function if everything dequeued correctly. mCurrentBufferInfo = nullptr; - // check if the native window has been resized or rotated and update accordingly - SkISize newSize = SkISize::MakeEmpty(); + // Query the transform hint synced from the initial Surface connect or last queueBuffer. The + // auto prerotation on the buffer is based on the same transform hint in use by the producer. int transformHint = 0; - mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_WIDTH, &newSize.fWidth); - mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_HEIGHT, &newSize.fHeight); - mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_TRANSFORM_HINT, &transformHint); - if (newSize != mWindowInfo.actualSize || transformHint != mWindowInfo.transform) { - WindowInfo newWindowInfo = mWindowInfo; - newWindowInfo.size = newSize; - newWindowInfo.transform = IsTransformSupported(transformHint) ? transformHint : 0; - ComputeWindowSizeAndTransform(&newWindowInfo, mMinWindowSize, mMaxWindowSize); - - int err = 0; - if (newWindowInfo.actualSize != mWindowInfo.actualSize) { - // reset the native buffers and update the window - err = native_window_set_buffers_dimensions(mNativeWindow.get(), - newWindowInfo.actualSize.width(), - newWindowInfo.actualSize.height()); - if (err != 0) { - ALOGE("native_window_set_buffers_dimensions(%d,%d) failed: %s (%d)", - newWindowInfo.actualSize.width(), newWindowInfo.actualSize.height(), - strerror(-err), err); - return nullptr; - } + int err = + mNativeWindow->query(mNativeWindow.get(), NATIVE_WINDOW_TRANSFORM_HINT, &transformHint); + + // Since auto pre-rotation is enabled, dequeueBuffer to get the consumer driven buffer size + // from ANativeWindowBuffer. + ANativeWindowBuffer* buffer; + int fence_fd; + err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buffer, &fence_fd); + if (err != 0) { + ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), err); + return nullptr; + } + + SkISize actualSize = SkISize::Make(buffer->width, buffer->height); + if (actualSize != mWindowInfo.actualSize || transformHint != mWindowInfo.transform) { + if (actualSize != mWindowInfo.actualSize) { // reset the NativeBufferInfo (including SkSurface) associated with the old buffers. The // new NativeBufferInfo storage will be populated lazily as we dequeue each new buffer. + mWindowInfo.actualSize = actualSize; releaseBuffers(); - // TODO should we ask the nativewindow to allocate buffers? } - if (newWindowInfo.transform != mWindowInfo.transform) { + if (transformHint != mWindowInfo.transform) { err = native_window_set_buffers_transform(mNativeWindow.get(), - InvertTransform(newWindowInfo.transform)); + InvertTransform(transformHint)); if (err != 0) { - ALOGE("native_window_set_buffers_transform(%d) failed: %s (%d)", - newWindowInfo.transform, strerror(-err), err); - newWindowInfo.transform = mWindowInfo.transform; - ComputeWindowSizeAndTransform(&newWindowInfo, mMinWindowSize, mMaxWindowSize); + ALOGE("native_window_set_buffers_transform(%d) failed: %s (%d)", transformHint, + strerror(-err), err); + mNativeWindow->cancelBuffer(mNativeWindow.get(), buffer, fence_fd); + return nullptr; } + mWindowInfo.transform = transformHint; } - mWindowInfo = newWindowInfo; - } + mWindowInfo.size = actualSize; + if (mWindowInfo.transform & NATIVE_WINDOW_TRANSFORM_ROT_90) { + mWindowInfo.size.set(actualSize.height(), actualSize.width()); + } - ANativeWindowBuffer* buffer; - int fence_fd; - int err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buffer, &fence_fd); - if (err != 0) { - ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), err); - return nullptr; + mWindowInfo.preTransform = GetPreTransformMatrix(mWindowInfo.size, mWindowInfo.transform); } uint32_t idx; diff --git a/libs/hwui/renderthread/VulkanSurface.h b/libs/hwui/renderthread/VulkanSurface.h index 54007e771999..5fa860a20916 100644 --- a/libs/hwui/renderthread/VulkanSurface.h +++ b/libs/hwui/renderthread/VulkanSurface.h @@ -101,16 +101,12 @@ private: SkMatrix preTransform; }; - VulkanSurface(ANativeWindow* window, const WindowInfo& windowInfo, SkISize minWindowSize, - SkISize maxWindowSize, GrContext* grContext); + VulkanSurface(ANativeWindow* window, const WindowInfo& windowInfo, GrContext* grContext); static bool InitializeWindowInfoStruct(ANativeWindow* window, ColorMode colorMode, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const VulkanManager& vkManager, uint32_t extraBuffers, - const SkISize& minSize, const SkISize& maxSize, WindowInfo* outWindowInfo); static bool UpdateWindow(ANativeWindow* window, const WindowInfo& windowInfo); - static void ComputeWindowSizeAndTransform(WindowInfo* windowInfo, const SkISize& minSize, - const SkISize& maxSize); void releaseBuffers(); // TODO: Just use a vector? @@ -122,11 +118,8 @@ private: uint32_t mPresentCount = 0; NativeBufferInfo* mCurrentBufferInfo = nullptr; - - const SkISize mMinWindowSize; - const SkISize mMaxWindowSize; }; } /* namespace renderthread */ } /* namespace uirenderer */ -} /* namespace android */
\ No newline at end of file +} /* namespace android */ diff --git a/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/services/core/java/com/android/server/uri/UriGrantsManagerService.java index 8b332d271a3a..55f062bca2d1 100644 --- a/services/core/java/com/android/server/uri/UriGrantsManagerService.java +++ b/services/core/java/com/android/server/uri/UriGrantsManagerService.java @@ -1032,11 +1032,13 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { // must always grant permissions on behalf of someone explicit. final int callingAppId = UserHandle.getAppId(callingUid); if ((callingAppId == SYSTEM_UID) || (callingAppId == ROOT_UID)) { - if ("com.android.settings.files".equals(grantUri.uri.getAuthority())) { + if ("com.android.settings.files".equals(grantUri.uri.getAuthority()) + || "com.android.settings.module_licenses".equals(grantUri.uri.getAuthority())) { // Exempted authority for // 1. cropping user photos and sharing a generated license html // file in Settings app // 2. sharing a generated license html file in TvSettings app + // 3. Sharing module license files from Settings app } else { Slog.w(TAG, "For security reasons, the system cannot issue a Uri permission" + " grant to " + grantUri + "; use startActivityAsCaller() instead"); diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 8d39f98aba0f..157e15ac94f1 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -1302,6 +1302,11 @@ class ActivityStack extends ConfigurationContainer { return; } + getDisplay().positionChildAtBottom(this, reason); + if (task != null) { + insertTaskAtBottom(task); + } + /** * The intent behind moving a primary split screen stack to the back is usually to hide * behind the home stack. Exit split screen in this case. @@ -1309,11 +1314,6 @@ class ActivityStack extends ConfigurationContainer { if (getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) { setWindowingMode(WINDOWING_MODE_UNDEFINED); } - - getDisplay().positionChildAtBottom(this, reason); - if (task != null) { - insertTaskAtBottom(task); - } } boolean isFocusable() { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 16dd5552d693..6e3f03d34cab 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -3918,10 +3918,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { // Caller wants the current split-screen primary stack to be the top stack after // it goes fullscreen, so move it to the front. stack.moveToFront("dismissSplitScreenMode"); - } else if (mRootActivityContainer.isTopDisplayFocusedStack(stack)) { + } else { // In this case the current split-screen primary stack shouldn't be the top - // stack after it goes fullscreen, but it current has focus, so we move the - // focus to the top-most split-screen secondary stack next to it. + // stack after it goes fullscreen, so we move the focus to the top-most + // split-screen secondary stack next to it. final ActivityStack otherStack = stack.getDisplay().getTopStackInWindowingMode( WINDOWING_MODE_SPLIT_SCREEN_SECONDARY); if (otherStack != null) { |