diff options
115 files changed, 2694 insertions, 345 deletions
diff --git a/apct-tests/perftests/healthconnect/OWNERS b/apct-tests/perftests/healthconnect/OWNERS index acfe799314ec..7c9e7692a9fc 100644 --- a/apct-tests/perftests/healthconnect/OWNERS +++ b/apct-tests/perftests/healthconnect/OWNERS @@ -1,5 +1,4 @@ # Bug component: 1219472 -arkivanov@google.com jstembridge@google.com itsleo@google.com diff --git a/api/OWNERS b/api/OWNERS index f2bcf13d2d2e..31ffa8cd4e9f 100644 --- a/api/OWNERS +++ b/api/OWNERS @@ -1,4 +1,3 @@ -hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS diff --git a/cmds/idmap2/OWNERS b/cmds/idmap2/OWNERS index 062ffd41348a..def9f401e51f 100644 --- a/cmds/idmap2/OWNERS +++ b/cmds/idmap2/OWNERS @@ -1,4 +1,3 @@ set noparent -toddke@google.com patb@google.com zyy@google.com diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 7273e64846c0..e88d7ab3a725 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -550,35 +550,35 @@ public class ActivityManager { public static final int START_ASSISTANT_NOT_ACTIVE_SESSION = FIRST_START_FATAL_ERROR_CODE + 11; /** - * Result for IActivityManaqer.startActivity: the activity was started + * Result for IActivityManager.startActivity: the activity was started * successfully as normal. * @hide */ public static final int START_SUCCESS = FIRST_START_SUCCESS_CODE; /** - * Result for IActivityManaqer.startActivity: the caller asked that the Intent not + * Result for IActivityManager.startActivity: the caller asked that the Intent not * be executed if it is the recipient, and that is indeed the case. * @hide */ public static final int START_RETURN_INTENT_TO_CALLER = FIRST_START_SUCCESS_CODE + 1; /** - * Result for IActivityManaqer.startActivity: activity was started or brought forward in an + * Result for IActivityManager.startActivity: activity was started or brought forward in an * existing task which was brought to the foreground. * @hide */ public static final int START_TASK_TO_FRONT = FIRST_START_SUCCESS_CODE + 2; /** - * Result for IActivityManaqer.startActivity: activity wasn't really started, but + * Result for IActivityManager.startActivity: activity wasn't really started, but * the given Intent was given to the existing top activity. * @hide */ public static final int START_DELIVERED_TO_TOP = FIRST_START_SUCCESS_CODE + 3; /** - * Result for IActivityManaqer.startActivity: request was canceled because + * Result for IActivityManager.startActivity: request was canceled because * app switches are temporarily canceled to ensure the user's last request * (such as pressing home) is performed. * @hide @@ -586,7 +586,7 @@ public class ActivityManager { public static final int START_SWITCHES_CANCELED = FIRST_START_NON_FATAL_ERROR_CODE; /** - * Result for IActivityManaqer.startActivity: a new activity was attempted to be started + * Result for IActivityManager.startActivity: a new activity was attempted to be started * while in Lock Task Mode. * @hide */ @@ -594,55 +594,55 @@ public class ActivityManager { FIRST_START_NON_FATAL_ERROR_CODE + 1; /** - * Result for IActivityManaqer.startActivity: a new activity start was aborted. Never returned + * Result for IActivityManager.startActivity: a new activity start was aborted. Never returned * externally. * @hide */ public static final int START_ABORTED = FIRST_START_NON_FATAL_ERROR_CODE + 2; /** - * Flag for IActivityManaqer.startActivity: do special start mode where + * Flag for IActivityManager.startActivity: do special start mode where * a new activity is launched only if it is needed. * @hide */ public static final int START_FLAG_ONLY_IF_NEEDED = 1<<0; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * debugging. * @hide */ public static final int START_FLAG_DEBUG = 1<<1; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * allocation tracking. * @hide */ public static final int START_FLAG_TRACK_ALLOCATION = 1<<2; /** - * Flag for IActivityManaqer.startActivity: launch the app with + * Flag for IActivityManager.startActivity: launch the app with * native debugging support. * @hide */ public static final int START_FLAG_NATIVE_DEBUGGING = 1<<3; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * debugging and suspend threads. * @hide */ public static final int START_FLAG_DEBUG_SUSPEND = 1 << 4; /** - * Result for IActivityManaqer.broadcastIntent: success! + * Result for IActivityManager.broadcastIntent: success! * @hide */ public static final int BROADCAST_SUCCESS = 0; /** - * Result for IActivityManaqer.broadcastIntent: attempt to broadcast + * Result for IActivityManager.broadcastIntent: attempt to broadcast * a sticky intent without appropriate permission. * @hide */ @@ -656,20 +656,20 @@ public class ActivityManager { public static final int BROADCAST_FAILED_USER_STOPPED = -2; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent type is unknown. + * Type for IActivityManager.getIntentSender: this PendingIntent type is unknown. * @hide */ public static final int INTENT_SENDER_UNKNOWN = 0; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a sendBroadcast operation. * @hide */ public static final int INTENT_SENDER_BROADCAST = 1; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startActivity operation. * @hide */ @@ -677,21 +677,21 @@ public class ActivityManager { public static final int INTENT_SENDER_ACTIVITY = 2; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for an activity result operation. * @hide */ public static final int INTENT_SENDER_ACTIVITY_RESULT = 3; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startService operation. * @hide */ public static final int INTENT_SENDER_SERVICE = 4; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startForegroundService operation. * @hide */ diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 7eacaac29d4b..bb35e6cf1bfa 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -190,6 +190,7 @@ public class Instrumentation { * @param arguments Any additional arguments that were supplied when the * instrumentation was started. */ + @android.ravenwood.annotation.RavenwoodKeep public void onCreate(Bundle arguments) { } diff --git a/core/java/android/app/contentsuggestions/OWNERS b/core/java/android/app/contentsuggestions/OWNERS index 5f8de77c9dda..3d21a6a2b58f 100644 --- a/core/java/android/app/contentsuggestions/OWNERS +++ b/core/java/android/app/contentsuggestions/OWNERS @@ -1,4 +1,3 @@ # Bug component: 643919 hackz@google.com -volnov@google.com diff --git a/core/java/android/app/ondeviceintelligence/OWNERS b/core/java/android/app/ondeviceintelligence/OWNERS index 85e9e653e6fb..0e8110aeee1b 100644 --- a/core/java/android/app/ondeviceintelligence/OWNERS +++ b/core/java/android/app/ondeviceintelligence/OWNERS @@ -3,4 +3,3 @@ sandeepbandaru@google.com shivanker@google.com hackz@google.com -volnov@google.com diff --git a/core/java/android/app/wearable/OWNERS b/core/java/android/app/wearable/OWNERS index 497eaf0e40f1..56c8ca57a293 100644 --- a/core/java/android/app/wearable/OWNERS +++ b/core/java/android/app/wearable/OWNERS @@ -2,4 +2,3 @@ charliewang@google.com hackz@google.com oni@google.com tomchan@google.com -volnov@google.com
\ No newline at end of file diff --git a/core/java/android/content/integrity/OWNERS b/core/java/android/content/integrity/OWNERS index 20c758aedd67..ca65fdab99b1 100644 --- a/core/java/android/content/integrity/OWNERS +++ b/core/java/android/content/integrity/OWNERS @@ -1,5 +1,4 @@ # Bug component: 722021 toddke@android.com -toddke@google.com patb@google.com diff --git a/core/java/android/content/pm/parsing/OWNERS b/core/java/android/content/pm/parsing/OWNERS index 8049d5cb7fa2..445a8330037b 100644 --- a/core/java/android/content/pm/parsing/OWNERS +++ b/core/java/android/content/pm/parsing/OWNERS @@ -2,4 +2,3 @@ chiuwinson@google.com patb@google.com -toddke@google.com diff --git a/core/java/android/content/pm/permission/OWNERS b/core/java/android/content/pm/permission/OWNERS index cf7e6890876a..8ef84745c99f 100644 --- a/core/java/android/content/pm/permission/OWNERS +++ b/core/java/android/content/pm/permission/OWNERS @@ -3,6 +3,5 @@ include platform/frameworks/base:/core/java/android/permission/OWNERS toddke@android.com -toddke@google.com patb@google.com diff --git a/core/java/android/gesture/OWNERS b/core/java/android/gesture/OWNERS index 168630af6da4..ffa753aa65b2 100644 --- a/core/java/android/gesture/OWNERS +++ b/core/java/android/gesture/OWNERS @@ -3,5 +3,4 @@ romainguy@google.com adamp@google.com aurimas@google.com -nduca@google.com sumir@google.com diff --git a/core/java/android/metrics/OWNERS b/core/java/android/metrics/OWNERS index ba867e0cad2b..98aaf3f47b21 100644 --- a/core/java/android/metrics/OWNERS +++ b/core/java/android/metrics/OWNERS @@ -1,4 +1,3 @@ # Bug component: 26805 cwren@android.com -cwren@google.com diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS index 727dcbaca4bf..a6785bab56f3 100644 --- a/core/java/android/os/OWNERS +++ b/core/java/android/os/OWNERS @@ -78,7 +78,7 @@ per-file Trace.java = file:/TRACE_OWNERS per-file PatternMatcher* = file:/PACKAGE_MANAGER_OWNERS # PermissionEnforcer -per-file PermissionEnforcer.java = tweek@google.com, brufino@google.com +per-file PermissionEnforcer.java = tweek@google.com # RemoteCallbackList per-file RemoteCallbackList.java = shayba@google.com diff --git a/core/java/android/preference/OWNERS b/core/java/android/preference/OWNERS index b4cb9ec7ceda..38a5abd8ff56 100644 --- a/core/java/android/preference/OWNERS +++ b/core/java/android/preference/OWNERS @@ -1,5 +1,4 @@ lpf@google.com -pavlis@google.com clarabayarri@google.com -per-file SeekBarVolumizer.java = jmtrivi@google.com
\ No newline at end of file +per-file SeekBarVolumizer.java = jmtrivi@google.com diff --git a/core/java/android/print/OWNERS b/core/java/android/print/OWNERS index ce79f5d0c669..15f640650868 100644 --- a/core/java/android/print/OWNERS +++ b/core/java/android/print/OWNERS @@ -1,5 +1,4 @@ # Bug component: 47273 anothermark@google.com -kumarashishg@google.com bmgordon@google.com diff --git a/core/java/android/printservice/OWNERS b/core/java/android/printservice/OWNERS index ce79f5d0c669..15f640650868 100644 --- a/core/java/android/printservice/OWNERS +++ b/core/java/android/printservice/OWNERS @@ -1,5 +1,4 @@ # Bug component: 47273 anothermark@google.com -kumarashishg@google.com bmgordon@google.com diff --git a/core/java/android/speech/OWNERS b/core/java/android/speech/OWNERS index 32f482264103..f228ba46be0c 100644 --- a/core/java/android/speech/OWNERS +++ b/core/java/android/speech/OWNERS @@ -1,3 +1,2 @@ -volnov@google.com eugeniom@google.com schfan@google.com diff --git a/core/java/android/text/OWNERS b/core/java/android/text/OWNERS index 0935ffd9dd81..b493ef7009d9 100644 --- a/core/java/android/text/OWNERS +++ b/core/java/android/text/OWNERS @@ -4,7 +4,6 @@ grantapher@google.com halilibo@google.com haoyuchang@google.com justinghan@google.com -klippenstein@google.com nona@google.com seanmcq@google.com siyamed@google.com diff --git a/core/java/android/util/apk/OWNERS b/core/java/android/util/apk/OWNERS index 0f4e869f8b9a..f267f9a4edb6 100644 --- a/core/java/android/util/apk/OWNERS +++ b/core/java/android/util/apk/OWNERS @@ -1,3 +1,2 @@ include /core/java/android/content/pm/OWNERS -cbrubaker@google.com mpgroover@google.com diff --git a/core/java/android/view/OWNERS b/core/java/android/view/OWNERS index 3b69f1dde4ca..b06ba579d45b 100644 --- a/core/java/android/view/OWNERS +++ b/core/java/android/view/OWNERS @@ -3,7 +3,6 @@ romainguy@google.com adamp@google.com aurimas@google.com -nduca@google.com sumir@google.com ogunwale@google.com jjaggi@google.com diff --git a/core/java/android/view/inspector/OWNERS b/core/java/android/view/inspector/OWNERS index 705f4b342d42..f3450344ea81 100644 --- a/core/java/android/view/inspector/OWNERS +++ b/core/java/android/view/inspector/OWNERS @@ -2,5 +2,4 @@ romainguy@google.com alanv@google.com adamp@google.com aurimas@google.com -nduca@google.com sumir@google.com diff --git a/core/java/com/android/internal/config/appcloning/OWNERS b/core/java/com/android/internal/config/appcloning/OWNERS index 0645a8c54414..9369438deb07 100644 --- a/core/java/com/android/internal/config/appcloning/OWNERS +++ b/core/java/com/android/internal/config/appcloning/OWNERS @@ -1,3 +1,2 @@ # Bug component: 1207885 jigarthakkar@google.com -saumyap@google.com
\ No newline at end of file diff --git a/core/java/com/android/internal/infra/OWNERS b/core/java/com/android/internal/infra/OWNERS index 45503582b2c5..e69de29bb2d1 100644 --- a/core/java/com/android/internal/infra/OWNERS +++ b/core/java/com/android/internal/infra/OWNERS @@ -1,6 +0,0 @@ -per-file AndroidFuture.java = eugenesusla@google.com -per-file RemoteStream.java = eugenesusla@google.com -per-file PerUser.java = eugenesusla@google.com -per-file ServiceConnector.java = eugenesusla@google.com -per-file AndroidFuture.aidl = eugenesusla@google.com -per-file IAndroidFuture.aidl = eugenesusla@google.com
\ No newline at end of file diff --git a/core/java/com/android/internal/util/OWNERS b/core/java/com/android/internal/util/OWNERS index 9be8ea7aadc4..d174fe36e460 100644 --- a/core/java/com/android/internal/util/OWNERS +++ b/core/java/com/android/internal/util/OWNERS @@ -1,8 +1,8 @@ -per-file AsyncChannel* = lorenzo@google.com, satk@google.com, etancohen@google.com +per-file AsyncChannel* = lorenzo@google.com, satk@google.com per-file MessageUtils*, Protocol*, RingBuffer*, TokenBucket* = jchalard@google.com, lorenzo@google.com, satk@google.com per-file *Notification* = file:/services/core/java/com/android/server/notification/OWNERS per-file *ContrastColor* = file:/services/core/java/com/android/server/notification/OWNERS -per-file Protocol* = etancohen@google.com, lorenzo@google.com +per-file Protocol* =lorenzo@google.com per-file State* = jchalard@google.com, lorenzo@google.com, satk@google.com per-file *Dump* = file:/core/java/com/android/internal/util/dump/OWNERS per-file *Screenshot* = file:/packages/SystemUI/src/com/android/systemui/screenshot/OWNERS diff --git a/core/java/com/android/internal/util/function/pooled/OWNERS b/core/java/com/android/internal/util/function/pooled/OWNERS index da723b3b67da..e69de29bb2d1 100644 --- a/core/java/com/android/internal/util/function/pooled/OWNERS +++ b/core/java/com/android/internal/util/function/pooled/OWNERS @@ -1 +0,0 @@ -eugenesusla@google.com
\ No newline at end of file diff --git a/core/java/com/android/internal/widget/remotecompose/OWNERS b/core/java/com/android/internal/widget/remotecompose/OWNERS index e163474bccb9..c606744df150 100644 --- a/core/java/com/android/internal/widget/remotecompose/OWNERS +++ b/core/java/com/android/internal/widget/remotecompose/OWNERS @@ -1,6 +1,5 @@ nicolasroard@google.com hoford@google.com -jnichol@google.com sihua@google.com sunnygoyal@google.com oscarad@google.com diff --git a/core/res/OWNERS b/core/res/OWNERS index faed4d80f39b..a208f7f1a3ad 100644 --- a/core/res/OWNERS +++ b/core/res/OWNERS @@ -9,7 +9,6 @@ hackbod@google.com ilyamaty@google.com jbolinger@google.com jsharkey@android.com -jsharkey@google.com juliacr@google.com kchyn@google.com michaelwr@google.com diff --git a/core/tests/coretests/src/android/content/pm/OWNERS b/core/tests/coretests/src/android/content/pm/OWNERS index 867336515ce3..c4c40dcaa87a 100644 --- a/core/tests/coretests/src/android/content/pm/OWNERS +++ b/core/tests/coretests/src/android/content/pm/OWNERS @@ -1,5 +1,4 @@ include /core/java/android/content/pm/OWNERS per-file AppSearchPersonTest.java = file:/core/java/android/content/pm/SHORTCUT_OWNERS -per-file SigningDetailsTest.java = cbrubaker@google.com per-file SigningDetailsTest.java = mpgroover@google.com diff --git a/core/tests/featureflagtests/OWNERS b/core/tests/featureflagtests/OWNERS index 2ff4f5ab8807..6784f2891009 100644 --- a/core/tests/featureflagtests/OWNERS +++ b/core/tests/featureflagtests/OWNERS @@ -1,2 +1 @@ -sbasi@google.com -tmfang@google.com
\ No newline at end of file +tmfang@google.com diff --git a/data/etc/OWNERS b/data/etc/OWNERS index 712042f6ff6b..1251fce1ce19 100644 --- a/data/etc/OWNERS +++ b/data/etc/OWNERS @@ -1,6 +1,5 @@ include /PACKAGE_MANAGER_OWNERS -cbrubaker@google.com hackbod@android.com hackbod@google.com jeffv@google.com diff --git a/drm/java/android/drm/OWNERS b/drm/java/android/drm/OWNERS index 43871001c9ad..b65cce70225e 100644 --- a/drm/java/android/drm/OWNERS +++ b/drm/java/android/drm/OWNERS @@ -1,4 +1,3 @@ # Bug component: 49079 -jtinker@google.com robertshih@google.com diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/apptoweb/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/apptoweb/OWNERS index 6207e5b020f7..7e557860365e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/apptoweb/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/apptoweb/OWNERS @@ -4,5 +4,4 @@ madym@google.com mattsziklay@google.com mdehaini@google.com pbdr@google.com -tkachenkoi@google.com vaniadesmonda@google.com diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS index 44d46eea9c55..7a63ec5eeda3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/freeform/OWNERS @@ -2,7 +2,6 @@ atsjenk@google.com jorgegil@google.com madym@google.com -nmusgrave@google.com pbdr@google.com vaniadesmonda@google.com pragyabajoria@google.com diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/OWNERS index 5aa3c4e2abef..245669b644db 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/tv/OWNERS @@ -1,3 +1,2 @@ # WM shell sub-module TV pip owner -galinap@google.com bronger@google.com diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/tv/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/tv/OWNERS index 28be0efc38f6..9dc0ebbb8e56 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/tv/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/tv/OWNERS @@ -1,3 +1,2 @@ # WM shell sub-module TV splitscreen owner -galinap@google.com bronger@google.com diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/OWNERS b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/OWNERS index 736d4cff6ce8..a7d1890a0286 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/OWNERS +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/OWNERS @@ -1,3 +1,2 @@ # WM shell sub-module TV pip owners -galinap@google.com -bronger@google.com
\ No newline at end of file +bronger@google.com diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index 23cd3ce965ff..c75db29c6699 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -203,6 +203,9 @@ java_sdk_library { visibility: [ "//frameworks/base", // Framework ], + impl_library_visibility: [ + "//frameworks/base/ravenwood", + ], srcs: [ ":framework-graphics-srcs", @@ -227,6 +230,14 @@ java_sdk_library { } filegroup { + name: "framework-graphics-ravenwood-policies", + srcs: [ + "framework-graphics-ravenwood-policies.txt", + ], + visibility: ["//frameworks/base/ravenwood"], +} + +filegroup { name: "framework-graphics-srcs", srcs: [ "apex/java/**/*.java", diff --git a/libs/hwui/OWNERS b/libs/hwui/OWNERS index 70d13ab8b3e5..9c06fd5f0225 100644 --- a/libs/hwui/OWNERS +++ b/libs/hwui/OWNERS @@ -3,7 +3,7 @@ alecmouri@google.com djsollen@google.com jreck@google.com -njawad@google.com +nscobie@google.com sumir@google.com # For text, e.g. Typeface, Font, Minikin, etc. diff --git a/libs/hwui/framework-graphics-ravenwood-policies.txt b/libs/hwui/framework-graphics-ravenwood-policies.txt new file mode 100644 index 000000000000..7296225ccfe8 --- /dev/null +++ b/libs/hwui/framework-graphics-ravenwood-policies.txt @@ -0,0 +1 @@ +class android.graphics.ColorMatrix keepclass diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java index b11a81047bf8..4e1d472688ea 100644 --- a/media/java/android/media/MediaExtractor.java +++ b/media/java/android/media/MediaExtractor.java @@ -375,6 +375,9 @@ public final class MediaExtractor { /** * Extract DRM initialization data if it exists * + * <p>If the media contains a PSSH box, only PSSH version 0 is supported. The result for media + * with other PSSH versions is undefined. + * * @return DRM initialization data in the content, or {@code null} * if no recognizable DRM format is found; * @see DrmInitData @@ -460,6 +463,10 @@ public final class MediaExtractor { /** * Get the PSSH info if present. + * + * <p>This method only supports version 0 PSSH boxes. The result for other versions is + * undefined. + * * @return a map of uuid-to-bytes, with the uuid specifying * the crypto scheme, and the bytes being the data specific to that scheme. * This can be {@code null} if the source does not contain PSSH info. diff --git a/media/java/android/media/musicrecognition/OWNERS b/media/java/android/media/musicrecognition/OWNERS index 037b04831260..820be004efd5 100644 --- a/media/java/android/media/musicrecognition/OWNERS +++ b/media/java/android/media/musicrecognition/OWNERS @@ -1,5 +1,4 @@ # Bug component: 830636 oni@google.com -volnov@google.com diff --git a/media/jni/OWNERS b/media/jni/OWNERS index fdddf13a0a23..84618a35cd4f 100644 --- a/media/jni/OWNERS +++ b/media/jni/OWNERS @@ -1,5 +1,5 @@ # extra for MTP related files -per-file android_mtp_*.cpp=aprasath@google.com,anothermark@google.com,kumarashishg@google.com,sarup@google.com,jsharkey@android.com,jameswei@google.com,rmojumder@google.com +per-file android_mtp_*.cpp=aprasath@google.com,anothermark@google.com,sarup@google.com,jsharkey@android.com,jameswei@google.com,rmojumder@google.com # extra for TV related files per-file android_media_tv_*=hgchen@google.com,quxiangfang@google.com diff --git a/opengl/java/android/opengl/OWNERS b/opengl/java/android/opengl/OWNERS index e340bc62567a..4ec9e29c48b0 100644 --- a/opengl/java/android/opengl/OWNERS +++ b/opengl/java/android/opengl/OWNERS @@ -3,4 +3,3 @@ sumir@google.com prahladk@google.com ianelliott@google.com -lpy@google.com diff --git a/packages/SettingsLib/OWNERS b/packages/SettingsLib/OWNERS index 04df308e72a0..7348920dfd3d 100644 --- a/packages/SettingsLib/OWNERS +++ b/packages/SettingsLib/OWNERS @@ -8,6 +8,7 @@ edgarwang@google.com evanlaird@google.com jiannan@google.com juliacr@google.com +millchen@google.com ykhung@google.com # Exempt resource files (because they are in a flat directory and too hard to manage via OWNERS) diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/OWNERS b/packages/SettingsLib/src/com/android/settingslib/wifi/OWNERS index b9449acc6f7d..50bfe8c7cd78 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/OWNERS +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/OWNERS @@ -1,6 +1,5 @@ # Default reviewers for this and subdirectories. andychou@google.com -arcwang@google.com asapperstein@google.com changbetty@google.com qal@google.com diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java index 60fae3f1fea9..ea40ae4b7dd2 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java @@ -456,11 +456,16 @@ final class SettingsState { @GuardedBy("mLock") private void loadAconfigDefaultValuesLocked(List<String> filePaths) { for (String fileName : filePaths) { - try (FileInputStream inputStream = new FileInputStream(fileName)) { - loadAconfigDefaultValues( - inputStream.readAllBytes(), mNamespaceDefaults, mAconfigDefaultFlags); - } catch (IOException e) { - Slog.e(LOG_TAG, "failed to read protobuf", e); + File f = new File(fileName); + if (f.isFile() && f.canRead()) { + try (FileInputStream inputStream = new FileInputStream(fileName)) { + loadAconfigDefaultValues( + inputStream.readAllBytes(), mNamespaceDefaults, mAconfigDefaultFlags); + } catch (IOException e) { + Slog.e(LOG_TAG, "failed to read protobuf", e); + } + } else { + Slog.d(LOG_TAG, "No protobuf file at " + fileName); } } } diff --git a/packages/Shell/OWNERS b/packages/Shell/OWNERS index dd939bbe041e..b9ddee5026be 100644 --- a/packages/Shell/OWNERS +++ b/packages/Shell/OWNERS @@ -3,12 +3,9 @@ set noparent jsharkey@android.com felipeal@google.com nandana@google.com -svetoslavganov@google.com hackbod@google.com yamasani@google.com -toddke@google.com patb@google.com -cbrubaker@google.com omakoto@google.com michaelwr@google.com ronish@google.com diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt index 2bdee67dd57a..ba135f94dc56 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaProcessingHelper.kt @@ -22,6 +22,7 @@ import android.content.Context import android.graphics.drawable.Icon import android.media.session.MediaController import android.media.session.PlaybackState +import android.os.BadParcelableException import android.util.Log import com.android.systemui.Flags.mediaControlsPostsOptimization import com.android.systemui.biometrics.Utils.toBitmap @@ -109,7 +110,12 @@ private fun areCustomActionsEqual( } if (firstAction.extras != null) { firstAction.extras.keySet().forEach { key -> - if (firstAction.extras[key] != secondAction.extras[key]) { + try { + if (firstAction.extras[key] != secondAction.extras[key]) { + return false + } + } catch (e: BadParcelableException) { + Log.e(TAG, "Cannot unparcel extras", e) return false } } diff --git a/proto/src/metrics_constants/OWNERS b/proto/src/metrics_constants/OWNERS index 274d0d6323cf..169f887ede56 100644 --- a/proto/src/metrics_constants/OWNERS +++ b/proto/src/metrics_constants/OWNERS @@ -1,3 +1,2 @@ cwren@android.com -yanglu@google.com yaochen@google.com diff --git a/ravenwood/Android.bp b/ravenwood/Android.bp index adbb3afb4130..ccbc46fdb03b 100644 --- a/ravenwood/Android.bp +++ b/ravenwood/Android.bp @@ -121,6 +121,7 @@ java_library { name: "ravenwood-helper-framework-runtime", srcs: [ "runtime-helper-src/framework/**/*.java", + ":framework-graphics-srcs", ], static_libs: [ "ravenwood-runtime-common", @@ -278,6 +279,7 @@ cc_library_host_shared { cc_library_host_shared { name: "libravenwood_runtime", defaults: ["ravenwood_jni_defaults"], + header_libs: ["libicuuc_headers"], srcs: [ "runtime-jni/ravenwood_runtime.cpp", "runtime-jni/ravenwood_os_constants.cpp", @@ -372,6 +374,13 @@ platform_compat_config { visibility: ["//visibility:private"], } +java_library { + name: "ext-ravenwood", + installable: false, + static_libs: ["ext"], + visibility: ["//visibility:private"], +} + filegroup { name: "ravenwood-data", device_common_srcs: [ @@ -637,6 +646,7 @@ android_ravenwood_libgroup { libs: [ "100-framework-minus-apex.ravenwood", "200-kxml2-android", + "ext-ravenwood", "ravenwood-runtime-common-ravenwood", @@ -661,6 +671,9 @@ android_ravenwood_libgroup { // StatsD "framework-statsd.ravenwood", + // Graphics + "framework-graphics.ravenwood", + // Provide runtime versions of utils linked in below "junit", "truth", diff --git a/ravenwood/Framework.bp b/ravenwood/Framework.bp index 99fc31b258e9..e36677189e02 100644 --- a/ravenwood/Framework.bp +++ b/ravenwood/Framework.bp @@ -399,3 +399,57 @@ java_genrule { "framework-statsd.ravenwood.jar", ], } + +////////////////////// +// framework-graphics +////////////////////// + +java_genrule { + name: "framework-graphics.ravenwood-base", + tools: ["hoststubgen"], + cmd: "$(location hoststubgen) " + + "@$(location :ravenwood-standard-options) " + + + "--debug-log $(location framework-graphics.log) " + + "--stats-file $(location framework-graphics_stats.csv) " + + "--supported-api-list-file $(location framework-graphics_apis.csv) " + + "--gen-keep-all-file $(location framework-graphics_keep_all.txt) " + + "--gen-input-dump-file $(location framework-graphics_dump.txt) " + + + "--out-impl-jar $(location ravenwood.jar) " + + "--in-jar $(location :framework-graphics.impl{.jar}) " + + + "--policy-override-file $(location :ravenwood-common-policies) " + + "--policy-override-file $(location :framework-graphics-ravenwood-policies) ", + srcs: [ + ":framework-graphics.impl{.jar}", + + ":ravenwood-common-policies", + ":framework-graphics-ravenwood-policies", + ":ravenwood-standard-options", + ], + out: [ + "ravenwood.jar", + + // Following files are created just as FYI. + "framework-graphics_keep_all.txt", + "framework-graphics_dump.txt", + + "framework-graphics.log", + "framework-graphics_stats.csv", + "framework-graphics_apis.csv", + ], + visibility: ["//visibility:private"], +} + +java_genrule { + name: "framework-graphics.ravenwood", + defaults: ["ravenwood-internal-only-visibility-genrule"], + cmd: "cp $(in) $(out)", + srcs: [ + ":framework-graphics.ravenwood-base{ravenwood.jar}", + ], + out: [ + "framework-graphics.ravenwood.jar", + ], +} diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java index 3ebef02284d6..b6167665c985 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodAwareTestRunner.java @@ -23,13 +23,10 @@ import static org.junit.Assume.assumeTrue; import android.annotation.NonNull; import android.annotation.Nullable; -import android.os.Bundle; import android.platform.test.annotations.RavenwoodTestRunnerInitializing; import android.platform.test.annotations.internal.InnerRunner; import android.util.Log; -import androidx.test.platform.app.InstrumentationRegistry; - import com.android.ravenwood.common.RavenwoodCommonUtils; import org.junit.rules.TestRule; @@ -285,11 +282,6 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase private boolean onBefore(Description description, Scope scope, Order order) { Log.v(TAG, "onBefore: description=" + description + ", " + scope + ", " + order); - if (scope == Scope.Instance && order == Order.Outer) { - // Start of a test method. - mState.enterTestMethod(description); - } - final var classDescription = getDescription(); // Class-level annotations are checked by the runner already, so we only check @@ -299,6 +291,12 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase return false; } } + + if (scope == Scope.Instance && order == Order.Outer) { + // Start of a test method. + mState.enterTestMethod(description); + } + return true; } @@ -314,8 +312,7 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase if (scope == Scope.Instance && order == Order.Outer) { // End of a test method. - mState.exitTestMethod(); - + mState.exitTestMethod(description); } // If RUN_DISABLED_TESTS is set, and the method did _not_ throw, make it an error. diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java index a3326337d485..9e6b12f60add 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodContext.java @@ -230,6 +230,16 @@ public class RavenwoodContext extends RavenwoodBaseContext { return mAppContext; } + @Override + public boolean isRestricted() { + return false; + } + + @Override + public boolean canLoadUnsafeResources() { + return true; + } + /** * Wrap the given {@link Supplier} to become memoized. * diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java index a208d6dce2ce..7e935d0451ae 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodNativeLoader.java @@ -48,6 +48,7 @@ public final class RavenwoodNativeLoader { android.content.res.AssetManager.class, android.content.res.StringBlock.class, android.content.res.XmlBlock.class, + android.text.AndroidCharacter.class, }; /** @@ -61,15 +62,49 @@ public final class RavenwoodNativeLoader { android.graphics.Path.class, android.graphics.Color.class, android.graphics.ColorSpace.class, + android.graphics.Bitmap.class, + android.graphics.BitmapFactory.class, + android.graphics.BitmapRegionDecoder.class, + android.graphics.Camera.class, + android.graphics.Canvas.class, + android.graphics.CanvasProperty.class, + android.graphics.ColorFilter.class, + android.graphics.DrawFilter.class, + android.graphics.FontFamily.class, + android.graphics.Gainmap.class, + android.graphics.ImageDecoder.class, + android.graphics.MaskFilter.class, + android.graphics.NinePatch.class, + android.graphics.Paint.class, + android.graphics.PathEffect.class, + android.graphics.PathIterator.class, + android.graphics.PathMeasure.class, + android.graphics.Picture.class, + android.graphics.RecordingCanvas.class, + android.graphics.Region.class, + android.graphics.RenderNode.class, + android.graphics.Shader.class, + android.graphics.RenderEffect.class, + android.graphics.Typeface.class, + android.graphics.YuvImage.class, + android.graphics.fonts.Font.class, + android.graphics.fonts.FontFamily.class, + android.graphics.text.LineBreaker.class, + android.graphics.text.MeasuredText.class, + android.graphics.text.TextRunShaper.class, + android.graphics.text.GraphemeBreak.class, + android.util.PathParser.class, }; /** * Extra strings needed to pass to register_android_graphics_classes(). * - * `android.graphics.Graphics` is not actually a class, so we just hardcode it here. + * Several entries are not actually a class, so we just hardcode them here. */ public final static String[] GRAPHICS_EXTRA_INIT_PARAMS = new String[] { - "android.graphics.Graphics" + "android.graphics.Graphics", + "android.graphics.ByteBufferStreamAdaptor", + "android.graphics.CreateJavaOutputStreamAdaptor" }; private RavenwoodNativeLoader() { diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java index 70bc52bdaa12..705186edba00 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRunnerState.java @@ -81,12 +81,15 @@ public final class RavenwoodRunnerState { RavenwoodRuntimeEnvironmentController.exitTestClass(); } + /** Called when a test method is about to start */ public void enterTestMethod(Description description) { mMethodDescription = description; - RavenwoodRuntimeEnvironmentController.initForMethod(); + RavenwoodRuntimeEnvironmentController.enterTestMethod(description); } - public void exitTestMethod() { + /** Called when a test method finishes */ + public void exitTestMethod(Description description) { + RavenwoodRuntimeEnvironmentController.exitTestMethod(description); mMethodDescription = null; } diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java index ae88bb234e9d..33c4e86d885d 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java @@ -43,6 +43,7 @@ import android.app.UiAutomation; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.res.Resources; +import android.graphics.Typeface; import android.icu.util.ULocale; import android.os.Binder; import android.os.Build; @@ -50,6 +51,7 @@ import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.HandlerThread; import android.os.Looper; +import android.os.Message; import android.os.Process_ravenwood; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; @@ -73,6 +75,7 @@ import com.android.ravenwood.common.SneakyThrow; import com.android.server.LocalServices; import com.android.server.compat.PlatformCompat; +import org.junit.AssumptionViolatedException; import org.junit.internal.management.ManagementFactory; import org.junit.runner.Description; @@ -80,6 +83,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -92,6 +96,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; +import java.util.stream.Collectors; /** * Responsible for initializing and the environment. @@ -106,32 +111,60 @@ public class RavenwoodRuntimeEnvironmentController { @SuppressWarnings("UnusedVariable") private static final PrintStream sStdErr = System.err; - private static final String MAIN_THREAD_NAME = "RavenwoodMain"; + private static final String MAIN_THREAD_NAME = "Ravenwood:Main"; + private static final String TESTS_THREAD_NAME = "Ravenwood:Test"; + private static final String LIBRAVENWOOD_INITIALIZER_NAME = "ravenwood_initializer"; private static final String RAVENWOOD_NATIVE_RUNTIME_NAME = "ravenwood_runtime"; private static final String ANDROID_LOG_TAGS = "ANDROID_LOG_TAGS"; private static final String RAVENWOOD_ANDROID_LOG_TAGS = "RAVENWOOD_" + ANDROID_LOG_TAGS; + static volatile Thread sTestThread; + static volatile Thread sMainThread; + /** * When enabled, attempt to dump all thread stacks just before we hit the * overall Tradefed timeout, to aid in debugging deadlocks. + * + * Note, this timeout will _not_ stop the test, as there isn't really a clean way to do it. + * It'll merely print stacktraces. */ private static final boolean ENABLE_TIMEOUT_STACKS = - "1".equals(System.getenv("RAVENWOOD_ENABLE_TIMEOUT_STACKS")); + !"0".equals(System.getenv("RAVENWOOD_ENABLE_TIMEOUT_STACKS")); + + private static final boolean TOLERATE_LOOPER_ASSERTS = + !"0".equals(System.getenv("RAVENWOOD_TOLERATE_LOOPER_ASSERTS")); + + static final int DEFAULT_TIMEOUT_SECONDS = 10; + private static final int TIMEOUT_MILLIS = getTimeoutSeconds() * 1000; + + static int getTimeoutSeconds() { + var e = System.getenv("RAVENWOOD_TIMEOUT_SECONDS"); + if (e == null || e.isEmpty()) { + return DEFAULT_TIMEOUT_SECONDS; + } + return Integer.parseInt(e); + } - private static final int TIMEOUT_MILLIS = 9_000; private static final ScheduledExecutorService sTimeoutExecutor = - Executors.newScheduledThreadPool(1); + Executors.newScheduledThreadPool(1, (Runnable r) -> { + Thread t = Executors.defaultThreadFactory().newThread(r); + t.setName("Ravenwood:TimeoutMonitor"); + t.setDaemon(true); + return t; + }); - private static ScheduledFuture<?> sPendingTimeout; + private static volatile ScheduledFuture<?> sPendingTimeout; /** * When enabled, attempt to detect uncaught exceptions from background threads. */ private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = - "1".equals(System.getenv("RAVENWOOD_ENABLE_UNCAUGHT_EXCEPTION_DETECTION")); + !"0".equals(System.getenv("RAVENWOOD_ENABLE_UNCAUGHT_EXCEPTION_DETECTION")); + + private static final boolean DIE_ON_UNCAUGHT_EXCEPTION = true; /** * When set, an unhandled exception was discovered (typically on a background thread), and we @@ -140,12 +173,6 @@ public class RavenwoodRuntimeEnvironmentController { private static final AtomicReference<Throwable> sPendingUncaughtException = new AtomicReference<>(); - private static final Thread.UncaughtExceptionHandler sUncaughtExceptionHandler = - (thread, throwable) -> { - // Remember the first exception we discover - sPendingUncaughtException.compareAndSet(null, throwable); - }; - // TODO: expose packCallingIdentity function in libbinder and use it directly // See: packCallingIdentity in frameworks/native/libs/binder/IPCThreadState.cpp private static long packBinderIdentityToken( @@ -186,6 +213,8 @@ public class RavenwoodRuntimeEnvironmentController { * Initialize the global environment. */ public static void globalInitOnce() { + sTestThread = Thread.currentThread(); + Thread.currentThread().setName(TESTS_THREAD_NAME); synchronized (sInitializationLock) { if (!sInitialized) { // globalInitOnce() is called from class initializer, which cause @@ -193,6 +222,7 @@ public class RavenwoodRuntimeEnvironmentController { sInitialized = true; // This is the first call. + final long start = System.currentTimeMillis(); try { globalInitInner(); } catch (Throwable th) { @@ -201,6 +231,9 @@ public class RavenwoodRuntimeEnvironmentController { sExceptionFromGlobalInit = th; SneakyThrow.sneakyThrow(th); } + final long end = System.currentTimeMillis(); + // TODO Show user/system time too + Log.e(TAG, "globalInit() took " + (end - start) + "ms"); } else { // Subsequent calls. If the first call threw, just throw the same error, to prevent // the test from running. @@ -219,7 +252,8 @@ public class RavenwoodRuntimeEnvironmentController { RavenwoodCommonUtils.log(TAG, "globalInitInner()"); if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { - Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler); + Thread.setDefaultUncaughtExceptionHandler( + RavenwoodRuntimeEnvironmentController::reportUncaughtExceptions); } // Some process-wide initialization: @@ -246,6 +280,13 @@ public class RavenwoodRuntimeEnvironmentController { // Do the basic set up for the android sysprops. RavenwoodSystemProperties.initialize(); + // Set ICU data file + String icuData = RavenwoodCommonUtils.getRavenwoodRuntimePath() + + "ravenwood-data/" + + RavenwoodRuntimeNative.getIcuDataName() + + ".dat"; + RavenwoodRuntimeNative.setSystemProperty("ro.icu.data.path", icuData); + // Enable all log levels for native logging, until we'll have a way to change the native // side log level at runtime. // Do this after loading RAVENWOOD_NATIVE_RUNTIME_NAME (which backs Os.setenv()), @@ -268,6 +309,12 @@ public class RavenwoodRuntimeEnvironmentController { Objects.requireNonNull(Build.TYPE); Objects.requireNonNull(Build.VERSION.SDK); + // Fonts can only be initialized once + // AOSP only: typeface is not supported on AOSP. + // Typeface.init(); + // Typeface.loadPreinstalledSystemFontMap(); + // Typeface.loadNativeSystemFonts(); + System.setProperty(RAVENWOOD_VERSION_JAVA_SYSPROP, "1"); // This will let AndroidJUnit4 use the original runner. System.setProperty("android.junit.runner", @@ -291,6 +338,7 @@ public class RavenwoodRuntimeEnvironmentController { ActivityManager.init$ravenwood(SYSTEM.getIdentifier()); final var main = new HandlerThread(MAIN_THREAD_NAME); + sMainThread = main; main.start(); Looper.setMainLooperForTest(main.getLooper()); @@ -337,9 +385,20 @@ public class RavenwoodRuntimeEnvironmentController { var systemServerContext = new RavenwoodContext(ANDROID_PACKAGE_NAME, main, systemResourcesLoader); - sInstrumentation = new Instrumentation(); - sInstrumentation.basicInit(instContext, targetContext, null); - InstrumentationRegistry.registerInstance(sInstrumentation, Bundle.EMPTY); + var instArgs = Bundle.EMPTY; + RavenwoodUtils.runOnMainThreadSync(() -> { + try { + // TODO We should get the instrumentation class name from the build file or + // somewhere. + var InstClass = Class.forName("android.app.Instrumentation"); + sInstrumentation = (Instrumentation) InstClass.getConstructor().newInstance(); + sInstrumentation.basicInit(instContext, targetContext, null); + sInstrumentation.onCreate(instArgs); + } catch (Exception e) { + SneakyThrow.sneakyThrow(e); + } + }); + InstrumentationRegistry.registerInstance(sInstrumentation, instArgs); RavenwoodSystemServer.init(systemServerContext); @@ -386,22 +445,46 @@ public class RavenwoodRuntimeEnvironmentController { SystemProperties.clearChangeCallbacksForTest(); - if (ENABLE_TIMEOUT_STACKS) { - sPendingTimeout = sTimeoutExecutor.schedule( - RavenwoodRuntimeEnvironmentController::dumpStacks, - TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); - } - if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { - maybeThrowPendingUncaughtException(false); - } + maybeThrowPendingUncaughtException(); } /** - * Partially reset and initialize before each test method invocation + * Called when a test method is about to be started. */ - public static void initForMethod() { + public static void enterTestMethod(Description description) { // TODO(b/375272444): this is a hacky workaround to ensure binder identity Binder.restoreCallingIdentity(sCallingIdentity); + + scheduleTimeout(); + } + + /** + * Called when a test method finished. + */ + public static void exitTestMethod(Description description) { + cancelTimeout(); + maybeThrowPendingUncaughtException(); + } + + private static void scheduleTimeout() { + if (!ENABLE_TIMEOUT_STACKS) { + return; + } + cancelTimeout(); + + sPendingTimeout = sTimeoutExecutor.schedule( + RavenwoodRuntimeEnvironmentController::onTestTimedOut, + TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); + } + + private static void cancelTimeout() { + if (!ENABLE_TIMEOUT_STACKS) { + return; + } + var pt = sPendingTimeout; + if (pt != null) { + pt.cancel(false); + } } private static void initializeCompatIds() { @@ -460,15 +543,36 @@ public class RavenwoodRuntimeEnvironmentController { } /** + * Return if an exception is benign and okay to continue running the main looper even + * if we detect it. + */ + private static boolean isThrowableBenign(Throwable th) { + return th instanceof AssertionError || th instanceof AssumptionViolatedException; + } + + static void dispatchMessage(Message msg) { + try { + msg.getTarget().dispatchMessage(msg); + } catch (Throwable th) { + var desc = String.format("Detected %s on looper thread %s", th.getClass().getName(), + Thread.currentThread()); + sStdErr.println(desc); + if (TOLERATE_LOOPER_ASSERTS && isThrowableBenign(th)) { + sStdErr.printf("*** Continuing the test because it's %s ***\n", + th.getClass().getSimpleName()); + var e = new Exception(desc, th); + sPendingUncaughtException.compareAndSet(null, e); + return; + } + throw th; + } + } + + /** * A callback when a test class finishes its execution, mostly only for debugging. */ public static void exitTestClass() { - if (ENABLE_TIMEOUT_STACKS) { - sPendingTimeout.cancel(false); - } - if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { - maybeThrowPendingUncaughtException(true); - } + maybeThrowPendingUncaughtException(); } public static void logTestRunner(String label, Description description) { @@ -478,35 +582,70 @@ public class RavenwoodRuntimeEnvironmentController { + "(" + description.getTestClass().getName() + ")"); } - private static void dumpStacks() { - final PrintStream out = System.err; - out.println("-----BEGIN ALL THREAD STACKS-----"); - final Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces(); - for (Map.Entry<Thread, StackTraceElement[]> stack : stacks.entrySet()) { - out.println(); - Thread t = stack.getKey(); - out.println(t.toString() + " ID=" + t.getId()); - for (StackTraceElement e : stack.getValue()) { - out.println("\tat " + e); - } + private static void maybeThrowPendingUncaughtException() { + final Throwable pending = sPendingUncaughtException.getAndSet(null); + if (pending != null) { + throw new IllegalStateException("Found an uncaught exception", pending); } - out.println("-----END ALL THREAD STACKS-----"); } /** - * If there's a pending uncaught exception, consume and throw it now. Typically used to - * report an exception on a background thread as a failure for the currently running test. + * Prints the stack trace from all threads. */ - private static void maybeThrowPendingUncaughtException(boolean duringReset) { - final Throwable pending = sPendingUncaughtException.getAndSet(null); - if (pending != null) { - if (duringReset) { - throw new IllegalStateException( - "Found an uncaught exception during this test", pending); - } else { - throw new IllegalStateException( - "Found an uncaught exception before this test started", pending); + private static void onTestTimedOut() { + sStdErr.println("********* SLOW TEST DETECTED ********"); + dumpStacks(null, null); + } + + private static final Object sDumpStackLock = new Object(); + + /** + * Prints the stack trace from all threads. + */ + private static void dumpStacks( + @Nullable Thread exceptionThread, @Nullable Throwable throwable) { + cancelTimeout(); + synchronized (sDumpStackLock) { + final PrintStream out = sStdErr; + out.println("-----BEGIN ALL THREAD STACKS-----"); + + var stacks = Thread.getAllStackTraces(); + var threads = stacks.keySet().stream().sorted( + Comparator.comparingLong(Thread::getId)).collect(Collectors.toList()); + + // Put the test and the main thread at the top. + var testThread = sTestThread; + var mainThread = sMainThread; + if (mainThread != null) { + threads.remove(mainThread); + threads.add(0, mainThread); } + if (testThread != null) { + threads.remove(testThread); + threads.add(0, testThread); + } + // Put the exception thread at the top. + // Also inject the stacktrace from the exception. + if (exceptionThread != null) { + threads.remove(exceptionThread); + threads.add(0, exceptionThread); + stacks.put(exceptionThread, throwable.getStackTrace()); + } + for (var th : threads) { + out.println(); + + out.print("Thread"); + if (th == exceptionThread) { + out.print(" [** EXCEPTION THREAD **]"); + } + out.print(": " + th.getName() + " / " + th); + out.println(); + + for (StackTraceElement e : stacks.get(th)) { + out.println("\tat " + e); + } + } + out.println("-----END ALL THREAD STACKS-----"); } } @@ -532,13 +671,17 @@ public class RavenwoodRuntimeEnvironmentController { () -> Class.forName("org.mockito.Matchers")); } - // TODO: use the real UiAutomation class instead of a mock - private static UiAutomation createMockUiAutomation() { - sAdoptedPermissions = Collections.emptySet(); - var mock = mock(UiAutomation.class, inv -> { + static <T> T makeDefaultThrowMock(Class<T> clazz) { + return mock(clazz, inv -> { HostTestUtils.onThrowMethodCalled(); return null; }); + } + + // TODO: use the real UiAutomation class instead of a mock + private static UiAutomation createMockUiAutomation() { + sAdoptedPermissions = Collections.emptySet(); + var mock = makeDefaultThrowMock(UiAutomation.class); doAnswer(inv -> { sAdoptedPermissions = UiAutomation.ALL_PERMISSIONS; return null; @@ -573,6 +716,23 @@ public class RavenwoodRuntimeEnvironmentController { } } + private static void reportUncaughtExceptions(Thread th, Throwable e) { + sStdErr.printf("Uncaught exception detected: %s: %s\n", + th, RavenwoodCommonUtils.getStackTraceString(e)); + + doBugreport(th, e, DIE_ON_UNCAUGHT_EXCEPTION); + } + + private static void doBugreport( + @Nullable Thread exceptionThread, @Nullable Throwable throwable, + boolean killSelf) { + // TODO: Print more information + dumpStacks(exceptionThread, throwable); + if (killSelf) { + System.exit(13); + } + } + private static void dumpJavaProperties() { Log.v(TAG, "JVM properties:"); dumpMap(System.getProperties()); @@ -588,7 +748,6 @@ public class RavenwoodRuntimeEnvironmentController { Log.v(TAG, " " + key + "=" + map.get(key)); } } - private static void dumpOtherInfo() { Log.v(TAG, "Other key information:"); var jloc = Locale.getDefault(); diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java index 70c161c1f19a..819d93a9c336 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodSystemProperties.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @@ -45,6 +46,9 @@ public class RavenwoodSystemProperties { /** The default values. */ static final Map<String, String> sDefaultValues = new HashMap<>(); + static final Set<String> sReadableKeys = new HashSet<>(); + static final Set<String> sWritableKeys = new HashSet<>(); + private static final String[] PARTITIONS = { "bootimage", "odm", @@ -88,9 +92,24 @@ public class RavenwoodSystemProperties { ravenwoodProps.forEach((key, origValue) -> { final String value; - // If a value starts with "$$$", then this is a reference to the device-side value. if (origValue.startsWith("$$$")) { + // If a value starts with "$$$", then: + // - If it's "$$$r", the key is allowed to read. + // - If it's "$$$w", the key is allowed to write. + // - Otherwise, it's a reference to the device-side value. + // In case of $$$r and $$$w, if the key ends with a '.', then it'll be treaded + // as a prefix match. var deviceKey = origValue.substring(3); + if ("r".equals(deviceKey)) { + sReadableKeys.add(key); + Log.v(TAG, key + " (readable)"); + return; + } else if ("w".equals(deviceKey)) { + sWritableKeys.add(key); + Log.v(TAG, key + " (writable)"); + return; + } + var deviceValue = deviceProps.get(deviceKey); if (deviceValue == null) { throw new RuntimeException("Failed to initialize system properties. Key '" @@ -131,50 +150,38 @@ public class RavenwoodSystemProperties { sDefaultValues.forEach(RavenwoodRuntimeNative::setSystemProperty); } - private static boolean isKeyReadable(String key) { - // All writable keys are also readable - if (isKeyWritable(key)) return true; + private static boolean checkAllowedInner(String key, Set<String> allowed) { + if (allowed.contains(key)) { + return true; + } - final String root = getKeyRoot(key); + // Also search for a prefix match. + for (var k : allowed) { + if (k.endsWith(".") && key.startsWith(k)) { + return true; + } + } + return false; + } - // This set is carefully curated to help identify situations where a test may - // accidentally depend on a default value of an obscure property whose owner hasn't - // decided how Ravenwood should behave. - if (root.startsWith("boot.")) return true; - if (root.startsWith("build.")) return true; - if (root.startsWith("product.")) return true; - if (root.startsWith("soc.")) return true; - if (root.startsWith("system.")) return true; + private static boolean checkAllowed(String key, Set<String> allowed) { + return checkAllowedInner(key, allowed) || checkAllowedInner(getKeyRoot(key), allowed); + } + private static boolean isKeyReadable(String key) { // All core values should be readable - if (sDefaultValues.containsKey(key)) return true; - - // Hardcoded allowlist - return switch (key) { - case "gsm.version.baseband", - "no.such.thing", - "qemu.sf.lcd_density", - "ro.bootloader", - "ro.hardware", - "ro.hw_timeout_multiplier", - "ro.odm.build.media_performance_class", - "ro.sf.lcd_density", - "ro.treble.enabled", - "ro.vndk.version", - "ro.icu.data.path" -> true; - default -> false; - }; + if (sDefaultValues.containsKey(key)) { + return true; + } + if (checkAllowed(key, sReadableKeys)) { + return true; + } + // All writable keys are also readable + return isKeyWritable(key); } private static boolean isKeyWritable(String key) { - final String root = getKeyRoot(key); - - if (root.startsWith("debug.")) return true; - - // For PropertyInvalidatedCache - if (root.startsWith("cache_key.")) return true; - - return false; + return checkAllowed(key, sWritableKeys); } static boolean isKeyAccessible(String key, boolean write) { diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodUtils.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodUtils.java index 19c1bffaebcd..3e2c4051b792 100644 --- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodUtils.java +++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodUtils.java @@ -15,7 +15,20 @@ */ package android.platform.test.ravenwood; +import static com.android.ravenwood.common.RavenwoodCommonUtils.ReflectedMethod.reflectMethod; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.os.Handler; +import android.os.Looper; + import com.android.ravenwood.common.RavenwoodCommonUtils; +import com.android.ravenwood.common.SneakyThrow; + +import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; /** * Utilities for writing (bivalent) ravenwood tests. @@ -47,4 +60,129 @@ public class RavenwoodUtils { public static void loadJniLibrary(String libname) { RavenwoodCommonUtils.loadJniLibrary(libname); } + + private class MainHandlerHolder { + static Handler sMainHandler = new Handler(Looper.getMainLooper()); + } + + /** + * Returns the main thread handler. + */ + public static Handler getMainHandler() { + return MainHandlerHolder.sMainHandler; + } + + /** + * Run a Callable on Handler and wait for it to complete. + */ + @Nullable + public static <T> T runOnHandlerSync(@NonNull Handler h, @NonNull Callable<T> c) { + var result = new AtomicReference<T>(); + var thrown = new AtomicReference<Throwable>(); + var latch = new CountDownLatch(1); + h.post(() -> { + try { + result.set(c.call()); + } catch (Throwable th) { + thrown.set(th); + } + latch.countDown(); + }); + try { + latch.await(); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted while waiting on the Runnable", e); + } + var th = thrown.get(); + if (th != null) { + SneakyThrow.sneakyThrow(th); + } + return result.get(); + } + + + /** + * Run a Runnable on Handler and wait for it to complete. + */ + @Nullable + public static void runOnHandlerSync(@NonNull Handler h, @NonNull Runnable r) { + runOnHandlerSync(h, () -> { + r.run(); + return null; + }); + } + + /** + * Run a Callable on main thread and wait for it to complete. + */ + @Nullable + public static <T> T runOnMainThreadSync(@NonNull Callable<T> c) { + return runOnHandlerSync(getMainHandler(), c); + } + + /** + * Run a Runnable on main thread and wait for it to complete. + */ + @Nullable + public static void runOnMainThreadSync(@NonNull Runnable r) { + runOnHandlerSync(getMainHandler(), r); + } + + public static class MockitoHelper { + private MockitoHelper() { + } + + /** + * Allow verifyZeroInteractions to work on ravenwood. It was replaced with a different + * method on. (Maybe we should do it in Ravenizer.) + */ + public static void verifyZeroInteractions(Object... mocks) { + if (RavenwoodRule.isOnRavenwood()) { + // Mockito 4 or later + reflectMethod("org.mockito.Mockito", "verifyNoInteractions", Object[].class) + .callStatic(new Object[]{mocks}); + } else { + // Mockito 2 + reflectMethod("org.mockito.Mockito", "verifyZeroInteractions", Object[].class) + .callStatic(new Object[]{mocks}); + } + } + } + + + /** + * Wrap the given {@link Supplier} to become memoized. + * + * The underlying {@link Supplier} will only be invoked once, and that result will be cached + * and returned for any future requests. + */ + static <T> Supplier<T> memoize(ThrowingSupplier<T> supplier) { + return new Supplier<>() { + private T mInstance; + + @Override + public T get() { + synchronized (this) { + if (mInstance == null) { + mInstance = create(); + } + return mInstance; + } + } + + private T create() { + try { + return supplier.get(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }; + } + + /** Used by {@link #memoize(ThrowingSupplier)} */ + public interface ThrowingSupplier<T> { + /** */ + T get() throws Exception; + } } diff --git a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java index a967a3fff0d7..893b354d4645 100644 --- a/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +++ b/ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java @@ -26,10 +26,12 @@ import java.io.FileInputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; +import java.util.Objects; import java.util.function.Supplier; public class RavenwoodCommonUtils { @@ -329,4 +331,70 @@ public class RavenwoodCommonUtils { public static <T> T withDefault(@Nullable T value, @Nullable T def) { return value != null ? value : def; } + + /** + * Utility for calling a method with reflections. Used to call a method by name. + * Note, this intentionally does _not_ support non-public methods, as we generally + * shouldn't violate java visibility in ravenwood. + * + * @param <TTHIS> class owning the method. + */ + public static class ReflectedMethod<TTHIS> { + private final Class<TTHIS> mThisClass; + private final Method mMethod; + + private ReflectedMethod(Class<TTHIS> thisClass, Method method) { + mThisClass = thisClass; + mMethod = method; + } + + /** Factory method. */ + @SuppressWarnings("unchecked") + public static <TTHIS> ReflectedMethod<TTHIS> reflectMethod( + @NonNull Class<TTHIS> clazz, @NonNull String methodName, + @NonNull Class<?>... argTypes) { + try { + return new ReflectedMethod(clazz, clazz.getMethod(methodName, argTypes)); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + + /** Factory method. */ + @SuppressWarnings("unchecked") + public static <TTHIS> ReflectedMethod<TTHIS> reflectMethod( + @NonNull String className, @NonNull String methodName, + @NonNull Class<?>... argTypes) { + try { + return reflectMethod((Class<TTHIS>) Class.forName(className), methodName, argTypes); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + + /** Call the instance method */ + @SuppressWarnings("unchecked") + public <RET> RET call(@NonNull TTHIS thisObject, @NonNull Object... args) { + try { + return (RET) mMethod.invoke(Objects.requireNonNull(thisObject), args); + } catch (InvocationTargetException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + /** Call the static method */ + @SuppressWarnings("unchecked") + public <RET> RET callStatic(@NonNull Object... args) { + try { + return (RET) mMethod.invoke(null, args); + } catch (InvocationTargetException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + + /** Handy method to create an array */ + public static <T> T[] arr(@NonNull T... objects) { + return objects; + } } diff --git a/ravenwood/runtime-helper-src/framework/android/util/Log_ravenwood.java b/ravenwood/runtime-helper-src/framework/android/util/Log_ravenwood.java index 7ab9cda378b7..855a4ff21671 100644 --- a/ravenwood/runtime-helper-src/framework/android/util/Log_ravenwood.java +++ b/ravenwood/runtime-helper-src/framework/android/util/Log_ravenwood.java @@ -21,7 +21,6 @@ import android.util.Log.Level; import com.android.internal.annotations.GuardedBy; import com.android.internal.os.RuntimeInit; import com.android.ravenwood.RavenwoodRuntimeNative; -import com.android.ravenwood.common.RavenwoodCommonUtils; import java.io.PrintStream; import java.text.SimpleDateFormat; @@ -164,7 +163,7 @@ public class Log_ravenwood { * Return the "real" {@code System.out} if it's been swapped by {@code RavenwoodRuleImpl}, so * that we don't end up in a recursive loop. */ - private static PrintStream getRealOut() { + public static PrintStream getRealOut() { if (RuntimeInit.sOut$ravenwood != null) { return RuntimeInit.sOut$ravenwood; } else { diff --git a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java index 96aed4b3401d..d5a96ddc3a98 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java +++ b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodJdkPatch.java @@ -20,6 +20,7 @@ import com.android.ravenwood.common.JvmWorkaround; import java.io.FileDescriptor; import java.util.LinkedHashMap; import java.util.Map; +import java.util.regex.Pattern; /** * Class to host APIs that exist in libcore, but not in standard JRE. @@ -46,4 +47,22 @@ public class RavenwoodJdkPatch { final var it = map.entrySet().iterator(); return it.hasNext() ? it.next() : null; } + + /** + * Implements Pattern.compile(String) + * + * ART always assumes UNICODE_CHARACTER_CLASS is set. + */ + public static Pattern compilePattern(String regex) { + return Pattern.compile(regex, Pattern.UNICODE_CHARACTER_CLASS); + } + + /** + * Implements Pattern.compile(String, int) + * + * ART always assumes UNICODE_CHARACTER_CLASS is set. + */ + public static Pattern compilePattern(String regex, int flag) { + return Pattern.compile(regex, flag | Pattern.UNICODE_CHARACTER_CLASS); + } } diff --git a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java index acbcdf1926db..0d82a8691881 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java +++ b/ravenwood/runtime-helper-src/libcore-fake/com/android/ravenwood/RavenwoodRuntimeNative.java @@ -66,6 +66,8 @@ public class RavenwoodRuntimeNative { public static native int gettid(); + public static native String getIcuDataName(); + public static long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException { return nLseek(JvmWorkaround.getInstance().getFdInt(fd), offset, whence); } diff --git a/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/CloseGuard.java b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/CloseGuard.java new file mode 100644 index 000000000000..82bab64f22f3 --- /dev/null +++ b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/CloseGuard.java @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2010 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 dalvik.system; + +/** + * A no-op copy of libcore/dalvik/src/main/java/dalvik/system/CloseGuard.java + */ +public final class CloseGuard { + + /** + * Returns a CloseGuard instance. {@code #open(String)} can be used to set + * up the instance to warn on failure to close. + * + * @return {@link CloseGuard} instance. + * + * @hide + */ + public static CloseGuard get() { + return new CloseGuard(); + } + + /** + * Enables/disables stack capture and tracking. A call stack is captured + * during open(), and open/close events are reported to the Tracker, only + * if enabled is true. If a stack trace was captured, the {@link + * #getReporter() reporter} is informed of unclosed resources; otherwise a + * one-line warning is logged. + * + * @param enabled whether stack capture and tracking is enabled. + * + * @hide + */ + public static void setEnabled(boolean enabled) { + } + + /** + * True if CloseGuard stack capture and tracking are enabled. + * + * @hide + */ + public static boolean isEnabled() { + return false; + } + + /** + * Used to replace default Reporter used to warn of CloseGuard + * violations when stack tracking is enabled. Must be non-null. + * + * @param rep replacement for default Reporter. + * + * @hide + */ + public static void setReporter(Reporter rep) { + if (rep == null) { + throw new NullPointerException("reporter == null"); + } + } + + /** + * Returns non-null CloseGuard.Reporter. + * + * @return CloseGuard's Reporter. + * + * @hide + */ + public static Reporter getReporter() { + return null; + } + + /** + * Sets the {@link Tracker} that is notified when resources are allocated and released. + * The Tracker is invoked only if CloseGuard {@link #isEnabled()} held when {@link #open()} + * was called. A null argument disables tracking. + * + * <p>This is only intended for use by {@code dalvik.system.CloseGuardSupport} class and so + * MUST NOT be used for any other purposes. + * + * @hide + */ + public static void setTracker(Tracker tracker) { + } + + /** + * Returns {@link #setTracker(Tracker) last Tracker that was set}, or null to indicate + * there is none. + * + * <p>This is only intended for use by {@code dalvik.system.CloseGuardSupport} class and so + * MUST NOT be used for any other purposes. + * + * @hide + */ + public static Tracker getTracker() { + return null; + } + + private CloseGuard() {} + + /** + * {@code open} initializes the instance with a warning that the caller + * should have explicitly called the {@code closer} method instead of + * relying on finalization. + * + * @param closer non-null name of explicit termination method. Printed by warnIfOpen. + * @throws NullPointerException if closer is null. + * + * @hide + */ + public void open(String closer) { + openWithCallSite(closer, null /* callsite */); + } + + /** + * Like {@link #open(String)}, but with explicit callsite string being passed in for better + * performance. + * <p> + * This only has better performance than {@link #open(String)} if {@link #isEnabled()} returns {@code true}, which + * usually shouldn't happen on release builds. + * + * @param closer Non-null name of explicit termination method. Printed by warnIfOpen. + * @param callsite Non-null string uniquely identifying the callsite. + * + * @hide + */ + public void openWithCallSite(String closer, String callsite) { + } + + // We keep either an allocation stack containing the closer String or, when + // in disabled state, just the closer String. + // We keep them in a single field only to minimize overhead. + private Object /* String or Throwable */ closerNameOrAllocationInfo; + + /** + * Marks this CloseGuard instance as closed to avoid warnings on + * finalization. + * + * @hide + */ + public void close() { + } + + /** + * Logs a warning if the caller did not properly cleanup by calling an + * explicit close method before finalization. If CloseGuard was enabled + * when the CloseGuard was created, passes the stacktrace associated with + * the allocation to the current reporter. If it was not enabled, it just + * directly logs a brief message. + * + * @hide + */ + public void warnIfOpen() { + } + + + /** + * Interface to allow customization of tracking behaviour. + * + * <p>This is only intended for use by {@code dalvik.system.CloseGuardSupport} class and so + * MUST NOT be used for any other purposes. + * + * @hide + */ + public interface Tracker { + void open(Throwable allocationSite); + void close(Throwable allocationSite); + } + + /** + * Interface to allow customization of reporting behavior. + * @hide + */ + public interface Reporter { + /** + * + * @hide + */ + void report(String message, Throwable allocationSite); + + /** + * + * @hide + */ + default void report(String message) {} + } +} diff --git a/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java index eaadac6a8b92..50cfd3bbe863 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java +++ b/ravenwood/runtime-helper-src/libcore-fake/dalvik/system/VMRuntime.java @@ -57,4 +57,12 @@ public class VMRuntime { public int getTargetSdkVersion() { return RavenwoodRuntimeState.sTargetSdkLevel; } + + /** Ignored on ravenwood. */ + public void registerNativeAllocation(long bytes) { + } + + /** Ignored on ravenwood. */ + public void registerNativeFree(long bytes) { + } } diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoBridge.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoBridge.java new file mode 100644 index 000000000000..2a1ee2542982 --- /dev/null +++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/io/IoBridge.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2025 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 libcore.io; + +import android.system.ErrnoException; +import android.system.Os; +import android.system.OsConstants; + +import java.io.FileDescriptor; +import java.io.FileNotFoundException; +import java.io.IOException; + +public class IoBridge { + + public static void closeAndSignalBlockedThreads(FileDescriptor fd) throws IOException { + if (fd == null) { + return; + } + try { + Os.close(fd); + } catch (ErrnoException errnoException) { + throw errnoException.rethrowAsIOException(); + } + } + + public static FileDescriptor open(String path, int flags) throws FileNotFoundException { + FileDescriptor fd = null; + try { + fd = Os.open(path, flags, 0666); + // Posix open(2) fails with EISDIR only if you ask for write permission. + // Java disallows reading directories too.f + if (OsConstants.S_ISDIR(Os.fstat(fd).st_mode)) { + throw new ErrnoException("open", OsConstants.EISDIR); + } + return fd; + } catch (ErrnoException errnoException) { + try { + if (fd != null) { + closeAndSignalBlockedThreads(fd); + } + } catch (IOException ignored) { + } + FileNotFoundException ex = new FileNotFoundException(path + ": " + + errnoException.getMessage()); + ex.initCause(errnoException); + throw ex; + } + } +} diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java index ad86135de32e..985e00e8641d 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java +++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NativeAllocationRegistry.java @@ -35,6 +35,11 @@ public class NativeAllocationRegistry { return new NativeAllocationRegistry(classLoader, freeFunction, size); } + public static NativeAllocationRegistry createNonmalloced( + Class clazz, long freeFunction, long size) { + return new NativeAllocationRegistry(clazz.getClassLoader(), freeFunction, size); + } + public static NativeAllocationRegistry createMalloced( ClassLoader classLoader, long freeFunction, long size) { return new NativeAllocationRegistry(classLoader, freeFunction, size); @@ -45,6 +50,11 @@ public class NativeAllocationRegistry { return new NativeAllocationRegistry(classLoader, freeFunction, 0); } + public static NativeAllocationRegistry createMalloced( + Class clazz, long freeFunction, long size) { + return new NativeAllocationRegistry(clazz.getClassLoader(), freeFunction, size); + } + public NativeAllocationRegistry(ClassLoader classLoader, long freeFunction, long size) { if (size < 0) { throw new IllegalArgumentException("Invalid native allocation size: " + size); @@ -52,21 +62,67 @@ public class NativeAllocationRegistry { mFreeFunction = freeFunction; } + private class CleanerThunk implements Runnable { + private long nativePtr; + + public CleanerThunk() { + nativePtr = 0; + } + + public void setNativePtr(long ptr) { + nativePtr = ptr; + } + + @Override + public void run() { + if (nativePtr != 0) { + applyFreeFunction(mFreeFunction, nativePtr); + } + } + } + + private static class CleanableRunner implements Runnable { + private final Cleaner.Cleanable mCleanable; + + public CleanableRunner(Cleaner.Cleanable cleanable) { + mCleanable = cleanable; + } + + public void run() { + mCleanable.clean(); + } + } + public Runnable registerNativeAllocation(Object referent, long nativePtr) { if (referent == null) { throw new IllegalArgumentException("referent is null"); } + if (mFreeFunction == 0) { + return () -> {}; // do nothing + } if (nativePtr == 0) { throw new IllegalArgumentException("nativePtr is null"); } - final Runnable releaser = () -> { - RavenwoodRuntimeNative.applyFreeFunction(mFreeFunction, nativePtr); - }; - sCleaner.register(referent, releaser); + final CleanerThunk thunk; + final CleanableRunner result; + try { + thunk = new CleanerThunk(); + final var cleanable = sCleaner.register(referent, thunk); + result = new CleanableRunner(cleanable); + } catch (VirtualMachineError vme /* probably OutOfMemoryError */) { + applyFreeFunction(mFreeFunction, nativePtr); + throw vme; + } + // Enable the cleaner only after we can no longer throw anything, including OOME. + thunk.setNativePtr(nativePtr); // Ensure that cleaner doesn't get invoked before we enable it. Reference.reachabilityFence(referent); - return releaser; + return result; + } + + public static void applyFreeFunction(long freeFunction, long nativePtr) { + RavenwoodRuntimeNative.applyFreeFunction(freeFunction, nativePtr); } } diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NonNull.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NonNull.java index db3cd8ed712f..1153a77d5c9a 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NonNull.java +++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/NonNull.java @@ -35,14 +35,4 @@ import java.lang.annotation.Target; @Retention(SOURCE) @Target({FIELD, METHOD, PARAMETER, TYPE_USE}) @libcore.api.IntraCoreApi -public @interface NonNull { - /** - * Min Android API level (inclusive) to which this annotation is applied. - */ - int from() default Integer.MIN_VALUE; - - /** - * Max Android API level to which this annotation is applied. - */ - int to() default Integer.MAX_VALUE; -} +public @interface NonNull {} diff --git a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Nullable.java b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Nullable.java index 3371978b0568..295f083426ff 100644 --- a/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Nullable.java +++ b/ravenwood/runtime-helper-src/libcore-fake/libcore/util/Nullable.java @@ -35,14 +35,4 @@ import java.lang.annotation.Target; @Retention(SOURCE) @Target({FIELD, METHOD, PARAMETER, TYPE_USE}) @libcore.api.IntraCoreApi -public @interface Nullable { - /** - * Min Android API level (inclusive) to which this annotation is applied. - */ - int from() default Integer.MIN_VALUE; - - /** - * Max Android API level to which this annotation is applied. - */ - int to() default Integer.MAX_VALUE; -} +public @interface Nullable {} diff --git a/ravenwood/runtime-jni/ravenwood_runtime.cpp b/ravenwood/runtime-jni/ravenwood_runtime.cpp index 8d8ed7119e84..01ebdc953539 100644 --- a/ravenwood/runtime-jni/ravenwood_runtime.cpp +++ b/ravenwood/runtime-jni/ravenwood_runtime.cpp @@ -20,6 +20,7 @@ #include <sys/syscall.h> #include <unistd.h> #include <utils/misc.h> +#include <unicode/utypes.h> #include <string> @@ -183,6 +184,10 @@ static jint Linux_gettid(JNIEnv* env, jobject) { return syscall(__NR_gettid); } +static jstring getIcuDataName(JNIEnv* env, jclass clazz) { + return env->NewStringUTF(U_ICUDATA_NAME); +} + // ---- Registration ---- extern void register_android_system_OsConstants(JNIEnv* env); @@ -201,6 +206,7 @@ static const JNINativeMethod sMethods[] = { "setenv", "(Ljava/lang/String;Ljava/lang/String;Z)V", (void*)Linux_setenv }, { "getpid", "()I", (void*)Linux_getpid }, { "gettid", "()I", (void*)Linux_gettid }, + { "getIcuDataName", "()Ljava/lang/String;", (void*)getIcuDataName }, }; extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) { diff --git a/ravenwood/scripts/add-annotations.sh b/ravenwood/scripts/add-annotations.sh index 3e86037d7c7b..8c394f51d8c4 100755 --- a/ravenwood/scripts/add-annotations.sh +++ b/ravenwood/scripts/add-annotations.sh @@ -35,7 +35,7 @@ set -e # We add this line to each methods found. # Note, if we used a single @, that'd be handled as an at file. Use # the double-at instead. -annotation="@@android.platform.test.annotations.DisabledOnRavenwood" +annotation="@@android.platform.test.annotations.DisabledOnRavenwood(reason = \"bulk-disabled by script\")" while getopts "t:" opt; do case "$opt" in t) diff --git a/ravenwood/tests/coretest/Android.bp b/ravenwood/tests/coretest/Android.bp index 9dd7cc683719..182a7cf3d3de 100644 --- a/ravenwood/tests/coretest/Android.bp +++ b/ravenwood/tests/coretest/Android.bp @@ -33,3 +33,34 @@ android_ravenwood_test { }, auto_gen_config: true, } + +// Same as RavenwoodCoreTest, but it excludes tests using platform-parametric-runner-lib, +// because that modules has too many dependencies and slow to build incrementally. +android_ravenwood_test { + name: "RavenwoodCoreTest-light", + + static_libs: [ + "androidx.annotation_annotation", + "androidx.test.ext.junit", + "androidx.test.rules", + + // This library should be removed by Ravenizer + "mockito-target-minus-junit4", + ], + libs: [ + // We access internal private classes + "ravenwood-junit-impl", + ], + srcs: [ + "test/**/*.java", + "test/**/*.kt", + ], + + exclude_srcs: [ + "test/com/android/ravenwoodtest/runnercallbacktests/*", + ], + ravenizer: { + strip_mockito: true, + }, + auto_gen_config: true, +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodMainThreadTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodMainThreadTest.java new file mode 100644 index 000000000000..68387d76b675 --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodMainThreadTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.coretest; + +import static com.google.common.truth.Truth.assertThat; + +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import android.platform.test.ravenwood.RavenwoodUtils; + +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicReference; + +public class RavenwoodMainThreadTest { + private static final boolean RUN_UNSAFE_TESTS = + "1".equals(System.getenv("RAVENWOOD_RUN_UNSAFE_TESTS")); + + @Test + public void testRunOnMainThread() { + AtomicReference<Thread> thr = new AtomicReference<>(); + RavenwoodUtils.runOnMainThreadSync(() -> { + thr.set(Thread.currentThread()); + }); + var th = thr.get(); + assertThat(th).isNotNull(); + assertThat(th).isNotEqualTo(Thread.currentThread()); + } + + /** + * Sleep a long time on the main thread. This test would then "pass", but Ravenwood + * should show the stack traces. + * + * This is "unsafe" because this test is slow. + */ + @Test + public void testUnsafeMainThreadHang() { + assumeTrue(RUN_UNSAFE_TESTS); + + // The test should time out. + RavenwoodUtils.runOnMainThreadSync(() -> { + try { + Thread.sleep(30_000); + } catch (InterruptedException e) { + fail("Interrupted"); + } + }); + } + + /** + * AssertionError on the main thread would be swallowed and reported "normally". + * (Other kinds of exceptions would be caught by the unhandled exception handler, and kills + * the process) + * + * This is "unsafe" only because this feature can be disabled via the env var. + */ + @Test + public void testUnsafeAssertFailureOnMainThread() { + assumeTrue(RUN_UNSAFE_TESTS); + + assertThrows(AssertionError.class, () -> { + RavenwoodUtils.runOnMainThreadSync(() -> { + fail(); + }); + }); + } +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodReflectorTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodReflectorTest.java new file mode 100644 index 000000000000..421fb50e0c9a --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodReflectorTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.coretest; + +import static com.google.common.truth.Truth.assertThat; + +import com.android.ravenwood.common.RavenwoodCommonUtils.ReflectedMethod; + +import org.junit.Test; + +/** + * Tests for {@link ReflectedMethod}. + */ +public class RavenwoodReflectorTest { + /** test target */ + public class Target { + private final int mVar; + + /** test target */ + public Target(int var) { + mVar = var; + } + + /** test target */ + public int foo(int x) { + return x + mVar; + } + + /** test target */ + public static int bar(int x) { + return x + 1; + } + } + + /** Test for a non-static method call */ + @Test + public void testNonStatic() { + var obj = new Target(5); + + var m = ReflectedMethod.reflectMethod(Target.class, "foo", int.class); + assertThat((int) m.call(obj, 2)).isEqualTo(7); + } + + /** Test for a static method call */ + @Test + public void testStatic() { + var m = ReflectedMethod.reflectMethod(Target.class, "bar", int.class); + assertThat((int) m.callStatic(1)).isEqualTo(2); + } +} diff --git a/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodSystemPropertiesTest.java b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodSystemPropertiesTest.java new file mode 100644 index 000000000000..454f5a9576d9 --- /dev/null +++ b/ravenwood/tests/coretest/test/com/android/ravenwoodtest/coretest/RavenwoodSystemPropertiesTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.ravenwoodtest.coretest; + +import static com.google.common.truth.Truth.assertThat; + +import static org.junit.Assert.fail; + +import android.os.SystemProperties; + +import org.junit.Test; + +public class RavenwoodSystemPropertiesTest { + @Test + public void testRead() { + assertThat(SystemProperties.get("ro.board.first_api_level")).isEqualTo("1"); + } + + @Test + public void testWrite() { + SystemProperties.set("debug.xxx", "5"); + assertThat(SystemProperties.get("debug.xxx")).isEqualTo("5"); + } + + private static void assertException(String expectedMessage, Runnable r) { + try { + r.run(); + fail("Excepted exception with message '" + expectedMessage + "' but wasn't thrown"); + } catch (RuntimeException e) { + if (e.getMessage().contains(expectedMessage)) { + return; + } + fail("Excepted exception with message '" + expectedMessage + "' but was '" + + e.getMessage() + "'"); + } + } + + + @Test + public void testReadDisallowed() { + assertException("Read access to system property 'nonexisitent' denied", () -> { + SystemProperties.get("nonexisitent"); + }); + } + + @Test + public void testWriteDisallowed() { + assertException("failed to set system property \"ro.board.first_api_level\" ", () -> { + SystemProperties.set("ro.board.first_api_level", "2"); + }); + } +} diff --git a/ravenwood/tests/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java b/ravenwood/tests/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java index 30abaa2e7d38..b1a40f082656 100644 --- a/ravenwood/tests/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java +++ b/ravenwood/tests/minimum-test/test/com/android/ravenwoodtest/RavenwoodMinimumTest.java @@ -16,28 +16,27 @@ package com.android.ravenwoodtest; import android.platform.test.annotations.IgnoreUnderRavenwood; -import android.platform.test.ravenwood.RavenwoodRule; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Assert; -import org.junit.Rule; +import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class RavenwoodMinimumTest { - @Rule - public final RavenwoodRule mRavenwood = new RavenwoodRule.Builder() - .setProcessApp() - .build(); - @Test public void testSimple() { Assert.assertTrue(android.os.Process.isApplicationUid(android.os.Process.myUid())); } @Test + public void testAssumeNot() { + Assume.assumeFalse(android.os.Process.isApplicationUid(android.os.Process.myUid())); + } + + @Test @IgnoreUnderRavenwood public void testIgnored() { throw new RuntimeException("Shouldn't be executed under ravenwood"); diff --git a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt index c196a09e18d1..7462cc2f384a 100644 --- a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt +++ b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt @@ -30,6 +30,10 @@ android.util.AndroidRuntimeException android.util.ArrayMap android.util.ArraySet android.util.AtomicFile +android.util.AtomicFileOutputStream +android.util.AtomicFileBufferedOutputStream +android.util.AtomicFilePrintWriter +android.util.AtomicFileBufferedPrintWriter android.util.BackupUtils android.util.Base64 android.util.Base64DataException @@ -111,6 +115,7 @@ android.util.UtilConfig android.util.Xml android.util.proto.EncodedBuffer +android.util.proto.ProtoFieldFilter android.util.proto.ProtoInputStream android.util.proto.ProtoOutputStream android.util.proto.ProtoParseException @@ -146,6 +151,10 @@ android.os.Looper android.os.Message android.os.MessageQueue android.os.MessageQueue_ravenwood +android.os.PerfettoTrace +android.os.PerfettoTrace$Category +android.os.PerfettoTrackEventExtra +android.os.PerfettoTrackEventExtra$NoOpBuilder android.os.PackageTagsList android.os.Parcel android.os.ParcelFileDescriptor @@ -250,6 +259,8 @@ android.database.sqlite.SQLiteClosable android.database.sqlite.SQLiteException android.text.TextUtils +android.text.Html +android.text.HtmlToSpannedConverter android.accounts.Account @@ -269,6 +280,10 @@ android.graphics.PointF android.graphics.Rect android.graphics.RectF +android.graphics.fonts.SystemFonts + +android.graphics.text.LineBreakConfig + android.content.ContentProvider android.app.ActivityManager @@ -374,3 +389,228 @@ android.app.compat.* com.android.server.compat.* com.android.internal.compat.* android.app.AppCompatCallbacks +android.graphics.AvoidXfermode +android.graphics.BLASTBufferQueue +android.graphics.BaseCanvas +android.graphics.BaseRecordingCanvas +android.graphics.Bitmap +android.graphics.BitmapFactory +android.graphics.BitmapRegionDecoder +android.graphics.BitmapShader +android.graphics.BlendMode +android.graphics.BlendModeColorFilter +android.graphics.BlurMaskFilter +android.graphics.Camera +android.graphics.Canvas +android.graphics.CanvasProperty +android.graphics.ColorFilter +android.graphics.ColorMatrix +android.graphics.ColorMatrixColorFilter +android.graphics.Compatibility +android.graphics.ComposePathEffect +android.graphics.ComposeShader +android.graphics.CornerPathEffect +android.graphics.DashPathEffect +android.graphics.DiscretePathEffect +android.graphics.DrawFilter +android.graphics.EmbossMaskFilter +android.graphics.FontFamily +android.graphics.FontListParser +android.graphics.ForceDarkType +android.graphics.FrameInfo +android.graphics.Gainmap +android.graphics.GraphicBuffer +android.graphics.GraphicsProtos +android.graphics.GraphicsStatsService +android.graphics.HardwareBufferRenderer +android.graphics.HardwareRenderer +android.graphics.HardwareRendererObserver +android.graphics.ImageDecoder +android.graphics.ImageFormat +android.graphics.LayerRasterizer +android.graphics.LeakyTypefaceStorage +android.graphics.LightingColorFilter +android.graphics.LinearGradient +android.graphics.MaskFilter +android.graphics.Mesh +android.graphics.MeshSpecification +android.graphics.Movie +android.graphics.NinePatch +android.graphics.Paint +android.graphics.PaintFlagsDrawFilter +android.graphics.PathDashPathEffect +android.graphics.PathEffect +android.graphics.PathIterator +android.graphics.PathMeasure +android.graphics.Picture +android.graphics.PixelXorXfermode +android.graphics.PorterDuff +android.graphics.PorterDuffColorFilter +android.graphics.PorterDuffXfermode +android.graphics.PostProcessor +android.graphics.RadialGradient +android.graphics.Rasterizer +android.graphics.RecordingCanvas +android.graphics.Region +android.graphics.RegionIterator +android.graphics.RenderEffect +android.graphics.RenderNode +android.graphics.RuntimeColorFilter +android.graphics.RuntimeShader +android.graphics.RuntimeXfermode +android.graphics.Shader +android.graphics.SumPathEffect +android.graphics.SurfaceTexture +android.graphics.SweepGradient +android.graphics.TableMaskFilter +android.graphics.TemporaryBuffer +android.graphics.TextureLayer +android.graphics.Typeface +android.graphics.Xfermode +android.graphics.YuvImage +android.graphics.fonts.Font +android.graphics.fonts.FontCustomizationParser +android.graphics.fonts.FontFamily +android.graphics.fonts.FontFamilyUpdateRequest +android.graphics.fonts.FontFileUpdateRequest +android.graphics.fonts.FontFileUtil +android.graphics.fonts.FontStyle +android.graphics.fonts.FontVariationAxis +android.graphics.text.GraphemeBreak +android.graphics.text.LineBreaker +android.graphics.text.MeasuredText +android.graphics.text.PositionedGlyphs +android.graphics.text.TextRunShaper +android.text.AlteredCharSequence +android.text.AndroidBidi +android.text.AndroidCharacter +android.text.Annotation +android.text.AutoGrowArray +android.text.AutoText +android.text.BidiFormatter +android.text.BoringLayout +android.text.CharSequenceCharacterIterator +android.text.ClipboardManager +android.text.DynamicLayout +android.text.Editable +android.text.Emoji +android.text.EmojiConsistency +android.text.FontConfig +android.text.GetChars +android.text.GraphemeClusterSegmentFinder +android.text.GraphicsOperations +android.text.Highlights +android.text.Hyphenator +android.text.InputFilter +android.text.InputType +android.text.Layout +android.text.LoginFilter +android.text.MeasuredParagraph +android.text.NoCopySpan +android.text.PackedIntVector +android.text.PackedObjectVector +android.text.ParcelableSpan +android.text.PrecomputedText +android.text.SegmentFinder +android.text.Selection +android.text.SpanColors +android.text.SpanSet +android.text.SpanWatcher +android.text.Spannable +android.text.SpannableString +android.text.SpannableStringBuilder +android.text.SpannableStringInternal +android.text.Spanned +android.text.SpannedString +android.text.StaticLayout +android.text.TextDirectionHeuristic +android.text.TextDirectionHeuristics +android.text.TextLine +android.text.TextPaint +android.text.TextShaper +android.text.TextWatcher +android.text.WordSegmentFinder +android.text.format.DateFormat +android.text.format.DateIntervalFormat +android.text.format.DateTimeFormat +android.text.format.DateUtils +android.text.format.DateUtilsBridge +android.text.format.Formatter +android.text.format.RelativeDateTimeFormatter +android.text.format.Time +android.text.format.TimeFormatter +android.text.format.TimeMigrationUtils +android.text.method.AllCapsTransformationMethod +android.text.method.ArrowKeyMovementMethod +android.text.method.BaseKeyListener +android.text.method.BaseMovementMethod +android.text.method.CharacterPickerDialog +android.text.method.DateKeyListener +android.text.method.DateTimeKeyListener +android.text.method.DialerKeyListener +android.text.method.DigitsKeyListener +android.text.method.HideReturnsTransformationMethod +android.text.method.InsertModeTransformationMethod +android.text.method.KeyListener +android.text.method.LinkMovementMethod +android.text.method.MetaKeyKeyListener +android.text.method.MovementMethod +android.text.method.MultiTapKeyListener +android.text.method.NumberKeyListener +android.text.method.OffsetMapping +android.text.method.PasswordTransformationMethod +android.text.method.QwertyKeyListener +android.text.method.ReplacementTransformationMethod +android.text.method.ScrollingMovementMethod +android.text.method.SingleLineTransformationMethod +android.text.method.TextKeyListener +android.text.method.TimeKeyListener +android.text.method.Touch +android.text.method.TransformationMethod +android.text.method.TransformationMethod2 +android.text.method.TranslationTransformationMethod +android.text.method.WordIterator +android.text.style.AbsoluteSizeSpan +android.text.style.AccessibilityClickableSpan +android.text.style.AccessibilityReplacementSpan +android.text.style.AccessibilityURLSpan +android.text.style.AlignmentSpan +android.text.style.BackgroundColorSpan +android.text.style.BulletSpan +android.text.style.CharacterStyle +android.text.style.ClickableSpan +android.text.style.ForegroundColorSpan +android.text.style.IconMarginSpan +android.text.style.LeadingMarginSpan +android.text.style.LineBackgroundSpan +android.text.style.LineBreakConfigSpan +android.text.style.LineHeightSpan +android.text.style.LocaleSpan +android.text.style.MaskFilterSpan +android.text.style.MetricAffectingSpan +android.text.style.NoWritingToolsSpan +android.text.style.ParagraphStyle +android.text.style.QuoteSpan +android.text.style.RasterizerSpan +android.text.style.RelativeSizeSpan +android.text.style.ReplacementSpan +android.text.style.ScaleXSpan +android.text.style.SpanUtils +android.text.style.SpellCheckSpan +android.text.style.StrikethroughSpan +android.text.style.StyleSpan +android.text.style.SubscriptSpan +android.text.style.SuggestionRangeSpan +android.text.style.SuggestionSpan +android.text.style.SuperscriptSpan +android.text.style.TabStopSpan +android.text.style.TextAppearanceSpan +android.text.style.TtsSpan +android.text.style.TypefaceSpan +android.text.style.URLSpan +android.text.style.UnderlineSpan +android.text.style.UpdateAppearance +android.text.style.UpdateLayout +android.text.style.WrapTogetherSpan +android.text.util.Rfc822Token +android.text.util.Rfc822Tokenizer diff --git a/ravenwood/texts/ravenwood-build.prop b/ravenwood/texts/ravenwood-build.prop index 93a18cffec50..974ea296f0ed 100644 --- a/ravenwood/texts/ravenwood-build.prop +++ b/ravenwood/texts/ravenwood-build.prop @@ -8,7 +8,43 @@ ro.soc.manufacturer=Android ro.soc.model=Ravenwood ro.debuggable=1 -# The ones starting with "ro.product" or "ro.bild" will be copied to all "partitions" too. +persist.sys.locale=en-US +ro.product.locale=en-US + +ro.hwui.max_texture_allocation_size=104857600 + +# Allowlist control: +# This set is carefully curated to help identify situations where a test may +# accidentally depend on a default value of an obscure property whose owner hasn't +# decided how Ravenwood should behave. + +boot.=$$$r +build.=$$$r +product.=$$$r +soc.=$$$r +system.=$$$r +wm.debug.=$$$r +wm.extensions.=$$$r + +gsm.version.baseband=$$$r +no.such.thing=$$$r +qemu.sf.lcd_density=$$$r +ro.bootloader=$$$r +ro.hardware=$$$r +ro.hw_timeout_multiplier=$$$r +ro.odm.build.media_performance_class=$$$r +ro.sf.lcd_density=$$$r +ro.treble.enabled=$$$r +ro.vndk.version=$$$r +ro.icu.data.path=$$$r + +# Writable keys +debug.=$$$w + +# For PropertyInvalidatedCache +cache_key.=$$$w + +# The ones starting with "ro.product" or "ro.build" will be copied to all "partitions" too. # See RavenwoodSystemProperties. ro.product.brand=Android ro.product.device=Ravenwood diff --git a/ravenwood/texts/ravenwood-common-policies.txt b/ravenwood/texts/ravenwood-common-policies.txt index fd4ea6cf40c2..f0f4b8580f7d 100644 --- a/ravenwood/texts/ravenwood-common-policies.txt +++ b/ravenwood/texts/ravenwood-common-policies.txt @@ -21,3 +21,7 @@ class java.io.FileDescriptor # no-pta method setInt$ @com.android.ravenwood.RavenwoodJdkPatch.setInt$ class java.util.LinkedHashMap # no-pta method eldest @com.android.ravenwood.RavenwoodJdkPatch.eldest + +# Always set flag UNICODE_CHARACTER_CLASS when compiling regex +class java.util.regex.Pattern keep + method compile @com.android.ravenwood.RavenwoodJdkPatch.compilePattern diff --git a/ravenwood/texts/ravenwood-framework-policies.txt b/ravenwood/texts/ravenwood-framework-policies.txt index bd51b9303f7e..5c1766241698 100644 --- a/ravenwood/texts/ravenwood-framework-policies.txt +++ b/ravenwood/texts/ravenwood-framework-policies.txt @@ -65,3 +65,22 @@ class android.text.ClipboardManager keep # no-pta # Just enough to allow ResourcesManager to run class android.hardware.display.DisplayManagerGlobal keep # no-pta method getInstance ()Landroid/hardware/display/DisplayManagerGlobal; ignore # no-pta + +# Bare minimum to support running ImageDecoderTest +class android.graphics.drawable.Drawable$ConstantState keepclass # no-pta +class android.graphics.drawable.BitmapDrawable$BitmapState keepclass # no-pta +class android.graphics.drawable.BitmapDrawable keep # no-pta + method <init> (Landroid/content/res/Resources;Landroid/graphics/Bitmap;)V keep + method init * keep + method updateLocalState * keep + method computeBitmapSize * keep + method getIntrinsicWidth * keep + method getIntrinsicHeight * keep + method getBitmap * keep +class android.graphics.drawable.Drawable keep # no-pta + method <init> ()V keep + method resolveDensity * keep + method updateBlendModeFilter * ignore + +class android.os.StrictMode keep # no-pta + method noteSlowCall (Ljava/lang/String;)V ignore diff --git a/ravenwood/texts/ravenwood-services-jarjar-rules.txt b/ravenwood/texts/ravenwood-services-jarjar-rules.txt index 8fdd3408f74d..64a0e2548e2e 100644 --- a/ravenwood/texts/ravenwood-services-jarjar-rules.txt +++ b/ravenwood/texts/ravenwood-services-jarjar-rules.txt @@ -5,7 +5,7 @@ rule com.android.server.pm.pkg.AndroidPackageSplit @0 # Rename all other service internals so that tests can continue to statically # link services code when owners aren't ready to support on Ravenwood -rule com.android.server.** repackaged.@0 +rule com.android.server.** repackaged.services.@0 # TODO: support AIDL generated Parcelables via hoststubgen -rule android.hardware.power.stats.** repackaged.@0 +rule android.hardware.power.stats.** repackaged.services.@0 diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt index 735635cc309a..b41ce0f65017 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt @@ -268,18 +268,45 @@ fun writeByteCodeToReturn(methodDescriptor: String, writer: MethodVisitor) { } /** + * Write bytecode to pop the 2 uninitialized instances out of the stack + * after performing constructor redirection. + */ +fun adjustStackForConstructorRedirection(writer: MethodVisitor) { + // Stack: { uninitialized, uninitialized, obj } + writer.visitInsn(Opcodes.SWAP) + // Stack: { uninitialized, obj, uninitialized } + writer.visitInsn(Opcodes.POP) + // Stack: { uninitialized, obj } + writer.visitInsn(Opcodes.SWAP) + // Stack: { obj, uninitialized } + writer.visitInsn(Opcodes.POP) + // Stack: { obj } + + // We end up with only the desired object on the stack +} + +/** * Given a method descriptor, insert an [argType] as the first argument to it. */ fun prependArgTypeToMethodDescriptor(methodDescriptor: String, classInternalName: String): String { val returnType = Type.getReturnType(methodDescriptor) val argTypes = Type.getArgumentTypes(methodDescriptor).toMutableList() - argTypes.add(0, Type.getType("L" + classInternalName + ";")) + argTypes.add(0, Type.getType("L$classInternalName;")) return Type.getMethodDescriptor(returnType, *argTypes.toTypedArray()) } /** + * Given a method descriptor, change the return type to [classInternalName]. + */ +fun changeMethodDescriptorReturnType(methodDescriptor: String, classInternalName: String): String { + val argTypes = Type.getArgumentTypes(methodDescriptor) + val returnType = Type.getType("L$classInternalName;") + return Type.getMethodDescriptor(returnType, *argTypes) +} + +/** * Return the "visibility" modifier from an `access` integer. * * (see https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1) diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt index c5a2f9ff5e96..bba4681d3838 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterRemapper.kt @@ -15,6 +15,7 @@ */ package com.android.hoststubgen.filters +import com.android.hoststubgen.log import org.objectweb.asm.commons.Remapper /** @@ -23,19 +24,25 @@ import org.objectweb.asm.commons.Remapper class FilterRemapper(val filter: OutputFilter) : Remapper() { private val cache = mutableMapOf<String, String>() - override fun mapType(typeInternalName: String?): String? { + + override fun map(typeInternalName: String?): String? { if (typeInternalName == null) { return null } cache[typeInternalName]?.let { + // log.d("Cached rename from $typeInternalName to $it") return it } - var mapped = filter.remapType(typeInternalName) ?: typeInternalName + var mapped = filter.remapType(typeInternalName) + if (mapped != null) { + log.d("Renaming type $typeInternalName to $mapped") + } else { + // log.d("Not renaming type $typeInternalName") + } + mapped = mapped ?: typeInternalName cache[typeInternalName] = mapped return mapped } - - // TODO Do we need to implement mapPackage(), etc too? }
\ No newline at end of file diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt index d0c97c006647..dd353e9caeff 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFileFilterPolicyParser.kt @@ -100,7 +100,6 @@ interface PolicyFileProcessor { methodName: String, methodDesc: String, replaceSpec: TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec, - policy: FilterPolicyWithReason, ) } @@ -286,9 +285,10 @@ class TextFileFilterPolicyBuilder( methodName: String, methodDesc: String, replaceSpec: TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec, - policy: FilterPolicyWithReason, ) { - imf.setPolicyForMethod(className, methodName, methodDesc, policy) + // Keep the source method, because the target method may call it. + imf.setPolicyForMethod(className, methodName, methodDesc, + FilterPolicy.Keep.withReason(FILTER_REASON)) methodReplaceSpec.add(replaceSpec) } } @@ -642,7 +642,6 @@ class TextFileFilterPolicyParser { methodName, signature, spec, - policyWithReason, ) } else { // It's an in-class replace. diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt index a78c6552b8d0..bc90d1248322 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/TextFilePolicyRemapperFilter.kt @@ -15,7 +15,6 @@ */ package com.android.hoststubgen.filters -import com.android.hoststubgen.log import java.util.regex.Pattern /** @@ -34,17 +33,12 @@ class TextFilePolicyRemapperFilter( val typeInternalNamePrefix: String, ) - private val cache = mutableMapOf<String, String>() - override fun remapType(className: String): String? { - var mapped: String = className typeRenameSpecs.forEach { if (it.typeInternalNamePattern.matcher(className).matches()) { - mapped = it.typeInternalNamePrefix + className - log.d("Renaming type $className to $mapped") + return it.typeInternalNamePrefix + className } } - cache[className] = mapped - return mapped + return null } } diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt index 70e7d46bb6cd..b8a357668c2b 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/visitors/ImplGeneratingAdapter.kt @@ -17,7 +17,10 @@ package com.android.hoststubgen.visitors import com.android.hoststubgen.asm.CLASS_INITIALIZER_DESC import com.android.hoststubgen.asm.CLASS_INITIALIZER_NAME +import com.android.hoststubgen.asm.CTOR_NAME import com.android.hoststubgen.asm.ClassNodes +import com.android.hoststubgen.asm.adjustStackForConstructorRedirection +import com.android.hoststubgen.asm.changeMethodDescriptorReturnType import com.android.hoststubgen.asm.prependArgTypeToMethodDescriptor import com.android.hoststubgen.asm.writeByteCodeToPushArguments import com.android.hoststubgen.asm.writeByteCodeToReturn @@ -33,6 +36,7 @@ import org.objectweb.asm.ClassVisitor import org.objectweb.asm.MethodVisitor import org.objectweb.asm.Opcodes import org.objectweb.asm.Opcodes.INVOKEINTERFACE +import org.objectweb.asm.Opcodes.INVOKESPECIAL import org.objectweb.asm.Opcodes.INVOKESTATIC import org.objectweb.asm.Opcodes.INVOKEVIRTUAL import org.objectweb.asm.Type @@ -376,53 +380,90 @@ class ImplGeneratingAdapter( val callerMethodName: String, next: MethodVisitor?, ) : MethodVisitor(OPCODE_VERSION, next) { - override fun visitMethodInsn( + + private fun doReplace( opcode: Int, - owner: String?, - name: String?, - descriptor: String?, - isInterface: Boolean, - ) { + owner: String, + name: String, + descriptor: String, + ): Boolean { when (opcode) { INVOKESTATIC, INVOKEVIRTUAL, INVOKEINTERFACE -> {} - else -> { - // Don't touch other opcodes. - super.visitMethodInsn(opcode, owner, name, descriptor, isInterface) - return - } + // We only support INVOKESPECIAL when replacing constructors. + INVOKESPECIAL -> if (name != CTOR_NAME) return false + // Don't touch other opcodes. + else -> return false } + val to = filter.getMethodCallReplaceTo( - currentClassName, callerMethodName, owner!!, name!!, descriptor!! + currentClassName, callerMethodName, owner, name, descriptor ) if (to == null // Don't replace if the target is the callsite. || (to.className == currentClassName && to.methodName == callerMethodName) ) { - super.visitMethodInsn(opcode, owner, name, descriptor, isInterface) - return + return false } - // Replace the method call with a (static) call to the target method. - // If it's a non-static call, the target method's first argument will receive "this". - // (Because of that, we don't need to manipulate the stack. Just replace the - // method call.) + if (opcode != INVOKESPECIAL) { + // It's either a static method call or virtual method call. + // Either way, we don't manipulate the stack and send the original arguments + // as is to the target method. + // + // If the call is a virtual call (INVOKEVIRTUAL or INVOKEINTERFACE), then + // the first argument in the stack is the "this" object, so the target + // method must have an extra argument as the first argument to receive it. + // We update the method descriptor with prependArgTypeToMethodDescriptor() + // to absorb this difference. + + val toDesc = if (opcode == INVOKESTATIC) { + descriptor + } else { + prependArgTypeToMethodDescriptor(descriptor, owner) + } - val toDesc = if (opcode == INVOKESTATIC) { - // Static call to static call, no need to change the desc. - descriptor + mv.visitMethodInsn( + INVOKESTATIC, + to.className, + to.methodName, + toDesc, + false + ) } else { - // Need to prepend the "this" type to the descriptor. - prependArgTypeToMethodDescriptor(descriptor, owner) + // Because an object initializer does not return a value, the newly created + // but uninitialized object will be dup-ed at the bottom of the stack. + // We first call the target method to consume the constructor arguments at the top. + + val toDesc = changeMethodDescriptorReturnType(descriptor, owner) + + // Before stack: { uninitialized, uninitialized, args... } + mv.visitMethodInsn( + INVOKESTATIC, + to.className, + to.methodName, + toDesc, + false + ) + // After stack: { uninitialized, uninitialized, obj } + + // Next we pop the 2 uninitialized instances out of the stack. + adjustStackForConstructorRedirection(mv) } - mv.visitMethodInsn( - INVOKESTATIC, - to.className, - to.methodName, - toDesc, - false - ) + return true + } + + override fun visitMethodInsn( + opcode: Int, + owner: String, + name: String, + descriptor: String, + isInterface: Boolean, + ) { + if (!doReplace(opcode, owner, name, descriptor)) { + super.visitMethodInsn(opcode, owner, name, descriptor, isInterface) + } } } } diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/01-hoststubgen-test-tiny-framework-orig-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/01-hoststubgen-test-tiny-framework-orig-dump.txt index 635f66d8e90c..2b942a91a8f8 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/01-hoststubgen-test-tiny-framework-orig-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/01-hoststubgen-test-tiny-framework-orig-dump.txt @@ -1883,6 +1883,42 @@ BootstrapMethods: InnerClasses: public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 1, attributes: 3 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 0 10 1 i I +} +SourceFile: "TinyFrameworkMethodCallReplace.java" +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -1891,7 +1927,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 3 + interfaces: 0, fields: 0, methods: 4, attributes: 3 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo(); @@ -1937,10 +1973,28 @@ Constant pool: Start Length Slot Name Signature 0 4 0 a I 0 4 1 b I + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 11 0 i I } SourceFile: "TinyFrameworkMethodCallReplace.java" NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.class Compiled from "TinyFrameworkMethodCallReplace.java" @@ -1950,7 +2004,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 5, attributes: 5 + interfaces: 0, fields: 0, methods: 6, attributes: 5 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace(); @@ -2008,6 +2062,21 @@ Constant pool: x: ireturn LineNumberTable: + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 9 0 i I + private static int originalAdd(int, int); descriptor: (II)I flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2046,6 +2115,7 @@ RuntimeInvisibleAnnotations: android.hosttest.annotation.HostSideTestWholeClassKeep NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester BootstrapMethods: x: #x REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; Method arguments: @@ -2053,8 +2123,9 @@ BootstrapMethods: #x REF_invokeStatic com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.lambda$nonStaticMethodCallReplaceTester$0:(Ljava/util/concurrent/atomic/AtomicBoolean;)V #x ()V InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace - public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles + public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -3198,7 +3269,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 2, attributes: 2 + interfaces: 0, fields: 0, methods: 3, attributes: 2 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); @@ -3229,6 +3300,22 @@ Constant pool: LocalVariableTable: Start Length Slot Name Signature 0 12 0 value I + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 value I } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeInvisibleAnnotations: @@ -3242,7 +3329,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 2, attributes: 2 + interfaces: 0, fields: 1, methods: 3, attributes: 2 Constant pool: { private final int mValue; @@ -3278,6 +3365,26 @@ Constant pool: LocalVariableTable: Start Length Slot Name Signature 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: iconst_1 + x: anewarray #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 16 0 value I } SourceFile: "TinyFrameworkToBeRenamed.java" RuntimeInvisibleAnnotations: diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/03-hoststubgen-test-tiny-framework-host-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/03-hoststubgen-test-tiny-framework-host-dump.txt index 51a33554afa9..d493ad152225 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/03-hoststubgen-test-tiny-framework-host-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/03-hoststubgen-test-tiny-framework-host-dump.txt @@ -2002,6 +2002,51 @@ BootstrapMethods: #x ()Ljava/lang/Integer; NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 0 10 1 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +} +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +SourceFile: "TinyFrameworkMethodCallReplace.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -2010,7 +2055,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 4 + interfaces: 0, fields: 0, methods: 4, attributes: 4 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo(); @@ -2065,9 +2110,30 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 11 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: - public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace SourceFile: "TinyFrameworkMethodCallReplace.java" RuntimeVisibleAnnotations: x: #x() @@ -2081,7 +2147,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 4, attributes: 6 + interfaces: 0, fields: 0, methods: 6, attributes: 6 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace(); @@ -2148,6 +2214,48 @@ Constant pool: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.newConstructorTester:(I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: swap + x: pop + x: swap + x: pop + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 13 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static int originalAdd(int, int); + descriptor: (II)I + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=2, args_size=2 + x: iload_0 + x: iload_1 + x: iadd + x: iconst_1 + x: isub + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 6 0 a I + 0 6 1 b I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean); descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC @@ -2167,6 +2275,7 @@ Constant pool: com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles SourceFile: "TinyFrameworkMethodCallReplace.java" @@ -2184,6 +2293,7 @@ BootstrapMethods: #x ()V NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -3392,7 +3502,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 2, attributes: 3 + interfaces: 0, fields: 0, methods: 3, attributes: 3 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); @@ -3429,6 +3539,25 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: invokestatic #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeVisibleAnnotations: @@ -3867,7 +3996,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 2, attributes: 3 + interfaces: 0, fields: 1, methods: 3, attributes: 3 Constant pool: { private final int mValue; @@ -3891,7 +4020,7 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 10 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; 0 10 1 value I RuntimeVisibleAnnotations: x: #x() @@ -3908,7 +4037,30 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 5 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: iconst_1 + x: anewarray #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 16 0 value I RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/13-hoststubgen-test-tiny-framework-host-ext-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/13-hoststubgen-test-tiny-framework-host-ext-dump.txt index a466a2e2c3a7..8978a7acefd8 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/13-hoststubgen-test-tiny-framework-host-ext-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output.RELEASE_TARGET_JAVA_21/13-hoststubgen-test-tiny-framework-host-ext-dump.txt @@ -2413,6 +2413,66 @@ BootstrapMethods: #x ()Ljava/lang/Integer; NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=4, locals=2, args_size=2 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: ldc #x // String <init> + x: ldc #x // String (I)V + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 11 10 1 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +} +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +SourceFile: "TinyFrameworkMethodCallReplace.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -2421,7 +2481,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 4, attributes: 4 + interfaces: 0, fields: 0, methods: 5, attributes: 4 Constant pool: { private static {}; @@ -2501,8 +2561,34 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + x: ldc #x // String newConstructorTester + x: ldc #x // String (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 11 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace SourceFile: "TinyFrameworkMethodCallReplace.java" RuntimeVisibleAnnotations: @@ -2517,7 +2603,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 5, attributes: 6 + interfaces: 0, fields: 0, methods: 7, attributes: 6 Constant pool: { private static {}; @@ -2609,18 +2695,70 @@ Constant pool: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + x: ldc #x // String constructorReplaceTester + x: ldc #x // String (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.newConstructorTester:(I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: swap + x: pop + x: swap + x: pop + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 13 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static int originalAdd(int, int); + descriptor: (II)I + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=4, locals=2, args_size=2 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + x: ldc #x // String originalAdd + x: ldc #x // String (II)I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iload_0 + x: iload_1 + x: iadd + x: iconst_1 + x: isub + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 6 0 a I + 11 6 1 b I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean); descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC Code: stack=4, locals=1, args_size=1 x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace - x: ldc #x // String lambda$nonStaticMethodCallReplaceTester$0 - x: ldc #x // String (Ljava/util/concurrent/atomic/AtomicBoolean;)V + x: ldc #x // String lambda$nonStaticMethodCallReplaceTester$0 + x: ldc #x // String (Ljava/util/concurrent/atomic/AtomicBoolean;)V x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V x: aload_0 - x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread; + x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread; x: invokevirtual #x // Method java/lang/Thread.isDaemon:()Z x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.set:(Z)V x: return @@ -2633,6 +2771,7 @@ Constant pool: com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles SourceFile: "TinyFrameworkMethodCallReplace.java" @@ -2650,6 +2789,7 @@ BootstrapMethods: #x ()V NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -4241,7 +4381,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 3 + interfaces: 0, fields: 0, methods: 4, attributes: 3 Constant pool: { private static {}; @@ -4298,6 +4438,30 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + x: ldc #x // String bar + x: ldc #x // String (I)I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iload_0 + x: invokestatic #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 10 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeVisibleAnnotations: @@ -4947,7 +5111,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 3, attributes: 3 + interfaces: 0, fields: 1, methods: 4, attributes: 3 Constant pool: { private final int mValue; @@ -4962,8 +5126,8 @@ Constant pool: flags: (0x000a) ACC_PRIVATE, ACC_STATIC Code: stack=2, locals=0, args_size=0 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed - x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V x: return @@ -4972,7 +5136,7 @@ Constant pool: flags: (0x0001) ACC_PUBLIC Code: stack=4, locals=2, args_size=2 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed x: ldc #x // String <init> x: ldc #x // String (I)V x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall @@ -4986,7 +5150,7 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 11 10 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; 11 10 1 value I RuntimeVisibleAnnotations: x: #x() @@ -4997,7 +5161,7 @@ Constant pool: flags: (0x0001) ACC_PUBLIC Code: stack=4, locals=1, args_size=1 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed x: ldc #x // String getValue x: ldc #x // String ()I x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall @@ -5008,7 +5172,35 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 11 5 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String getArray + x: ldc #x // String (I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iconst_1 + x: anewarray #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 16 0 value I RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt index 78341d7afbb9..406c61138705 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/01-hoststubgen-test-tiny-framework-orig-dump.txt @@ -1883,6 +1883,42 @@ BootstrapMethods: InnerClasses: public static #x= #x of #x; // Nested=class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested of class com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 1, attributes: 3 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 0 10 1 i I +} +SourceFile: "TinyFrameworkMethodCallReplace.java" +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -1891,7 +1927,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 3 + interfaces: 0, fields: 0, methods: 4, attributes: 3 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo(); @@ -1937,10 +1973,28 @@ Constant pool: Start Length Slot Name Signature 0 4 0 a I 0 4 1 b I + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 11 0 i I } SourceFile: "TinyFrameworkMethodCallReplace.java" NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.class Compiled from "TinyFrameworkMethodCallReplace.java" @@ -1950,7 +2004,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 5, attributes: 5 + interfaces: 0, fields: 0, methods: 6, attributes: 5 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace(); @@ -2008,6 +2062,21 @@ Constant pool: x: ireturn LineNumberTable: + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 9 0 i I + private static int originalAdd(int, int); descriptor: (II)I flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2046,6 +2115,7 @@ RuntimeInvisibleAnnotations: android.hosttest.annotation.HostSideTestWholeClassKeep NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester BootstrapMethods: x: #x REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; Method arguments: @@ -2053,8 +2123,9 @@ BootstrapMethods: #x REF_invokeStatic com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.lambda$nonStaticMethodCallReplaceTester$0:(Ljava/util/concurrent/atomic/AtomicBoolean;)V #x ()V InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace - public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles + public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -3219,7 +3290,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 2, attributes: 2 + interfaces: 0, fields: 0, methods: 3, attributes: 2 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); @@ -3250,6 +3321,22 @@ Constant pool: LocalVariableTable: Start Length Slot Name Signature 0 12 0 value I + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 value I } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeInvisibleAnnotations: @@ -3263,7 +3350,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 2, attributes: 2 + interfaces: 0, fields: 1, methods: 3, attributes: 2 Constant pool: { private final int mValue; @@ -3299,6 +3386,26 @@ Constant pool: LocalVariableTable: Start Length Slot Name Signature 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: iconst_1 + x: anewarray #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 16 0 value I } SourceFile: "TinyFrameworkToBeRenamed.java" RuntimeInvisibleAnnotations: diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt index 2e0b1820a696..6a8e4885d1d0 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/03-hoststubgen-test-tiny-framework-host-dump.txt @@ -2002,6 +2002,51 @@ BootstrapMethods: #x ()Ljava/lang/Integer; NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=2, locals=2, args_size=2 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 0 10 1 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +} +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +SourceFile: "TinyFrameworkMethodCallReplace.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -2010,7 +2055,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 4 + interfaces: 0, fields: 0, methods: 4, attributes: 4 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo(); @@ -2065,9 +2110,30 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 11 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: - public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace SourceFile: "TinyFrameworkMethodCallReplace.java" RuntimeVisibleAnnotations: x: #x() @@ -2081,7 +2147,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 4, attributes: 6 + interfaces: 0, fields: 0, methods: 6, attributes: 6 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace(); @@ -2148,6 +2214,48 @@ Constant pool: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=3, locals=1, args_size=1 + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.newConstructorTester:(I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: swap + x: pop + x: swap + x: pop + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 13 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static int originalAdd(int, int); + descriptor: (II)I + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=2, args_size=2 + x: iload_0 + x: iload_1 + x: iadd + x: iconst_1 + x: isub + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 6 0 a I + 0 6 1 b I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean); descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC @@ -2167,6 +2275,7 @@ Constant pool: com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles SourceFile: "TinyFrameworkMethodCallReplace.java" @@ -2184,6 +2293,7 @@ BootstrapMethods: #x ()V NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -3422,7 +3532,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 2, attributes: 3 + interfaces: 0, fields: 0, methods: 3, attributes: 3 Constant pool: { public com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller(); @@ -3459,6 +3569,25 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: invokestatic #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 10 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeVisibleAnnotations: @@ -3897,7 +4026,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 2, attributes: 3 + interfaces: 0, fields: 1, methods: 3, attributes: 3 Constant pool: { private final int mValue; @@ -3921,7 +4050,7 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 0 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 10 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; 0 10 1 value I RuntimeVisibleAnnotations: x: #x() @@ -3938,7 +4067,30 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 0 5 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: iconst_1 + x: anewarray #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 16 0 value I RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt index 51f79258d53a..d8e76321b038 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/golden-output/13-hoststubgen-test-tiny-framework-host-ext-dump.txt @@ -2413,6 +2413,66 @@ BootstrapMethods: #x ()Ljava/lang/Integer; NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester.class + Compiled from "TinyFrameworkMethodCallReplace.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + super_class: #x // java/lang/Object + interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ + public int i; + descriptor: I + flags: (0x0001) ACC_PUBLIC + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static {}; + descriptor: ()V + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=2, locals=0, args_size=0 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V + x: return + + public com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester(int); + descriptor: (I)V + flags: (0x0001) ACC_PUBLIC + Code: + stack=4, locals=2, args_size=2 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: ldc #x // String <init> + x: ldc #x // String (I)V + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: aload_0 + x: iload_1 + x: putfield #x // Field i:I + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + 11 10 1 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +} +InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace +SourceFile: "TinyFrameworkMethodCallReplace.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.class Compiled from "TinyFrameworkMethodCallReplace.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo @@ -2421,7 +2481,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 4, attributes: 4 + interfaces: 0, fields: 0, methods: 5, attributes: 4 Constant pool: { private static {}; @@ -2501,8 +2561,34 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester newConstructorTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + x: ldc #x // String newConstructorTester + x: ldc #x // String (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: iconst_1 + x: iadd + x: invokespecial #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester."<init>":(I)V + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 11 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace SourceFile: "TinyFrameworkMethodCallReplace.java" RuntimeVisibleAnnotations: @@ -2517,7 +2603,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 5, attributes: 6 + interfaces: 0, fields: 0, methods: 7, attributes: 6 Constant pool: { private static {}; @@ -2609,18 +2695,70 @@ Constant pool: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + public static com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester constructorReplaceTester(int); + descriptor: (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + x: ldc #x // String constructorReplaceTester + x: ldc #x // String (I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: new #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester + x: dup + x: iload_0 + x: invokestatic #x // Method com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo.newConstructorTester:(I)Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester; + x: swap + x: pop + x: swap + x: pop + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 13 0 i I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + private static int originalAdd(int, int); + descriptor: (II)I + flags: (0x000a) ACC_PRIVATE, ACC_STATIC + Code: + stack=4, locals=2, args_size=2 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace + x: ldc #x // String originalAdd + x: ldc #x // String (II)I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iload_0 + x: iload_1 + x: iadd + x: iconst_1 + x: isub + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 6 0 a I + 11 6 1 b I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + private static void lambda$nonStaticMethodCallReplaceTester$0(java.util.concurrent.atomic.AtomicBoolean); descriptor: (Ljava/util/concurrent/atomic/AtomicBoolean;)V flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC Code: stack=4, locals=1, args_size=1 x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace - x: ldc #x // String lambda$nonStaticMethodCallReplaceTester$0 - x: ldc #x // String (Ljava/util/concurrent/atomic/AtomicBoolean;)V + x: ldc #x // String lambda$nonStaticMethodCallReplaceTester$0 + x: ldc #x // String (Ljava/util/concurrent/atomic/AtomicBoolean;)V x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V x: aload_0 - x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread; + x: invokestatic #x // Method java/lang/Thread.currentThread:()Ljava/lang/Thread; x: invokevirtual #x // Method java/lang/Thread.isDaemon:()Z x: invokevirtual #x // Method java/util/concurrent/atomic/AtomicBoolean.set:(Z)V x: return @@ -2633,6 +2771,7 @@ Constant pool: com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } InnerClasses: + public static #x= #x of #x; // ConstructorTester=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static #x= #x of #x; // ReplaceTo=class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo of class com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace public static final #x= #x of #x; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles SourceFile: "TinyFrameworkMethodCallReplace.java" @@ -2650,6 +2789,7 @@ BootstrapMethods: #x ()V NestMembers: com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ReplaceTo + com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace$ConstructorTester ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkNative.class Compiled from "TinyFrameworkNative.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative @@ -4271,7 +4411,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller super_class: #x // java/lang/Object - interfaces: 0, fields: 0, methods: 3, attributes: 3 + interfaces: 0, fields: 0, methods: 4, attributes: 3 Constant pool: { private static {}; @@ -4328,6 +4468,30 @@ Constant pool: RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static int bar(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=4, locals=1, args_size=1 + x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller + x: ldc #x // String bar + x: ldc #x // String (I)I + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iload_0 + x: invokestatic #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getArray:(I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: iconst_0 + x: aaload + x: invokevirtual #x // Method rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.getValue:()I + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 10 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep } SourceFile: "TinyFrameworkRenamedClassCaller.java" RuntimeVisibleAnnotations: @@ -4977,7 +5141,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew flags: (0x0021) ACC_PUBLIC, ACC_SUPER this_class: #x // rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed super_class: #x // java/lang/Object - interfaces: 0, fields: 1, methods: 3, attributes: 3 + interfaces: 0, fields: 1, methods: 4, attributes: 3 Constant pool: { private final int mValue; @@ -4992,8 +5156,8 @@ Constant pool: flags: (0x000a) ACC_PRIVATE, ACC_STATIC Code: stack=2, locals=0, args_size=0 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed - x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.onClassLoaded:(Ljava/lang/Class;Ljava/lang/String;)V x: return @@ -5002,7 +5166,7 @@ Constant pool: flags: (0x0001) ACC_PUBLIC Code: stack=4, locals=2, args_size=2 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed x: ldc #x // String <init> x: ldc #x // String (I)V x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall @@ -5016,7 +5180,7 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 11 10 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 11 10 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; 11 10 1 value I RuntimeVisibleAnnotations: x: #x() @@ -5027,7 +5191,7 @@ Constant pool: flags: (0x0001) ACC_PUBLIC Code: stack=4, locals=1, args_size=1 - x: ldc #x // class com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed x: ldc #x // String getValue x: ldc #x // String ()I x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall @@ -5038,7 +5202,35 @@ Constant pool: LineNumberTable: LocalVariableTable: Start Length Slot Name Signature - 11 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + 11 5 0 this Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + + public static rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFrameworkToBeRenamed[] getArray(int); + descriptor: (I)[Lrename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=6, locals=1, args_size=1 + x: ldc #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: ldc #x // String getArray + x: ldc #x // String (I)[Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed; + x: ldc #x // String com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall + x: invokestatic #x // Method com/android/hoststubgen/hosthelper/HostTestUtils.callMethodCallHook:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + x: iconst_1 + x: anewarray #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iconst_0 + x: new #x // class rename_prefix/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed + x: dup + x: iload_0 + x: invokespecial #x // Method "<init>":(I)V + x: aastore + x: areturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 16 0 value I RuntimeVisibleAnnotations: x: #x() com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt index 1f64a3c78c53..cbaad2e85717 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/policy-override-tiny-framework.txt @@ -68,6 +68,10 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace class java.lang.Thread keep method start ()V @com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo.startThread +# Used to test constructor replacement. +class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ConstructorTester keepclass + method <init> (I)V @com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallReplace$ReplaceTo.newConstructorTester + # "rename" takes a type internal name, so '/'s is used as a separator. # The leading / in the prefix is not needed (it'll be stripped), but it's added to make diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java index 57c69a336654..d850be82719f 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkMethodCallReplace.java @@ -41,10 +41,23 @@ public class TinyFrameworkMethodCallReplace { return originalAdd(1, 2); } + public static ConstructorTester constructorReplaceTester(int i) { + // This object construction will be replaced with ReplaceTo.newConstructorTester(). + return new ConstructorTester(i); + } + private static int originalAdd(int a, int b) { return a + b - 1; // Original is broken. } + public static class ConstructorTester { + public int i; + + public ConstructorTester(int i) { + this.i = i; + } + } + public static class ReplaceTo { public static void startThread(Thread thread) { thread.setDaemon(true); @@ -54,5 +67,9 @@ public class TinyFrameworkMethodCallReplace { public static int add(int a, int b) { return a + b; } + + public static ConstructorTester newConstructorTester(int i) { + return new ConstructorTester(i + 1); + } } } diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java index 707bc0ebb4db..74e4610187c4 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.java @@ -25,4 +25,9 @@ public class TinyFrameworkRenamedClassCaller { // so this code should work as-is. return new TinyFrameworkToBeRenamed(value).getValue(); } + + /** Calls the class that'll be renamed. */ + public static int bar(int value) { + return TinyFrameworkToBeRenamed.getArray(value)[0].getValue(); + } } diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java index 8319ced6109a..7dcc83e79e26 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkToBeRenamed.java @@ -31,4 +31,8 @@ public class TinyFrameworkToBeRenamed { public int getValue() { return mValue; } + + public static TinyFrameworkToBeRenamed[] getArray(int value) { + return new TinyFrameworkToBeRenamed[] { new TinyFrameworkToBeRenamed(value) }; + } } diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java index 68673dc2a5b8..89fcd30b3df5 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkClassTest.java @@ -308,6 +308,11 @@ public class TinyFrameworkClassTest { } @Test + public void testTypeRenameArray() { + assertThat(TinyFrameworkRenamedClassCaller.bar(2)).isEqualTo(2); + } + + @Test public void testMethodCallReplaceNonStatic() throws Exception { assertThat(TinyFrameworkMethodCallReplace.nonStaticMethodCallReplaceTester()) .isEqualTo(true); @@ -318,4 +323,10 @@ public class TinyFrameworkClassTest { assertThat(TinyFrameworkMethodCallReplace.staticMethodCallReplaceTester()) .isEqualTo(3); } + + @Test + public void testConstructorCallReplace() throws Exception { + assertThat(TinyFrameworkMethodCallReplace.constructorReplaceTester(5).i) + .isEqualTo(6); + } } diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt index b6089eaff1ed..a7f481a02533 100644 --- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt +++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/PtaProcessor.kt @@ -449,7 +449,6 @@ private class TextPolicyToAnnotationConverter( methodName: String, methodDesc: String, replaceSpec: TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec, - policy: FilterPolicyWithReason ) { // This can't be converted to an annotation. classHasMember = true diff --git a/services/core/java/com/android/server/SystemTimeZone.java b/services/core/java/com/android/server/SystemTimeZone.java index dd07081bda12..c8810f672320 100644 --- a/services/core/java/com/android/server/SystemTimeZone.java +++ b/services/core/java/com/android/server/SystemTimeZone.java @@ -133,6 +133,7 @@ public final class SystemTimeZone { boolean timeZoneChanged = false; synchronized (SystemTimeZone.class) { String currentTimeZoneId = getTimeZoneId(); + @TimeZoneConfidence int currentConfidence = getTimeZoneConfidence(); if (currentTimeZoneId == null || !currentTimeZoneId.equals(timeZoneId)) { SystemProperties.set(TIME_ZONE_SYSTEM_PROPERTY, timeZoneId); if (DEBUG) { @@ -145,6 +146,8 @@ public final class SystemTimeZone { String logMsg = "Time zone or confidence set: " + " (new) timeZoneId=" + timeZoneId + ", (new) confidence=" + confidence + + ", (old) timeZoneId=" + currentTimeZoneId + + ", (old) confidence=" + currentConfidence + ", logInfo=" + logInfo; addDebugLogEntry(logMsg); } diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index ca2eb2314fc3..c14f702e1e7a 100644 --- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java @@ -986,7 +986,9 @@ final class LocalDisplayAdapter extends DisplayAdapter { void handleHdrSdrNitsChanged(float displayNits, float sdrNits) { final float newHdrSdrRatio; - if (displayNits != INVALID_NITS && sdrNits != INVALID_NITS) { + if (displayNits != INVALID_NITS && sdrNits != INVALID_NITS + && (mBacklightAdapter.mUseSurfaceControlBrightness || + mBacklightAdapter.mForceSurfaceControl)) { // Ensure the ratio stays >= 1.0f as values below that are nonsensical newHdrSdrRatio = Math.max(1.f, displayNits / sdrNits); } else { diff --git a/services/core/java/com/android/server/inputmethod/OWNERS b/services/core/java/com/android/server/inputmethod/OWNERS index e507c6ba40a1..9d8aef943fa5 100644 --- a/services/core/java/com/android/server/inputmethod/OWNERS +++ b/services/core/java/com/android/server/inputmethod/OWNERS @@ -1,7 +1,6 @@ set noparent roosa@google.com -yukawa@google.com tarandeep@google.com fstern@google.com cosminbaies@google.com diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS index 62b89f3252e6..f98ec04f84d8 100644 --- a/services/core/java/com/android/server/pm/OWNERS +++ b/services/core/java/com/android/server/pm/OWNERS @@ -1,7 +1,6 @@ hackbod@android.com hackbod@google.com jsharkey@android.com -jsharkey@google.com narayan@google.com include /PACKAGE_MANAGER_OWNERS diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index c0be8f7a01ee..9edbaa8fadd9 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -5144,7 +5144,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { "Session " + sessionId + " is a parent of multi-package session and " + "requestUserPreapproval on the parent session isn't supported."); } - + if (statusReceiver == null) { + throw new IllegalArgumentException("Status receiver cannot be null."); + } synchronized (mLock) { assertPreparedAndNotSealedLocked("request of session " + sessionId); mPreapprovalDetails = details; @@ -5497,6 +5499,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { */ private static void sendOnUserActionRequired(Context context, IntentSender target, int sessionId, Intent intent) { + if (target == null) { + Slog.e(TAG, "Missing receiver for pending user action."); + return; + } final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_SESSION_ID, sessionId); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_PENDING_USER_ACTION); diff --git a/services/core/java/com/android/server/pm/dex/OWNERS b/services/core/java/com/android/server/pm/dex/OWNERS index 5ca8ddd1fe17..70af4e7d36b2 100644 --- a/services/core/java/com/android/server/pm/dex/OWNERS +++ b/services/core/java/com/android/server/pm/dex/OWNERS @@ -1,4 +1,3 @@ -alanstokes@google.com jiakaiz@google.com ngeoffray@google.com mast@google.com diff --git a/services/core/java/com/android/server/uri/OWNERS b/services/core/java/com/android/server/uri/OWNERS index cdc07ed7c67a..6599db7936c0 100644 --- a/services/core/java/com/android/server/uri/OWNERS +++ b/services/core/java/com/android/server/uri/OWNERS @@ -1,3 +1,2 @@ jsharkey@android.com -jsharkey@google.com varunshah@google.com diff --git a/services/core/java/com/android/server/wm/ContentRecorder.java b/services/core/java/com/android/server/wm/ContentRecorder.java index 1b4898665ebf..d20a04ab909b 100644 --- a/services/core/java/com/android/server/wm/ContentRecorder.java +++ b/services/core/java/com/android/server/wm/ContentRecorder.java @@ -474,7 +474,7 @@ final class ContentRecorder implements WindowContainerListener { return null; } final Task taskToRecord = wc.asTask(); - if (taskToRecord == null) { + if (taskToRecord == null || !taskToRecord.isAttached()) { handleStartRecordingFailed(); ProtoLog.v(WM_DEBUG_CONTENT_RECORDING, "Content Recording: Unable to retrieve task to start recording for " diff --git a/services/core/java/com/android/server/wm/OWNERS b/services/core/java/com/android/server/wm/OWNERS index dede7676a4b6..243a5326b545 100644 --- a/services/core/java/com/android/server/wm/OWNERS +++ b/services/core/java/com/android/server/wm/OWNERS @@ -3,7 +3,6 @@ set noparent ogunwale@google.com jjaggi@google.com racarr@google.com -chaviw@google.com vishnun@google.com akulian@google.com roosa@google.com diff --git a/services/core/jni/stats/OWNERS b/services/core/jni/stats/OWNERS index ab2d91adaeab..8d87925fbe45 100644 --- a/services/core/jni/stats/OWNERS +++ b/services/core/jni/stats/OWNERS @@ -1,5 +1,4 @@ jeffreyhuang@google.com -jtnguyen@google.com muhammadq@google.com sharaieko@google.com singhtejinder@google.com diff --git a/services/musicrecognition/OWNERS b/services/musicrecognition/OWNERS index 037b04831260..820be004efd5 100644 --- a/services/musicrecognition/OWNERS +++ b/services/musicrecognition/OWNERS @@ -1,5 +1,4 @@ # Bug component: 830636 oni@google.com -volnov@google.com diff --git a/telecomm/java/android/telecom/OWNERS b/telecomm/java/android/telecom/OWNERS index 6656a01403b8..0854c5d45603 100644 --- a/telecomm/java/android/telecom/OWNERS +++ b/telecomm/java/android/telecom/OWNERS @@ -3,4 +3,3 @@ rgreenwalt@google.com tgunn@google.com breadley@google.com -hallliu@google.com diff --git a/tests/EnforcePermission/OWNERS b/tests/EnforcePermission/OWNERS index 39550a394f33..160849e5616f 100644 --- a/tests/EnforcePermission/OWNERS +++ b/tests/EnforcePermission/OWNERS @@ -1,3 +1,2 @@ # Bug component: 315013 tweek@google.com -brufino@google.com diff --git a/tools/codegen/OWNERS b/tools/codegen/OWNERS index c9bd260ca7ae..e69de29bb2d1 100644 --- a/tools/codegen/OWNERS +++ b/tools/codegen/OWNERS @@ -1 +0,0 @@ -chiuwinson@google.com diff --git a/tools/hiddenapi/OWNERS b/tools/hiddenapi/OWNERS index dc82aac9d41c..d1e36b953e7f 100644 --- a/tools/hiddenapi/OWNERS +++ b/tools/hiddenapi/OWNERS @@ -1,6 +1,5 @@ # compat-team@ for changes to hiddenapi files mathewi@google.com -satayev@google.com # soong-team@ as the files these tools protect are tightly coupled with Soong file:platform/build/soong:/OWNERS diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS index 8e4569ee2a30..4035e19158c6 100644 --- a/tools/lint/OWNERS +++ b/tools/lint/OWNERS @@ -1,6 +1,5 @@ mattgilbride@google.com azharaa@google.com -jsharkey@google.com per-file *CallingSettingsNonUserGetterMethods* = file:/packages/SettingsProvider/OWNERS per-file *RegisterReceiverFlagDetector* = jacobhobbie@google.com diff --git a/wifi/java/src/android/net/wifi/sharedconnectivity/OWNERS b/wifi/java/src/android/net/wifi/sharedconnectivity/OWNERS index 2a4acc111257..abb9aa4c05a2 100644 --- a/wifi/java/src/android/net/wifi/sharedconnectivity/OWNERS +++ b/wifi/java/src/android/net/wifi/sharedconnectivity/OWNERS @@ -1,4 +1,3 @@ # Bug component: 1216021 asapperstein@google.com -etancohen@google.com |