diff options
285 files changed, 6216 insertions, 1341 deletions
diff --git a/ADPF_OWNERS b/ADPF_OWNERS index bcdc33825a13..c7ff4640b185 100644 --- a/ADPF_OWNERS +++ b/ADPF_OWNERS @@ -1,4 +1,5 @@ -sumir@google.com +adyabr@google.com chingtangyu@google.com -xwxw@google.com mattbuckley@google.com +sumir@google.com +xwxw@google.com
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java index 9e45c4ae23b5..bcc0a3b70dfa 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ClientSocketPerfTest.java @@ -112,36 +112,20 @@ public final class ClientSocketPerfTest { for (EndpointFactory endpointFactory : EndpointFactory.values()) { for (ChannelType channelType : ChannelType.values()) { for (PerfTestProtocol protocol : PerfTestProtocol.values()) { - params.add( - new Object[] { - new Config( - endpointFactory, - endpointFactory, - 64, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - channelType, - protocol) - }); - params.add( - new Object[] { - new Config( - endpointFactory, - endpointFactory, - 512, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - channelType, - protocol) - }); - params.add( - new Object[] { - new Config( - endpointFactory, - endpointFactory, - 4096, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - channelType, - protocol) - }); + for (int messageSize : ConscryptParams.messageSizes) { + for (String cipher : ConscryptParams.ciphers) { + params.add( + new Object[] { + new Config( + endpointFactory, + endpointFactory, + messageSize, + cipher, + channelType, + protocol) + }); + } + } } } } diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java new file mode 100644 index 000000000000..e5131b82cd8d --- /dev/null +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ConscryptParams.java @@ -0,0 +1,35 @@ +/* + * Copyright 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 android.conscrypt; + +import java.util.List; + +public class ConscryptParams { + public static final List<String> ciphers = List.of( + "TLS_RSA_WITH_AES_128_GCM_SHA256", + "TLS_RSA_WITH_AES_256_GCM_SHA384", + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" + ); + + public static final List<Integer> messageSizes = List.of( + 64, + 512, + 4096 + ); +}
\ No newline at end of file diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java index cd0ac96b41de..341d8e608c0c 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineHandshakePerfTest.java @@ -87,11 +87,13 @@ public final class EngineHandshakePerfTest { } } + public Collection getParams() { final List<Object[]> params = new ArrayList<>(); for (BufferType bufferType : BufferType.values()) { - params.add(new Object[] {new Config(bufferType, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", 100)}); + for (String cipher : ConscryptParams.ciphers) { + params.add(new Object[] {new Config(bufferType, cipher, 100)}); + } } return params; } diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java index 1fee2183b11e..23b642ee9537 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/EngineWrapPerfTest.java @@ -37,10 +37,10 @@ import static org.conscrypt.TestUtils.newTextMessage; import static org.junit.Assert.assertEquals; import java.nio.ByteBuffer; -import java.util.Locale; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngineResult; import javax.net.ssl.SSLException; @@ -94,12 +94,11 @@ public final class EngineWrapPerfTest { public Collection getParams() { final List<Object[]> params = new ArrayList<>(); for (BufferType bufferType : BufferType.values()) { - params.add(new Object[] {new Config(bufferType, 64, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); - params.add(new Object[] {new Config(bufferType, 512, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); - params.add(new Object[] {new Config(bufferType, 4096, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")}); + for (int messageSize : ConscryptParams.messageSizes) { + for (String cipher : ConscryptParams.ciphers) { + params.add(new Object[] {new Config(bufferType, messageSize, cipher)}); + } + } } return params; } diff --git a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java index 90a87ce0c69d..343bb1294af7 100644 --- a/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java +++ b/apct-tests/perftests/core/src/android/conscrypt/conscrypt/ServerSocketPerfTest.java @@ -102,15 +102,12 @@ public final class ServerSocketPerfTest { final List<Object[]> params = new ArrayList<>(); for (EndpointFactory endpointFactory : EndpointFactory.values()) { for (ChannelType channelType : ChannelType.values()) { - params.add(new Object[] {new Config(endpointFactory, - endpointFactory, 64, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); - params.add(new Object[] {new Config(endpointFactory, - endpointFactory, 512, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); - params.add(new Object[] {new Config(endpointFactory, - endpointFactory, 4096, - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)}); + for (int messageSize : ConscryptParams.messageSizes) { + for (String cipher : ConscryptParams.ciphers) { + params.add(new Object[] {new Config(endpointFactory, + endpointFactory, messageSize, cipher, channelType)}); + } + } } } return params; diff --git a/apct-tests/perftests/healthconnect/OWNERS b/apct-tests/perftests/healthconnect/OWNERS index da0b46adeaef..7c9e7692a9fc 100644 --- a/apct-tests/perftests/healthconnect/OWNERS +++ b/apct-tests/perftests/healthconnect/OWNERS @@ -1,6 +1,4 @@ # Bug component: 1219472 -arkivanov@google.com jstembridge@google.com -pratyushmore@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/cmds/incidentd/OWNERS b/cmds/incidentd/OWNERS index bcdcfc3cafed..db8fa9f09725 100644 --- a/cmds/incidentd/OWNERS +++ b/cmds/incidentd/OWNERS @@ -1,4 +1,3 @@ joeo@google.com yaochen@google.com yanmin@google.com -zhouwenjie@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/ActivityThread.java b/core/java/android/app/ActivityThread.java index a624994d3571..05eb59a5f5d8 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1130,12 +1130,19 @@ public final class ActivityThread extends ClientTransactionHandler CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) { + long debugStoreId = -1; + if (DEBUG_STORE_ENABLED) { + debugStoreId = DebugStore.recordScheduleReceiver(); + } updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, sendingUid, sendingPackage); r.info = info; sendMessage(H.RECEIVER, r); + if (DEBUG_STORE_ENABLED) { + DebugStore.recordEventEnd(debugStoreId); + } } public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { @@ -1458,6 +1465,10 @@ public final class ActivityThread extends ClientTransactionHandler boolean sticky, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) throws RemoteException { + long debugStoreId = -1; + if (DEBUG_STORE_ENABLED) { + debugStoreId = DebugStore.recordScheduleRegisteredReceiver(); + } updateProcessState(processState, false); // We can't modify IIntentReceiver due to UnsupportedAppUsage, so @@ -1482,6 +1493,9 @@ public final class ActivityThread extends ClientTransactionHandler receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); } + if (DEBUG_STORE_ENABLED) { + DebugStore.recordEventEnd(debugStoreId); + } } @Override @@ -2445,8 +2459,15 @@ public final class ActivityThread extends ClientTransactionHandler switch (msg.what) { case BIND_APPLICATION: Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "bindApplication"); + if (DEBUG_STORE_ENABLED) { + debugStoreId = + DebugStore.recordHandleBindApplication(); + } AppBindData data = (AppBindData)msg.obj; handleBindApplication(data); + if (DEBUG_STORE_ENABLED) { + DebugStore.recordEventEnd(debugStoreId); + } Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); break; case EXIT_APPLICATION: @@ -2469,7 +2490,8 @@ public final class ActivityThread extends ClientTransactionHandler ReceiverData receiverData = (ReceiverData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = - DebugStore.recordBroadcastHandleReceiver(receiverData.intent); + DebugStore.recordBroadcastReceive( + receiverData.intent, System.identityHashCode(receiverData)); } try { 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/LoadedApk.java b/core/java/android/app/LoadedApk.java index 29578c956485..c9a3a9739d69 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -61,6 +61,7 @@ import android.view.DisplayAdjustments; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; +import com.android.internal.os.DebugStore; import com.android.internal.util.ArrayUtils; import dalvik.system.BaseDexClassLoader; @@ -107,6 +108,9 @@ public final class LoadedApk { static final String TAG = "LoadedApk"; static final boolean DEBUG = false; + private static final boolean DEBUG_STORE_ENABLED = + com.android.internal.os.Flags.debugStoreEnabled(); + @UnsupportedAppUsage private final ActivityThread mActivityThread; @UnsupportedAppUsage @@ -1805,6 +1809,12 @@ public final class LoadedApk { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "broadcastReceiveReg: " + intent.getAction()); } + long debugStoreId = -1; + if (DEBUG_STORE_ENABLED) { + debugStoreId = + DebugStore.recordBroadcastReceiveReg( + intent, System.identityHashCode(this)); + } try { ClassLoader cl = mReceiver.getClass().getClassLoader(); @@ -1827,6 +1837,10 @@ public final class LoadedApk { "Error receiving broadcast " + intent + " in " + mReceiver, e); } + } finally { + if (DEBUG_STORE_ENABLED) { + DebugStore.recordEventEnd(debugStoreId); + } } if (receiver.getPendingResult() != null) { 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/people/OWNERS b/core/java/android/app/people/OWNERS index 7371a88df237..399511a0e0cb 100644 --- a/core/java/android/app/people/OWNERS +++ b/core/java/android/app/people/OWNERS @@ -1,4 +1,3 @@ # Bug component: 978868 -danningc@google.com -juliacr@google.com
\ No newline at end of file +juliacr@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/appwidget/OWNERS b/core/java/android/appwidget/OWNERS index 0e85d5bd7a27..1dc4cbb701fa 100644 --- a/core/java/android/appwidget/OWNERS +++ b/core/java/android/appwidget/OWNERS @@ -3,5 +3,4 @@ sihua@google.com pinyaoting@google.com suprabh@google.com sunnygoyal@google.com -zakcohen@google.com shamalip@google.com diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java index 964a8be0f153..cd16dd07fb6f 100644 --- a/core/java/android/content/BroadcastReceiver.java +++ b/core/java/android/content/BroadcastReceiver.java @@ -52,6 +52,8 @@ import com.android.internal.os.DebugStore; * <a href="{@docRoot}guide/components/broadcasts.html">Broadcasts</a> developer guide.</p></div> * */ +@android.ravenwood.annotation.RavenwoodPartiallyAllowlisted +@android.ravenwood.annotation.RavenwoodKeepPartialClass public abstract class BroadcastReceiver { @UnsupportedAppUsage private PendingResult mPendingResult; @@ -261,7 +263,7 @@ public abstract class BroadcastReceiver { 1); } if (DEBUG_STORE_ENABLED) { - DebugStore.recordFinish(mReceiverClassName); + DebugStore.recordFinish(System.identityHashCode(this)); } if (mType == TYPE_COMPONENT) { @@ -361,6 +363,7 @@ public abstract class BroadcastReceiver { } } + @android.ravenwood.annotation.RavenwoodKeep public BroadcastReceiver() { } @@ -442,7 +445,7 @@ public abstract class BroadcastReceiver { PendingResult res = mPendingResult; mPendingResult = null; if (DEBUG_STORE_ENABLED) { - DebugStore.recordGoAsync(getClass().getName()); + DebugStore.recordGoAsync(System.identityHashCode(res)); } if (res != null && Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { res.mReceiverClassName = getClass().getName(); 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/flags.aconfig b/core/java/android/content/pm/flags.aconfig index 609377eeebcf..a0d38ff254c5 100644 --- a/core/java/android/content/pm/flags.aconfig +++ b/core/java/android/content/pm/flags.aconfig @@ -319,3 +319,11 @@ flag { bug: "377474232" is_fixed_read_only: true } + +flag { + name: "cloud_compilation_verification" + namespace: "art_mainline" + description: "Feature flag to enable the Cloud Compilation install-time verification in the package manager." + bug: "377474232" + is_fixed_read_only: true +} diff --git a/core/java/android/content/pm/parsing/OWNERS b/core/java/android/content/pm/parsing/OWNERS index 8049d5cb7fa2..b8fa1a93ed78 100644 --- a/core/java/android/content/pm/parsing/OWNERS +++ b/core/java/android/content/pm/parsing/OWNERS @@ -1,5 +1,3 @@ # Bug component: 36137 -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/Html.java b/core/java/android/text/Html.java index ae12132d49a1..a42eece57eec 100644 --- a/core/java/android/text/Html.java +++ b/core/java/android/text/Html.java @@ -614,7 +614,7 @@ public class Html { if (style[j] instanceof TypefaceSpan) { String s = ((TypefaceSpan) style[j]).getFamily(); - if (s.equals("monospace")) { + if ("monospace".equals(s)) { out.append("</tt>"); } } 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/android/view/textclassifier/intent/OWNERS b/core/java/android/view/textclassifier/intent/OWNERS index 3465fe62784f..4a5dfd8501be 100644 --- a/core/java/android/view/textclassifier/intent/OWNERS +++ b/core/java/android/view/textclassifier/intent/OWNERS @@ -1,7 +1,5 @@ # Bug component: 709498 -mns@google.com toki@google.com svetoslavganov@android.com -svetoslavganov@google.com joannechung@google.com diff --git a/core/java/com/android/internal/app/OWNERS b/core/java/com/android/internal/app/OWNERS index 52f18fb80c27..0bba24d4ce19 100644 --- a/core/java/com/android/internal/app/OWNERS +++ b/core/java/com/android/internal/app/OWNERS @@ -20,3 +20,6 @@ per-file *VisualQuery* = file:/core/java/android/service/voice/OWNERS # System language settings per-file *Locale* = file:platform/packages/apps/Settings:/src/com/android/settings/localepicker/OWNERS + +# Media +per-file *MediaRoute* = file:/packages/SystemUI/src/com/android/systemui/media/dialog/OWNERS 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/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java index ad7329485a0e..4663d62896a2 100644 --- a/core/java/com/android/internal/content/PackageMonitor.java +++ b/core/java/com/android/internal/content/PackageMonitor.java @@ -36,6 +36,7 @@ import android.util.Log; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.annotations.WeaklyReferencedCallback; import com.android.internal.os.BackgroundThread; import java.lang.ref.WeakReference; @@ -46,6 +47,7 @@ import java.util.concurrent.Executor; * Helper class for monitoring the state of packages: adding, removing, * updating, and disappearing and reappearing on the SD card. */ +@WeaklyReferencedCallback public abstract class PackageMonitor extends android.content.BroadcastReceiver { static final String TAG = "PackageMonitor"; 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/os/DEBUG_STORE_OWNERS b/core/java/com/android/internal/os/DEBUG_STORE_OWNERS new file mode 100644 index 000000000000..c8e22b70ff77 --- /dev/null +++ b/core/java/com/android/internal/os/DEBUG_STORE_OWNERS @@ -0,0 +1,2 @@ +benmiles@google.com +mohamadmahmoud@google.com diff --git a/core/java/com/android/internal/os/DebugStore.java b/core/java/com/android/internal/os/DebugStore.java index 4c45feed8511..3dca786a82af 100644 --- a/core/java/com/android/internal/os/DebugStore.java +++ b/core/java/com/android/internal/os/DebugStore.java @@ -20,6 +20,7 @@ import android.annotation.Nullable; import android.compat.annotation.UnsupportedAppUsage; import android.content.Intent; import android.content.pm.ServiceInfo; +import android.util.Log; import com.android.internal.annotations.VisibleForTesting; @@ -43,6 +44,9 @@ import java.util.Objects; * @hide */ public class DebugStore { + private static final boolean DEBUG_EVENTS = false; + private static final String TAG = "DebugStore"; + private static DebugStoreNative sDebugStoreNative = new DebugStoreNativeImpl(); @UnsupportedAppUsage @@ -120,7 +124,7 @@ public class DebugStore { * @param receiverClassName The class name of the broadcast receiver. */ @UnsupportedAppUsage - public static void recordGoAsync(String receiverClassName) { + public static void recordGoAsync(int pendingResultId) { sDebugStoreNative.recordEvent( "GoAsync", List.of( @@ -128,8 +132,8 @@ public class DebugStore { Thread.currentThread().getName(), "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", - Objects.toString(receiverClassName))); + "prid", + Integer.toHexString(pendingResultId))); } /** @@ -138,7 +142,7 @@ public class DebugStore { * @param receiverClassName The class of the broadcast receiver that completed the operation. */ @UnsupportedAppUsage - public static void recordFinish(String receiverClassName) { + public static void recordFinish(int pendingResultId) { sDebugStoreNative.recordEvent( "Finish", List.of( @@ -146,9 +150,10 @@ public class DebugStore { Thread.currentThread().getName(), "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", - Objects.toString(receiverClassName))); + "prid", + Integer.toHexString(pendingResultId))); } + /** * Records the completion of a long-running looper message. * @@ -172,21 +177,92 @@ public class DebugStore { /** - * Records the reception of a broadcast. + * Records the reception of a broadcast by a manifest-declared receiver. * * @param intent The Intent associated with the broadcast. * @return A unique ID for the recorded event. */ @UnsupportedAppUsage - public static long recordBroadcastHandleReceiver(@Nullable Intent intent) { + public static long recordBroadcastReceive(@Nullable Intent intent, int pendingResultId) { + return sDebugStoreNative.beginEvent( + "BcRcv", + List.of( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "act", + Objects.toString(intent != null ? intent.getAction() : null), + "cmp", + Objects.toString(intent != null ? intent.getComponent() : null), + "pkg", + Objects.toString(intent != null ? intent.getPackage() : null), + "prid", + Integer.toHexString(pendingResultId))); + } + + /** + * Records the reception of a broadcast by a context-registered receiver. + * + * @param intent The Intent associated with the broadcast. + * @param pendingResultId The object ID of the PendingResult associated with the broadcast. + * @return A unique ID for the recorded event. + */ + @UnsupportedAppUsage + public static long recordBroadcastReceiveReg(@Nullable Intent intent, int pendingResultId) { + return sDebugStoreNative.beginEvent( + "BcRcvReg", + List.of( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "act", + Objects.toString(intent != null ? intent.getAction() : null), + "cmp", + Objects.toString(intent != null ? intent.getComponent() : null), + "pkg", + Objects.toString(intent != null ? intent.getPackage() : null), + "prid", + Integer.toHexString(pendingResultId))); + } + + /** + * Records the binding of an application. + * + * @return A unique ID for the recorded event. + */ + @UnsupportedAppUsage + public static long recordHandleBindApplication() { + return sDebugStoreNative.beginEvent("BindApp", List.of()); + } + + /** + * Records the scheduling of a receiver. + * + * @return A unique ID for the recorded event. + */ + @UnsupportedAppUsage + public static long recordScheduleReceiver() { return sDebugStoreNative.beginEvent( - "HandleReceiver", + "SchRcv", List.of( "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "act", Objects.toString(intent != null ? intent.getAction() : null), - "cmp", Objects.toString(intent != null ? intent.getComponent() : null), - "pkg", Objects.toString(intent != null ? intent.getPackage() : null))); + "tid", String.valueOf(Thread.currentThread().getId()))); + } + + /** + * Records the scheduling of a registered receiver. + * + * @return A unique ID for the recorded event. + */ + @UnsupportedAppUsage + public static long recordScheduleRegisteredReceiver() { + return sDebugStoreNative.beginEvent( + "SchRcvReg", + List.of( + "tname", Thread.currentThread().getName(), + "tid", String.valueOf(Thread.currentThread().getId()))); } /** @@ -225,18 +301,48 @@ public class DebugStore { private static class DebugStoreNativeImpl implements DebugStoreNative { @Override public long beginEvent(String eventName, List<String> attributes) { - return DebugStore.beginEventNative(eventName, attributes); + long id = DebugStore.beginEventNative(eventName, attributes); + if (DEBUG_EVENTS) { + Log.i( + TAG, + "beginEvent: " + id + " " + eventName + " " + attributeString(attributes)); + } + return id; } @Override public void endEvent(long id, List<String> attributes) { + if (DEBUG_EVENTS) { + Log.i(TAG, "endEvent: " + id + " " + attributeString(attributes)); + } DebugStore.endEventNative(id, attributes); } @Override public void recordEvent(String eventName, List<String> attributes) { + if (DEBUG_EVENTS) { + Log.i(TAG, "recordEvent: " + eventName + " " + attributeString(attributes)); + } DebugStore.recordEventNative(eventName, attributes); } + + /** + * Returns a string like "[key1=foo, key2=bar]" + */ + private String attributeString(List<String> attributes) { + StringBuilder sb = new StringBuilder().append("["); + + for (int i = 0; i < attributes.size(); i++) { + sb.append(attributes.get(i)); + + if (i % 2 == 0) { + sb.append("="); + } else if (i < attributes.size() - 1) { + sb.append(", "); + } + } + return sb.append("]").toString(); + } } private static native long beginEventNative(String eventName, List<String> attributes); diff --git a/core/java/com/android/internal/os/OWNERS b/core/java/com/android/internal/os/OWNERS index 391d25757af4..a5e2d956cd8e 100644 --- a/core/java/com/android/internal/os/OWNERS +++ b/core/java/com/android/internal/os/OWNERS @@ -2,6 +2,7 @@ per-file *Power* = file:/services/core/java/com/android/server/power/OWNERS per-file *Zygote* = file:/ZYGOTE_OWNERS per-file *Cpu* = file:CPU_OWNERS per-file *Binder* = file:BINDER_OWNERS +per-file *DebugStore* = file:DEBUG_STORE_OWNERS per-file *BinaryTransparency* = file:/core/java/android/transparency/OWNERS # BatteryStats 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/jni/com_android_internal_os_ZygoteCommandBuffer.cpp b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp index e0cc055a62a6..c4259f41e380 100644 --- a/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp +++ b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp @@ -266,16 +266,24 @@ class NativeCommandBuffer { } // Picky version of atoi(). No sign or unexpected characters allowed. Return -1 on failure. static int digitsVal(char* start, char* end) { + constexpr int vmax = std::numeric_limits<int>::max(); int result = 0; - if (end - start > 6) { - return -1; - } for (char* dp = start; dp < end; ++dp) { if (*dp < '0' || *dp > '9') { - ALOGW("Argument failed integer format check"); + ALOGW("Argument contains non-integer characters"); + return -1; + } + int digit = *dp - '0'; + if (result > vmax / 10) { + ALOGW("Argument exceeds int limit"); + return -1; + } + result *= 10; + if (result > vmax - digit) { + ALOGW("Argument exceeds int limit"); return -1; } - result = 10 * result + (*dp - '0'); + result += digit; } return result; } diff --git a/core/proto/OWNERS b/core/proto/OWNERS index b51f72dee260..c80402408180 100644 --- a/core/proto/OWNERS +++ b/core/proto/OWNERS @@ -5,8 +5,6 @@ joeo@google.com singhtejinder@google.com yanmin@google.com yaochen@google.com -yro@google.com -zhouwenjie@google.com # Frameworks ogunwale@google.com diff --git a/core/proto/android/net/OWNERS b/core/proto/android/net/OWNERS index 509699b9fb4b..a6627fe344b6 100644 --- a/core/proto/android/net/OWNERS +++ b/core/proto/android/net/OWNERS @@ -1,3 +1,2 @@ -ek@google.com lorenzo@google.com satk@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/res/res/values/config.xml b/core/res/res/values/config.xml index c735b2712aed..319e4b5b3c82 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2741,6 +2741,20 @@ <integer name="config_dreamsBatteryLevelDrainCutoff">5</integer> <!-- Limit of how long the device can remain unlocked due to attention checking. --> <integer name="config_attentionMaximumExtension">900000</integer> <!-- 15 minutes. --> + + <!-- Enables or disables the 'prevent screen timeout' feature, where when a user manually + undims the screen, the feature acquires a wakelock to prevent screen timeout. + false = disabled, true = enabled. Disabled by default. --> + <bool name="config_defaultPreventScreenTimeoutEnabled">false</bool> + <!-- Default value (in milliseconds) to prevent the screen timeout after user undims it + manually between screen dims, a sign the user is interacting with the device. --> + <integer name="config_defaultPreventScreenTimeoutForMillis">300000</integer> <!-- 5 minutes. --> + <!-- Default max duration (in milliseconds) of the time between undims to still consider them + consecutive. --> + <integer name="config_defaultMaxDurationBetweenUndimsMillis">600000</integer> <!-- 10 min. --> + <!-- Default number of user undims required to trigger preventing screen sleep. --> + <integer name="config_defaultUndimsRequired">2</integer> + <!-- Whether there is to be a chosen Dock User who is the only user allowed to dream. --> <bool name="config_dreamsOnlyEnabledForDockUser">false</bool> <!-- Whether dreams are disabled when ambient mode is suppressed. --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index cbdf5a1ecb1b..8613d717bdc8 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4312,6 +4312,11 @@ <!-- For Attention Service --> <java-symbol type="integer" name="config_attentionMaximumExtension" /> + <java-symbol type="bool" name="config_defaultPreventScreenTimeoutEnabled" /> + <java-symbol type="integer" name="config_defaultPreventScreenTimeoutForMillis" /> + <java-symbol type="integer" name="config_defaultMaxDurationBetweenUndimsMillis" /> + <java-symbol type="integer" name="config_defaultUndimsRequired" /> + <java-symbol type="string" name="config_incidentReportApproverPackage" /> <java-symbol type="array" name="config_restrictedImagesServices" /> 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/coretests/src/com/android/internal/os/DebugStoreTest.java b/core/tests/coretests/src/com/android/internal/os/DebugStoreTest.java index 786c2fc63018..bc452e7689e0 100644 --- a/core/tests/coretests/src/com/android/internal/os/DebugStoreTest.java +++ b/core/tests/coretests/src/com/android/internal/os/DebugStoreTest.java @@ -47,21 +47,17 @@ import java.util.List; /** * Test class for {@link DebugStore}. * - * To run it: - * atest FrameworksCoreTests:com.android.internal.os.DebugStoreTest + * <p>To run it: atest FrameworksCoreTests:com.android.internal.os.DebugStoreTest */ @RunWith(AndroidJUnit4.class) @DisabledOnRavenwood(blockedBy = DebugStore.class) @SmallTest public class DebugStoreTest { - @Rule - public final RavenwoodRule mRavenwood = new RavenwoodRule(); + @Rule public final RavenwoodRule mRavenwood = new RavenwoodRule(); - @Mock - private DebugStore.DebugStoreNative mDebugStoreNativeMock; + @Mock private DebugStore.DebugStoreNative mDebugStoreNativeMock; - @Captor - private ArgumentCaptor<List<String>> mListCaptor; + @Captor private ArgumentCaptor<List<String>> mListCaptor; @Before public void setUp() { @@ -79,16 +75,14 @@ public class DebugStoreTest { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(1L); long eventId = DebugStore.recordServiceOnStart(1, 0, intent); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcStart"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "stId", "1", - "flg", "0", - "act", "com.android.ACTION", - "comp", "ComponentInfo{com.android/androidService}", - "pkg", "com.android" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcStart")) + .containsExactly( + "stId", "1", + "flg", "0", + "act", "com.android.ACTION", + "comp", "ComponentInfo{com.android/androidService}", + "pkg", "com.android") + .inOrder(); assertThat(eventId).isEqualTo(1L); } @@ -101,13 +95,11 @@ public class DebugStoreTest { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(2L); long eventId = DebugStore.recordServiceCreate(serviceInfo); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcCreate"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "name", "androidService", - "pkg", "com.android" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcCreate")) + .containsExactly( + "name", "androidService", + "pkg", "com.android") + .inOrder(); assertThat(eventId).isEqualTo(2L); } @@ -121,59 +113,60 @@ public class DebugStoreTest { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(3L); long eventId = DebugStore.recordServiceBind(true, intent); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcBind"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "rebind", "true", - "act", "com.android.ACTION", - "cmp", "ComponentInfo{com.android/androidService}", - "pkg", "com.android" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcBind")) + .containsExactly( + "rebind", "true", + "act", "com.android.ACTION", + "cmp", "ComponentInfo{com.android/androidService}", + "pkg", "com.android") + .inOrder(); assertThat(eventId).isEqualTo(3L); } @Test public void testRecordGoAsync() { - DebugStore.recordGoAsync("androidReceiver"); - - verify(mDebugStoreNativeMock).recordEvent(eq("GoAsync"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", "androidReceiver" - ).inOrder(); + DebugStore.recordGoAsync(3840 /* 0xf00 */); + + assertThat(paramsForRecordEvent("GoAsync")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "prid", + "f00") + .inOrder(); } @Test public void testRecordFinish() { - DebugStore.recordFinish("androidReceiver"); - - verify(mDebugStoreNativeMock).recordEvent(eq("Finish"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", "androidReceiver" - ).inOrder(); + DebugStore.recordFinish(3840 /* 0xf00 */); + + assertThat(paramsForRecordEvent("Finish")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "prid", + "f00") + .inOrder(); } @Test public void testRecordLongLooperMessage() { DebugStore.recordLongLooperMessage(100, "androidHandler", 500L); - verify(mDebugStoreNativeMock).recordEvent(eq("LooperMsg"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "code", "100", - "trgt", "androidHandler", - "elapsed", "500" - ).inOrder(); + assertThat(paramsForRecordEvent("LooperMsg")) + .containsExactly( + "code", "100", + "trgt", "androidHandler", + "elapsed", "500") + .inOrder(); } @Test - public void testRecordBroadcastHandleReceiver() { + public void testRecordBroadcastReceive() { Intent intent = new Intent(); intent.setAction("com.android.ACTION"); intent.setComponent(new ComponentName("com.android", "androidReceiver")); @@ -181,21 +174,87 @@ public class DebugStoreTest { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(4L); - long eventId = DebugStore.recordBroadcastHandleReceiver(intent); - - verify(mDebugStoreNativeMock).beginEvent(eq("HandleReceiver"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "act", "com.android.ACTION", - "cmp", "ComponentInfo{com.android/androidReceiver}", - "pkg", "com.android" - ).inOrder(); + long eventId = DebugStore.recordBroadcastReceive(intent, 3840 /* 0xf00 */); + assertThat(paramsForBeginEvent("BcRcv")) + .containsExactly( + "tname", Thread.currentThread().getName(), + "tid", String.valueOf(Thread.currentThread().getId()), + "act", "com.android.ACTION", + "cmp", "ComponentInfo{com.android/androidReceiver}", + "pkg", "com.android", + "prid", "f00") + .inOrder(); assertThat(eventId).isEqualTo(4L); } @Test + public void testRecordBroadcastReceiveReg() { + Intent intent = new Intent(); + intent.setAction("com.android.ACTION"); + intent.setComponent(new ComponentName("com.android", "androidReceiver")); + intent.setPackage("com.android"); + + when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(5L); + + long eventId = DebugStore.recordBroadcastReceiveReg(intent, 3840 /* 0xf00 */); + assertThat(paramsForBeginEvent("BcRcvReg")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "act", + "com.android.ACTION", + "cmp", + "ComponentInfo{com.android/androidReceiver}", + "pkg", + "com.android", + "prid", + "f00") + .inOrder(); + assertThat(eventId).isEqualTo(5L); + } + + @Test + public void testRecordHandleBindApplication() { + when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(6L); + long eventId = DebugStore.recordHandleBindApplication(); + + assertThat(paramsForBeginEvent("BindApp")).isEmpty(); + assertThat(eventId).isEqualTo(6L); + } + + @Test + public void testRecordScheduleReceiver() { + when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(7L); + long eventId = DebugStore.recordScheduleReceiver(); + + assertThat(paramsForBeginEvent("SchRcv")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId())) + .inOrder(); + assertThat(eventId).isEqualTo(7L); + } + + @Test + public void testRecordScheduleRegisteredReceiver() { + when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(8L); + long eventId = DebugStore.recordScheduleRegisteredReceiver(); + + assertThat(paramsForBeginEvent("SchRcvReg")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId())) + .inOrder(); + assertThat(eventId).isEqualTo(8L); + } + + @Test public void testRecordEventEnd() { DebugStore.recordEventEnd(1L); @@ -203,109 +262,124 @@ public class DebugStoreTest { } @Test - public void testRecordServiceOnStartWithNullIntent() { + public void testRecordServiceOnStart_withNullIntent() { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(5L); long eventId = DebugStore.recordServiceOnStart(1, 0, null); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcStart"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "stId", "1", - "flg", "0", - "act", "null", - "comp", "null", - "pkg", "null" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcStart")) + .containsExactly( + "stId", "1", + "flg", "0", + "act", "null", + "comp", "null", + "pkg", "null") + .inOrder(); assertThat(eventId).isEqualTo(5L); } @Test - public void testRecordServiceCreateWithNullServiceInfo() { + public void testRecordServiceCreate_withNullServiceInfo() { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(6L); long eventId = DebugStore.recordServiceCreate(null); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcCreate"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "name", "null", - "pkg", "null" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcCreate")) + .containsExactly( + "name", "null", + "pkg", "null") + .inOrder(); assertThat(eventId).isEqualTo(6L); } @Test - public void testRecordServiceBindWithNullIntent() { + public void testRecordServiceBind_withNullIntent() { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(7L); long eventId = DebugStore.recordServiceBind(false, null); - - verify(mDebugStoreNativeMock).beginEvent(eq("SvcBind"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "rebind", "false", - "act", "null", - "cmp", "null", - "pkg", "null" - ).inOrder(); + assertThat(paramsForBeginEvent("SvcBind")) + .containsExactly( + "rebind", "false", + "act", "null", + "cmp", "null", + "pkg", "null") + .inOrder(); assertThat(eventId).isEqualTo(7L); } @Test - public void testRecordBroadcastHandleReceiverWithNullIntent() { + public void testRecordBroadcastReceive_withNullIntent() { when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(8L); - long eventId = DebugStore.recordBroadcastHandleReceiver(null); - - verify(mDebugStoreNativeMock).beginEvent(eq("HandleReceiver"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "act", "null", - "cmp", "null", - "pkg", "null" - ).inOrder(); + long eventId = DebugStore.recordBroadcastReceive(null, 3840 /* 0xf00 */); + assertThat(paramsForBeginEvent("BcRcv")) + .containsExactly( + "tname", Thread.currentThread().getName(), + "tid", String.valueOf(Thread.currentThread().getId()), + "act", "null", + "cmp", "null", + "pkg", "null", + "prid", "f00") + .inOrder(); assertThat(eventId).isEqualTo(8L); } @Test - public void testRecordGoAsyncWithNullReceiverClassName() { - DebugStore.recordGoAsync(null); - - verify(mDebugStoreNativeMock).recordEvent(eq("GoAsync"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", "null" - ).inOrder(); + public void testRecordBroadcastReceiveReg_withNullIntent() { + when(mDebugStoreNativeMock.beginEvent(anyString(), anyList())).thenReturn(8L); + + long eventId = DebugStore.recordBroadcastReceiveReg(null, 3840 /* 0xf00 */); + assertThat(paramsForBeginEvent("BcRcvReg")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "act", + "null", + "cmp", + "null", + "pkg", + "null", + "prid", + "f00") + .inOrder(); + assertThat(eventId).isEqualTo(8L); } @Test - public void testRecordFinishWithNullReceiverClassName() { - DebugStore.recordFinish(null); - - verify(mDebugStoreNativeMock).recordEvent(eq("Finish"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "tname", Thread.currentThread().getName(), - "tid", String.valueOf(Thread.currentThread().getId()), - "rcv", "null" - ).inOrder(); + public void testRecordFinish_withNullReceiverClassName() { + DebugStore.recordFinish(3840 /* 0xf00 */); + + assertThat(paramsForRecordEvent("Finish")) + .containsExactly( + "tname", + Thread.currentThread().getName(), + "tid", + String.valueOf(Thread.currentThread().getId()), + "prid", + "f00") + .inOrder(); } @Test - public void testRecordLongLooperMessageWithNullTargetClass() { + public void testRecordLongLooperMessage_withNullTargetClass() { DebugStore.recordLongLooperMessage(200, null, 1000L); - verify(mDebugStoreNativeMock).recordEvent(eq("LooperMsg"), mListCaptor.capture()); - List<String> capturedList = mListCaptor.getValue(); - assertThat(capturedList).containsExactly( - "code", "200", - "trgt", "null", - "elapsed", "1000" - ).inOrder(); + assertThat(paramsForRecordEvent("LooperMsg")) + .containsExactly( + "code", "200", + "trgt", "null", + "elapsed", "1000") + .inOrder(); } + + private List<String> paramsForBeginEvent(String eventName) { + verify(mDebugStoreNativeMock).beginEvent(eq(eventName), mListCaptor.capture()); + return mListCaptor.getValue(); + } + + private List<String> paramsForRecordEvent(String eventName) { + verify(mDebugStoreNativeMock).recordEvent(eq(eventName), mListCaptor.capture()); + return mListCaptor.getValue(); + } + } diff --git a/core/tests/coretests/src/com/android/internal/os/OWNERS b/core/tests/coretests/src/com/android/internal/os/OWNERS index 3f8f9e29c6a0..ec236ca7fb32 100644 --- a/core/tests/coretests/src/com/android/internal/os/OWNERS +++ b/core/tests/coretests/src/com/android/internal/os/OWNERS @@ -2,3 +2,4 @@ include /BATTERY_STATS_OWNERS # CPU per-file *Cpu* = file:/core/java/com/android/internal/os/CPU_OWNERS +per-file *DebugStore* = file:/core/java/com/android/internal/os/DEBUG_STORE_OWNERS 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/graphics/java/android/graphics/pdf/OWNERS b/graphics/java/android/graphics/pdf/OWNERS index 057dc0d9583c..24557b48ca5a 100644 --- a/graphics/java/android/graphics/pdf/OWNERS +++ b/graphics/java/android/graphics/pdf/OWNERS @@ -4,4 +4,3 @@ romainguy@google.com djsollen@google.com sumir@google.com svetoslavganov@android.com -svetoslavganov@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/androidfw/LocaleDataLookup.cpp b/libs/androidfw/LocaleDataLookup.cpp index ea9e9a2d4280..9aacdcb9ca92 100644 --- a/libs/androidfw/LocaleDataLookup.cpp +++ b/libs/androidfw/LocaleDataLookup.cpp @@ -14871,12 +14871,22 @@ static uint32_t findLatnParent(uint32_t packed_lang_region) { case 0x656E4154u: // en-AT -> en-150 case 0x656E4245u: // en-BE -> en-150 case 0x656E4348u: // en-CH -> en-150 + case 0x656E435Au: // en-CZ -> en-150 case 0x656E4445u: // en-DE -> en-150 case 0x656E444Bu: // en-DK -> en-150 + case 0x656E4553u: // en-ES -> en-150 case 0x656E4649u: // en-FI -> en-150 + case 0x656E4652u: // en-FR -> en-150 + case 0x656E4855u: // en-HU -> en-150 + case 0x656E4954u: // en-IT -> en-150 case 0x656E4E4Cu: // en-NL -> en-150 + case 0x656E4E4Fu: // en-NO -> en-150 + case 0x656E504Cu: // en-PL -> en-150 + case 0x656E5054u: // en-PT -> en-150 + case 0x656E524Fu: // en-RO -> en-150 case 0x656E5345u: // en-SE -> en-150 case 0x656E5349u: // en-SI -> en-150 + case 0x656E534Bu: // en-SK -> en-150 return 0x656E80A1u; case 0x65734152u: // es-AR -> es-419 case 0x6573424Fu: // es-BO -> es-419 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/DeviceInfo.h b/libs/hwui/DeviceInfo.h index fb58a69747b3..b72e066e64ae 100644 --- a/libs/hwui/DeviceInfo.h +++ b/libs/hwui/DeviceInfo.h @@ -84,6 +84,7 @@ public: // this value is only valid after the GPU has been initialized and there is a valid graphics // context or if you are using the HWUI_NULL_GPU int maxTextureSize() const; + bool hasMaxTextureSize() const { return mMaxTextureSize > 0; } sk_sp<SkColorSpace> getWideColorSpace() const { return mWideColorSpace; } SkColorType getWideColorType() { static std::once_flag kFlag; 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/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 2c23864317a4..4801bd1038a3 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -186,7 +186,7 @@ void RenderNode::pushLayerUpdate(TreeInfo& info) { // If we are not a layer OR we cannot be rendered (eg, view was detached) // we need to destroy any Layers we may have had previously if (CC_LIKELY(layerType != LayerType::RenderLayer) || CC_UNLIKELY(!isRenderable()) || - CC_UNLIKELY(properties().getWidth() == 0) || CC_UNLIKELY(properties().getHeight() == 0) || + CC_UNLIKELY(properties().getWidth() <= 0) || CC_UNLIKELY(properties().getHeight() <= 0) || CC_UNLIKELY(!properties().fitsOnLayer())) { if (CC_UNLIKELY(hasLayer())) { this->setLayerSurface(nullptr); diff --git a/libs/hwui/RenderProperties.h b/libs/hwui/RenderProperties.h index b1ad8b2eb1b9..4dc57004e401 100644 --- a/libs/hwui/RenderProperties.h +++ b/libs/hwui/RenderProperties.h @@ -545,7 +545,8 @@ public: bool fitsOnLayer() const { const DeviceInfo* deviceInfo = DeviceInfo::get(); return mPrimitiveFields.mWidth <= deviceInfo->maxTextureSize() && - mPrimitiveFields.mHeight <= deviceInfo->maxTextureSize(); + mPrimitiveFields.mHeight <= deviceInfo->maxTextureSize() && + mPrimitiveFields.mWidth > 0 && mPrimitiveFields.mHeight > 0; } bool promotedToLayer() const { 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/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 8ec04304a808..b36b8be10779 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -418,6 +418,11 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, int64_t sy RenderNode* target) { mRenderThread.removeFrameCallback(this); + // Make sure we have a valid device info + if (!DeviceInfo::get()->hasMaxTextureSize()) { + (void)mRenderThread.requireGrContext(); + } + // If the previous frame was dropped we don't need to hold onto it, so // just keep using the previous frame's structure instead const auto reason = wasSkipped(mCurrentFrameInfo); diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index cb3753822035..c31d0be74cb6 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -312,7 +312,7 @@ private: }; // Need at least 4 because we do quad buffer. Add a few more for good measure. - RingBuffer<SwapHistory, 7> mSwapHistory; + RingBuffer<SwapHistory, 8> mSwapHistory; // Frame numbers start at 1, 0 means uninitialized uint64_t mFrameNumber = 0; int64_t mDamageId = 0; diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 715153b5083d..77879cf992b7 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -206,7 +206,7 @@ void RenderProxy::buildLayer(RenderNode* node) { } bool RenderProxy::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap& bitmap) { - ATRACE_NAME("TextureView#getBitmap"); + ATRACE_NAME("RenderProxy#copyLayerInto readback"); auto& thread = RenderThread::getInstance(); return thread.queue().runSync([&]() -> bool { return thread.readback().copyLayerInto(layer, &bitmap) == CopyResult::Success; @@ -473,7 +473,7 @@ void RenderProxy::prepareToDraw(Bitmap& bitmap) { } int RenderProxy::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) { - ATRACE_NAME("HardwareBitmap readback"); + ATRACE_NAME("RenderProxy#copyHWBitmapInto readback"); RenderThread& thread = RenderThread::getInstance(); if (RenderThread::isCurrent()) { // TODO: fix everything that hits this. We should never be triggering a readback ourselves. @@ -485,6 +485,7 @@ int RenderProxy::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) { } int RenderProxy::copyImageInto(const sk_sp<SkImage>& image, SkBitmap* bitmap) { + ATRACE_NAME("RenderProxy#copyImageInto readback"); RenderThread& thread = RenderThread::getInstance(); if (RenderThread::isCurrent()) { // TODO: fix everything that hits this. We should never be triggering a readback ourselves. diff --git a/libs/hwui/tests/unit/RenderPropertiesTests.cpp b/libs/hwui/tests/unit/RenderPropertiesTests.cpp index 3e8e0576bf49..6ec042cf23b0 100644 --- a/libs/hwui/tests/unit/RenderPropertiesTests.cpp +++ b/libs/hwui/tests/unit/RenderPropertiesTests.cpp @@ -40,7 +40,11 @@ TEST(RenderProperties, layerValidity) { props.setLeftTopRightBottom(0, 0, maxTextureSize + 1, maxTextureSize + 1); ASSERT_FALSE(props.fitsOnLayer()); - // Too small, but still 'fits'. Not fitting is an error case, so don't report empty as such. + // Too small, we can't create a layer for a 0 width or height props.setLeftTopRightBottom(0, 0, 100, 0); - ASSERT_TRUE(props.fitsOnLayer()); + ASSERT_FALSE(props.fitsOnLayer()); + + // Can't create a negative-sized layer + props.setLeftTopRightBottom(0, 0, -100, 300); + ASSERT_FALSE(props.fitsOnLayer()); } diff --git a/location/Android.bp b/location/Android.bp index bc02d1f852de..80556a2376bf 100644 --- a/location/Android.bp +++ b/location/Android.bp @@ -42,6 +42,7 @@ java_sdk_library { "FlaggedApi", ], }, + jarjar_prefix: "com.android.internal.hidden_from_bootclasspath", } platform_compat_config { diff --git a/media/OWNERS b/media/OWNERS index 5e391959b663..50995ea6de58 100644 --- a/media/OWNERS +++ b/media/OWNERS @@ -18,5 +18,4 @@ wonsik@google.com include platform/frameworks/av:/media/janitors/media_solutions_OWNERS # SEA/KIR/BVE -jtinker@google.com robertshih@google.com diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index cdb517b3fd3e..cbf62c0f07da 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -4716,7 +4716,7 @@ public class AudioManager { focusReceiver = addClientIdToFocusReceiverLocked(clientFakeId); } - return handleExternalAudioPolicyWaitIfNeeded(clientFakeId, focusReceiver); + return handleExternalAudioPolicyWaitIfNeeded(clientFakeId, focusReceiver, afr); } /** @@ -4929,7 +4929,7 @@ public class AudioManager { focusReceiver = addClientIdToFocusReceiverLocked(clientId); } - return handleExternalAudioPolicyWaitIfNeeded(clientId, focusReceiver); + return handleExternalAudioPolicyWaitIfNeeded(clientId, focusReceiver, afr); } @GuardedBy("mFocusRequestsLock") @@ -4945,11 +4945,20 @@ public class AudioManager { } private @FocusRequestResult int handleExternalAudioPolicyWaitIfNeeded(String clientId, - BlockingFocusResultReceiver focusReceiver) { + BlockingFocusResultReceiver focusReceiver, @NonNull AudioFocusRequest afr) { focusReceiver.waitForResult(EXT_FOCUS_POLICY_TIMEOUT_MS); - if (DEBUG && !focusReceiver.receivedResult()) { - Log.e(TAG, "handleExternalAudioPolicyWaitIfNeeded" - + " response from ext policy timed out, denying request"); + if (!focusReceiver.receivedResult()) { + if (DEBUG) { + Log.e(TAG, "handleExternalAudioPolicyWaitIfNeeded" + + " response from ext policy timed out, denying request"); + } + try { + // To prevent from orphan focus holder, cleanup + abandonAudioFocus(afr.getOnAudioFocusChangeListener()); + } catch (Exception e) { + Log.e(TAG, "handleExternalAudioPolicyWaitIfNeeded failed to abandon audio" + +" focus after time out, error: " + e.getMessage()); + } } synchronized (mFocusRequestsLock) { diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index 23f87abaffed..b8259ef45de4 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -2037,9 +2037,10 @@ public class ExifInterface { // Ignore exceptions in order to keep the compatibility with the old versions of // ExifInterface. mIsSupportedFile = false; - Log.w(TAG, "Invalid image: ExifInterface got an unsupported image format file" - + "(ExifInterface supports JPEG and some RAW image formats only) " - + "or a corrupted JPEG file to ExifInterface.", e); + Log.d( + TAG, + "Invalid image: ExifInterface got an unsupported or corrupted image file", + e); } finally { addDefaultValuesForCompatibility(); 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/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 61c287b9633c..ae54c18eb135 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -2990,11 +2990,16 @@ static void extractMemoryFromContext( } *memory = context->toHidlMemory(); } - if (context->mBlock == nullptr || context->mReadWriteMapping == nullptr) { - ALOGW("extractMemoryFromContext: Cannot extract memory as C2Block is not created/mapped"); + if (context->mBlock == nullptr) { + // this should be ok as we may only have IMemory/hidlMemory + // e.g. video codecs may only have IMemory and no mBlock return; } - if (context->mReadWriteMapping->error() != C2_OK) { + + // if we have mBlock and memory, then we will copy data from mBlock to hidlMemory + // e.g. audio codecs may only have mBlock and wanted to decrypt using hidlMemory + // and also wanted to re-use mBlock + if (context->mReadWriteMapping == nullptr || context->mReadWriteMapping->error() != C2_OK) { ALOGW("extractMemoryFromContext: failed to map C2Block (%d)", context->mReadWriteMapping->error()); return; diff --git a/native/android/OWNERS b/native/android/OWNERS index 3ea2d3506f31..1e8d30d1681c 100644 --- a/native/android/OWNERS +++ b/native/android/OWNERS @@ -6,8 +6,7 @@ per-file libandroid.map.txt = jreck@google.com, zyy@google.com, mattbuckley@goog # Networking per-file libandroid_net.map.txt, net.c = set noparent -per-file libandroid_net.map.txt, net.c = codewiz@google.com, jchalard@google.com, junyulai@google.com -per-file libandroid_net.map.txt, net.c = lorenzo@google.com, reminv@google.com, satk@google.com +per-file libandroid_net.map.txt, net.c = file:platform/packages/modules/Connectivity:main:/OWNERS_core_networking # Fonts per-file system_fonts.cpp = file:/graphics/java/android/graphics/fonts/OWNERS 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/EasterEgg/src/com/android/egg/landroid/Autopilot.kt b/packages/EasterEgg/src/com/android/egg/landroid/Autopilot.kt index fb5954ec9736..4f5a88e85457 100644 --- a/packages/EasterEgg/src/com/android/egg/landroid/Autopilot.kt +++ b/packages/EasterEgg/src/com/android/egg/landroid/Autopilot.kt @@ -43,7 +43,7 @@ class Autopilot(val ship: Spacecraft, val universe: Universe) : Entity { get() = listOf( "---- AUTOPILOT ENGAGED ----", - "TGT: " + (target?.name?.toUpperCase() ?: "SELECTING..."), + "TGT: " + (target?.name?.uppercase() ?: "SELECTING..."), "EXE: $strategy" + if (debug.isNotEmpty()) " ($debug)" else "", ) .joinToString("\n") diff --git a/packages/EasterEgg/src/com/android/egg/landroid/MainActivity.kt b/packages/EasterEgg/src/com/android/egg/landroid/MainActivity.kt index 16ec1a933d92..927216e54b5e 100644 --- a/packages/EasterEgg/src/com/android/egg/landroid/MainActivity.kt +++ b/packages/EasterEgg/src/com/android/egg/landroid/MainActivity.kt @@ -64,7 +64,6 @@ import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.toUpperCase import androidx.compose.ui.tooling.preview.Devices import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -226,7 +225,7 @@ fun Telemetry(universe: VisibleUniverse) { val distToClosest = ((closest.pos - pos).mag() - closest.radius).toInt() listOfNotNull( landing?.let { - "LND: ${it.planet.name.toUpperCase()}\nJOB: ${it.text}" + "LND: ${it.planet.name.uppercase()}\nJOB: ${it.text}" } ?: if (distToClosest < 10_000) { "ALT: $distToClosest" diff --git a/packages/EasterEgg/src/com/android/egg/landroid/Namer.kt b/packages/EasterEgg/src/com/android/egg/landroid/Namer.kt index 73318077f47a..28e56d045ed9 100644 --- a/packages/EasterEgg/src/com/android/egg/landroid/Namer.kt +++ b/packages/EasterEgg/src/com/android/egg/landroid/Namer.kt @@ -121,6 +121,6 @@ class Namer(resources: Resources) { else -> "unknown template tag: ${it.groupValues[0]}" } } - .toUpperCase() + .uppercase() } } diff --git a/packages/NeuralNetworks/OWNERS b/packages/NeuralNetworks/OWNERS index 6b391503b5c4..bf3c8fe1550f 100644 --- a/packages/NeuralNetworks/OWNERS +++ b/packages/NeuralNetworks/OWNERS @@ -1,5 +1,4 @@ # Bug component: 195575 sandeepbandaru@google.com -shivanker@google.com -shiqing@google.com
\ No newline at end of file +shiqing@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/connectivity/OWNERS b/packages/SettingsLib/src/com/android/settingslib/connectivity/OWNERS index 9f15c1bb5081..b676d8daad52 100644 --- a/packages/SettingsLib/src/com/android/settingslib/connectivity/OWNERS +++ b/packages/SettingsLib/src/com/android/settingslib/connectivity/OWNERS @@ -1,6 +1,5 @@ # Default reviewers for this and subdirectories. andychou@google.com -arcwang@google.com changbetty@google.com qal@google.com wengsu@google.com diff --git a/packages/SettingsLib/src/com/android/settingslib/qrcode/OWNERS b/packages/SettingsLib/src/com/android/settingslib/qrcode/OWNERS index 372eb81fdee2..921ffedb337c 100644 --- a/packages/SettingsLib/src/com/android/settingslib/qrcode/OWNERS +++ b/packages/SettingsLib/src/com/android/settingslib/qrcode/OWNERS @@ -1,5 +1,4 @@ # Default reviewers for this and subdirectories. -bonianchen@google.com changbetty@google.com wengsu@google.com zoeychen@google.com 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/DeviceConfigService.java b/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java index c3af44b60d0c..0b9b81c51989 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DeviceConfigService.java @@ -68,6 +68,7 @@ import java.util.Map; public final class DeviceConfigService extends Binder { private static final List<String> sAconfigTextProtoFilesOnDevice = List.of( "/system/etc/aconfig_flags.pb", + "/system_ext/etc/aconfig_flags.pb", "/product/etc/aconfig_flags.pb", "/vendor/etc/aconfig_flags.pb"); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java index 60fae3f1fea9..3f5d440d0f02 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java @@ -158,6 +158,7 @@ final class SettingsState { private static final List<String> sAconfigTextProtoFilesOnDevice = List.of( "/system/etc/aconfig_flags.pb", + "/system_ext/etc/aconfig_flags.pb", "/product/etc/aconfig_flags.pb", "/vendor/etc/aconfig_flags.pb"); @@ -456,11 +457,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/BUILD_OWNERS b/packages/SystemUI/BUILD_OWNERS new file mode 100644 index 000000000000..4aadee173388 --- /dev/null +++ b/packages/SystemUI/BUILD_OWNERS @@ -0,0 +1,22 @@ +# Build file owners for System UI. Owners should consider the following: +# +# - Does the change negatively affect developer builds? Will it make +# the build slower? +# +# - Does the change add unnecessary dependencies or compilation steps +# that will be difficult to refactor? +# +# For more information, see http://go/sysui-build-owners + +dsandler@android.com + +caitlinshk@google.com +ccross@android.com +cinek@google.com +jernej@google.com +mankoff@google.com +nicomazz@google.com +peskal@google.com +pixel@google.com +saff@google.com +vadimt@google.com diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS index 09c0cf7a2ac1..ab3fa1b06255 100644 --- a/packages/SystemUI/OWNERS +++ b/packages/SystemUI/OWNERS @@ -8,7 +8,6 @@ achalke@google.com acul@google.com adamcohen@google.com aioana@google.com -alexchau@google.com alexflo@google.com andonian@google.com amiko@google.com @@ -23,6 +22,7 @@ bhinegardner@google.com bhnm@google.com brycelee@google.com brzezinski@google.com +burakov@google.com caitlinshk@google.com cameronyee@google.com chandruis@google.com @@ -90,10 +90,8 @@ rahulbanerjee@google.com rgl@google.com roosa@google.com saff@google.com -samcackett@google.com santie@google.com shanh@google.com -silvajordan@google.com snoeberger@google.com spdonghao@google.com steell@google.com @@ -105,7 +103,6 @@ thiruram@google.com tracyzhou@google.com tsuji@google.com twickham@google.com -uwaisashraf@google.com vadimt@google.com valiiftime@google.com vanjan@google.com @@ -118,4 +115,16 @@ xuqiu@google.com yeinj@google.com yuandizhou@google.com yurilin@google.com +yuzhechen@google.com zakcohen@google.com + +# Overview eng team +alexchau@google.com +samcackett@google.com +silvajordan@google.com +uwaisashraf@google.com +vinayjoglekar@google.com +willosborn@google.com + +per-file *.mk,{**/,}Android.bp = set noparent +per-file *.mk,{**/,}Android.bp = file:BUILD_OWNERS diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index f2c7ed771c81..6a0aba0dc7fc 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -188,7 +188,7 @@ import javax.inject.Provider; * to be updated. */ @SysUISingleton -public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpable, CoreStartable { +public class KeyguardUpdateMonitor implements TrustManager.TrustListener, CoreStartable { private static final String TAG = "KeyguardUpdateMonitor"; private static final int BIOMETRIC_LOCKOUT_RESET_DELAY_MS = 600; diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index 9b5d5b6eadca..15cb0a1ae4a8 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -113,7 +113,7 @@ import javax.inject.Inject; */ @SysUISingleton public class ScreenDecorations implements - CoreStartable, ConfigurationController.ConfigurationListener, Dumpable { + CoreStartable, ConfigurationController.ConfigurationListener { private static final boolean DEBUG_LOGGING = false; private static final String TAG = "ScreenDecorations"; diff --git a/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS b/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS index 429b4b0fccab..329aa07fdd9e 100644 --- a/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS @@ -3,6 +3,5 @@ dupin@google.com linyuh@google.com pauldpong@google.com -praveenj@google.com vicliang@google.com yuklimko@google.com diff --git a/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt b/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt index ca43871415e6..25f99207ad28 100644 --- a/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt +++ b/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt @@ -27,7 +27,6 @@ import android.content.res.Resources import android.content.res.Resources.NotFoundException import android.graphics.Bitmap import android.graphics.ImageDecoder -import android.graphics.ImageDecoder.DecodeException import android.graphics.drawable.AdaptiveIconDrawable import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -39,7 +38,6 @@ import com.android.app.tracing.traceSection import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background -import java.io.IOException import javax.inject.Inject import kotlin.math.min import kotlinx.coroutines.CoroutineDispatcher @@ -54,7 +52,7 @@ class ImageLoader @Inject constructor( @Application private val defaultContext: Context, - @Background private val backgroundDispatcher: CoroutineDispatcher + @Background private val backgroundDispatcher: CoroutineDispatcher, ) { /** Source of the image data. */ @@ -103,7 +101,7 @@ constructor( source: Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Bitmap? = withContext(backgroundDispatcher) { loadBitmapSync(source, maxWidth, maxHeight, allocator) } @@ -127,14 +125,14 @@ constructor( source: Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Bitmap? { return try { loadBitmapSync( toImageDecoderSource(source, defaultContext), maxWidth, maxHeight, - allocator + allocator, ) } catch (e: NotFoundException) { Log.w(TAG, "Couldn't load resource $source", e) @@ -162,7 +160,7 @@ constructor( source: ImageDecoder.Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Bitmap? = traceSection("ImageLoader#loadBitmap") { return try { @@ -170,12 +168,11 @@ constructor( configureDecoderForMaximumSize(decoder, info.size, maxWidth, maxHeight) decoder.allocator = allocator } - } catch (e: IOException) { + } catch (e: Exception) { + // If we're loading an Uri, we can receive any exception from the other side. + // So we have to catch them all. Log.w(TAG, "Failed to load source $source", e) return null - } catch (e: DecodeException) { - Log.w(TAG, "Failed to decode source $source", e) - return null } } @@ -199,7 +196,7 @@ constructor( source: Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Drawable? = withContext(backgroundDispatcher) { loadDrawableSync(source, maxWidth, maxHeight, allocator) @@ -227,7 +224,7 @@ constructor( context: Context = defaultContext, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Drawable? = withContext(backgroundDispatcher) { loadDrawableSync(icon, context, maxWidth, maxHeight, allocator) @@ -254,7 +251,7 @@ constructor( source: Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Drawable? = traceSection("ImageLoader#loadDrawable") { return try { @@ -262,7 +259,7 @@ constructor( toImageDecoderSource(source, defaultContext), maxWidth, maxHeight, - allocator + allocator, ) ?: // If we have a resource, retry fallback using the "normal" Resource loading @@ -301,7 +298,7 @@ constructor( source: ImageDecoder.Source, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Drawable? = traceSection("ImageLoader#loadDrawable") { return try { @@ -309,12 +306,11 @@ constructor( configureDecoderForMaximumSize(decoder, info.size, maxWidth, maxHeight) decoder.allocator = allocator } - } catch (e: IOException) { + } catch (e: Exception) { + // If we're loading from an Uri, any exception can happen on the + // other side. We have to catch them all. Log.w(TAG, "Failed to load source $source", e) return null - } catch (e: DecodeException) { - Log.w(TAG, "Failed to decode source $source", e) - return null } } @@ -325,7 +321,7 @@ constructor( context: Context = defaultContext, @Px maxWidth: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, @Px maxHeight: Int = DEFAULT_MAX_SAFE_BITMAP_SIZE_PX, - allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT + allocator: Int = ImageDecoder.ALLOCATOR_DEFAULT, ): Drawable? = traceSection("ImageLoader#loadDrawable") { return when (icon.type) { @@ -341,7 +337,7 @@ constructor( ImageDecoder.createSource(it, icon.resId), maxWidth, maxHeight, - allocator + allocator, ) } // Fallback to non-ImageDecoder load if the attempt failed (e.g. the @@ -360,7 +356,7 @@ constructor( ImageDecoder.createSource(icon.dataBytes, icon.dataOffset, icon.dataLength), maxWidth, maxHeight, - allocator + allocator, ) } else -> { @@ -421,12 +417,10 @@ constructor( fun loadSizeSync(source: ImageDecoder.Source): Size? { return try { ImageDecoder.decodeHeader(source).size - } catch (e: IOException) { + } catch (e: Exception) { + // Any exception can happen when loading Uris, so we have to catch them all. Log.w(TAG, "Failed to load source $source", e) return null - } catch (e: DecodeException) { - Log.w(TAG, "Failed to decode source $source", e) - return null } } @@ -472,7 +466,7 @@ constructor( decoder: ImageDecoder, imgSize: Size, @Px maxWidth: Int, - @Px maxHeight: Int + @Px maxHeight: Int, ) { if (maxWidth == DO_NOT_RESIZE && maxHeight == DO_NOT_RESIZE) { return @@ -547,7 +541,7 @@ constructor( pm.getApplicationInfo( resPackage, PackageManager.MATCH_UNINSTALLED_PACKAGES or - PackageManager.GET_SHARED_LIBRARY_FILES + PackageManager.GET_SHARED_LIBRARY_FILES, ) if (ai != null) { return pm.getResourcesForApplication(ai) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 0a38ce07a798..8919c20161a1 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -233,7 +233,7 @@ import java.util.function.Consumer; * directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI * thread of the keyguard. */ -public class KeyguardViewMediator implements CoreStartable, Dumpable, +public class KeyguardViewMediator implements CoreStartable, StatusBarStateController.StateListener { private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000; private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000; 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/packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt index 3e6d46c00df9..27c55ae1f387 100644 --- a/packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt @@ -24,7 +24,6 @@ import com.android.internal.logging.InstanceId import com.android.internal.logging.UiEventLogger import com.android.internal.statusbar.IUndoMediaTransferCallback import com.android.systemui.CoreStartable -import com.android.systemui.Dumpable import com.android.systemui.common.shared.model.Text import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager @@ -55,7 +54,7 @@ constructor( private val logger: MediaTttSenderLogger, private val mediaTttFlags: MediaTttFlags, private val uiEventLogger: MediaTttSenderUiEventLogger, -) : CoreStartable, Dumpable { +) : CoreStartable { // Since the media transfer display is similar to a heads-up notification, use the same timeout. private val defaultTimeout = context.resources.getInteger(R.integer.heads_up_notification_decay) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java index cd59d4ebfd73..7b685f4cc006 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarViewController.java @@ -384,6 +384,7 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat mAnimationScheduler.addCallback(mAnimationCallback); mUserInfoController.addCallback(mOnUserInfoChangedListener); mStatusBarStateController.addCallback(mStatusBarStateListener); + mStatusBarState = mStatusBarStateController.getState(); mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback); mDisableStateTracker.startTracking(mCommandQueue, mView.getDisplay().getDisplayId()); if (mTintedIconManager == null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProvider.kt index 34c7059ec991..b695d9bf0034 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LetterboxBackgroundProvider.kt @@ -23,7 +23,6 @@ import android.os.Handler import android.os.RemoteException import android.view.IWindowManager import com.android.systemui.CoreStartable -import com.android.systemui.Dumpable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main @@ -40,7 +39,7 @@ constructor( @Background private val backgroundExecutor: Executor, private val wallpaperManager: WallpaperManager, @Main private val mainHandler: Handler, -) : CoreStartable, Dumpable { +) : CoreStartable { @ColorInt var letterboxBackgroundColor: Int = Color.BLACK private set diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt index bd6a1c05ddc9..27dada8d5366 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt @@ -79,7 +79,7 @@ constructor( private val swipeStatusBarAwayGestureHandler: SwipeStatusBarAwayGestureHandler, private val statusBarModeRepository: StatusBarModeRepositoryStore, @OngoingCallLog private val logger: LogBuffer, -) : CallbackController<OngoingCallListener>, Dumpable, CoreStartable { +) : CallbackController<OngoingCallListener>, CoreStartable { private var isFullscreen: Boolean = false /** Non-null if there's an active call notification. */ private var callNotificationInfo: CallNotificationInfo? = null diff --git a/packages/SystemUI/src/com/android/systemui/temporarydisplay/TemporaryViewDisplayController.kt b/packages/SystemUI/src/com/android/systemui/temporarydisplay/TemporaryViewDisplayController.kt index 3c53d2d05fb8..635576743462 100644 --- a/packages/SystemUI/src/com/android/systemui/temporarydisplay/TemporaryViewDisplayController.kt +++ b/packages/SystemUI/src/com/android/systemui/temporarydisplay/TemporaryViewDisplayController.kt @@ -34,7 +34,6 @@ import androidx.annotation.CallSuper import androidx.annotation.VisibleForTesting import com.android.app.viewcapture.ViewCaptureAwareWindowManager import com.android.systemui.CoreStartable -import com.android.systemui.Dumpable import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dump.DumpManager import com.android.systemui.statusbar.policy.ConfigurationController @@ -81,7 +80,7 @@ abstract class TemporaryViewDisplayController<T : TemporaryViewInfo, U : Tempora private val wakeLockBuilder: WakeLock.Builder, private val systemClock: SystemClock, internal val tempViewUiEventLogger: TemporaryViewUiEventLogger, -) : CoreStartable, Dumpable { +) : CoreStartable { /** * Window layout params that will be used as a starting point for the [windowLayoutParams] of * all subclasses. diff --git a/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt new file mode 100644 index 000000000000..8d9fa6ad6e08 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.graphics + +import android.content.ContentProvider +import android.content.ContentValues +import android.content.Context +import android.database.Cursor +import android.net.Uri +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import androidx.test.rule.provider.ProviderTestRule +import com.android.systemui.SysuiTestCase +import com.android.systemui.kosmos.testDispatcher +import com.android.systemui.kosmos.testScope +import com.android.systemui.testKosmos +import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.test.runTest +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.kotlin.mock +import org.mockito.kotlin.whenever + +const val AUTHORITY = "exception.provider.authority" +val TEST_URI = Uri.Builder().scheme("content").authority(AUTHORITY).path("path").build() + +@SmallTest +@kotlinx.coroutines.ExperimentalCoroutinesApi +@RunWith(AndroidJUnit4::class) +class ImageLoaderContentProviderTest : SysuiTestCase() { + + private val kosmos = testKosmos() + private val testScope = kosmos.testScope + private val mockContext = mock<Context>() + private lateinit var imageLoader: ImageLoader + + @Rule + @JvmField + @Suppress("DEPRECATION") + public val providerTestRule = + ProviderTestRule.Builder(ExceptionThrowingContentProvider::class.java, AUTHORITY).build() + + @Before + fun setUp() { + whenever(mockContext.contentResolver).thenReturn(providerTestRule.resolver) + imageLoader = ImageLoader(mockContext, kosmos.testDispatcher) + } + + @Test(expected = IllegalArgumentException::class) + fun loadFromTestContentProvider_throwsException() { + // This checks if the resolution actually throws the exception from test provider. + mockContext.contentResolver.query(TEST_URI, null, null, null) + } + + @Test + fun loadFromRuntimeExceptionThrowingProvider_returnsNull() = + testScope.runTest { assertThat(imageLoader.loadBitmap(ImageLoader.Uri(TEST_URI))).isNull() } +} + +class ExceptionThrowingContentProvider : ContentProvider() { + override fun query( + uri: Uri, + projection: Array<out String>?, + selection: String?, + selectionArgs: Array<out String>?, + sortOrder: String?, + ): Cursor? { + throw IllegalArgumentException("Test exception") + } + + override fun getType(uri: Uri): String? { + throw IllegalArgumentException("Test exception") + } + + override fun insert(uri: Uri, values: ContentValues?): Uri? { + throw IllegalArgumentException("Test exception") + } + + override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int { + throw IllegalArgumentException("Test exception") + } + + override fun update( + uri: Uri, + values: ContentValues?, + selection: String?, + selectionArgs: Array<out String>?, + ): Int { + throw IllegalArgumentException("Test exception") + } + + override fun onCreate(): Boolean = true +} diff --git a/packages/SystemUI/tests/src/com/android/systemui/stylus/StylusManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/stylus/StylusManagerTest.kt index 0b3dd660532b..10503aa08e13 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/stylus/StylusManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/stylus/StylusManagerTest.kt @@ -28,6 +28,7 @@ import com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession import com.android.dx.mockito.inline.extended.ExtendedMockito.never import com.android.dx.mockito.inline.extended.ExtendedMockito.times import com.android.dx.mockito.inline.extended.ExtendedMockito.verify +import com.android.dx.mockito.inline.extended.MockedVoidMethod import com.android.dx.mockito.inline.extended.StaticMockitoSession import com.android.internal.logging.InstanceId import com.android.internal.logging.UiEventLogger @@ -246,7 +247,7 @@ class StylusManagerTest : SysuiTestCase() { @Test fun onInputDeviceAdded_btStylus_firstUsed_setsFlag() { stylusManager.onInputDeviceAdded(BT_STYLUS_DEVICE_ID) - verify({ InputSettings.setStylusEverUsed(mContext, true) }, times(1)) + verify(MockedVoidMethod { InputSettings.setStylusEverUsed(mContext, true) }, times(1)) } @Test @@ -512,7 +513,7 @@ class StylusManagerTest : SysuiTestCase() { stylusManager.onBatteryStateChanged(STYLUS_DEVICE_ID, 1, batteryState) - verify({ InputSettings.setStylusEverUsed(mContext, true) }, times(1)) + verify(MockedVoidMethod { InputSettings.setStylusEverUsed(mContext, true) }, times(1)) } @Test @@ -613,7 +614,7 @@ class StylusManagerTest : SysuiTestCase() { stylusManager.onBatteryStateChanged(STYLUS_DEVICE_ID, 1, batteryState) - verify({ InputSettings.setStylusEverUsed(mContext, true) }, never()) + verify(MockedVoidMethod { InputSettings.setStylusEverUsed(mContext, true) }, never()) } @Test diff --git a/packages/Vcn/TEST_MAPPING b/packages/Vcn/TEST_MAPPING index 9722a838ab8e..9ca5304eb8d9 100644 --- a/packages/Vcn/TEST_MAPPING +++ b/packages/Vcn/TEST_MAPPING @@ -14,5 +14,13 @@ { "name": "CtsVcnTestCases" } + ], + "tethering-mainline-presubmit": [ + { + "name": "FrameworksVcnTests" + }, + { + "name": "CtsVcnTestCases" + } ] }
\ No newline at end of file diff --git a/packages/Vcn/service-b/Android.bp b/packages/Vcn/service-b/Android.bp index 97574e6e35e3..aad534c3289c 100644 --- a/packages/Vcn/service-b/Android.bp +++ b/packages/Vcn/service-b/Android.bp @@ -29,7 +29,10 @@ filegroup { "vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java", ], }), - visibility: ["//frameworks/base/services/core"], + visibility: [ + "//frameworks/base/services/core", + "//packages/modules/Connectivity/service-t", + ], } // TODO: b/374174952 This library is only used in "service-connectivity-b-platform" diff --git a/packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java b/packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java index 81c7edf4adf1..b3f7eb5590c1 100644 --- a/packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java +++ b/packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java @@ -38,9 +38,27 @@ public final class ConnectivityServiceInitializerB extends SystemService { private static final String TAG = ConnectivityServiceInitializerB.class.getSimpleName(); private final VcnManagementService mVcnManagementService; + // STOPSHIP: b/385203616 This static flag is for handling a temporary case when the mainline + // module prebuilt has updated to register the VCN but the platform change to remove + // registration is not merged. After mainline prebuilt is updated, we should merge the platform + // ASAP and remove this static check. This check is safe because both mainline and platform + // registration are triggered from the same method on the same thread. + private static boolean sIsRegistered = false; + public ConnectivityServiceInitializerB(Context context) { super(context); - mVcnManagementService = VcnManagementService.create(context); + + if (!sIsRegistered) { + mVcnManagementService = VcnManagementService.create(context); + sIsRegistered = true; + } else { + mVcnManagementService = null; + Log.e( + TAG, + "Ignore this registration since VCN is already registered. It will happen when" + + " the mainline module prebuilt has updated to register the VCN but the" + + " platform change to remove registration is not merged."); + } } @Override diff --git a/proto/src/metrics_constants/OWNERS b/proto/src/metrics_constants/OWNERS index 7009282b66e1..169f887ede56 100644 --- a/proto/src/metrics_constants/OWNERS +++ b/proto/src/metrics_constants/OWNERS @@ -1,4 +1,2 @@ cwren@android.com -yanglu@google.com yaochen@google.com -yro@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/TEST_MAPPING b/ravenwood/TEST_MAPPING index cb54e9f56c0c..df63cb9dfc50 100644 --- a/ravenwood/TEST_MAPPING +++ b/ravenwood/TEST_MAPPING @@ -2,6 +2,7 @@ "presubmit": [ { "name": "tiny-framework-dump-test" }, { "name": "hoststubgentest" }, + { "name": "ravenhelpertest" }, { "name": "hoststubgen-test-tiny-test" }, { "name": "hoststubgen-invoke-test" }, { "name": "RavenwoodMockitoTest_device" }, 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/RavenwoodMethodCallLogger.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodMethodCallLogger.java new file mode 100644 index 000000000000..7ee9d7a8a5c6 --- /dev/null +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodMethodCallLogger.java @@ -0,0 +1,229 @@ +/* + * 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 android.platform.test.ravenwood; + +import com.android.ravenwood.RavenwoodRuntimeNative; + +import java.io.PrintStream; +import java.util.HashSet; +import java.util.Objects; + +/** + * Provides a method call hook that prints almost all (see below) the framework methods being + * called with indentation. + * + * We don't log methods that are trivial, uninteresting, or would be too noisy. + * e.g. we don't want to log any logging related methods, or collection APIs. + * + */ +public class RavenwoodMethodCallLogger { + private RavenwoodMethodCallLogger() { + } + + /** We don't want to log anything before ravenwood is initialized. This flag controls it.*/ + private static volatile boolean sEnabled = false; + + private static volatile PrintStream sOut = System.out; + + /** Return the current thread's call nest level. */ + private static int getNestLevel() { + return Thread.currentThread().getStackTrace().length; + } + + private static class ThreadInfo { + /** + * We save the current thread's nest call level here and use that as the initial level. + * We do it because otherwise the nest level would be too deep by the time test + * starts. + */ + public final int mInitialNestLevel = getNestLevel(); + + /** + * A nest level where shouldLog() returned false. + * Once it's set, we ignore all calls deeper than this. + */ + public int mDisabledNestLevel = Integer.MAX_VALUE; + } + + private static final ThreadLocal<ThreadInfo> sThreadInfo = new ThreadLocal<>() { + @Override + protected ThreadInfo initialValue() { + return new ThreadInfo(); + } + }; + + /** Classes that should be logged. Uses a map for fast lookup. */ + private static final HashSet<Class> sIgnoreClasses = new HashSet<>(); + static { + // The following classes are not interesting... + sIgnoreClasses.add(android.util.Log.class); + sIgnoreClasses.add(android.util.Slog.class); + sIgnoreClasses.add(android.util.EventLog.class); + sIgnoreClasses.add(android.util.TimingsTraceLog.class); + + sIgnoreClasses.add(android.util.SparseArray.class); + sIgnoreClasses.add(android.util.SparseIntArray.class); + sIgnoreClasses.add(android.util.SparseLongArray.class); + sIgnoreClasses.add(android.util.SparseBooleanArray.class); + sIgnoreClasses.add(android.util.SparseDoubleArray.class); + sIgnoreClasses.add(android.util.SparseSetArray.class); + sIgnoreClasses.add(android.util.SparseArrayMap.class); + sIgnoreClasses.add(android.util.LongSparseArray.class); + sIgnoreClasses.add(android.util.LongSparseLongArray.class); + sIgnoreClasses.add(android.util.LongArray.class); + + sIgnoreClasses.add(android.text.FontConfig.class); + + sIgnoreClasses.add(android.os.SystemClock.class); + sIgnoreClasses.add(android.os.Trace.class); + sIgnoreClasses.add(android.os.LocaleList.class); + sIgnoreClasses.add(android.os.Build.class); + sIgnoreClasses.add(android.os.SystemProperties.class); + + sIgnoreClasses.add(com.android.internal.util.Preconditions.class); + + sIgnoreClasses.add(android.graphics.FontListParser.class); + sIgnoreClasses.add(android.graphics.ColorSpace.class); + + sIgnoreClasses.add(android.graphics.fonts.FontStyle.class); + sIgnoreClasses.add(android.graphics.fonts.FontVariationAxis.class); + + sIgnoreClasses.add(com.android.internal.compat.CompatibilityChangeInfo.class); + sIgnoreClasses.add(com.android.internal.os.LoggingPrintStream.class); + + sIgnoreClasses.add(android.os.ThreadLocalWorkSource.class); + + // Following classes *may* be interesting for some purposes, but the initialization is + // too noisy... + sIgnoreClasses.add(android.graphics.fonts.SystemFonts.class); + + } + + /** + * Return if a class should be ignored. Uses {link #sIgnoreCladsses}, but + * we ignore more classes. + */ + private static boolean shouldIgnoreClass(Class<?> clazz) { + if (sIgnoreClasses.contains(clazz)) { + return true; + } + // Let's also ignore collection-ish classes in android.util. + if (java.util.Collection.class.isAssignableFrom(clazz) + || java.util.Map.class.isAssignableFrom(clazz) + ) { + if ("android.util".equals(clazz.getPackageName())) { + return true; + } + return false; + } + + switch (clazz.getSimpleName()) { + case "EventLogTags": + return false; + } + + // Following are classes that can't be referred to here directly. + // e.g. AndroidPrintStream is package-private, so we can't use its "class" here. + switch (clazz.getName()) { + case "com.android.internal.os.AndroidPrintStream": + return false; + } + return false; + } + + private static boolean shouldLog( + Class<?> methodClass, + String methodName, + @SuppressWarnings("UnusedVariable") String methodDescriptor + ) { + // Should we ignore this class? + if (shouldIgnoreClass(methodClass)) { + return false; + } + // Is it a nested class in a class that should be ignored? + var host = methodClass.getNestHost(); + if (host != methodClass && shouldIgnoreClass(host)) { + return false; + } + + var className = methodClass.getName(); + + // Ad-hoc ignore list. They'd be too noisy. + if ("create".equals(methodName) + // We may apply jarjar, so use endsWith(). + && className.endsWith("com.android.server.compat.CompatConfig")) { + return false; + } + + var pkg = methodClass.getPackageName(); + if (pkg.startsWith("android.icu")) { + return false; + } + + return true; + } + + /** + * Call this to enable logging. + */ + public static void enable(PrintStream out) { + sEnabled = true; + sOut = Objects.requireNonNull(out); + + // It's called from the test thread (Java's main thread). Because we're already + // in deep nest calls, we initialize the initial nest level here. + sThreadInfo.get(); + } + + /** Actual method hook entry point.*/ + public static void logMethodCall( + Class<?> methodClass, + String methodName, + String methodDescriptor + ) { + if (!sEnabled) { + return; + } + final var ti = sThreadInfo.get(); + final int nestLevel = getNestLevel() - ti.mInitialNestLevel; + + // Once shouldLog() returns false, we just ignore all deeper calls. + if (ti.mDisabledNestLevel < nestLevel) { + return; // Still ignore. + } + final boolean shouldLog = shouldLog(methodClass, methodName, methodDescriptor); + + if (!shouldLog) { + ti.mDisabledNestLevel = nestLevel; + return; + } + ti.mDisabledNestLevel = Integer.MAX_VALUE; + + var out = sOut; + out.print("# ["); + out.print(RavenwoodRuntimeNative.gettid()); + out.print(": "); + out.print(Thread.currentThread().getName()); + out.print("]: "); + out.print("[@"); + out.printf("%2d", nestLevel); + out.print("] "); + for (int i = 0; i < nestLevel; i++) { + out.print(" "); + } + out.println(methodClass.getName() + "." + methodName + methodDescriptor); + } +} 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 7af03ed2e6c8..33c4e86d885d 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuntimeEnvironmentController.java @@ -23,7 +23,6 @@ import static android.platform.test.ravenwood.RavenwoodSystemServer.ANDROID_PACK import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_EMPTY_RESOURCES_APK; import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_INST_RESOURCE_APK; import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_RESOURCE_APK; -import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING; import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERSION_JAVA_SYSPROP; import static com.android.ravenwood.common.RavenwoodCommonUtils.parseNullableInt; import static com.android.ravenwood.common.RavenwoodCommonUtils.withDefault; @@ -44,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; @@ -51,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; @@ -74,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; @@ -81,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; @@ -93,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. @@ -103,32 +107,64 @@ public class RavenwoodRuntimeEnvironmentController { private RavenwoodRuntimeEnvironmentController() { } - private static final String MAIN_THREAD_NAME = "RavenwoodMain"; + private static final PrintStream sStdOut = System.out; + @SuppressWarnings("UnusedVariable") + private static final PrintStream sStdErr = System.err; + + 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 @@ -137,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( @@ -183,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 @@ -190,6 +222,7 @@ public class RavenwoodRuntimeEnvironmentController { sInitialized = true; // This is the first call. + final long start = System.currentTimeMillis(); try { globalInitInner(); } catch (Throwable th) { @@ -198,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. @@ -212,11 +248,12 @@ public class RavenwoodRuntimeEnvironmentController { } private static void globalInitInner() throws IOException { - if (RAVENWOOD_VERBOSE_LOGGING) { - Log.v(TAG, "globalInit() called here...", new RuntimeException("NOT A CRASH")); - } + // We haven't initialized liblog yet, so directly write to System.out here. + RavenwoodCommonUtils.log(TAG, "globalInitInner()"); + if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { - Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler); + Thread.setDefaultUncaughtExceptionHandler( + RavenwoodRuntimeEnvironmentController::reportUncaughtExceptions); } // Some process-wide initialization: @@ -234,9 +271,6 @@ public class RavenwoodRuntimeEnvironmentController { dumpJavaProperties(); dumpOtherInfo(); - // We haven't initialized liblog yet, so directly write to System.out here. - RavenwoodCommonUtils.log(TAG, "globalInitInner()"); - // Make sure libravenwood_runtime is loaded. System.load(RavenwoodCommonUtils.getJniLibraryPath(RAVENWOOD_NATIVE_RUNTIME_NAME)); @@ -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()), @@ -261,10 +302,19 @@ public class RavenwoodRuntimeEnvironmentController { // Make sure libandroid_runtime is loaded. RavenwoodNativeLoader.loadFrameworkNativeCode(); + // Start method logging. + RavenwoodMethodCallLogger.enable(sStdOut); + // Touch some references early to ensure they're <clinit>'ed 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", @@ -288,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()); @@ -334,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); @@ -383,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() { @@ -457,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) { @@ -475,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-----"); } } @@ -529,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; @@ -570,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()); @@ -585,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/scripts/run-ravenwood-tests.sh b/ravenwood/scripts/run-ravenwood-tests.sh index 27c5ea1bd0d7..67ebb1fc9473 100755 --- a/ravenwood/scripts/run-ravenwood-tests.sh +++ b/ravenwood/scripts/run-ravenwood-tests.sh @@ -66,7 +66,7 @@ esac done shift $(($OPTIND - 1)) -all_tests=(hoststubgentest tiny-framework-dump-test hoststubgen-invoke-test ravenwood-stats-checker) +all_tests=(hoststubgentest tiny-framework-dump-test hoststubgen-invoke-test ravenwood-stats-checker ravenhelpertest) all_tests+=( $(${0%/*}/list-ravenwood-tests.sh) ) filter() { 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 fff9e6ad41d5..5c1766241698 100644 --- a/ravenwood/texts/ravenwood-framework-policies.txt +++ b/ravenwood/texts/ravenwood-framework-policies.txt @@ -50,8 +50,10 @@ class android.net.UriCodec keepclass # no-pta class android.telephony.PinResult keepclass # no-pta # Just enough to support mocking, no further functionality -class android.content.BroadcastReceiver keep # no-pta - method <init> ()V keep +class android.content.BroadcastReceiver allow-annotation + method <init> ()V allow-annotation + +# TODO: Convert the following policies to "allow-annotation". class android.content.Context keep # no-pta method <init> ()V keep method getSystemService (Ljava/lang/Class;)Ljava/lang/Object; keep # no-pta @@ -63,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/texts/ravenwood-standard-options.txt b/ravenwood/texts/ravenwood-standard-options.txt index 91fd9283aff2..233657557747 100644 --- a/ravenwood/texts/ravenwood-standard-options.txt +++ b/ravenwood/texts/ravenwood-standard-options.txt @@ -9,8 +9,10 @@ # Uncomment below lines to enable each feature. +# Enable method call hook. #--default-method-call-hook -# com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall +# android.platform.test.ravenwood.RavenwoodMethodCallLogger.logMethodCall + #--default-class-load-hook # com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded @@ -34,6 +36,9 @@ --ignore-annotation android.ravenwood.annotation.RavenwoodIgnore +--partially-allowed-annotation + android.ravenwood.annotation.RavenwoodPartiallyAllowlisted + --substitute-annotation android.ravenwood.annotation.RavenwoodReplace diff --git a/ravenwood/tools/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestPartiallyAllowlisted.java b/ravenwood/tools/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestPartiallyAllowlisted.java new file mode 100644 index 000000000000..49b5938941fb --- /dev/null +++ b/ravenwood/tools/hoststubgen/annotations-src/android/hosttest/annotation/HostSideTestPartiallyAllowlisted.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hosttest.annotation; + +import static java.lang.annotation.ElementType.TYPE; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({TYPE}) +@Retention(RetentionPolicy.CLASS) +public @interface HostSideTestPartiallyAllowlisted { +} diff --git a/ravenwood/tools/hoststubgen/framework-policy-override.txt b/ravenwood/tools/hoststubgen/framework-policy-override.txt deleted file mode 100644 index af3789e270a4..000000000000 --- a/ravenwood/tools/hoststubgen/framework-policy-override.txt +++ /dev/null @@ -1,105 +0,0 @@ -# -------------------------------------------------------------------------------------------------- -# This file contains rules to process `framework-all.jar` to generate the host side test "stub" and -# "impl" jars, without using Java annotations. -# -# Useful when: -# - The class is auto-generated and annotations can't be added. -# (We need to figure out what to do on auto-generated classes.) -# - Want to quickly change filter rules without having to rebuild framework.jar. -# -# Using this file, one can control the visibility of APIs on a per-class, per-field and per-method -# basis, but in most cases, per-class directives would be sufficient. That is: -# -# - To put the entire class, including its members and nested classes, in the "stub" jar, -# so that the test / target code can use the API, use `stubclass`. -# -# class package.class stubclass -# -# - To put the entire class, including its members and nested classes, in the "impl" jar, -# but not in the "stub" jar, use `keepclass`. Use this when you don't want to expose an API to -# tests/target directly, but it's still needed at runtime, because it's used by other "stub" APIs -# directly or indirectly. -# -# class package.class keepclass -# -# All other classes will be removed from both the stub jar and impl jar. -# -# -------------------------------------------------------------------------------------------------- - -# -------------------------------------------------------------------------------------------------- -# Directions on auto-generated classes, where we can't use Java annotations (yet). -# -------------------------------------------------------------------------------------------------- -class android.Manifest stubclass -class android.R stubclass -class android.os.PersistableBundleProto keepclass - -# This is in module-utils, where using a HostStubGen annotation would be complicated, so we -# add a direction here rather than using a java annotation. -# The build file says it's deprecated, anyway...? Figure out what to do with it. -class com.android.internal.util.Preconditions keepclass - -# -------------------------------------------------------------------------------------------------- -# Actual framework classes -# -------------------------------------------------------------------------------------------------- - -# Put basic exception classes in the "impl" jar. -# We don't put them in stub yet (until something actually needs them). -class android.os.DeadObjectException keepclass -class android.os.DeadSystemRuntimeException keepclass -class android.os.NetworkOnMainThreadException keepclass -class android.os.RemoteException keepclass -class android.os.ServiceSpecificException keepclass -class android.util.AndroidException keepclass -class android.util.AndroidRuntimeException keepclass -class android.os.DeadSystemException keepclass - - -# For now, we only want to expose ArrayMap and Log, but they and their tests depend on -# more classes. - -class android.util.ArrayMap stubclass - -# Used by ArrayMap. No need to put them in the stub, but we need them in impl. -class android.util.MapCollections keepclass -class android.util.ContainerHelpers keepclass -class android.util.EmptyArray stubclass -class com.android.internal.util.XmlUtils keepclass -class com.android.internal.util.FastMath keepclass -class android.util.MathUtils keepclass - - -class android.util.Log stubclass -class android.util.Slog stubclass -# We don't use Log's native code, yet. Instead, the following line enables the Java substitution. -# Comment it out to disable Java substitution of Log's native methods. -class android.util.Log !com.android.hoststubgen.nativesubstitution.Log_host - -# Used by log -class com.android.internal.util.FastPrintWriter keepclass -class com.android.internal.util.LineBreakBufferedWriter keepclass - -class android.util.EventLog stubclass -class android.util.EventLog !com.android.hoststubgen.nativesubstitution.EventLog_host -class android.util.EventLog$Event stubclass - -# Expose Context because it's referred to by AndroidTestCase, but don't need to expose any of -# its members. -class android.content.Context keep - -# Expose Parcel, Parcel and there relevant classes, which are used by ArrayMapTets. -class android.os.Parcelable StubClass -class android.os.Parcel StubClass -class android.os.Parcel !com.android.hoststubgen.nativesubstitution.Parcel_host - -class android.os.IBinder stubClass -class android.os.IInterface stubclass - -class android.os.BadParcelableException stubclass -class android.os.BadTypeParcelableException stubclass - -class android.os.BaseBundle stubclass -class android.os.Bundle stubclass -class android.os.PersistableBundle stubclass - -class android.os.MessageQueue stubclass -class android.os.MessageQueue !com.android.hoststubgen.nativesubstitution.MessageQueue_host diff --git a/ravenwood/tools/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java b/ravenwood/tools/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java index 78fd8f7f960a..145325ccc809 100644 --- a/ravenwood/tools/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java +++ b/ravenwood/tools/hoststubgen/helper-runtime-src/com/android/hoststubgen/hosthelper/HostTestUtils.java @@ -18,6 +18,7 @@ package com.android.hoststubgen.hosthelper; import java.io.PrintStream; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.Arrays; /** * Utilities used in the host side test environment. @@ -36,9 +37,14 @@ public class HostTestUtils { public static final String CLASS_INTERNAL_NAME = getInternalName(HostTestUtils.class); + /** If true, we skip all method call hooks */ + private static final boolean SKIP_METHOD_CALL_HOOK = "1".equals(System.getenv( + "HOSTTEST_SKIP_METHOD_CALL_HOOK")); + /** If true, we won't print method call log. */ - private static final boolean SKIP_METHOD_LOG = "1".equals(System.getenv( - "HOSTTEST_SKIP_METHOD_LOG")); + private static final boolean SKIP_METHOD_LOG = + "1".equals(System.getenv("HOSTTEST_SKIP_METHOD_LOG")) + || "1".equals(System.getenv("RAVENWOOD_NO_METHOD_LOG")); /** If true, we won't print class load log. */ private static final boolean SKIP_CLASS_LOG = "1".equals(System.getenv( @@ -65,6 +71,9 @@ public class HostTestUtils { + "consider using Mockito; more details at go/ravenwood-docs"); } + private static final Class<?>[] sMethodHookArgTypes = + { Class.class, String.class, String.class}; + /** * Trampoline method for method-call-hook. */ @@ -74,16 +83,22 @@ public class HostTestUtils { String methodDescriptor, String callbackMethod ) { - callStaticMethodByName(callbackMethod, "method call hook", methodClass, - methodName, methodDescriptor); + if (SKIP_METHOD_CALL_HOOK) { + return; + } + callStaticMethodByName(callbackMethod, "method call hook", sMethodHookArgTypes, + methodClass, methodName, methodDescriptor); } /** + * Simple implementation of method call hook, which just prints the information of the + * method. This is just for basic testing. We don't use it in Ravenwood, because this would + * be way too noisy as it prints every single method, even trivial ones. (iterator methods, + * etc..) + * * I can be used as * {@code --default-method-call-hook * com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall}. - * - * It logs every single methods called. */ public static void logMethodCall( Class<?> methodClass, @@ -97,6 +112,8 @@ public class HostTestUtils { + methodName + methodDescriptor); } + private static final Class<?>[] sClassLoadHookArgTypes = { Class.class }; + /** * Called when any top level class (not nested classes) in the impl jar is loaded. * @@ -111,11 +128,12 @@ public class HostTestUtils { logPrintStream.println("! Class loaded: " + loadedClass.getCanonicalName() + " calling hook " + callbackMethod); - callStaticMethodByName(callbackMethod, "class load hook", loadedClass); + callStaticMethodByName( + callbackMethod, "class load hook", sClassLoadHookArgTypes, loadedClass); } private static void callStaticMethodByName(String classAndMethodName, - String description, Object... args) { + String description, Class<?>[] argTypes, Object... args) { // Forward the call to callbackMethod. final int lastPeriod = classAndMethodName.lastIndexOf("."); @@ -145,19 +163,14 @@ public class HostTestUtils { className)); } - Class<?>[] argTypes = new Class[args.length]; - for (int i = 0; i < args.length; i++) { - argTypes[i] = args[i].getClass(); - } - Method method = null; try { method = clazz.getMethod(methodName, argTypes); } catch (Exception e) { throw new HostTestException(String.format( "Unable to find %s: class %s doesn't have method %s" - + " (method must take exactly one parameter of type Class," - + " and public static)", + + " Method must be public static, and arg types must be: " + + Arrays.toString(argTypes), description, className, methodName), e); } if (!(Modifier.isPublic(method.getModifiers()) diff --git a/ravenwood/tools/hoststubgen/hoststubgen-standard-options.txt b/ravenwood/tools/hoststubgen/hoststubgen-standard-options.txt index 9c46a1646560..062541241d2c 100644 --- a/ravenwood/tools/hoststubgen/hoststubgen-standard-options.txt +++ b/ravenwood/tools/hoststubgen/hoststubgen-standard-options.txt @@ -20,6 +20,9 @@ --keep-class-annotation android.hosttest.annotation.HostSideTestWholeClassKeep +--partially-allowed-annotation + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + --throw-annotation android.hosttest.annotation.HostSideTestThrow diff --git a/ravenwood/tools/hoststubgen/invoketest/hoststubgen-invoke-test.sh b/ravenwood/tools/hoststubgen/invoketest/hoststubgen-invoke-test.sh index 084448d0a797..da1e40a27944 100755 --- a/ravenwood/tools/hoststubgen/invoketest/hoststubgen-invoke-test.sh +++ b/ravenwood/tools/hoststubgen/invoketest/hoststubgen-invoke-test.sh @@ -47,6 +47,7 @@ INJAR=hoststubgen-test-tiny-framework.jar OUTJAR=$TEMP/host.jar ANNOTATION_FILTER=$TEMP/annotation-filter.txt +POLICY_FILE=$TEMP/policy-file.txt HOSTSTUBGEN_OUT=$TEMP/output.txt @@ -66,12 +67,14 @@ hoststubgen() { run_hoststubgen() { local test_name="$1" local annotation_filter="$2" + local policy="$3" echo "# Test: $test_name" cleanup_temp local filter_arg="" + local policy_arg="" if [[ "$annotation_filter" != "" ]] ; then echo "$annotation_filter" > $ANNOTATION_FILTER @@ -80,6 +83,13 @@ run_hoststubgen() { cat $ANNOTATION_FILTER fi + if [[ "$policy" != "" ]] ; then + echo "$policy" > $POLICY_FILE + policy_arg="--policy-override-file $POLICY_FILE" + echo "=== policy ===" + cat $POLICY_FILE + fi + local out_arg="" if [[ "$OUTJAR" != "" ]] ; then @@ -108,7 +118,10 @@ run_hoststubgen() { android.hosttest.annotation.HostSideTestClassLoadHook \ --keep-static-initializer-annotation \ android.hosttest.annotation.HostSideTestStaticInitializerKeep \ + --partially-allowed-annotation \ + android.hosttest.annotation.HostSideTestPartiallyAllowlisted \ $filter_arg \ + $policy_arg \ $EXTRA_ARGS \ |& tee $HOSTSTUBGEN_OUT HOSTSTUBGEN_RC=${PIPESTATUS[0]} @@ -132,10 +145,11 @@ assert_file_generated() { } run_hoststubgen_for_success() { + local test_name="$1" run_hoststubgen "$@" if (( $HOSTSTUBGEN_RC != 0 )) ; then - echo "HostStubGen expected to finish successfully, but failed with $rc" + echo "HostStubGen expected to finish successfully, but failed with $HOSTSTUBGEN_RC: Test=$test_name" return 1 fi @@ -151,7 +165,7 @@ run_hoststubgen_for_failure() { run_hoststubgen "$test_name" "$@" if (( $HOSTSTUBGEN_RC == 0 )) ; then - echo "HostStubGen expected to fail, but it didn't fail" + echo "HostStubGen expected to fail, but it didn't fail. Test=$test_name" return 1 fi @@ -161,24 +175,31 @@ run_hoststubgen_for_failure() { # Start the tests... +# These classes require special care, so let's delete them in most tests... +DELETE_PARTIAL_ANNOTATION_CLASSESS=' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove +' + # Pass "" as a filter to _not_ add `--annotation-allowed-classes-file`. -run_hoststubgen_for_success "No annotation filter" "" +run_hoststubgen_for_success "No annotation filter" "" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" # Now, we use " ", so we do add `--annotation-allowed-classes-file`. run_hoststubgen_for_failure "No classes are allowed to have annotations" \ "not allowed to have Ravenwood annotations" \ - " " + " " "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_success "All classes allowed (wildcard)" \ " * # Allow all classes -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_failure "All classes disallowed (wildcard)" \ "not allowed to have Ravenwood annotations" \ " !* # Disallow all classes -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_failure "Some classes not allowed (1)" \ "not allowed to have Ravenwood annotations" \ @@ -186,7 +207,7 @@ run_hoststubgen_for_failure "Some classes not allowed (1)" \ android.hosttest.* com.android.hoststubgen.* com.supported.* -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_failure "Some classes not allowed (2)" \ "not allowed to have Ravenwood annotations" \ @@ -194,7 +215,7 @@ run_hoststubgen_for_failure "Some classes not allowed (2)" \ android.hosttest.* com.android.hoststubgen.* com.unsupported.* -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_success "All classes allowed (package wildcard)" \ " @@ -202,27 +223,109 @@ android.hosttest.* com.android.hoststubgen.* com.supported.* com.unsupported.* -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_failure "One specific class disallowed" \ "TinyFrameworkAnnotations is not allowed to have Ravenwood annotations" \ " !com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations * # All other classes allowed -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" run_hoststubgen_for_success "One specific class disallowed, but it doesn't use annotations" \ " !com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPolicy * # All other classes allowed -" +" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" -OUTJAR="" run_hoststubgen_for_success "No output generation" "" +OUTJAR="" run_hoststubgen_for_success "No output generation" "" "$DELETE_PARTIAL_ANNOTATION_CLASSESS" EXTRA_ARGS="--in-jar abc" run_hoststubgen_for_failure "Duplicate arg" \ "Duplicate or conflicting argument found: --in-jar" \ "" +# --------------------------------------------------------------------------------------------- +# Tests for "partially-allowlisted". +# --------------------------------------------------------------------------------------------- + +# Allowlist used by hoststubgen-test-tiny-test. +ALLOWLIST=' +com.android.hoststubgen.test.tinyframework.* +com.supported.* +com.unsupported.* +!* +' + +run_hoststubgen_for_success 'The settings used by hoststubgen-test-tiny-test' \ + "$ALLOWLIST" \ + ' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation + method foo2 allow-annotation + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove +' + +run_hoststubgen_for_failure 'PartiallyAllowlisted does not have allow-annotation' \ + "PartiallyAllowlisted has annotation android.hosttest.annotation.HostSideTestPartiallyAllowlisted, but" \ + "$ALLOWLIST" \ + ' +#class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation +# method foo2 allow-annotation + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove +' + + +run_hoststubgen_for_failure 'PartiallyAllowlisted.foo2 does not have allow-annotation' \ + "foo2(I)I is not allowed to have Ravenwood annotations. (Class is partially allowlisted.)" \ + "$ALLOWLIST" \ + ' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation +# method foo2 allow-annotation + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove +' + +run_hoststubgen_for_failure 'Partially-allowlisted classes cannot have class-wide policies' \ + "PartialWithWholeClass_bad has class wide annotation android.hosttest.annotation.HostSideTestWholeClassKeep" \ + "$ALLOWLIST" \ + ' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation + method foo2 allow-annotation + +# Now with allow-annotation +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad allow-annotation + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove +' + +run_hoststubgen_for_failure 'Partially-allowlisted classes cannot have class-wide policies' \ + "PartiallyAllowlistedWithoutAnnot_bad must have android.hosttest.annotation.HostSideTestPartiallyAllowlisted" \ + "$ALLOWLIST" \ + ' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation + method foo2 allow-annotation +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove + +# Now with allow-annotation +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad allow-annotation +' + +run_hoststubgen_for_success 'The settings used by hoststubgen-test-tiny-test' \ + "$ALLOWLIST" \ + ' +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation + method foo2 allow-annotation +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove + +# NoAnnotations has no annotations at all. Setting "allow-annotation" to it is okay even though +# it does not have an @HostSideTestPartiallyAllowlisted, because it does nott have any other annotations anyway. +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$NoAnnotations allow-annotation +' echo "All tests passed" exit 0 diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt index 985947575a86..7e294ed652d3 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGen.kt @@ -29,7 +29,7 @@ import com.android.hoststubgen.filters.OutputFilter import com.android.hoststubgen.filters.SanitizationFilter import com.android.hoststubgen.filters.TextFileFilterPolicyBuilder import com.android.hoststubgen.filters.printAsTextPolicy -import com.android.hoststubgen.utils.ClassFilter +import com.android.hoststubgen.utils.ClassPredicate import com.android.hoststubgen.visitors.BaseAdapter import com.android.hoststubgen.visitors.PackageRedirectRemapper import java.io.BufferedInputStream @@ -145,21 +145,22 @@ class HostStubGen(val options: HostStubGenOptions) { // Inject default hooks from options. filter = DefaultHookInjectingFilter( + allClasses, options.defaultClassLoadHook.get, options.defaultMethodCallHook.get, filter ) - val annotationAllowedClassesFilter = options.annotationAllowedClassesFile.get.let { file -> + val annotationAllowedPredicate = options.annotationAllowedClassesFile.get.let { file -> if (file == null) { - ClassFilter.newNullFilter(true) // Allow all classes + ClassPredicate.newConstantPredicate(true) // Allow all classes } else { - ClassFilter.loadFromFile(file, false) + ClassPredicate.loadFromFile(file, false) } } // Next, Java annotation based filter. - filter = AnnotationBasedFilter( + val annotFilter = AnnotationBasedFilter( errors, allClasses, options.keepAnnotations, @@ -171,10 +172,12 @@ class HostStubGen(val options: HostStubGenOptions) { options.redirectAnnotations, options.redirectionClassAnnotations, options.classLoadHookAnnotations, + options.partiallyAllowedAnnotations, options.keepStaticInitializerAnnotations, - annotationAllowedClassesFilter, + annotationAllowedPredicate, filter ) + filter = annotFilter // Next, "text based" filter, which allows to override polices without touching // the target code. @@ -182,6 +185,7 @@ class HostStubGen(val options: HostStubGenOptions) { val builder = TextFileFilterPolicyBuilder(allClasses, filter) options.policyOverrideFiles.forEach(builder::parse) filter = builder.createOutputFilter() + annotFilter.annotationAllowedMembers = builder.annotationAllowedMembersFilter } // Apply the implicit filter. diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt index 297420d08ac1..1ab88d24ab28 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/HostStubGenOptions.kt @@ -86,6 +86,7 @@ class HostStubGenOptions( var removeAnnotations: MutableSet<String> = mutableSetOf(), var ignoreAnnotations: MutableSet<String> = mutableSetOf(), var keepClassAnnotations: MutableSet<String> = mutableSetOf(), + var partiallyAllowedAnnotations: MutableSet<String> = mutableSetOf(), var redirectAnnotations: MutableSet<String> = mutableSetOf(), var substituteAnnotations: MutableSet<String> = mutableSetOf(), @@ -181,6 +182,9 @@ class HostStubGenOptions( "--keep-class-annotation" -> ret.keepClassAnnotations.addUniqueAnnotationArg() + "--partially-allowed-annotation" -> + ret.partiallyAllowedAnnotations.addUniqueAnnotationArg() + "--throw-annotation" -> ret.throwAnnotations.addUniqueAnnotationArg() @@ -287,6 +291,7 @@ class HostStubGenOptions( removeAnnotations=$removeAnnotations, ignoreAnnotations=$ignoreAnnotations, keepClassAnnotations=$keepClassAnnotations, + partiallyAllowedAnnotations=$partiallyAllowedAnnotations, substituteAnnotations=$substituteAnnotations, nativeSubstituteAnnotations=$redirectionClassAnnotations, classLoadHookAnnotations=$classLoadHookAnnotations, 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 f47aaba8ef22..b41ce0f65017 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/asm/AsmUtils.kt @@ -191,7 +191,14 @@ fun String.toJvmClassName(): String { } fun String.toHumanReadableClassName(): String { - return this.replace('/', '.') + var ret = this + if (ret.startsWith("L")) { + ret = ret.substring(1) + } + if (ret.endsWith(";")) { + ret = ret.substring(0, ret.length - 1) + } + return ret.replace('/', '.') } fun String.toHumanReadableMethodName(): String { @@ -261,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/AnnotationBasedFilter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt index 36adf0626415..73c72a21ef7b 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/AnnotationBasedFilter.kt @@ -31,7 +31,7 @@ import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.asm.toHumanReadableMethodName import com.android.hoststubgen.asm.toJvmClassName import com.android.hoststubgen.log -import com.android.hoststubgen.utils.ClassFilter +import com.android.hoststubgen.utils.ClassPredicate import org.objectweb.asm.tree.AnnotationNode import org.objectweb.asm.tree.ClassNode @@ -53,10 +53,19 @@ class AnnotationBasedFilter( redirectAnnotations_: Set<String>, redirectionClassAnnotations_: Set<String>, classLoadHookAnnotations_: Set<String>, + partiallyAllowlistedClassAnnotations_: Set<String>, keepStaticInitializerAnnotations_: Set<String>, - private val annotationAllowedClassesFilter: ClassFilter, + private val annotationAllowedClassesFilter: ClassPredicate, fallback: OutputFilter, ) : DelegatingFilter(fallback) { + + /** + * This is a filter chain to check if an entity (class/member) has a "allow-annotation" + * policy. + */ + var annotationAllowedMembers: OutputFilter = + ConstantFilter(FilterPolicy.Remove, "default disallowed") + private val keepAnnotations = convertToInternalNames(keepAnnotations_) private val keepClassAnnotations = convertToInternalNames(keepClassAnnotations_) private val throwAnnotations = convertToInternalNames(throwAnnotations_) @@ -67,6 +76,9 @@ class AnnotationBasedFilter( private val redirectionClassAnnotations = convertToInternalNames(redirectionClassAnnotations_) private val classLoadHookAnnotations = convertToInternalNames(classLoadHookAnnotations_) + private val partiallyAllowlistedClassAnnotations = + convertToInternalNames(partiallyAllowlistedClassAnnotations_) + private val keepStaticInitializerAnnotations = convertToInternalNames(keepStaticInitializerAnnotations_) @@ -79,17 +91,22 @@ class AnnotationBasedFilter( redirectAnnotations + substituteAnnotations - /** All the annotations we use. */ - private val allAnnotations = visibilityAnnotations + + /** + * Annotations that require "fully" allowlisting. + */ + private val allowlistRequiringAnnotations = visibilityAnnotations + redirectionClassAnnotations + classLoadHookAnnotations + keepStaticInitializerAnnotations + // partiallyAllowlistedClassAnnotations // This is excluded. /** - * All the annotations we use. Note, this one is in a [convertToJvmNames] format unlike - * other ones, because of how it's used. + * We always keep these types. + * + * Note, this one is in a [convertToJvmNames] format unlike other ones, because of how it's + * used. */ - private val allAnnotationClasses: Set<String> = convertToJvmNames( + private val alwaysKeepClasses: Set<String> = convertToJvmNames( keepAnnotations_ + keepClassAnnotations_ + throwAnnotations_ + @@ -98,6 +115,7 @@ class AnnotationBasedFilter( substituteAnnotations_ + redirectionClassAnnotations_ + classLoadHookAnnotations_ + + partiallyAllowlistedClassAnnotations_ + keepStaticInitializerAnnotations_ ) @@ -122,7 +140,7 @@ class AnnotationBasedFilter( override fun getPolicyForClass(className: String): FilterPolicyWithReason { // If it's any of the annotations, then always keep it. - if (allAnnotationClasses.contains(className)) { + if (alwaysKeepClasses.contains(className)) { return FilterPolicy.KeepClass.withReason("HostStubGen Annotation") } @@ -197,13 +215,34 @@ class AnnotationBasedFilter( val classLoadHooks: List<String> init { - val allowAnnotation = annotationAllowedClassesFilter.matches(cn.name) - detectInvalidAnnotations( - cn.name, allowAnnotation, + // First, check if the class has "partially-allowed" policy. + // This filter chain contains + val annotationPartiallyAllowedClass = + annotationAllowedMembers.getPolicyForClass(cn.name).policy == + FilterPolicy.AnnotationAllowed + + // If a class is partially-allowlisted, then it's not fully-allowlisted. + // Otherwise, just use annotationAllowedClassesFilter. + val fullyAllowAnnotation = !annotationPartiallyAllowedClass && + annotationAllowedClassesFilter.matches(cn.name) + detectInvalidAnnotations(isClass = true, + cn.name, fullyAllowAnnotation, annotationPartiallyAllowedClass, + annotationPartiallyAllowedClass, cn.visibleAnnotations, cn.invisibleAnnotations, "class", cn.name ) - classPolicy = cn.findAnyAnnotation(visibilityAnnotations)?.policy + + val classAnnot = cn.findAnyAnnotation(visibilityAnnotations) + classPolicy = classAnnot?.policy + + classPolicy?.let { policy -> + if (policy.policy.isClassWide && annotationPartiallyAllowedClass) { + errors.onErrorFound("Class ${cn.name.toHumanReadableClassName()}" + + " has class wide annotation" + + " ${classAnnot?.desc?.toHumanReadableClassName()}" + + ", which can't be used in a partially-allowlisted class") + } + } redirectionClass = cn.findAnyAnnotation(redirectionClassAnnotations)?.let { an -> getAnnotationField(an, "value")?.let { resolveRelativeClass(cn, it) } } @@ -216,8 +255,10 @@ class AnnotationBasedFilter( } for (fn in cn.fields ?: emptyList()) { - detectInvalidAnnotations( - cn.name, allowAnnotation, + val partiallyAllowAnnotation = false // No partial allowlisting on fields (yet) + detectInvalidAnnotations(isClass = false, + cn.name, fullyAllowAnnotation, partiallyAllowAnnotation, + annotationPartiallyAllowedClass, fn.visibleAnnotations, fn.invisibleAnnotations, "field", cn.name, fn.name ) @@ -227,8 +268,12 @@ class AnnotationBasedFilter( } for (mn in cn.methods ?: emptyList()) { - detectInvalidAnnotations( - cn.name, allowAnnotation, + val partiallyAllowAnnotation = + annotationAllowedMembers.getPolicyForMethod(cn.name, mn.name, mn.desc).policy == + FilterPolicy.AnnotationAllowed + detectInvalidAnnotations(isClass = false, + cn.name, fullyAllowAnnotation, partiallyAllowAnnotation, + annotationPartiallyAllowedClass, mn.visibleAnnotations, mn.invisibleAnnotations, "method", cn.name, mn.name, mn.desc ) @@ -263,8 +308,11 @@ class AnnotationBasedFilter( * to avoid unnecessary string concatenations. */ private fun detectInvalidAnnotations( + isClass: Boolean, className: String, - allowAnnotation: Boolean, + fullyAllowAnnotation: Boolean, + partiallyAllowAnnotation: Boolean, + classPartiallyAllowAnnotation: Boolean, visibles: List<AnnotationNode>?, invisibles: List<AnnotationNode>?, type: String, @@ -272,13 +320,26 @@ class AnnotationBasedFilter( name2: String = "", name3: String = "", ) { + // Lazily create the description. + val desc = { getItemDescription(type, name1, name2, name3) } + + val partiallyAllowlistAnnotation = + findAnyAnnotation(partiallyAllowlistedClassAnnotations, visibles, invisibles) + partiallyAllowlistAnnotation?.let { anot -> + if (!partiallyAllowAnnotation) { + errors.onErrorFound(desc() + + " has annotation ${anot.desc?.toHumanReadableClassName()}, but" + + " doesn't have" + + " '${FilterPolicy.AnnotationAllowed.policyStringOrPrefix}' policy.'") + } + } var count = 0 var visibleCount = 0 for (an in visibles ?: emptyList()) { if (visibilityAnnotations.contains(an.desc)) { visibleCount++ } - if (allAnnotations.contains(an.desc)) { + if (allowlistRequiringAnnotations.contains(an.desc)) { count++ } } @@ -286,28 +347,54 @@ class AnnotationBasedFilter( if (visibilityAnnotations.contains(an.desc)) { visibleCount++ } - if (allAnnotations.contains(an.desc)) { + if (allowlistRequiringAnnotations.contains(an.desc)) { count++ } } - if (count > 0 && !allowAnnotation) { + // Special case -- if it's a class, and has an "allow-annotation" policy + // *and* if it actually has an annotation, then it must have the + // "PartiallyAllowlisted" annotation. + // Conversely, even if it has an "allow-annotation" policy, it's okay + // if it doesn't have the annotation, as long as it doesn't have any + // annotations. + if (isClass && count > 0 && partiallyAllowAnnotation) { + if (partiallyAllowlistAnnotation == null) { + val requiredAnnot = partiallyAllowlistedClassAnnotations.firstOrNull() + throw InvalidAnnotationException( + "${desc()} must have ${requiredAnnot?.toHumanReadableClassName()} to use" + + " annotations") + } + } + + if (count > 0 && !(fullyAllowAnnotation || partiallyAllowAnnotation)) { + val extInfo = if (classPartiallyAllowAnnotation) { + " (Class is partially allowlisted.)" + } else {""} throw InvalidAnnotationException( - "Class ${className.toHumanReadableClassName()} is not allowed to have " + - "Ravenwood annotations. Contact g/ravenwood for more details." + "${desc()} is not allowed to have " + + "Ravenwood annotations.$extInfo Contact g/ravenwood for more details." ) } if (visibleCount > 1) { - val description = if (name2 == "" && name3 == "") { - "$type $name1" - } else { - "$type $name1.$name2$name3" - } throw InvalidAnnotationException( - "Found more than one visibility annotations on $description" + "Found more than one visibility annotations on ${desc()}" ) } } + private fun getItemDescription( + type: String, + name1: String, + name2: String, + name3: String, + ): String { + return if (name2 == "" && name3 == "") { + "$type $name1" + } else { + "$type $name1.$name2$name3" + } + } + /** * Return the (String) value of 'value' parameter from an annotation. */ diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/DefaultHookInjectingFilter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/DefaultHookInjectingFilter.kt index d771003a955d..aaf49c154a17 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/DefaultHookInjectingFilter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/DefaultHookInjectingFilter.kt @@ -16,8 +16,11 @@ package com.android.hoststubgen.filters import com.android.hoststubgen.addLists +import com.android.hoststubgen.asm.ClassNodes +import com.android.hoststubgen.asm.isAnnotation class DefaultHookInjectingFilter( + val classes: ClassNodes, defaultClassLoadHook: String?, defaultMethodCallHook: String?, fallback: OutputFilter @@ -36,8 +39,30 @@ class DefaultHookInjectingFilter( private val defaultClassLoadHookAsList: List<String> = toSingleList(defaultClassLoadHook) private val defaultMethodCallHookAsList: List<String> = toSingleList(defaultMethodCallHook) + private fun shouldInject(className: String): Boolean { + // Let's not inject default hooks to annotation classes or inner classes of an annotation + // class, because these methods could be called at the class load time, which + // is very confusing, and usually not useful. + + val cn = classes.findClass(className) ?: return false + if (cn.isAnnotation()) { + return false + } + cn.nestHostClass?.let { nestHostClass -> + val nestHost = classes.findClass(nestHostClass) ?: return false + if (nestHost.isAnnotation()) { + return false + } + } + return true + } + override fun getClassLoadHooks(className: String): List<String> { - return addLists(super.getClassLoadHooks(className), defaultClassLoadHookAsList) + val s = super.getClassLoadHooks(className) + if (!shouldInject(className)) { + return s + } + return addLists(s, defaultClassLoadHookAsList) } override fun getMethodCallHooks( @@ -45,9 +70,23 @@ class DefaultHookInjectingFilter( methodName: String, descriptor: String ): List<String> { - return addLists( - super.getMethodCallHooks(className, methodName, descriptor), - defaultMethodCallHookAsList, - ) + val s = super.getMethodCallHooks(className, methodName, descriptor) + if (!shouldInject(className)) { + return s + } + // Don't hook Object methods. + if (methodName == "finalize" && descriptor == "()V") { + return s + } + if (methodName == "toString" && descriptor == "()Ljava/lang/String;") { + return s + } + if (methodName == "equals" && descriptor == "(Ljava/lang/Object;)Z") { + return s + } + if (methodName == "hashCode" && descriptor == "()I") { + return s + } + return addLists(s, defaultMethodCallHookAsList) } -}
\ No newline at end of file +} diff --git a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt index 2f2f81b05ad1..81c26ffdf1f4 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/FilterPolicy.kt @@ -15,44 +15,51 @@ */ package com.android.hoststubgen.filters -enum class FilterPolicy { +enum class FilterPolicy(val policyStringOrPrefix: String) { /** * Keep the item in the jar file. */ - Keep, + Keep("keep"), /** * Only usable with classes. Keep the class in the jar, and also all its members. * Each member can have another policy to override it. */ - KeepClass, + KeepClass("keepclass"), /** * Only usable with methods. Replace a method with a "substitution" method. */ - Substitute, + Substitute("@"), // @ is a prefix /** * Only usable with methods. Redirect a method to a method in the substitution class. */ - Redirect, + Redirect("redirect"), /** * Only usable with methods. The item will be kept in the impl jar file, but when called, * it'll throw. */ - Throw, + Throw("throw"), /** * Only usable with methods. The item will be kept in the impl jar file, but when called, * it'll no-op. */ - Ignore, + Ignore("ignore"), /** * Remove the item completely. */ - Remove; + Remove("remove"), + + /** + * Special policy used for "partial annotation allowlisting". This policy must not be + * used in the "main" filter chain. (which would be detected by [SanitizationFilter].) + * It's used in a separate filter chain used by [AnnotationBasedFilter]. + */ + AnnotationAllowed("allow-annotation"); val needsInOutput: Boolean get() { @@ -66,7 +73,7 @@ enum class FilterPolicy { val isUsableWithClasses: Boolean get() { return when (this) { - Keep, KeepClass, Remove -> true + Keep, KeepClass, Remove, AnnotationAllowed -> true else -> false } } @@ -75,6 +82,7 @@ enum class FilterPolicy { val isUsableWithFields: Boolean get() { return when (this) { + // AnnotationAllowed isn't supported on fields (yet). We could support it if needed. Keep, Remove -> true else -> false } @@ -102,7 +110,7 @@ enum class FilterPolicy { val isSupported: Boolean get() { return when (this) { - Keep, KeepClass, Substitute, Redirect -> true + Keep, KeepClass, Substitute, Redirect, AnnotationAllowed -> true else -> false } } @@ -115,6 +123,25 @@ enum class FilterPolicy { } } + val isClassWide: Boolean + get() { + return when (this) { + Remove, KeepClass -> true + else -> false + } + } + + /** + * Internal policies must not be used in the main filter chain. + */ + val isInternalPolicy: Boolean + get() { + return when (this) { + AnnotationAllowed -> true + else -> false + } + } + /** * Convert KeepClass to Keep, or return itself. */ 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/SanitizationFilter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt index 18a1e16bcf3a..4375c6500b62 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/filters/SanitizationFilter.kt @@ -16,6 +16,7 @@ package com.android.hoststubgen.filters import com.android.hoststubgen.HostStubGenErrors +import com.android.hoststubgen.HostStubGenInternalException import com.android.hoststubgen.asm.ClassNodes import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.log @@ -28,12 +29,30 @@ class SanitizationFilter( private val classes: ClassNodes, fallback: OutputFilter ) : DelegatingFilter(fallback) { + private fun validate(policy: FilterPolicyWithReason): FilterPolicyWithReason { + // "Internal" policies shouldn't be used in the "main" filter chain. + // They're for filter chains for other purposes. + if (policy.policy.isInternalPolicy) { + throw HostStubGenInternalException( + "Policy $policy must not be used in the \"real\" filter chain.") + } + return policy + } + + override fun getPolicyForClass(className: String): FilterPolicyWithReason { + return validate(super.getPolicyForClass(className)) + } + + override fun getPolicyForField(className: String, fieldName: String): FilterPolicyWithReason { + return validate(super.getPolicyForField(className, fieldName)) + } + override fun getPolicyForMethod( className: String, methodName: String, descriptor: String ): FilterPolicyWithReason { - val policy = super.getPolicyForMethod(className, methodName, descriptor) + val policy = validate(super.getPolicyForMethod(className, methodName, descriptor)) if (policy.policy == FilterPolicy.Redirect) { // Check whether the hosting class has a redirection class if (getRedirectionClass(className) == null) { 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 9782f3d0f591..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, ) } @@ -122,6 +121,25 @@ class TextFileFilterPolicyBuilder( mutableListOf<TextFilePolicyMethodReplaceFilter.MethodCallReplaceSpec>() /** + * Fields for a filter chain used for "partial allowlisting", which are used by + * [AnnotationBasedFilter]. + */ + private val annotationAllowedInMemoryFilter: InMemoryOutputFilter + val annotationAllowedMembersFilter: OutputFilter + + private val annotationAllowedPolicy = FilterPolicy.AnnotationAllowed.withReason(FILTER_REASON) + + init { + // Create a filter that checks "partial allowlisting". + var aaf: OutputFilter = ConstantFilter(FilterPolicy.Remove, "default disallowed") + + aaf = InMemoryOutputFilter(classes, aaf) + annotationAllowedInMemoryFilter = aaf + + annotationAllowedMembersFilter = annotationAllowedInMemoryFilter + } + + /** * Parse a given policy file. This method can be called multiple times to read from * multiple files. To get the resulting filter, use [createOutputFilter] */ @@ -153,6 +171,11 @@ class TextFileFilterPolicyBuilder( private inner class Processor : PolicyFileProcessor { override fun onPackage(name: String, policy: FilterPolicyWithReason) { + if (policy.policy == FilterPolicy.AnnotationAllowed) { + throw ParseException("${FilterPolicy.AnnotationAllowed.policyStringOrPrefix}" + + " on `package` isn't supported yet.") + return + } packageFilter.addPolicy(name, policy) } @@ -169,6 +192,11 @@ class TextFileFilterPolicyBuilder( } override fun onSimpleClassPolicy(className: String, policy: FilterPolicyWithReason) { + if (policy.policy == FilterPolicy.AnnotationAllowed) { + annotationAllowedInMemoryFilter.setPolicyForClass( + className, annotationAllowedPolicy) + return + } imf.setPolicyForClass(className, policy) } @@ -224,6 +252,11 @@ class TextFileFilterPolicyBuilder( methodDesc: String, policy: FilterPolicyWithReason, ) { + if (policy.policy == FilterPolicy.AnnotationAllowed) { + annotationAllowedInMemoryFilter.setPolicyForMethod( + className, methodName, methodDesc, annotationAllowedPolicy) + return + } imf.setPolicyForMethod(className, methodName, methodDesc, policy) } @@ -252,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) } } @@ -375,14 +409,15 @@ class TextFileFilterPolicyParser { private fun parsePolicy(s: String): FilterPolicy { return when (s.lowercase()) { - "k", "keep" -> FilterPolicy.Keep - "t", "throw" -> FilterPolicy.Throw - "r", "remove" -> FilterPolicy.Remove - "kc", "keepclass" -> FilterPolicy.KeepClass - "i", "ignore" -> FilterPolicy.Ignore - "rdr", "redirect" -> FilterPolicy.Redirect + "k", FilterPolicy.Keep.policyStringOrPrefix -> FilterPolicy.Keep + "t", FilterPolicy.Throw.policyStringOrPrefix -> FilterPolicy.Throw + "r", FilterPolicy.Remove.policyStringOrPrefix -> FilterPolicy.Remove + "kc", FilterPolicy.KeepClass.policyStringOrPrefix -> FilterPolicy.KeepClass + "i", FilterPolicy.Ignore.policyStringOrPrefix -> FilterPolicy.Ignore + "rdr", FilterPolicy.Redirect.policyStringOrPrefix -> FilterPolicy.Redirect + FilterPolicy.AnnotationAllowed.policyStringOrPrefix -> FilterPolicy.AnnotationAllowed else -> { - if (s.startsWith("@")) { + if (s.startsWith(FilterPolicy.Substitute.policyStringOrPrefix)) { FilterPolicy.Substitute } else { throw ParseException("Invalid policy \"$s\"") @@ -607,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/utils/ClassFilter.kt b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/utils/ClassPredicate.kt index d6aa7617fd59..4c53bc8fba97 100644 --- a/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/utils/ClassFilter.kt +++ b/ravenwood/tools/hoststubgen/src/com/android/hoststubgen/utils/ClassPredicate.kt @@ -22,9 +22,11 @@ import com.android.hoststubgen.normalizeTextLine import java.io.File /** - * General purpose filter for class names. + * General purpose class "selector", which returns a boolean for a given class name. + * + * (It's used to check if a class is in the "annotations allowed classes" allowlist.) */ -class ClassFilter private constructor( +class ClassPredicate private constructor( private val defaultResult: Boolean, ) { private enum class MatchType { @@ -81,14 +83,14 @@ class ClassFilter private constructor( companion object { /** - * Return a filter that alawys returns true or false. + * Return a filter that always returns true or false. */ - fun newNullFilter(defaultResult: Boolean): ClassFilter { - return ClassFilter(defaultResult) + fun newConstantPredicate(defaultResult: Boolean): ClassPredicate { + return ClassPredicate(defaultResult) } /** Build a filter from a file. */ - fun loadFromFile(filename: String, defaultResult: Boolean): ClassFilter { + fun loadFromFile(filename: String, defaultResult: Boolean): ClassPredicate { return buildFromString(File(filename).readText(), defaultResult, filename) } @@ -97,8 +99,8 @@ class ClassFilter private constructor( filterString: String, defaultResult: Boolean, filenameForErrorMessage: String - ): ClassFilter { - val ret = ClassFilter(defaultResult) + ): ClassPredicate { + val ret = ClassPredicate(defaultResult) var lineNo = 0 filterString.split('\n').forEach { s -> 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/annotation-allowed-classes-tiny-framework.txt b/ravenwood/tools/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt index de4cb0c536c1..8e41a87d349d 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/annotation-allowed-classes-tiny-framework.txt @@ -1,29 +1,8 @@ -# Only classes listed here can use the hoststubgen annotations. - -# For each class, we check each item in this file, and when a match is found, we -# either allow it if the line doesn't have a !, or disallow if the line has a !. -# All the lines after the matching line will be ignored. - - -# To allow a specific class to use annotations: -# com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations - -# To disallow a specific class to use annotations: -# !com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations - -# To allow a specific package to use annotations: -# com.android.hoststubgen.test.* - -# To disallow a specific package to use annotations: -# !com.android.hoststubgen.test.* - +# Policy file for "tiny-framework" used by hoststubgen's own tests. com.android.hoststubgen.test.tinyframework.* com.supported.* com.unsupported.* -# Use this to allow all packages -# * - -# Use this to allow all packages -# !*
\ No newline at end of file +# Disallow all other classes +!*
\ No newline at end of file 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 b009b0957919..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 @@ -67,6 +67,28 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 65 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -1861,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 @@ -1869,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(); @@ -1915,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" @@ -1928,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(); @@ -1986,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 @@ -2024,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: @@ -2031,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 @@ -2946,6 +3039,228 @@ SourceFile: "TinyFrameworkPackageRedirect.java" RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$NoAnnotations + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 3 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$NoAnnotations(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // NoAnnotations=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestWholeClassKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartialWithWholeClass_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted; + + public static int foo1(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_1 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad; + + public static int foo1(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_1 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlistedWithoutAnnot_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 3 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +NestMembers: + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // NoAnnotations=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartiallyAllowlistedWithoutAnnot_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartialWithWholeClass_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -2954,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(); @@ -2985,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: @@ -2998,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; @@ -3034,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 84a8373008d7..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 @@ -7,6 +7,8 @@ public interface android.hosttest.annotation.HostSideTestClassLoadHook extends j this_class: #x // android/hosttest/annotation/HostSideTestClassLoadHook super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -35,6 +37,8 @@ public interface android.hosttest.annotation.HostSideTestKeep extends java.lang. this_class: #x // android/hosttest/annotation/HostSideTestKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestKeep.java" RuntimeVisibleAnnotations: @@ -48,6 +52,30 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 65 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -57,6 +85,8 @@ public interface android.hosttest.annotation.HostSideTestRedirect extends java.l this_class: #x // android/hosttest/annotation/HostSideTestRedirect super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRedirect.java" RuntimeVisibleAnnotations: @@ -79,6 +109,8 @@ public interface android.hosttest.annotation.HostSideTestRedirectionClass extend this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -107,6 +139,8 @@ public interface android.hosttest.annotation.HostSideTestRemove extends java.lan this_class: #x // android/hosttest/annotation/HostSideTestRemove super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRemove.java" RuntimeVisibleAnnotations: @@ -129,6 +163,8 @@ public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep e this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestStaticInitializerKeep.java" RuntimeVisibleAnnotations: @@ -151,6 +187,8 @@ public interface android.hosttest.annotation.HostSideTestSubstitute extends java this_class: #x // android/hosttest/annotation/HostSideTestSubstitute super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String suffix(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -179,6 +217,8 @@ public interface android.hosttest.annotation.HostSideTestThrow extends java.lang this_class: #x // android/hosttest/annotation/HostSideTestThrow super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestThrow.java" RuntimeVisibleAnnotations: @@ -201,6 +241,8 @@ public interface android.hosttest.annotation.HostSideTestWholeClassKeep extends this_class: #x // android/hosttest/annotation/HostSideTestWholeClassKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestWholeClassKeep.java" RuntimeVisibleAnnotations: @@ -223,6 +265,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Pro this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -273,6 +317,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -323,6 +369,8 @@ public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 4 +Constant pool: +{ } InnerClasses: public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl @@ -343,6 +391,8 @@ public class com.android.hoststubgen.test.tinyframework.R$Nested this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public static int[] ARRAY; descriptor: [I flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -400,6 +450,8 @@ public class com.android.hoststubgen.test.tinyframework.R this_class: #x // com/android/hoststubgen/test/tinyframework/R super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.R(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -433,6 +485,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 7, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -591,6 +645,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHo this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ public static final java.util.Set<java.lang.Class<?>> sLoadedClasses; descriptor: Ljava/util/Set; flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL @@ -668,6 +724,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 4, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -768,6 +826,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 0, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -805,6 +865,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 1, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -867,6 +929,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumC this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex super_class: #x // java/lang/Enum interfaces: 0, fields: 6, methods: 7, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1112,6 +1176,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumS this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple super_class: #x // java/lang/Enum interfaces: 0, fields: 3, methods: 5, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1260,6 +1326,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTe this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -1323,6 +1391,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPoli this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 2 +Constant pool: +{ public int stub; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1562,6 +1632,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nes this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -1749,6 +1821,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -1928,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 @@ -1936,7 +2055,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -1989,9 +2110,30 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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() @@ -2005,7 +2147,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -2070,6 +2214,48 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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 @@ -2089,6 +2275,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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" @@ -2106,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 @@ -2115,6 +2303,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 14, attributes: 3 +Constant pool: +{ int value; descriptor: I flags: (0x0000) @@ -2373,6 +2563,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 7, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -2503,6 +2695,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses); descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V flags: (0x0000) @@ -2573,6 +2767,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2(); descriptor: ()V flags: (0x0000) @@ -2639,6 +2835,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3(com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses); descriptor: (Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses;)V flags: (0x0000) @@ -2709,6 +2907,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4(); descriptor: ()V flags: (0x0000) @@ -2775,6 +2975,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -2818,6 +3020,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -2864,6 +3068,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$Stat this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$1(); descriptor: ()V flags: (0x0000) @@ -2931,6 +3137,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -2974,6 +3182,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3033,6 +3243,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass(int); descriptor: (I)V flags: (0x0001) ACC_PUBLIC @@ -3068,6 +3280,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 4, attributes: 5 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -3193,6 +3407,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedi this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -3235,6 +3451,49 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 5 +Constant pool: +{ + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -3243,7 +3502,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -3278,6 +3539,25 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas 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: @@ -3295,6 +3575,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "A.java" RuntimeVisibleAnnotations: @@ -3309,6 +3591,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "A.java" RuntimeVisibleAnnotations: @@ -3323,6 +3607,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C1.java" RuntimeVisibleAnnotations: @@ -3337,6 +3623,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C2.java" RuntimeVisibleAnnotations: @@ -3351,6 +3639,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C3.java" RuntimeVisibleAnnotations: @@ -3365,6 +3655,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "CA.java" RuntimeVisibleAnnotations: @@ -3379,6 +3671,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "CB.java" RuntimeVisibleAnnotations: @@ -3393,6 +3687,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C1.java" RuntimeVisibleAnnotations: @@ -3407,6 +3703,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C2.java" RuntimeVisibleAnnotations: @@ -3421,6 +3719,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C3.java" RuntimeVisibleAnnotations: @@ -3435,6 +3735,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I1.java" RuntimeVisibleAnnotations: @@ -3449,6 +3751,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA super_class: #x // java/lang/Object interfaces: 2, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I1_IA.java" RuntimeVisibleAnnotations: @@ -3463,6 +3767,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I2.java" RuntimeVisibleAnnotations: @@ -3477,6 +3783,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I3.java" RuntimeVisibleAnnotations: @@ -3491,6 +3799,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I1.java" RuntimeVisibleAnnotations: @@ -3505,6 +3815,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I2.java" RuntimeVisibleAnnotations: @@ -3519,6 +3831,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I3.java" RuntimeVisibleAnnotations: @@ -3533,6 +3847,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "IA.java" RuntimeVisibleAnnotations: @@ -3547,6 +3863,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "IB.java" RuntimeVisibleAnnotations: @@ -3561,6 +3879,8 @@ public class com.supported.UnsupportedClass this_class: #x // com/supported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 3 +Constant pool: +{ private final int mValue; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -3620,6 +3940,8 @@ public class com.unsupported.UnsupportedClass this_class: #x // com/unsupported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.unsupported.UnsupportedClass(int); descriptor: (I)V flags: (0x0001) ACC_PUBLIC @@ -3674,7 +3996,9 @@ 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; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -3696,7 +4020,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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() @@ -3713,7 +4037,30 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 49769e648bbf..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 @@ -6,17 +6,9 @@ public interface android.hosttest.annotation.HostSideTestClassLoadHook extends j flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestClassLoadHook super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestClassLoadHook - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -44,16 +36,9 @@ public interface android.hosttest.annotation.HostSideTestKeep extends java.lang. flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestKeep.java" RuntimeVisibleAnnotations: @@ -67,6 +52,30 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 65 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -75,16 +84,9 @@ public interface android.hosttest.annotation.HostSideTestRedirect extends java.l flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRedirect super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRedirect - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRedirect.java" RuntimeVisibleAnnotations: @@ -106,17 +108,9 @@ public interface android.hosttest.annotation.HostSideTestRedirectionClass extend flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRedirectionClass - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -144,16 +138,9 @@ public interface android.hosttest.annotation.HostSideTestRemove extends java.lan flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRemove super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRemove - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRemove.java" RuntimeVisibleAnnotations: @@ -175,16 +162,9 @@ public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep e flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestStaticInitializerKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestStaticInitializerKeep.java" RuntimeVisibleAnnotations: @@ -206,17 +186,9 @@ public interface android.hosttest.annotation.HostSideTestSubstitute extends java flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestSubstitute super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestSubstitute - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String suffix(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -244,16 +216,9 @@ public interface android.hosttest.annotation.HostSideTestThrow extends java.lang flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestThrow super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestThrow - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestThrow.java" RuntimeVisibleAnnotations: @@ -275,16 +240,9 @@ public interface android.hosttest.annotation.HostSideTestWholeClassKeep extends flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestWholeClassKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestWholeClassKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestWholeClassKeep.java" RuntimeVisibleAnnotations: @@ -307,6 +265,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Pro this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -377,6 +337,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -447,6 +409,8 @@ public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -476,6 +440,8 @@ public class com.android.hoststubgen.test.tinyframework.R$Nested this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public static int[] ARRAY; descriptor: [I flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -546,6 +512,8 @@ public class com.android.hoststubgen.test.tinyframework.R this_class: #x // com/android/hoststubgen/test/tinyframework/R super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -594,6 +562,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 7, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -785,6 +755,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHo this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ public static final java.util.Set<java.lang.Class<?>> sLoadedClasses; descriptor: Ljava/util/Set; flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL @@ -880,6 +852,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 5, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1010,6 +984,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 0, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -1047,6 +1023,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 1, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -1117,6 +1095,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumC this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex super_class: #x // java/lang/Enum interfaces: 0, fields: 6, methods: 7, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1400,6 +1380,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumS this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple super_class: #x // java/lang/Enum interfaces: 0, fields: 3, methods: 5, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1576,6 +1558,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTe this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -1659,6 +1643,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPoli this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 2 +Constant pool: +{ public int stub; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1971,6 +1957,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nes this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -2201,6 +2189,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -2423,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 @@ -2431,7 +2481,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2509,8 +2561,34 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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: @@ -2525,7 +2603,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2615,18 +2695,70 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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 @@ -2639,6 +2771,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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" @@ -2656,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 @@ -2665,6 +2799,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 3 +Constant pool: +{ int value; descriptor: I flags: (0x0000) @@ -2998,6 +3134,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 8, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3173,6 +3311,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3268,6 +3408,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3359,6 +3501,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3454,6 +3598,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3545,6 +3691,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3603,6 +3751,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3664,6 +3814,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$Stat this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3756,6 +3908,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3814,6 +3968,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3893,6 +4049,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3943,6 +4101,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 4, attributes: 5 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -4091,6 +4251,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedi this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4153,6 +4315,64 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 65 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 5 +Constant pool: +{ + 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/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + 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 static int foo2(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/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + x: ldc #x // String foo2 + 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: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 4 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -4161,7 +4381,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4216,6 +4438,30 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas 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: @@ -4233,6 +4479,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4256,6 +4504,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4279,6 +4529,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4302,6 +4554,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4325,6 +4579,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4348,6 +4604,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4371,6 +4629,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4394,6 +4654,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4417,6 +4679,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4440,6 +4704,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4463,6 +4729,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4486,6 +4754,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA super_class: #x // java/lang/Object interfaces: 2, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4509,6 +4779,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4532,6 +4804,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4555,6 +4829,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4578,6 +4854,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4601,6 +4879,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4624,6 +4904,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4647,6 +4929,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4670,6 +4954,8 @@ public class com.supported.UnsupportedClass this_class: #x // com/supported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ private final int mValue; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -4749,6 +5035,8 @@ public class com.unsupported.UnsupportedClass this_class: #x // com/unsupported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4823,7 +5111,9 @@ 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; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -4836,8 +5126,8 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4846,7 +5136,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4860,7 +5150,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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() @@ -4871,7 +5161,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4882,7 +5172,35 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 ad413425801b..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 @@ -67,6 +67,28 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 61 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -1861,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 @@ -1869,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(); @@ -1915,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" @@ -1928,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(); @@ -1986,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 @@ -2024,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: @@ -2031,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 @@ -2967,6 +3060,228 @@ SourceFile: "TinyFrameworkPackageRedirect.java" RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$NoAnnotations + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 3 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$NoAnnotations(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // NoAnnotations=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestWholeClassKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartialWithWholeClass_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted; + + public static int foo1(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_1 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad; + + public static int foo1(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_1 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlistedWithoutAnnot_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 3 +Constant pool: +{ + public com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted(); + descriptor: ()V + flags: (0x0001) ACC_PUBLIC + Code: + stack=1, locals=1, args_size=1 + x: aload_0 + x: invokespecial #x // Method java/lang/Object."<init>":()V + x: return + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 5 0 this Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted; +} +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +NestMembers: + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad + com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted +InnerClasses: + public static #x= #x of #x; // NoAnnotations=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$NoAnnotations of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartiallyAllowlistedWithoutAnnot_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartialWithWholeClass_bad=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -2975,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(); @@ -3006,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: @@ -3019,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; @@ -3055,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 eeec554e954c..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 @@ -7,6 +7,8 @@ public interface android.hosttest.annotation.HostSideTestClassLoadHook extends j this_class: #x // android/hosttest/annotation/HostSideTestClassLoadHook super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -35,6 +37,8 @@ public interface android.hosttest.annotation.HostSideTestKeep extends java.lang. this_class: #x // android/hosttest/annotation/HostSideTestKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestKeep.java" RuntimeVisibleAnnotations: @@ -48,6 +52,30 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 61 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -57,6 +85,8 @@ public interface android.hosttest.annotation.HostSideTestRedirect extends java.l this_class: #x // android/hosttest/annotation/HostSideTestRedirect super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRedirect.java" RuntimeVisibleAnnotations: @@ -79,6 +109,8 @@ public interface android.hosttest.annotation.HostSideTestRedirectionClass extend this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -107,6 +139,8 @@ public interface android.hosttest.annotation.HostSideTestRemove extends java.lan this_class: #x // android/hosttest/annotation/HostSideTestRemove super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRemove.java" RuntimeVisibleAnnotations: @@ -129,6 +163,8 @@ public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep e this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestStaticInitializerKeep.java" RuntimeVisibleAnnotations: @@ -151,6 +187,8 @@ public interface android.hosttest.annotation.HostSideTestSubstitute extends java this_class: #x // android/hosttest/annotation/HostSideTestSubstitute super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String suffix(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -179,6 +217,8 @@ public interface android.hosttest.annotation.HostSideTestThrow extends java.lang this_class: #x // android/hosttest/annotation/HostSideTestThrow super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestThrow.java" RuntimeVisibleAnnotations: @@ -201,6 +241,8 @@ public interface android.hosttest.annotation.HostSideTestWholeClassKeep extends this_class: #x // android/hosttest/annotation/HostSideTestWholeClassKeep super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestWholeClassKeep.java" RuntimeVisibleAnnotations: @@ -223,6 +265,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Pro this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Proxy(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -273,6 +317,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -323,6 +369,8 @@ public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 4 +Constant pool: +{ } InnerClasses: public static #x= #x of #x; // Stub=class com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub of class com/android/hoststubgen/test/tinyframework/IPretendingAidl @@ -343,6 +391,8 @@ public class com.android.hoststubgen.test.tinyframework.R$Nested this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public static int[] ARRAY; descriptor: [I flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -400,6 +450,8 @@ public class com.android.hoststubgen.test.tinyframework.R this_class: #x // com/android/hoststubgen/test/tinyframework/R super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.R(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -433,6 +485,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 7, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -591,6 +645,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHo this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ public static final java.util.Set<java.lang.Class<?>> sLoadedClasses; descriptor: Ljava/util/Set; flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL @@ -668,6 +724,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 4, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -768,6 +826,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 0, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -805,6 +865,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 1, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -867,6 +929,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumC this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex super_class: #x // java/lang/Enum interfaces: 0, fields: 6, methods: 7, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1112,6 +1176,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumS this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple super_class: #x // java/lang/Enum interfaces: 0, fields: 3, methods: 5, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1260,6 +1326,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTe this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTester(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -1323,6 +1391,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPoli this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 2 +Constant pool: +{ public int stub; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1562,6 +1632,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nes this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -1749,6 +1821,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -1928,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 @@ -1936,7 +2055,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -1989,9 +2110,30 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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() @@ -2005,7 +2147,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -2070,6 +2214,48 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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 @@ -2089,6 +2275,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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" @@ -2106,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 @@ -2115,6 +2303,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 14, attributes: 3 +Constant pool: +{ int value; descriptor: I flags: (0x0000) @@ -2373,6 +2563,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 7, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -2503,6 +2695,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1 super_class: #x // java/lang/Object interfaces: 1, fields: 1, methods: 3, attributes: 6 +Constant pool: +{ final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses; flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC @@ -2583,6 +2777,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2(); descriptor: ()V flags: (0x0000) @@ -2649,6 +2845,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3 super_class: #x // java/lang/Object interfaces: 1, fields: 1, methods: 3, attributes: 6 +Constant pool: +{ final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses; flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC @@ -2729,6 +2927,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4(); descriptor: ()V flags: (0x0000) @@ -2795,6 +2995,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -2838,6 +3040,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -2894,6 +3098,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$Stat this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 3, attributes: 6 +Constant pool: +{ com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$StaticNestedClass$1(); descriptor: ()V flags: (0x0000) @@ -2961,6 +3167,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 1, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3004,6 +3212,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3063,6 +3273,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$SubClass(int); descriptor: (I)V flags: (0x0001) ACC_PUBLIC @@ -3098,6 +3310,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 4, attributes: 5 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -3223,6 +3437,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedi this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedirect(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -3265,6 +3481,49 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 1, attributes: 5 +Constant pool: +{ + public static int foo2(int); + descriptor: (I)I + flags: (0x0009) ACC_PUBLIC, ACC_STATIC + Code: + stack=2, locals=1, args_size=1 + x: iload_0 + x: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 0 4 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -3273,7 +3532,9 @@ 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(); descriptor: ()V flags: (0x0001) ACC_PUBLIC @@ -3308,6 +3569,25 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas 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: @@ -3325,6 +3605,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "A.java" RuntimeVisibleAnnotations: @@ -3339,6 +3621,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "A.java" RuntimeVisibleAnnotations: @@ -3353,6 +3637,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C1.java" RuntimeVisibleAnnotations: @@ -3367,6 +3653,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C2.java" RuntimeVisibleAnnotations: @@ -3381,6 +3669,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "C3.java" RuntimeVisibleAnnotations: @@ -3395,6 +3685,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "CA.java" RuntimeVisibleAnnotations: @@ -3409,6 +3701,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "CB.java" RuntimeVisibleAnnotations: @@ -3423,6 +3717,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C1.java" RuntimeVisibleAnnotations: @@ -3437,6 +3733,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C2.java" RuntimeVisibleAnnotations: @@ -3451,6 +3749,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_C3.java" RuntimeVisibleAnnotations: @@ -3465,6 +3765,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I1.java" RuntimeVisibleAnnotations: @@ -3479,6 +3781,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA super_class: #x // java/lang/Object interfaces: 2, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I1_IA.java" RuntimeVisibleAnnotations: @@ -3493,6 +3797,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I2.java" RuntimeVisibleAnnotations: @@ -3507,6 +3813,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "Class_I3.java" RuntimeVisibleAnnotations: @@ -3521,6 +3829,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I1.java" RuntimeVisibleAnnotations: @@ -3535,6 +3845,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I2.java" RuntimeVisibleAnnotations: @@ -3549,6 +3861,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "I3.java" RuntimeVisibleAnnotations: @@ -3563,6 +3877,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "IA.java" RuntimeVisibleAnnotations: @@ -3577,6 +3893,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "IB.java" RuntimeVisibleAnnotations: @@ -3591,6 +3909,8 @@ public class com.supported.UnsupportedClass this_class: #x // com/supported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 3 +Constant pool: +{ private final int mValue; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -3650,6 +3970,8 @@ public class com.unsupported.UnsupportedClass this_class: #x // com/unsupported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 3 +Constant pool: +{ public com.unsupported.UnsupportedClass(int); descriptor: (I)V flags: (0x0001) ACC_PUBLIC @@ -3704,7 +4026,9 @@ 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; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -3726,7 +4050,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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() @@ -3743,7 +4067,30 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 0f8af92dc486..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 @@ -6,17 +6,9 @@ public interface android.hosttest.annotation.HostSideTestClassLoadHook extends j flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestClassLoadHook super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestClassLoadHook - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -44,16 +36,9 @@ public interface android.hosttest.annotation.HostSideTestKeep extends java.lang. flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestKeep.java" RuntimeVisibleAnnotations: @@ -67,6 +52,30 @@ RuntimeVisibleAnnotations: java.lang.annotation.Retention( value=Ljava/lang/annotation/RetentionPolicy;.CLASS ) +## Class: android/hosttest/annotation/HostSideTestPartiallyAllowlisted.class + Compiled from "HostSideTestPartiallyAllowlisted.java" +public interface android.hosttest.annotation.HostSideTestPartiallyAllowlisted extends java.lang.annotation.Annotation + minor version: 0 + major version: 61 + flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION + this_class: #x // android/hosttest/annotation/HostSideTestPartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ +} +SourceFile: "HostSideTestPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + x: #x(#x=[e#x.#x]) + java.lang.annotation.Target( + value=[Ljava/lang/annotation/ElementType;.TYPE] + ) + x: #x(#x=e#x.#x) + java.lang.annotation.Retention( + value=Ljava/lang/annotation/RetentionPolicy;.CLASS + ) ## Class: android/hosttest/annotation/HostSideTestRedirect.class Compiled from "HostSideTestRedirect.java" public interface android.hosttest.annotation.HostSideTestRedirect extends java.lang.annotation.Annotation @@ -75,16 +84,9 @@ public interface android.hosttest.annotation.HostSideTestRedirect extends java.l flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRedirect super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRedirect - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRedirect.java" RuntimeVisibleAnnotations: @@ -106,17 +108,9 @@ public interface android.hosttest.annotation.HostSideTestRedirectionClass extend flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRedirectionClass super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRedirectionClass - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String value(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -144,16 +138,9 @@ public interface android.hosttest.annotation.HostSideTestRemove extends java.lan flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestRemove super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestRemove - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestRemove.java" RuntimeVisibleAnnotations: @@ -175,16 +162,9 @@ public interface android.hosttest.annotation.HostSideTestStaticInitializerKeep e flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestStaticInitializerKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestStaticInitializerKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestStaticInitializerKeep.java" RuntimeVisibleAnnotations: @@ -206,17 +186,9 @@ public interface android.hosttest.annotation.HostSideTestSubstitute extends java flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestSubstitute super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 2, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestSubstitute - 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 - + interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ public abstract java.lang.String suffix(); descriptor: ()Ljava/lang/String; flags: (0x0401) ACC_PUBLIC, ACC_ABSTRACT @@ -244,16 +216,9 @@ public interface android.hosttest.annotation.HostSideTestThrow extends java.lang flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestThrow super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestThrow - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestThrow.java" RuntimeVisibleAnnotations: @@ -275,16 +240,9 @@ public interface android.hosttest.annotation.HostSideTestWholeClassKeep extends flags: (0x2601) ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT, ACC_ANNOTATION this_class: #x // android/hosttest/annotation/HostSideTestWholeClassKeep super_class: #x // java/lang/Object - interfaces: 1, fields: 0, methods: 1, attributes: 2 - private static {}; - descriptor: ()V - flags: (0x000a) ACC_PRIVATE, ACC_STATIC - Code: - stack=2, locals=0, args_size=0 - x: ldc #x // class android/hosttest/annotation/HostSideTestWholeClassKeep - 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 + interfaces: 1, fields: 0, methods: 0, attributes: 2 +Constant pool: +{ } SourceFile: "HostSideTestWholeClassKeep.java" RuntimeVisibleAnnotations: @@ -307,6 +265,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub$Pro this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub$Proxy super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -377,6 +337,8 @@ public class com.android.hoststubgen.test.tinyframework.IPretendingAidl$Stub this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl$Stub super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -447,6 +409,8 @@ public interface com.android.hoststubgen.test.tinyframework.IPretendingAidl this_class: #x // com/android/hoststubgen/test/tinyframework/IPretendingAidl super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -476,6 +440,8 @@ public class com.android.hoststubgen.test.tinyframework.R$Nested this_class: #x // com/android/hoststubgen/test/tinyframework/R$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public static int[] ARRAY; descriptor: [I flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -546,6 +512,8 @@ public class com.android.hoststubgen.test.tinyframework.R this_class: #x // com/android/hoststubgen/test/tinyframework/R super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -594,6 +562,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkAnnotations this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 7, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -785,6 +755,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassLoadHo this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassLoadHook super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ public static final java.util.Set<java.lang.Class<?>> sLoadedClasses; descriptor: Ljava/util/Set; flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL @@ -880,6 +852,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWideAn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWideAnnotations super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 5, attributes: 3 +Constant pool: +{ public int keep; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1010,6 +984,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerDefault super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 0, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -1047,6 +1023,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkClassWithIn this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkClassWithInitializerStub super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 1, attributes: 3 +Constant pool: +{ public static boolean sInitialized; descriptor: Z flags: (0x0009) ACC_PUBLIC, ACC_STATIC @@ -1117,6 +1095,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumC this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex super_class: #x // java/lang/Enum interfaces: 0, fields: 6, methods: 7, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumComplex RED; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumComplex; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1400,6 +1380,8 @@ public final class com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumS this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple super_class: #x // java/lang/Enum interfaces: 0, fields: 3, methods: 5, attributes: 4 +Constant pool: +{ public static final com.android.hoststubgen.test.tinyframework.TinyFrameworkEnumSimple CAT; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkEnumSimple; flags: (0x4019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM @@ -1576,6 +1558,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkExceptionTe this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkExceptionTester super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -1659,6 +1643,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkForTextPoli this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkForTextPolicy super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 2 +Constant pool: +{ public int stub; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -1971,6 +1957,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas$Nes this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas$Nested super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -2201,6 +2189,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkLambdas this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkLambdas super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 8, attributes: 6 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -2423,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 @@ -2431,7 +2481,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2509,8 +2561,34 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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: @@ -2525,7 +2603,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -2615,18 +2695,70 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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 @@ -2639,6 +2771,7 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkMethodCallR 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" @@ -2656,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 @@ -2665,6 +2799,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 15, attributes: 3 +Constant pool: +{ int value; descriptor: I flags: (0x0000) @@ -2998,6 +3134,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNative_host this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNative_host super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 8, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3173,6 +3311,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$1 super_class: #x // java/lang/Object interfaces: 1, fields: 1, methods: 4, attributes: 6 +Constant pool: +{ final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses; flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC @@ -3278,6 +3418,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3369,6 +3511,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$3 super_class: #x // java/lang/Object interfaces: 1, fields: 1, methods: 4, attributes: 6 +Constant pool: +{ final com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses this$0; descriptor: Lcom/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses; flags: (0x1010) ACC_FINAL, ACC_SYNTHETIC @@ -3474,6 +3618,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$4 ex this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$4 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3565,6 +3711,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3623,6 +3771,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$InnerClass super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3694,6 +3844,8 @@ class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClasses$Stat this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 4, attributes: 6 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3786,6 +3938,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass$Double$NestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 2, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3844,6 +3998,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$StaticNestedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 4 +Constant pool: +{ public int value; descriptor: I flags: (0x0001) ACC_PUBLIC @@ -3923,6 +4079,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$SubClass super_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses$BaseClass interfaces: 0, fields: 0, methods: 2, attributes: 4 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -3973,6 +4131,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkNestedClass this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkNestedClasses super_class: #x // java/lang/Object interfaces: 0, fields: 2, methods: 4, attributes: 5 +Constant pool: +{ public final java.util.function.Supplier<java.lang.Integer> mSupplier; descriptor: Ljava/util/function/Supplier; flags: (0x0011) ACC_PUBLIC, ACC_FINAL @@ -4121,6 +4281,8 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPackageRedi this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPackageRedirect super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4183,6 +4345,64 @@ RuntimeVisibleAnnotations: RuntimeInvisibleAnnotations: x: #x() android.hosttest.annotation.HostSideTestWholeClassKeep +## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted.class + Compiled from "TinyFrameworkPartiallyAllowlisted.java" +public class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + minor version: 0 + major version: 61 + flags: (0x0021) ACC_PUBLIC, ACC_SUPER + this_class: #x // com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + super_class: #x // java/lang/Object + interfaces: 0, fields: 0, methods: 2, attributes: 5 +Constant pool: +{ + 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/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + 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 static int foo2(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/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted + x: ldc #x // String foo2 + 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: iconst_2 + x: iadd + x: ireturn + LineNumberTable: + LocalVariableTable: + Start Length Slot Name Signature + 11 4 0 value I + RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep + RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestKeep +} +InnerClasses: + public static #x= #x of #x; // PartiallyAllowlisted=class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted of class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted +SourceFile: "TinyFrameworkPartiallyAllowlisted.java" +RuntimeVisibleAnnotations: + x: #x() + com.android.hoststubgen.hosthelper.HostStubGenProcessedAsKeep +RuntimeInvisibleAnnotations: + x: #x() + android.hosttest.annotation.HostSideTestPartiallyAllowlisted + x: #x() + android.hosttest.annotation.HostSideTestKeep +NestHost: class com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted ## Class: com/android/hoststubgen/test/tinyframework/TinyFrameworkRenamedClassCaller.class Compiled from "TinyFrameworkRenamedClassCaller.java" public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClassCaller @@ -4191,7 +4411,9 @@ 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 {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4246,6 +4468,30 @@ public class com.android.hoststubgen.test.tinyframework.TinyFrameworkRenamedClas 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: @@ -4263,6 +4509,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4286,6 +4534,8 @@ public class com.android.hoststubgen.test.tinyframework.packagetest.sub.A this_class: #x // com/android/hoststubgen/test/tinyframework/packagetest/sub/A super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4309,6 +4559,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4332,6 +4584,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C2 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4355,6 +4609,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.C3 extends this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4378,6 +4634,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4401,6 +4659,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.CB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/CB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4424,6 +4684,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C1 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C1 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C1 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4447,6 +4709,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C2 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C2 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C2 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4470,6 +4734,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_C3 ex this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_C3 super_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/C3 interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4493,6 +4759,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4516,6 +4784,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I1_IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I1_IA super_class: #x // java/lang/Object interfaces: 2, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4539,6 +4809,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I2 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4562,6 +4834,8 @@ public class com.android.hoststubgen.test.tinyframework.subclasstest.Class_I3 im this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/Class_I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4585,6 +4859,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I1 this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I1 super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4608,6 +4884,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I2 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I2 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4631,6 +4909,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.I3 exte this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/I3 super_class: #x // java/lang/Object interfaces: 1, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4654,6 +4934,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IA this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IA super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4677,6 +4959,8 @@ public interface com.android.hoststubgen.test.tinyframework.subclasstest.IB this_class: #x // com/android/hoststubgen/test/tinyframework/subclasstest/IB super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 1, attributes: 2 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4700,6 +4984,8 @@ public class com.supported.UnsupportedClass this_class: #x // com/supported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 1, methods: 3, attributes: 3 +Constant pool: +{ private final int mValue; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -4779,6 +5065,8 @@ public class com.unsupported.UnsupportedClass this_class: #x // com/unsupported/UnsupportedClass super_class: #x // java/lang/Object interfaces: 0, fields: 0, methods: 3, attributes: 3 +Constant pool: +{ private static {}; descriptor: ()V flags: (0x000a) ACC_PRIVATE, ACC_STATIC @@ -4853,7 +5141,9 @@ 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; descriptor: I flags: (0x0012) ACC_PRIVATE, ACC_FINAL @@ -4866,8 +5156,8 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4876,7 +5166,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4890,7 +5180,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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() @@ -4901,7 +5191,7 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 @@ -4912,7 +5202,35 @@ public class rename_prefix.com.android.hoststubgen.test.tinyframework.TinyFramew 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 2f35d35d608d..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,8 +68,18 @@ 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 # sure the stripping works. rename ^.*/TinyFrameworkToBeRenamed$ /rename_prefix/ + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlisted allow-annotation + method foo2 allow-annotation + +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartialWithWholeClass_bad remove +class com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted$PartiallyAllowlistedWithoutAnnot_bad remove
\ No newline at end of file diff --git a/ravenwood/tools/hoststubgen/test-tiny-framework/run-test-manually.sh b/ravenwood/tools/hoststubgen/test-tiny-framework/run-test-manually.sh index 80ebf3adab3d..450da237d65d 100755 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/run-test-manually.sh +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/run-test-manually.sh @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. - -source "${0%/*}"/../../common.sh +set -e +source "${0%/*}"/../common.sh # This scripts run the "tiny-framework" test, but does most stuff from the command line, using # the native java and javac commands. @@ -49,7 +49,7 @@ tiny_test_classes=$out/tiny-test/classes/ tiny_test_jar=$out/tiny-test.jar framework_compile_classpaths=( - $SOONG_INT/frameworks/base/tools/hoststubgen/hoststubgen/hoststubgen-annotations/android_common/javac/hoststubgen-annotations.jar + $SOONG_INT/frameworks/base/ravenwood/tools/hoststubgen/hoststubgen-annotations/android_common/javac/hoststubgen-annotations.jar ) test_compile_classpaths=( @@ -58,7 +58,7 @@ test_compile_classpaths=( ) test_runtime_classpaths=( - $SOONG_INT/frameworks/base/tools/hoststubgen/hoststubgen/hoststubgen-helper-runtime/linux_glibc_common/javac/hoststubgen-helper-runtime.jar + $SOONG_INT/frameworks/base/ravenwood/tools/hoststubgen/hoststubgen-helper-runtime/linux_glibc_common/javac/hoststubgen-helper-runtime.jar ) # This suite runs all tests in the JAR. @@ -73,7 +73,7 @@ echo "# Building tiny-framework..." run $JAVAC \ -cp $( \ join : \ - ${framework_compile_classpaths[@]} \ + "${framework_compile_classpaths[@]}" \ ) \ -d $tiny_framework_classes \ tiny-framework/src/**/*.java @@ -83,7 +83,9 @@ run $JAR cvf $tiny_framework_jar \ # Build stub/impl jars echo "# Generating the stub and impl jars..." +# Run with HOSTSTUBGEN_OPTS="-Jagentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8700" to enable the debugger run $HOSTSTUBGEN \ + $HOSTSTUBGEN_OPTS \ @../hoststubgen-standard-options.txt \ --in-jar $tiny_framework_jar \ --out-jar $tiny_framework_host_jar \ @@ -91,8 +93,7 @@ run $HOSTSTUBGEN \ --gen-keep-all-file out/tiny-framework_keep_all.txt \ --gen-input-dump-file out/tiny-framework_dump.txt \ --package-redirect com.unsupported:com.supported \ - --annotation-allowed-classes-file annotation-allowed-classes-tiny-framework.txt \ - $HOSTSTUBGEN_OPTS + --annotation-allowed-classes-file annotation-allowed-classes-tiny-framework.txt # Extract the jar files, so we can look into them. extract $tiny_framework_host_jar @@ -127,4 +128,4 @@ run $JAVA \ "${test_runtime_classpaths[@]}" \ ) \ org.junit.runner.JUnitCore \ - ${test_classes[@]} + "${test_classes[@]}" 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/TinyFrameworkPartiallyAllowlisted.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted.java new file mode 100644 index 000000000000..dfc9de4915bc --- /dev/null +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-framework/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkPartiallyAllowlisted.java @@ -0,0 +1,67 @@ +/* + * 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.hoststubgen.test.tinyframework; + +import android.hosttest.annotation.HostSideTestKeep; +import android.hosttest.annotation.HostSideTestPartiallyAllowlisted; +import android.hosttest.annotation.HostSideTestWholeClassKeep; + +/** + * Contains subclasses for tests for "partially-allowlisted". + */ +public class TinyFrameworkPartiallyAllowlisted { + /** */ + @HostSideTestPartiallyAllowlisted + @HostSideTestKeep + public static class PartiallyAllowlisted { + /** */ + public static int foo1(int value) { + return value + 1; + } + + /** */ + @HostSideTestKeep + public static int foo2(int value) { + return value + 2; + } + } + + /** */ + @HostSideTestPartiallyAllowlisted + @HostSideTestWholeClassKeep // This should be disallowed. + public static class PartialWithWholeClass_bad { + } + + /** */ + // Missing @HostSideTestPartiallyAllowlisted + @HostSideTestKeep + public static class PartiallyAllowlistedWithoutAnnot_bad { + /** */ + public static int foo1(int value) { + return value + 1; + } + + /** */ + @HostSideTestKeep + public static int foo2(int value) { + return value + 2; + } + } + + /** */ + public static class NoAnnotations { + } +} 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/TinyFrameworkAnnotationsTest.java b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java index 1ae049371229..93387f5928a1 100644 --- a/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java +++ b/ravenwood/tools/hoststubgen/test-tiny-framework/tiny-test/src/com/android/hoststubgen/test/tinyframework/TinyFrameworkAnnotationsTest.java @@ -19,6 +19,8 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertThrows; +import com.android.hoststubgen.test.tinyframework.TinyFrameworkPartiallyAllowlisted.PartiallyAllowlisted; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -61,4 +63,19 @@ public class TinyFrameworkAnnotationsTest { thrown.expectMessage("not yet supported"); tfc.unsupportedMethod(); } + + @Test + public void testPartiallyAllowed() { + assertThat(PartiallyAllowlisted.foo2(1)).isEqualTo(3); + assertThrows(NoSuchMethodError.class, () -> PartiallyAllowlisted.foo1(1)); + + // Just make sure the following classes don't exist. + assertThrows(ClassNotFoundException.class, + () -> Class.forName("com.android.hoststubgen.test.tinyframework" + + ".TinyFrameworkPartiallyAllowlisted.PartialWithWholeClass_bad")); + assertThrows(ClassNotFoundException.class, + () -> Class.forName("com.android.hoststubgen.test.tinyframework" + + ".TinyFrameworkPartiallyAllowlisted.PartiallyAllowlistedWithoutAnnot_bad" + )); + } } 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/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt b/ravenwood/tools/hoststubgen/test/com/android/hoststubgen/utils/ClassPredicateTest.kt index d4e75d43a54a..3e6615ec7667 100644 --- a/ravenwood/tools/hoststubgen/test/com/android/hoststubgen/utils/ClassFilterTest.kt +++ b/ravenwood/tools/hoststubgen/test/com/android/hoststubgen/utils/ClassPredicateTest.kt @@ -20,22 +20,22 @@ import com.google.common.truth.Truth.assertThat import org.junit.Assert.fail import org.junit.Test -class ClassFilterTest { +class ClassPredicateTest { @Test fun testDefaultTrue() { - val f = ClassFilter.newNullFilter(true) + val f = ClassPredicate.newConstantPredicate(true) assertThat(f.matches("a/b/c")).isEqualTo(true) } @Test fun testDefaultFalse() { - val f = ClassFilter.newNullFilter(false) + val f = ClassPredicate.newConstantPredicate(false) assertThat(f.matches("a/b/c")).isEqualTo(false) } @Test fun testComplex1() { - val f = ClassFilter.buildFromString(""" + val f = ClassPredicate.buildFromString(""" # ** this is a comment ** a.b.c # allow !a.b.d # disallow @@ -57,7 +57,7 @@ class ClassFilterTest { @Test fun testComplex2() { - val f = ClassFilter.buildFromString(""" + val f = ClassPredicate.buildFromString(""" a.b.c # allow !a.* # disallow everything else in package "a". !d.e.f # disallow d.e.f. @@ -75,7 +75,7 @@ class ClassFilterTest { @Test fun testNestedClass() { - val f = ClassFilter.buildFromString("a.b.c\nm.n.o\$p\n", false, "X") + val f = ClassPredicate.buildFromString("a.b.c\nm.n.o\$p\n", false, "X") assertThat(f.matches("a/b/c")).isEqualTo(true) assertThat(f.matches("a/b/c\$d")).isEqualTo(true) assertThat(f.matches("a/b/c\$d\$e")).isEqualTo(true) @@ -88,7 +88,7 @@ class ClassFilterTest { @Test fun testBadFilter1() { try { - ClassFilter.buildFromString(""" + ClassPredicate.buildFromString(""" a* """.trimIndent(), true, "FILENAME") fail("ParseException didn't happen") @@ -101,7 +101,7 @@ class ClassFilterTest { @Test fun testSuffix() { - val f = ClassFilter.buildFromString(""" + val f = ClassPredicate.buildFromString(""" *.Abc # allow !* # Disallow by default """.trimIndent(), true, "X") @@ -112,4 +112,4 @@ class ClassFilterTest { assertThat(f.matches("a/XyzAbc")).isEqualTo(false) } -}
\ No newline at end of file +} diff --git a/ravenwood/tools/ravenhelper/Android.bp b/ravenwood/tools/ravenhelper/Android.bp index a7ee4684506e..3da6dd824c37 100644 --- a/ravenwood/tools/ravenhelper/Android.bp +++ b/ravenwood/tools/ravenhelper/Android.bp @@ -24,3 +24,14 @@ java_binary_host { ], visibility: ["//visibility:public"], } + +java_test_host { + name: "ravenhelpertest", + srcs: ["test/**/*.kt"], + static_libs: [ + "ravenhelper", + "truth", + ], + test_suites: ["general-tests"], + visibility: ["//visibility:private"], +} diff --git a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt index ef1cb5dfca89..33fb015cc131 100644 --- a/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt +++ b/ravenwood/tools/ravenhelper/src/com/android/platform/test/ravenwood/ravenhelper/policytoannot/Annotations.kt @@ -49,6 +49,7 @@ class Annotations { "@android.ravenwood.annotation.RavenwoodIgnore" FilterPolicy.Remove -> "@android.ravenwood.annotation.RavenwoodRemove" + FilterPolicy.AnnotationAllowed -> null // Can't convert to an annotation. } } 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 3657a9077577..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 @@ -24,7 +24,7 @@ import com.android.hoststubgen.filters.SpecialClass import com.android.hoststubgen.filters.TextFileFilterPolicyParser import com.android.hoststubgen.filters.TextFilePolicyMethodReplaceFilter import com.android.hoststubgen.log -import com.android.hoststubgen.utils.ClassFilter +import com.android.hoststubgen.utils.ClassPredicate import com.android.platform.test.ravenwood.ravenhelper.SubcommandHandler import com.android.platform.test.ravenwood.ravenhelper.psi.createUastEnvironment import com.android.platform.test.ravenwood.ravenhelper.sourcemap.AllClassInfo @@ -66,11 +66,11 @@ private class TextPolicyToAnnotationConverter( val annotations: Annotations, val dumpOperations: Boolean, ) { - private val annotationAllowedClasses: ClassFilter = annotationAllowedClassesFile.let { file -> + private val annotationAllowedClasses: ClassPredicate = annotationAllowedClassesFile.let { file -> if (file == null) { - ClassFilter.newNullFilter(true) // Allow all classes + ClassPredicate.newConstantPredicate(true) // Allow all classes } else { - ClassFilter.loadFromFile(file, false) + ClassPredicate.loadFromFile(file, false) } } @@ -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/ravenwood/tools/ravenhelper/test/com/android/platform/test/ravenwood/ravenhelper/RavenhelperTest.kt b/ravenwood/tools/ravenhelper/test/com/android/platform/test/ravenwood/ravenhelper/RavenhelperTest.kt new file mode 100644 index 000000000000..203fab1544c9 --- /dev/null +++ b/ravenwood/tools/ravenhelper/test/com/android/platform/test/ravenwood/ravenhelper/RavenhelperTest.kt @@ -0,0 +1,27 @@ +/* + * 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.platform.test.ravenwood.ravenhelper + +import com.android.platform.test.ravenwood.ravenhelper.psi.createUastEnvironment +import org.junit.Test + +class RavenhelperTest { + @Test + fun testPsiInitialization() { + val env = createUastEnvironment() + env.dispose() + } +}
\ No newline at end of file diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java index 0ed239e442e7..200946fbedac 100644 --- a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java +++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java @@ -901,6 +901,9 @@ public class TouchExplorer extends BaseEventStreamTransformation mSendHoverEnterAndMoveDelayed.cancel(); mSendHoverExitDelayed.cancel(); } + if (pointerIndex < 0) { + return; + } // If the user is touch exploring the second pointer may be // performing a double tap to activate an item without need // for the user to lift their exploring finger. 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/adb/AdbDebuggingManager.java b/services/core/java/com/android/server/adb/AdbDebuggingManager.java index 8901c2d383b7..658ea4c27e4c 100644 --- a/services/core/java/com/android/server/adb/AdbDebuggingManager.java +++ b/services/core/java/com/android/server/adb/AdbDebuggingManager.java @@ -130,8 +130,6 @@ import java.util.concurrent.atomic.AtomicBoolean; */ public class AdbDebuggingManager { private static final String TAG = AdbDebuggingManager.class.getSimpleName(); - private static final boolean DEBUG = false; - private static final boolean MDNS_DEBUG = false; private static final String ADBD_SOCKET = "adbd"; private static final String ADB_DIRECTORY = "misc/adb"; @@ -259,12 +257,10 @@ public class AdbDebuggingManager { mHandler.sendMessage(msg); boolean paired = native_pairing_wait(); - if (DEBUG) { - if (mPublicKey != null) { - Slog.i(TAG, "Pairing succeeded key=" + mPublicKey); - } else { - Slog.i(TAG, "Pairing failed"); - } + if (mPublicKey != null) { + Slog.i(TAG, "Pairing succeeded key=" + mPublicKey); + } else { + Slog.i(TAG, "Pairing failed"); } mNsdManager.unregisterService(this); @@ -305,7 +301,7 @@ public class AdbDebuggingManager { @Override public void onServiceRegistered(NsdServiceInfo serviceInfo) { - if (MDNS_DEBUG) Slog.i(TAG, "Registered pairing service: " + serviceInfo); + Slog.i(TAG, "Registered pairing service: " + serviceInfo); } @Override @@ -317,7 +313,7 @@ public class AdbDebuggingManager { @Override public void onServiceUnregistered(NsdServiceInfo serviceInfo) { - if (MDNS_DEBUG) Slog.i(TAG, "Unregistered pairing service: " + serviceInfo); + Slog.i(TAG, "Unregistered pairing service: " + serviceInfo); } @Override @@ -352,7 +348,7 @@ public class AdbDebuggingManager { @Override public void run() { - if (DEBUG) Slog.d(TAG, "Starting adb port property poller"); + Slog.d(TAG, "Starting adb port property poller"); // Once adbwifi is enabled, we poll the service.adb.tls.port // system property until we get the port, or -1 on failure. // Let's also limit the polling to 10 seconds, just in case @@ -388,7 +384,7 @@ public class AdbDebuggingManager { class PortListenerImpl implements AdbConnectionPortListener { public void onPortReceived(int port) { - if (DEBUG) Slog.d(TAG, "Received tls port=" + port); + Slog.d(TAG, "Received tls port=" + port); Message msg = mHandler.obtainMessage(port > 0 ? AdbDebuggingHandler.MSG_SERVER_CONNECTED : AdbDebuggingHandler.MSG_SERVER_DISCONNECTED); @@ -417,11 +413,11 @@ public class AdbDebuggingManager { @Override public void run() { - if (DEBUG) Slog.d(TAG, "Entering thread"); + Slog.d(TAG, "Entering thread"); while (true) { synchronized (this) { if (mStopped) { - if (DEBUG) Slog.d(TAG, "Exiting thread"); + Slog.d(TAG, "Exiting thread"); return; } try { @@ -446,7 +442,7 @@ public class AdbDebuggingManager { LocalSocketAddress.Namespace.RESERVED); mInputStream = null; - if (DEBUG) Slog.d(TAG, "Creating socket"); + Slog.d(TAG, "Creating socket"); mSocket = new LocalSocket(LocalSocket.SOCKET_SEQPACKET); mSocket.connect(address); @@ -547,7 +543,7 @@ public class AdbDebuggingManager { } private void closeSocketLocked() { - if (DEBUG) Slog.d(TAG, "Closing socket"); + Slog.d(TAG, "Closing socket"); try { if (mOutputStream != null) { mOutputStream.close(); @@ -857,7 +853,7 @@ public class AdbDebuggingManager { private void startAdbDebuggingThread() { ++mAdbEnabledRefCount; - if (DEBUG) Slog.i(TAG, "startAdbDebuggingThread ref=" + mAdbEnabledRefCount); + Slog.i(TAG, "startAdbDebuggingThread ref=" + mAdbEnabledRefCount); if (mAdbEnabledRefCount > 1) { return; } @@ -873,7 +869,7 @@ public class AdbDebuggingManager { private void stopAdbDebuggingThread() { --mAdbEnabledRefCount; - if (DEBUG) Slog.i(TAG, "stopAdbDebuggingThread ref=" + mAdbEnabledRefCount); + Slog.i(TAG, "stopAdbDebuggingThread ref=" + mAdbEnabledRefCount); if (mAdbEnabledRefCount > 0) { return; } @@ -1099,7 +1095,7 @@ public class AdbDebuggingManager { startAdbDebuggingThread(); mAdbWifiEnabled = true; - if (DEBUG) Slog.i(TAG, "adb start wireless adb"); + Slog.i(TAG, "adb start wireless adb"); break; } case MSG_ADBDWIFI_DISABLE: @@ -1149,7 +1145,7 @@ public class AdbDebuggingManager { startAdbDebuggingThread(); mAdbWifiEnabled = true; - if (DEBUG) Slog.i(TAG, "adb start wireless adb"); + Slog.i(TAG, "adb start wireless adb"); break; case MSG_ADBWIFI_DENY: Settings.Global.putInt(mContentResolver, @@ -1257,7 +1253,7 @@ public class AdbDebuggingManager { break; } case MSG_ADBD_SOCKET_CONNECTED: { - if (DEBUG) Slog.d(TAG, "adbd socket connected"); + Slog.d(TAG, "adbd socket connected"); if (mAdbWifiEnabled) { // In scenarios where adbd is restarted, the tls port may change. mConnectionPortPoller = @@ -1267,7 +1263,7 @@ public class AdbDebuggingManager { break; } case MSG_ADBD_SOCKET_DISCONNECTED: { - if (DEBUG) Slog.d(TAG, "adbd socket disconnected"); + Slog.d(TAG, "adbd socket disconnected"); if (mConnectionPortPoller != null) { mConnectionPortPoller.cancelAndWait(); mConnectionPortPoller = null; @@ -1475,7 +1471,7 @@ public class AdbDebuggingManager { } private void updateUIPairCode(String code) { - if (DEBUG) Slog.i(TAG, "updateUIPairCode: " + code); + Slog.i(TAG, "updateUIPairCode: " + code); Intent intent = new Intent(AdbManager.WIRELESS_DEBUG_PAIRING_RESULT_ACTION); intent.putExtra(AdbManager.WIRELESS_PAIRING_CODE_EXTRA, code); diff --git a/services/core/java/com/android/server/adb/AdbService.java b/services/core/java/com/android/server/adb/AdbService.java index d4a2912263be..aae48daa5dde 100644 --- a/services/core/java/com/android/server/adb/AdbService.java +++ b/services/core/java/com/android/server/adb/AdbService.java @@ -222,8 +222,7 @@ public class AdbService extends IAdbManager.Stub { } } - private static final String TAG = "AdbService"; - private static final boolean DEBUG = false; + private static final String TAG = AdbService.class.getSimpleName(); /** * The persistent property which stores whether adb is enabled or not. @@ -256,7 +255,7 @@ public class AdbService extends IAdbManager.Stub { * SystemServer}. */ public void systemReady() { - if (DEBUG) Slog.d(TAG, "systemReady"); + Slog.d(TAG, "systemReady"); /* * Use the normal bootmode persistent prop to maintain state of adb across @@ -287,7 +286,7 @@ public class AdbService extends IAdbManager.Stub { * Called in response to {@code SystemService.PHASE_BOOT_COMPLETED} from {@code SystemServer}. */ public void bootCompleted() { - if (DEBUG) Slog.d(TAG, "boot completed"); + Slog.d(TAG, "boot completed"); if (mDebuggingManager != null) { mDebuggingManager.setAdbEnabled(mIsAdbUsbEnabled, AdbTransportType.USB); mDebuggingManager.setAdbEnabled(mIsAdbWifiEnabled, AdbTransportType.WIFI); @@ -429,17 +428,13 @@ public class AdbService extends IAdbManager.Stub { @Override public void registerCallback(IAdbCallback callback) throws RemoteException { - if (DEBUG) { - Slog.d(TAG, "Registering callback " + callback); - } + Slog.d(TAG, "Registering callback " + callback); mCallbacks.register(callback); } @Override public void unregisterCallback(IAdbCallback callback) throws RemoteException { - if (DEBUG) { - Slog.d(TAG, "Unregistering callback " + callback); - } + Slog.d(TAG, "Unregistering callback " + callback); mCallbacks.unregister(callback); } /** @@ -500,11 +495,8 @@ public class AdbService extends IAdbManager.Stub { } private void setAdbEnabled(boolean enable, byte transportType) { - if (DEBUG) { - Slog.d(TAG, "setAdbEnabled(" + enable + "), mIsAdbUsbEnabled=" + mIsAdbUsbEnabled - + ", mIsAdbWifiEnabled=" + mIsAdbWifiEnabled + ", transportType=" - + transportType); - } + Slog.d(TAG, "setAdbEnabled(" + enable + "), mIsAdbUsbEnabled=" + mIsAdbUsbEnabled + + ", mIsAdbWifiEnabled=" + mIsAdbWifiEnabled + ", transportType=" + transportType); if (transportType == AdbTransportType.USB && enable != mIsAdbUsbEnabled) { mIsAdbUsbEnabled = enable; @@ -549,20 +541,14 @@ public class AdbService extends IAdbManager.Stub { mDebuggingManager.setAdbEnabled(enable, transportType); } - if (DEBUG) { - Slog.d(TAG, "Broadcasting enable = " + enable + ", type = " + transportType); - } + Slog.d(TAG, "Broadcasting enable = " + enable + ", type = " + transportType); mCallbacks.broadcast((callback) -> { - if (DEBUG) { - Slog.d(TAG, "Sending enable = " + enable + ", type = " + transportType - + " to " + callback); - } + Slog.d(TAG, "Sending enable = " + enable + ", type = " + transportType + " to " + + callback); try { callback.onDebuggingChanged(enable, transportType); } catch (RemoteException ex) { - if (DEBUG) { - Slog.d(TAG, "Unable to send onDebuggingChanged:", ex); - } + Slog.w(TAG, "Unable to send onDebuggingChanged:", ex); } }); } diff --git a/services/core/java/com/android/server/am/OWNERS b/services/core/java/com/android/server/am/OWNERS index ebe1fe8dc7a4..534247ec082a 100644 --- a/services/core/java/com/android/server/am/OWNERS +++ b/services/core/java/com/android/server/am/OWNERS @@ -66,7 +66,7 @@ per-file CarUserSwitchingDialog.java = file:platform/packages/services/Car:/OWNE per-file ActivityManager* = file:/ACTIVITY_SECURITY_OWNERS # Aconfig Flags -per-file flags.aconfig = yamasani@google.com, bills@google.com, nalini@google.com +per-file flags.aconfig = yamasani@google.com, nalini@google.com # Londoners michaelwr@google.com #{LAST_RESORT_SUGGESTION} @@ -75,4 +75,4 @@ narayan@google.com #{LAST_RESORT_SUGGESTION} # Default yamasani@google.com hackbod@google.com #{LAST_RESORT_SUGGESTION} -omakoto@google.com #{LAST_RESORT_SUGGESTION}
\ No newline at end of file +omakoto@google.com #{LAST_RESORT_SUGGESTION} diff --git a/services/core/java/com/android/server/appop/AppOpsUidStateTrackerImpl.java b/services/core/java/com/android/server/appop/AppOpsUidStateTrackerImpl.java index 03c81560be89..c411cbba3356 100644 --- a/services/core/java/com/android/server/appop/AppOpsUidStateTrackerImpl.java +++ b/services/core/java/com/android/server/appop/AppOpsUidStateTrackerImpl.java @@ -334,17 +334,15 @@ class AppOpsUidStateTrackerImpl implements AppOpsUidStateTracker { } private void commitUidPendingState(int uid) { - int pendingUidState = mPendingUidStates.get(uid, - mUidStates.get(uid, MIN_PRIORITY_UID_STATE)); - int pendingCapability = mPendingCapability.get(uid, - mCapability.get(uid, PROCESS_CAPABILITY_NONE)); - boolean pendingAppWidgetVisible = mPendingAppWidgetVisible.get(uid, - mAppWidgetVisible.get(uid, false)); int uidState = mUidStates.get(uid, MIN_PRIORITY_UID_STATE); int capability = mCapability.get(uid, PROCESS_CAPABILITY_NONE); boolean appWidgetVisible = mAppWidgetVisible.get(uid, false); + int pendingUidState = mPendingUidStates.get(uid, uidState); + int pendingCapability = mPendingCapability.get(uid, capability); + boolean pendingAppWidgetVisible = mPendingAppWidgetVisible.get(uid, appWidgetVisible); + boolean foregroundChange = uidState <= UID_STATE_MAX_LAST_NON_RESTRICTED != pendingUidState <= UID_STATE_MAX_LAST_NON_RESTRICTED || capability != pendingCapability diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 8d0118173030..e5152dc43e65 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -7489,7 +7489,8 @@ public class AudioService extends IAudioService.Stub return AudioSystem.STREAM_RING; } default: - if (isInCommunication()) { + if (isInCommunication() + || mAudioSystem.isStreamActive(AudioManager.STREAM_VOICE_CALL, 0)) { if (!replaceStreamBtSco() && mBtCommDeviceActive.get() == BT_COMM_DEVICE_ACTIVE_SCO) { if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: Forcing STREAM_BLUETOOTH_SCO"); diff --git a/services/core/java/com/android/server/clipboard/OWNERS b/services/core/java/com/android/server/clipboard/OWNERS index 0d5dbf9acac3..4ca4b80ab2f0 100644 --- a/services/core/java/com/android/server/clipboard/OWNERS +++ b/services/core/java/com/android/server/clipboard/OWNERS @@ -1,3 +1,3 @@ -per-file EmulatorClipboardMonitor.java = bohu@google.com,lfy@google.com,rkir@google.com +per-file EmulatorClipboardMonitor.java = bohu@google.com,rkir@google.com olilan@google.com diff --git a/services/core/java/com/android/server/compat/overrides/AppCompatOverridesService.java b/services/core/java/com/android/server/compat/overrides/AppCompatOverridesService.java index 8637d2dfe565..47b1c5449dc2 100644 --- a/services/core/java/com/android/server/compat/overrides/AppCompatOverridesService.java +++ b/services/core/java/com/android/server/compat/overrides/AppCompatOverridesService.java @@ -103,12 +103,6 @@ public final class AppCompatOverridesService { } } - @Override - public void finalize() { - unregisterDeviceConfigListeners(); - unregisterPackageReceiver(); - } - @VisibleForTesting void registerDeviceConfigListeners() { for (DeviceConfigListener listener : mDeviceConfigListeners) { @@ -116,21 +110,11 @@ public final class AppCompatOverridesService { } } - private void unregisterDeviceConfigListeners() { - for (DeviceConfigListener listener : mDeviceConfigListeners) { - listener.unregister(); - } - } - @VisibleForTesting void registerPackageReceiver() { mPackageReceiver.register(); } - private void unregisterPackageReceiver() { - mPackageReceiver.unregister(); - } - /** * Same as {@link #applyOverrides(Properties, Set, Map)} except all properties of the given * {@code namespace} are fetched via {@link DeviceConfig#getProperties}. @@ -374,10 +358,6 @@ public final class AppCompatOverridesService { this); } - private void unregister() { - DeviceConfig.removeOnPropertiesChangedListener(this); - } - @Override public void onPropertiesChanged(Properties properties) { boolean removeOverridesFlagChanged = properties.getKeyset().contains( @@ -426,10 +406,6 @@ public final class AppCompatOverridesService { null, /* scheduler= */ null); } - private void unregister() { - mContext.unregisterReceiver(this); - } - @Override public void onReceive(@NonNull final Context context, @NonNull final Intent intent) { Uri data = intent.getData(); diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index 34d59d86bead..c14f702e1e7a 100644 --- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java @@ -49,7 +49,6 @@ import android.view.RoundedCorners; import android.view.SurfaceControl; import com.android.internal.R; -import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.display.BrightnessSynchronizer; import com.android.internal.util.function.pooled.PooledLambda; @@ -987,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 { @@ -1468,9 +1469,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { } public static class Injector { - // Ensure the callback is kept to preserve native weak reference lifecycle semantics. @SuppressWarnings("unused") - @KeepForWeakReference private ProxyDisplayEventReceiver mReceiver; public void setDisplayEventListenerLocked(Looper looper, DisplayEventListener listener) { mReceiver = new ProxyDisplayEventReceiver(looper, listener); diff --git a/services/core/java/com/android/server/display/color/OWNERS b/services/core/java/com/android/server/display/color/OWNERS index 27adf127d880..8f5a9a0c10eb 100644 --- a/services/core/java/com/android/server/display/color/OWNERS +++ b/services/core/java/com/android/server/display/color/OWNERS @@ -1,4 +1,3 @@ christyfranks@google.com -justinklaassen@google.com -per-file DisplayTransformManager.java=michaelwr@google.com
\ No newline at end of file +per-file DisplayTransformManager.java=michaelwr@google.com diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 2bb2b7b21cce..679d341c6f51 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -1294,8 +1294,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Do not reset the default (current) IME when it is a 3rd-party IME String selectedMethodId = bindingController.getSelectedMethodId(); final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); - if (selectedMethodId != null - && !settings.getMethodMap().get(selectedMethodId).isSystem()) { + final InputMethodInfo selectedImi = settings.getMethodMap().get(selectedMethodId); + if (selectedImi != null && !selectedImi.isSystem()) { return; } final List<InputMethodInfo> suitableImes = InputMethodInfoUtils.getDefaultEnabledImes( 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/integrity/OWNERS b/services/core/java/com/android/server/integrity/OWNERS index 33561fd728f9..352724aa0425 100644 --- a/services/core/java/com/android/server/integrity/OWNERS +++ b/services/core/java/com/android/server/integrity/OWNERS @@ -1,5 +1,4 @@ omernebil@google.com khelmy@google.com mdchurchill@google.com -sturla@google.com diff --git a/services/core/java/com/android/server/locales/LocaleManagerService.java b/services/core/java/com/android/server/locales/LocaleManagerService.java index 741513cf3c0b..cc0a7340494c 100644 --- a/services/core/java/com/android/server/locales/LocaleManagerService.java +++ b/services/core/java/com/android/server/locales/LocaleManagerService.java @@ -48,7 +48,6 @@ import android.util.AtomicFile; import android.util.Slog; import android.util.Xml; -import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.content.PackageMonitor; import com.android.internal.util.FrameworkStatsLog; @@ -101,7 +100,6 @@ public class LocaleManagerService extends SystemService { private LocaleManagerBackupHelper mBackupHelper; - @KeepForWeakReference private final PackageMonitor mPackageMonitor; private final Object mWriteLock = new Object(); diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index a0e543300ce7..42d0a5c4757a 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -3618,6 +3618,12 @@ public class LockSettingsService extends ILockSettings.Stub { return; } + UserInfo userInfo = mInjector.getUserManagerInternal().getUserInfo(userId); + if (userInfo != null && userInfo.isForTesting()) { + Slog.i(TAG, "Keeping escrow data for test-only user"); + return; + } + // Disable escrow token permanently on all other device/user types. Slogf.i(TAG, "Permanently disabling support for escrow tokens on user %d", userId); mSpManager.destroyEscrowData(userId); diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS b/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS index bb487fb52c9f..e54061670346 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS @@ -1,4 +1,2 @@ aseemk@google.com -bozhu@google.com dementyev@google.com -robertberry@google.com diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java index 6303ecd53dbb..253365fba595 100644 --- a/services/core/java/com/android/server/om/OverlayManagerService.java +++ b/services/core/java/com/android/server/om/OverlayManagerService.java @@ -81,7 +81,6 @@ import android.util.Slog; import android.util.SparseArray; import com.android.internal.annotations.GuardedBy; -import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.content.PackageMonitor; import com.android.internal.content.om.OverlayConfig; import com.android.internal.util.ArrayUtils; @@ -263,7 +262,6 @@ public final class OverlayManagerService extends SystemService { private final OverlayActorEnforcer mActorEnforcer; - @KeepForWeakReference private final PackageMonitor mPackageMonitor = new OverlayManagerPackageMonitor(); private int mPrevStartedUserId = -1; 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..2bf4b377bdd3 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyResources.Strings.Core.PACKAGE_INSTA import static android.app.admin.DevicePolicyResources.Strings.Core.PACKAGE_UPDATED_BY_DO; import static android.content.pm.DataLoaderType.INCREMENTAL; import static android.content.pm.DataLoaderType.STREAMING; +import static android.content.pm.Flags.cloudCompilationVerification; import static android.content.pm.PackageInstaller.LOCATION_DATA_APP; import static android.content.pm.PackageInstaller.UNARCHIVAL_OK; import static android.content.pm.PackageInstaller.UNARCHIVAL_STATUS_UNSET; @@ -3570,6 +3571,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { CollectionUtils.addAll(stagedSplitTypes, apk.getSplitTypes()); } + if (cloudCompilationVerification()) { + verifySdmSignatures(artManagedFilePaths, mSigningDetails); + } + if (removeSplitList.size() > 0) { if (pkgInfo == null) { throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, @@ -3934,6 +3939,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { File targetArtManagedFile = new File( ArtManagedInstallFileHelper.getTargetPathForApk(path, targetFile.getPath())); stageFileLocked(artManagedFile, targetArtManagedFile); + if (!artManagedFile.equals(targetArtManagedFile)) { + // The file has been renamed. Update the list to reflect the change. + for (int i = 0; i < artManagedFilePaths.size(); ++i) { + if (artManagedFilePaths.get(i).equals(path)) { + artManagedFilePaths.set(i, targetArtManagedFile.getAbsolutePath()); + } + } + } } } @@ -4262,6 +4275,37 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } /** + * Verifies the signatures of SDM files. + * + * SDM is a file format that contains the cloud compilation artifacts. As a requirement, the SDM + * file should be signed with the same key as the APK. + * + * TODO(b/377474232): Move this logic to ART Service. + */ + private static void verifySdmSignatures(List<String> artManagedFilePaths, + SigningDetails expectedSigningDetails) throws PackageManagerException { + ParseTypeImpl input = ParseTypeImpl.forDefaultParsing(); + for (String path : artManagedFilePaths) { + if (!path.endsWith(".sdm")) { + continue; + } + // SDM is a format introduced in Android 16, so we don't need to support older + // signature schemes. + int minSignatureScheme = SigningDetails.SignatureSchemeVersion.SIGNING_BLOCK_V3; + ParseResult<SigningDetails> verified = + ApkSignatureVerifier.verify(input, path, minSignatureScheme); + if (verified.isError()) { + throw new PackageManagerException( + INSTALL_FAILED_INVALID_APK, "Failed to verify SDM signatures"); + } + if (!expectedSigningDetails.signaturesMatchExactly(verified.getResult())) { + throw new PackageManagerException( + INSTALL_FAILED_INVALID_APK, "SDM signatures are inconsistent with APK"); + } + } + } + + /** * @return the uid of the owner this session */ public int getInstallerUid() { @@ -5144,7 +5188,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 +5543,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/power/ScreenUndimDetector.java b/services/core/java/com/android/server/power/ScreenUndimDetector.java index c4929c210e2c..b376417061db 100644 --- a/services/core/java/com/android/server/power/ScreenUndimDetector.java +++ b/services/core/java/com/android/server/power/ScreenUndimDetector.java @@ -30,11 +30,11 @@ import android.provider.DeviceConfig; import android.util.Slog; import android.view.Display; +import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.FrameworkStatsLog; import java.util.Set; -import java.util.concurrent.TimeUnit; /** * Detects when user manually undims the screen (x times) and acquires a wakelock to keep the screen @@ -48,7 +48,6 @@ public class ScreenUndimDetector { /** DeviceConfig flag: is keep screen on feature enabled. */ static final String KEY_KEEP_SCREEN_ON_ENABLED = "keep_screen_on_enabled"; - private static final boolean DEFAULT_KEEP_SCREEN_ON_ENABLED = true; private static final int OUTCOME_POWER_BUTTON = FrameworkStatsLog.TIMEOUT_AUTO_EXTENDED_REPORTED__OUTCOME__POWER_BUTTON; private static final int OUTCOME_TIMEOUT = @@ -58,15 +57,11 @@ public class ScreenUndimDetector { /** DeviceConfig flag: how long should we keep the screen on. */ @VisibleForTesting static final String KEY_KEEP_SCREEN_ON_FOR_MILLIS = "keep_screen_on_for_millis"; - @VisibleForTesting - static final long DEFAULT_KEEP_SCREEN_ON_FOR_MILLIS = TimeUnit.MINUTES.toMillis(10); private long mKeepScreenOnForMillis; /** DeviceConfig flag: how many user undims required to trigger keeping the screen on. */ @VisibleForTesting static final String KEY_UNDIMS_REQUIRED = "undims_required"; - @VisibleForTesting - static final int DEFAULT_UNDIMS_REQUIRED = 2; private int mUndimsRequired; /** @@ -76,8 +71,6 @@ public class ScreenUndimDetector { @VisibleForTesting static final String KEY_MAX_DURATION_BETWEEN_UNDIMS_MILLIS = "max_duration_between_undims_millis"; - @VisibleForTesting - static final long DEFAULT_MAX_DURATION_BETWEEN_UNDIMS_MILLIS = TimeUnit.MINUTES.toMillis(5); private long mMaxDurationBetweenUndimsMillis; @VisibleForTesting @@ -92,6 +85,7 @@ public class ScreenUndimDetector { private long mUndimOccurredTime = -1; private long mInteractionAfterUndimTime = -1; private InternalClock mClock; + private Context mContext; public ScreenUndimDetector() { mClock = new InternalClock(); @@ -109,12 +103,13 @@ public class ScreenUndimDetector { /** Should be called in parent's systemReady() */ public void systemReady(Context context) { + mContext = context; readValuesFromDeviceConfig(); DeviceConfig.addOnPropertiesChangedListener(NAMESPACE_ATTENTION_MANAGER_SERVICE, - context.getMainExecutor(), + mContext.getMainExecutor(), (properties) -> onDeviceConfigChange(properties.getKeyset())); - final PowerManager powerManager = context.getSystemService(PowerManager.class); + final PowerManager powerManager = mContext.getSystemService(PowerManager.class); mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, UNDIM_DETECTOR_WAKE_LOCK); @@ -203,36 +198,44 @@ public class ScreenUndimDetector { } } - private boolean readKeepScreenOnNotificationEnabled() { + private boolean readKeepScreenOnEnabled() { + boolean defaultKeepScreenOnEnabled = mContext.getResources().getBoolean( + R.bool.config_defaultPreventScreenTimeoutEnabled); return DeviceConfig.getBoolean(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_KEEP_SCREEN_ON_ENABLED, - DEFAULT_KEEP_SCREEN_ON_ENABLED); + defaultKeepScreenOnEnabled); } private long readKeepScreenOnForMillis() { + long defaultKeepScreenOnDuration = mContext.getResources().getInteger( + R.integer.config_defaultPreventScreenTimeoutForMillis); return DeviceConfig.getLong(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_KEEP_SCREEN_ON_FOR_MILLIS, - DEFAULT_KEEP_SCREEN_ON_FOR_MILLIS); + defaultKeepScreenOnDuration); } private int readUndimsRequired() { + int defaultUndimsRequired = mContext.getResources().getInteger( + R.integer.config_defaultUndimsRequired); int undimsRequired = DeviceConfig.getInt(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_UNDIMS_REQUIRED, - DEFAULT_UNDIMS_REQUIRED); + defaultUndimsRequired); if (undimsRequired < 1 || undimsRequired > 5) { Slog.e(TAG, "Provided undimsRequired=" + undimsRequired - + " is not allowed [1, 5]; using the default=" + DEFAULT_UNDIMS_REQUIRED); - return DEFAULT_UNDIMS_REQUIRED; + + " is not allowed [1, 5]; using the default=" + defaultUndimsRequired); + return defaultUndimsRequired; } return undimsRequired; } private long readMaxDurationBetweenUndimsMillis() { + long defaultMaxDurationBetweenUndimsMillis = mContext.getResources().getInteger( + R.integer.config_defaultMaxDurationBetweenUndimsMillis); return DeviceConfig.getLong(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_MAX_DURATION_BETWEEN_UNDIMS_MILLIS, - DEFAULT_MAX_DURATION_BETWEEN_UNDIMS_MILLIS); + defaultMaxDurationBetweenUndimsMillis); } private void onDeviceConfigChange(@NonNull Set<String> keys) { @@ -253,15 +256,16 @@ public class ScreenUndimDetector { @VisibleForTesting void readValuesFromDeviceConfig() { - mKeepScreenOnEnabled = readKeepScreenOnNotificationEnabled(); + mKeepScreenOnEnabled = readKeepScreenOnEnabled(); mKeepScreenOnForMillis = readKeepScreenOnForMillis(); mUndimsRequired = readUndimsRequired(); mMaxDurationBetweenUndimsMillis = readMaxDurationBetweenUndimsMillis(); Slog.i(TAG, "readValuesFromDeviceConfig():" + "\nmKeepScreenOnForMillis=" + mKeepScreenOnForMillis - + "\nmKeepScreenOnNotificationEnabled=" + mKeepScreenOnEnabled - + "\nmUndimsRequired=" + mUndimsRequired); + + "\nmKeepScreenOnEnabled=" + mKeepScreenOnEnabled + + "\nmUndimsRequired=" + mUndimsRequired + + "\nmMaxDurationBetweenUndimsMillis=" + mMaxDurationBetweenUndimsMillis); } diff --git a/services/core/java/com/android/server/security/advancedprotection/OWNERS b/services/core/java/com/android/server/security/advancedprotection/OWNERS index 9bf5e58c01a9..8336ee8702b1 100644 --- a/services/core/java/com/android/server/security/advancedprotection/OWNERS +++ b/services/core/java/com/android/server/security/advancedprotection/OWNERS @@ -1 +1,2 @@ file:platform/frameworks/base:main:/core/java/android/security/advancedprotection/OWNERS +per-file features/UsbDataAdvancedProtectionHook.java = georgechan@google.com, maunik@google.com diff --git a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java index 16658e360cba..a64e38e60ad1 100644 --- a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java +++ b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java @@ -131,7 +131,6 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; -import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.camera.flags.Flags; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.os.BackgroundThread; @@ -2008,11 +2007,7 @@ public final class SensorPrivacyService extends SystemService { } private class CallStateHelper { - // TelephonyCallback instances are only weakly referenced when registered, so we need - // to ensure these fields are kept during optimization to preserve lifecycle semantics. - @KeepForWeakReference private final OutgoingEmergencyStateCallback mEmergencyStateCallback; - @KeepForWeakReference private final CallStateCallback mCallStateCallback; private boolean mIsInEmergencyCall; 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/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 96b924336881..5d4c42605e1d 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -359,7 +359,6 @@ import android.window.WindowOnBackInvokedDispatcher; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; -import com.android.internal.annotations.KeepForWeakReference; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.ResolverActivity; import com.android.internal.content.ReferrerIntent; @@ -895,8 +894,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private RemoteCallbackList<IScreenCaptureObserver> mCaptureCallbacks; - // Ensure the field is kept during optimization to preserve downstream weak refs. - @KeepForWeakReference private final ColorDisplayService.ColorTransformController mColorTransformController = (matrix, translation) -> mWmService.mH.post(() -> { synchronized (mWmService.mGlobalLock) { 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/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 21212e573ffa..fa97a1d43dc5 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -835,11 +835,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ private final ToBooleanFunction<WindowState> mFindFocusedWindow = w -> { final ActivityRecord focusedApp = mFocusedApp; + final boolean canReceiveKeys = w.canReceiveKeys(); ProtoLog.v(WM_DEBUG_FOCUS, "Looking for focus: %s, flags=%d, canReceive=%b, reason=%s", - w, w.mAttrs.flags, w.canReceiveKeys(), + w, w.mAttrs.flags, canReceiveKeys, w.canReceiveKeysReason(false /* fromUserTouch */)); - if (!w.canReceiveKeys()) { + if (!canReceiveKeys) { return false; } @@ -3866,7 +3867,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mTmpWindow == null) { ProtoLog.v(WM_DEBUG_FOCUS_LIGHT, "findFocusedWindow: No focusable windows, display=%d", getDisplayId()); - return null; } return mTmpWindow; } diff --git a/services/core/java/com/android/server/wm/DisplayWindowListenerController.java b/services/core/java/com/android/server/wm/DisplayWindowListenerController.java index fa7a99d55896..d90fff229cd9 100644 --- a/services/core/java/com/android/server/wm/DisplayWindowListenerController.java +++ b/services/core/java/com/android/server/wm/DisplayWindowListenerController.java @@ -40,14 +40,14 @@ class DisplayWindowListenerController { } int[] registerListener(IDisplayWindowListener listener) { + mDisplayListeners.register(listener); + final IntArray displayIds = new IntArray(); synchronized (mService.mGlobalLock) { - mDisplayListeners.register(listener); - final IntArray displayIds = new IntArray(); mService.mAtmService.mRootWindowContainer.forAllDisplays((displayContent) -> { displayIds.add(displayContent.mDisplayId); }); - return displayIds.toArray(); } + return displayIds.toArray(); } void unregisterListener(IDisplayWindowListener listener) { 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/java/com/android/server/wm/WindowProcessControllerMap.java b/services/core/java/com/android/server/wm/WindowProcessControllerMap.java index 424b0436a008..ac675b8ba11c 100644 --- a/services/core/java/com/android/server/wm/WindowProcessControllerMap.java +++ b/services/core/java/com/android/server/wm/WindowProcessControllerMap.java @@ -72,9 +72,6 @@ final class WindowProcessControllerMap { } private void removeProcessFromUidMap(WindowProcessController proc) { - if (proc == null) { - return; - } final int uid = proc.mUid; ArraySet<WindowProcessController> procSet = mUidMap.get(uid); if (procSet != null) { diff --git a/services/core/jni/BroadcastRadio/OWNERS b/services/core/jni/BroadcastRadio/OWNERS index ea4421eae96a..a993823f88f7 100644 --- a/services/core/jni/BroadcastRadio/OWNERS +++ b/services/core/jni/BroadcastRadio/OWNERS @@ -1,2 +1 @@ twasilczyk@google.com -randolphs@google.com diff --git a/services/core/jni/stats/OWNERS b/services/core/jni/stats/OWNERS index 2611e5b6cee2..03086b3e44fc 100644 --- a/services/core/jni/stats/OWNERS +++ b/services/core/jni/stats/OWNERS @@ -1,8 +1,5 @@ jeffreyhuang@google.com -jtnguyen@google.com muhammadq@google.com -sharaieko@google.com singhtejinder@google.com tsaichristine@google.com yaochen@google.com -yro@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/services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java b/services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java index d203de537b81..cf83396d059a 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java @@ -397,6 +397,12 @@ public final class CachedAppOptimizerTest { // When we override new reasonable throttle values after init... mCountDown = new CountDownLatch(8); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, + CachedAppOptimizer.KEY_COMPACT_THROTTLE_MIN_OOM_ADJ, + Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_MIN_OOM_ADJ + 1), false); + DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, + CachedAppOptimizer.KEY_COMPACT_THROTTLE_MAX_OOM_ADJ, + Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_MAX_OOM_ADJ - 1), false); + DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, CachedAppOptimizer.KEY_COMPACT_THROTTLE_1, Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_1 + 1), false); DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, @@ -414,12 +420,6 @@ public final class CachedAppOptimizerTest { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, CachedAppOptimizer.KEY_COMPACT_THROTTLE_6, Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_6 + 1), false); - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, - CachedAppOptimizer.KEY_COMPACT_THROTTLE_MIN_OOM_ADJ, - Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_MIN_OOM_ADJ + 1), false); - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, - CachedAppOptimizer.KEY_COMPACT_THROTTLE_MAX_OOM_ADJ, - Long.toString(CachedAppOptimizer.DEFAULT_COMPACT_THROTTLE_MAX_OOM_ADJ - 1), false); assertThat(mCountDown.await(7, TimeUnit.SECONDS)).isTrue(); // Then those flags values are reflected in the compactor. diff --git a/services/tests/mockingservicestests/src/com/android/server/power/ScreenUndimDetectorTest.java b/services/tests/mockingservicestests/src/com/android/server/power/ScreenUndimDetectorTest.java index e8e1dacd6fcf..60d27353ca3a 100644 --- a/services/tests/mockingservicestests/src/com/android/server/power/ScreenUndimDetectorTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/power/ScreenUndimDetectorTest.java @@ -23,7 +23,6 @@ import static android.hardware.display.DisplayManagerInternal.DisplayPowerReques import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE; import static android.view.Display.DEFAULT_DISPLAY_GROUP; -import static com.android.server.power.ScreenUndimDetector.DEFAULT_MAX_DURATION_BETWEEN_UNDIMS_MILLIS; import static com.android.server.power.ScreenUndimDetector.KEY_KEEP_SCREEN_ON_ENABLED; import static com.android.server.power.ScreenUndimDetector.KEY_MAX_DURATION_BETWEEN_UNDIMS_MILLIS; import static com.android.server.power.ScreenUndimDetector.KEY_UNDIMS_REQUIRED; @@ -48,6 +47,7 @@ import org.junit.runners.JUnit4; import java.util.Arrays; import java.util.List; +import java.util.concurrent.TimeUnit; /** * Tests for {@link com.android.server.power.ScreenUndimDetector} @@ -60,7 +60,8 @@ public class ScreenUndimDetectorTest { POLICY_DIM, POLICY_BRIGHT); private static final int OTHER_DISPLAY_GROUP = DEFAULT_DISPLAY_GROUP + 1; - + private static final long DEFAULT_MAX_DURATION_BETWEEN_UNDIMS_MILLIS = + TimeUnit.MINUTES.toMillis(5); @ClassRule public static final TestableContext sContext = new TestableContext( InstrumentationRegistry.getInstrumentation().getTargetContext(), null); @@ -87,7 +88,8 @@ public class ScreenUndimDetectorTest { @Before public void setup() { InstrumentationRegistry.getInstrumentation().waitForIdleSync(); - + DeviceConfig.setProperty(NAMESPACE_ATTENTION_MANAGER_SERVICE, + KEY_KEEP_SCREEN_ON_ENABLED, Boolean.TRUE.toString(), false /*makeDefault*/); DeviceConfig.setProperty(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_UNDIMS_REQUIRED, Integer.toString(1), false /*makeDefault*/); @@ -107,10 +109,10 @@ public class ScreenUndimDetectorTest { @Test public void recordScreenPolicy_disabledByFlag_noop() { + setup(); DeviceConfig.setProperty(NAMESPACE_ATTENTION_MANAGER_SERVICE, KEY_KEEP_SCREEN_ON_ENABLED, Boolean.FALSE.toString(), false /*makeDefault*/); mScreenUndimDetector.readValuesFromDeviceConfig(); - mScreenUndimDetector.recordScreenPolicy(DEFAULT_DISPLAY_GROUP, POLICY_DIM); mScreenUndimDetector.recordScreenPolicy(DEFAULT_DISPLAY_GROUP, POLICY_BRIGHT); diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index 2620ea250ca5..d8b5a07ae9f0 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -33,9 +33,6 @@ android_test { "test-apps/DisplayManagerTestApp/src/**/*.java", ], - kotlincflags: [ - "-Werror", - ], static_libs: [ "a11ychecker", "aatf", diff --git a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java index 87c9db2fe565..acbce36c3d7f 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java @@ -354,14 +354,20 @@ public abstract class BaseLockSettingsServiceTests { @After public void tearDown_baseServices() throws Exception { - mStorage.closeDatabase(); + if (mStorage != null) { + mStorage.closeDatabase(); + } File db = InstrumentationRegistry.getContext().getDatabasePath("locksettings.db"); assertTrue(!db.exists() || db.delete()); - File storageDir = mStorage.mStorageDir; - assertTrue(FileUtils.deleteContents(storageDir)); + if (mStorage != null) { + File storageDir = mStorage.mStorageDir; + assertTrue(FileUtils.deleteContents(storageDir)); + } - mPasswordSlotManager.cleanup(); + if (mPasswordSlotManager != null) { + mPasswordSlotManager.cleanup(); + } } protected void flushHandlerTasks() { diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java index 02b86db6ab6f..387b89a41eba 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsStorageTests.java @@ -124,7 +124,9 @@ public class LockSettingsStorageTests { @After public void tearDown() throws Exception { - mStorage.closeDatabase(); + if (mStorage != null) { + mStorage.closeDatabase(); + } } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java index 2faf6a2b29d1..2c2b9374fdf9 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/PasswordSlotManagerTests.java @@ -49,7 +49,9 @@ public class PasswordSlotManagerTests { @After public void tearDown() throws Exception { - mManager.cleanup(); + if (mManager != null) { + mManager.cleanup(); + } } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java index 2da2f50447c7..e836780b3f71 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java @@ -16,6 +16,7 @@ package com.android.server.locksettings; +import static android.content.pm.UserInfo.FLAG_FOR_TESTING; import static android.content.pm.UserInfo.FLAG_FULL; import static android.content.pm.UserInfo.FLAG_MAIN; import static android.content.pm.UserInfo.FLAG_PRIMARY; @@ -44,6 +45,8 @@ import static org.mockito.Mockito.when; import android.app.PropertyInvalidatedCache; import android.app.admin.PasswordMetrics; +import android.content.ComponentName; +import android.content.pm.UserInfo; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; @@ -357,6 +360,45 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests { } @Test + public void testEscrowDataRetainedWhenManagedUserVerifiesCredential() throws RemoteException { + when(mDeviceStateCache.isUserOrganizationManaged(anyInt())).thenReturn(true); + + LockscreenCredential password = newPassword("password"); + initSpAndSetCredential(PRIMARY_USER_ID, password); + + mService.verifyCredential(password, PRIMARY_USER_ID, 0 /* flags */); + + assertTrue("Escrow data was destroyed", mSpManager.hasEscrowData(PRIMARY_USER_ID)); + } + + @Test + public void testEscrowDataRetainedWhenUnmanagedTestUserVerifiesCredential() + throws RemoteException { + when(mDeviceStateCache.isUserOrganizationManaged(anyInt())).thenReturn(false); + UserInfo userInfo = mUserManagerInternal.getUserInfo(PRIMARY_USER_ID); + userInfo.flags |= FLAG_FOR_TESTING; + + LockscreenCredential password = newPassword("password"); + initSpAndSetCredential(PRIMARY_USER_ID, password); + + mService.verifyCredential(password, PRIMARY_USER_ID, 0 /* flags */); + + assertTrue("Escrow data was destroyed", mSpManager.hasEscrowData(PRIMARY_USER_ID)); + } + + @Test + public void testEscrowDataDeletedWhenUnmanagedUserVerifiesCredential() throws RemoteException { + when(mDeviceStateCache.isUserOrganizationManaged(anyInt())).thenReturn(false); + + LockscreenCredential password = newPassword("password"); + initSpAndSetCredential(PRIMARY_USER_ID, password); + + mService.verifyCredential(password, PRIMARY_USER_ID, 0 /* flags */); + + assertFalse("Escrow data wasn't destroyed", mSpManager.hasAnyEscrowData(PRIMARY_USER_ID)); + } + + @Test public void testTokenBasedClearPassword() throws RemoteException { LockscreenCredential password = newPassword("password"); LockscreenCredential pattern = newPattern("123654"); diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java index 1514de04fb08..5add74e5b69e 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/KeySyncTaskTest.java @@ -156,9 +156,12 @@ public class KeySyncTaskTest { @After public void tearDown() { - mRecoverableKeyStoreDb.close(); - mDatabaseFile.delete(); - + if (mRecoverableKeyStoreDb != null) { + mRecoverableKeyStoreDb.close(); + } + if (mDatabaseFile != null) { + mDatabaseFile.delete(); + } File file = new File(InstrumentationRegistry.getTargetContext().getFilesDir(), SNAPSHOT_TOP_LEVEL_DIRECTORY); FileUtils.deleteContentsAndDir(file); diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/OWNERS b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/OWNERS index bb487fb52c9f..c8b8e4887b5e 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/OWNERS +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/OWNERS @@ -1,4 +1,3 @@ aseemk@google.com -bozhu@google.com dementyev@google.com robertberry@google.com diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/PlatformKeyManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/PlatformKeyManagerTest.java index c09e09c8404f..46eaba7dace6 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/PlatformKeyManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/PlatformKeyManagerTest.java @@ -117,8 +117,12 @@ public class PlatformKeyManagerTest { @After public void tearDown() { - mRecoverableKeyStoreDb.close(); - mDatabaseFile.delete(); + if (mRecoverableKeyStoreDb != null) { + mRecoverableKeyStoreDb.close(); + } + if (mDatabaseFile != null) { + mDatabaseFile.delete(); + } } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyGeneratorTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyGeneratorTest.java index 64130266b2c4..e6a6e36e75d6 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyGeneratorTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyGeneratorTest.java @@ -89,8 +89,12 @@ public class RecoverableKeyGeneratorTest { keyStore.load(/*param=*/ null); keyStore.deleteEntry(WRAPPING_KEY_ALIAS); - mRecoverableKeyStoreDb.close(); - mDatabaseFile.delete(); + if (mRecoverableKeyStoreDb != null) { + mRecoverableKeyStoreDb.close(); + } + if (mDatabaseFile != null) { + mDatabaseFile.delete(); + } } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java index 7641fb957cc8..878c838e734b 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManagerTest.java @@ -230,9 +230,15 @@ public class RecoverableKeyStoreManagerTest { @After public void tearDown() { - mRemoteLockscreenValidationSessionStorage.finishSession(mUserId); - mRecoverableKeyStoreDb.close(); - mDatabaseFile.delete(); + if (mRemoteLockscreenValidationSessionStorage != null) { + mRemoteLockscreenValidationSessionStorage.finishSession(mUserId); + } + if (mRecoverableKeyStoreDb != null) { + mRecoverableKeyStoreDb.close(); + } + if (mDatabaseFile != null) { + mDatabaseFile.delete(); + } } @Test diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java index bbd9223718ae..fb98fab52ca0 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbHelperTest.java @@ -18,6 +18,8 @@ package com.android.server.locksettings.recoverablekeystore.storage; import static com.google.common.truth.Truth.assertThat; +import static java.nio.charset.StandardCharsets.UTF_8; + import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; @@ -36,8 +38,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static java.nio.charset.StandardCharsets.UTF_8; - @SmallTest @RunWith(AndroidJUnit4.class) public class RecoverableKeyStoreDbHelperTest { @@ -110,7 +110,9 @@ public class RecoverableKeyStoreDbHelperTest { @After public void tearDown() throws Exception { - mDatabase.close(); + if (mDatabase != null) { + mDatabase.close(); + } } private void createV2Tables() throws Exception { diff --git a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java index 8bc14fc54ae1..a77d8bcd3875 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/storage/RecoverableKeyStoreDbTest.java @@ -72,8 +72,12 @@ public class RecoverableKeyStoreDbTest { @After public void tearDown() { - mRecoverableKeyStoreDb.close(); - mDatabaseFile.delete(); + if (mRecoverableKeyStoreDb != null) { + mRecoverableKeyStoreDb.close(); + } + if (mDatabaseFile != null) { + mDatabaseFile.delete(); + } } @Test diff --git a/startop/OWNERS b/startop/OWNERS index 11d5ad0f000a..3414a7469ac2 100644 --- a/startop/OWNERS +++ b/startop/OWNERS @@ -1,2 +1 @@ include platform/art:/OWNERS -keunyoung@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/Codegen/OWNERS b/tests/Codegen/OWNERS index da723b3b67da..e69de29bb2d1 100644 --- a/tests/Codegen/OWNERS +++ b/tests/Codegen/OWNERS @@ -1 +0,0 @@ -eugenesusla@google.com
\ No newline at end of file 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/tests/Input/Android.bp b/tests/Input/Android.bp index 6742cbe1f19a..bacb5eb1cfdf 100644 --- a/tests/Input/Android.bp +++ b/tests/Input/Android.bp @@ -19,9 +19,6 @@ android_test { "src/**/*.kt", ], asset_dirs: ["assets"], - kotlincflags: [ - "-Werror", - ], platform_apis: true, certificate: "platform", static_libs: [ diff --git a/tests/SoundTriggerTestApp/OWNERS b/tests/SoundTriggerTestApp/OWNERS index a0fcfc52704d..1e41886fe716 100644 --- a/tests/SoundTriggerTestApp/OWNERS +++ b/tests/SoundTriggerTestApp/OWNERS @@ -1,2 +1 @@ include /media/java/android/media/soundtrigger/OWNERS -mdooley@google.com diff --git a/tests/vcn/Android.bp b/tests/vcn/Android.bp index 51a300bff7ea..5ad1d1dce324 100644 --- a/tests/vcn/Android.bp +++ b/tests/vcn/Android.bp @@ -16,13 +16,20 @@ android_test { name: "FrameworksVcnTests", // For access hidden connectivity methods in tests defaults: ["framework-connectivity-test-defaults"], + + // Tethering module is released in R so this test needs to be installable + // on R + min_sdk_version: "30", + srcs: [ "java/**/*.java", "java/**/*.kt", ], platform_apis: true, - test_suites: ["device-tests"], - certificate: "platform", + test_suites: [ + "general-tests", + "mts-tethering", + ], static_libs: [ "android.net.vcn.flags-aconfig-java-export", "androidx.test.rules", diff --git a/tests/vcn/AndroidManifest.xml b/tests/vcn/AndroidManifest.xml index a8f657c89f76..6e8b4ac48816 100644 --- a/tests/vcn/AndroidManifest.xml +++ b/tests/vcn/AndroidManifest.xml @@ -16,8 +16,9 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.frameworks.tests.vcn"> - <uses-sdk android:minSdkVersion="33" - android:targetSdkVersion="33"/> + <!-- TODO: b/374174952 Use 36 after Android B finalization --> + <uses-sdk android:minSdkVersion="30" android:targetSdkVersion="35" /> + <application> <uses-library android:name="android.test.runner" /> </application> diff --git a/tests/vcn/AndroidTest.xml b/tests/vcn/AndroidTest.xml index dc521fd7bcd9..9c8362f36cb2 100644 --- a/tests/vcn/AndroidTest.xml +++ b/tests/vcn/AndroidTest.xml @@ -14,12 +14,20 @@ limitations under the License. --> <configuration description="Runs VCN Tests."> - <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> <option name="test-file-name" value="FrameworksVcnTests.apk" /> </target_preparer> <option name="test-suite-tag" value="apct" /> <option name="test-tag" value="FrameworksVcnTests" /> + + <!-- Run tests in MTS only if the Tethering Mainline module is installed. --> + <object type="module_controller" + class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController"> + <option name="mainline-module-package-name" value="com.google.android.tethering" /> + </object> + <test class="com.android.tradefed.testtype.AndroidJUnitTest" > <option name="package" value="com.android.frameworks.tests.vcn" /> <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" /> diff --git a/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java b/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java index 156961312323..0fa11ae1fe7d 100644 --- a/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java +++ b/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java @@ -23,11 +23,24 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.fail; +import android.os.Build; + +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; + import org.junit.Test; +import org.junit.runner.RunWith; import java.util.HashSet; import java.util.Set; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnCellUnderlyingNetworkTemplateTest extends VcnUnderlyingNetworkTemplateTestBase { private static final Set<String> ALLOWED_PLMN_IDS = new HashSet<>(); private static final Set<Integer> ALLOWED_CARRIER_IDS = new HashSet<>(); diff --git a/tests/vcn/java/android/net/vcn/VcnConfigTest.java b/tests/vcn/java/android/net/vcn/VcnConfigTest.java index 73a0a6183cb6..fa97de0aff45 100644 --- a/tests/vcn/java/android/net/vcn/VcnConfigTest.java +++ b/tests/vcn/java/android/net/vcn/VcnConfigTest.java @@ -29,11 +29,14 @@ import static org.mockito.Mockito.mock; import android.annotation.NonNull; import android.content.Context; +import android.os.Build; import android.os.Parcel; import android.util.ArraySet; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; @@ -42,7 +45,10 @@ import org.junit.runner.RunWith; import java.util.Collections; import java.util.Set; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnConfigTest { private static final String TEST_PACKAGE_NAME = VcnConfigTest.class.getPackage().getName(); diff --git a/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java b/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java index 59dc68900100..990cc74caf6c 100644 --- a/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java +++ b/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java @@ -34,10 +34,13 @@ import android.net.ipsec.ike.IkeSessionParams; import android.net.ipsec.ike.IkeTunnelConnectionParams; import android.net.vcn.persistablebundleutils.IkeSessionParamsUtilsTest; import android.net.vcn.persistablebundleutils.TunnelConnectionParamsUtilsTest; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -49,7 +52,10 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionConfigTest { // Public for use in VcnGatewayConnectionTest diff --git a/tests/vcn/java/android/net/vcn/VcnManagerTest.java b/tests/vcn/java/android/net/vcn/VcnManagerTest.java index 8461de6d877b..1739fbc0fa6d 100644 --- a/tests/vcn/java/android/net/vcn/VcnManagerTest.java +++ b/tests/vcn/java/android/net/vcn/VcnManagerTest.java @@ -38,16 +38,28 @@ import android.net.NetworkCapabilities; import android.net.vcn.VcnManager.VcnStatusCallback; import android.net.vcn.VcnManager.VcnStatusCallbackBinder; import android.net.vcn.VcnManager.VcnUnderlyingNetworkPolicyListener; +import android.os.Build; import android.os.ParcelUuid; +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; + import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.net.UnknownHostException; import java.util.UUID; import java.util.concurrent.Executor; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnManagerTest { private static final ParcelUuid SUB_GROUP = new ParcelUuid(new UUID(0, 0)); private static final String GATEWAY_CONNECTION_NAME = "gatewayConnectionName"; diff --git a/tests/vcn/java/android/net/vcn/VcnTransportInfoTest.java b/tests/vcn/java/android/net/vcn/VcnTransportInfoTest.java index 7bc9970629a6..52952eb3f2cc 100644 --- a/tests/vcn/java/android/net/vcn/VcnTransportInfoTest.java +++ b/tests/vcn/java/android/net/vcn/VcnTransportInfoTest.java @@ -30,12 +30,24 @@ import static org.junit.Assert.fail; import android.net.NetworkCapabilities; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; +import android.os.Build; import android.os.Parcel; +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; + import org.junit.Test; +import org.junit.runner.RunWith; import java.util.Arrays; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnTransportInfoTest { private static final int SUB_ID = 1; private static final int NETWORK_ID = 5; diff --git a/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkPolicyTest.java b/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkPolicyTest.java index a674425efea3..c82d2003dbf6 100644 --- a/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkPolicyTest.java +++ b/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkPolicyTest.java @@ -22,9 +22,21 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import android.net.NetworkCapabilities; +import android.os.Build; + +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; +import org.junit.runner.RunWith; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnUnderlyingNetworkPolicyTest { private static final VcnUnderlyingNetworkPolicy DEFAULT_NETWORK_POLICY = new VcnUnderlyingNetworkPolicy( diff --git a/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkSpecifierTest.java b/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkSpecifierTest.java index 2110d6ee7c86..22361cc71f12 100644 --- a/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkSpecifierTest.java +++ b/tests/vcn/java/android/net/vcn/VcnUnderlyingNetworkSpecifierTest.java @@ -22,14 +22,20 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import android.net.TelephonyNetworkSpecifier; +import android.os.Build; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnUnderlyingNetworkSpecifierTest { private static final int[] TEST_SUB_IDS = new int[] {1, 2, 3, 5}; diff --git a/tests/vcn/java/android/net/vcn/VcnUtilsTest.java b/tests/vcn/java/android/net/vcn/VcnUtilsTest.java index 3ce6c8f9386d..fb040d8f9b91 100644 --- a/tests/vcn/java/android/net/vcn/VcnUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/VcnUtilsTest.java @@ -30,13 +30,25 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.TelephonyNetworkSpecifier; import android.net.wifi.WifiInfo; +import android.os.Build; + +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import java.util.Arrays; import java.util.Collections; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnUtilsTest { private static final int SUB_ID = 1; diff --git a/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java b/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java index 4063178e005d..2c072e1cbc88 100644 --- a/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java +++ b/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java @@ -22,10 +22,23 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import android.os.Build; + +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; + import org.junit.Test; +import org.junit.runner.RunWith; import java.util.Set; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnWifiUnderlyingNetworkTemplateTest extends VcnUnderlyingNetworkTemplateTestBase { private static final String SSID = "TestWifi"; diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/EapSessionConfigUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/EapSessionConfigUtilsTest.java index bc8e9d3200b6..01e9ac2ac3cf 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/EapSessionConfigUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/EapSessionConfigUtilsTest.java @@ -21,11 +21,14 @@ import static android.telephony.TelephonyManager.APPTYPE_USIM; import static org.junit.Assert.assertEquals; import android.net.eap.EapSessionConfig; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,7 +38,10 @@ import java.nio.charset.StandardCharsets; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class EapSessionConfigUtilsTest { private static final byte[] EAP_ID = "test@android.net".getBytes(StandardCharsets.US_ASCII); diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeIdentificationUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeIdentificationUtilsTest.java index 4f3930f9b5af..821e5a6c94cb 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeIdentificationUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeIdentificationUtilsTest.java @@ -25,10 +25,13 @@ import android.net.ipsec.ike.IkeIpv4AddrIdentification; import android.net.ipsec.ike.IkeIpv6AddrIdentification; import android.net.ipsec.ike.IkeKeyIdIdentification; import android.net.ipsec.ike.IkeRfc822AddrIdentification; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,7 +42,10 @@ import java.net.InetAddress; import javax.security.auth.x500.X500Principal; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class IkeIdentificationUtilsTest { private static void verifyPersistableBundleEncodeDecodeIsLossless(IkeIdentification id) { diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java index 9f7d2390938f..7200aee1c012 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java @@ -29,14 +29,16 @@ import android.net.InetAddresses; import android.net.eap.EapSessionConfig; import android.net.ipsec.ike.IkeFqdnIdentification; import android.net.ipsec.ike.IkeSessionParams; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.internal.org.bouncycastle.util.io.pem.PemObject; import com.android.internal.org.bouncycastle.util.io.pem.PemReader; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -52,7 +54,10 @@ import java.security.cert.X509Certificate; import java.security.interfaces.RSAPrivateKey; import java.util.concurrent.TimeUnit; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class IkeSessionParamsUtilsTest { // Public for use in VcnGatewayConnectionConfigTest, EncryptedTunnelParamsUtilsTest diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeTrafficSelectorUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeTrafficSelectorUtilsTest.java index 28cf38a2a583..957e785d70c0 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeTrafficSelectorUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeTrafficSelectorUtilsTest.java @@ -20,17 +20,23 @@ import static org.junit.Assert.assertEquals; import android.net.InetAddresses; import android.net.ipsec.ike.IkeTrafficSelector; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; import java.net.InetAddress; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class IkeTrafficSelectorUtilsTest { private static final int START_PORT = 16; diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/SaProposalUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/SaProposalUtilsTest.java index 664044a9e7d4..1e8f5ff2dc07 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/SaProposalUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/SaProposalUtilsTest.java @@ -21,15 +21,21 @@ import static org.junit.Assert.assertEquals; import android.net.ipsec.ike.ChildSaProposal; import android.net.ipsec.ike.IkeSaProposal; import android.net.ipsec.ike.SaProposal; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class SaProposalUtilsTest { /** Package private so that IkeSessionParamsUtilsTest can use it */ diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelConnectionParamsUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelConnectionParamsUtilsTest.java index f9dc9eb4d5ae..7d17724112ec 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelConnectionParamsUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelConnectionParamsUtilsTest.java @@ -20,14 +20,20 @@ import static org.junit.Assert.assertEquals; import android.net.ipsec.ike.IkeSessionParams; import android.net.ipsec.ike.IkeTunnelConnectionParams; +import android.os.Build; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class TunnelConnectionParamsUtilsTest { // Public for use in VcnGatewayConnectionConfigTest diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelModeChildSessionParamsUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelModeChildSessionParamsUtilsTest.java index e0b5f0ef0381..3d7348a79b8c 100644 --- a/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelModeChildSessionParamsUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/TunnelModeChildSessionParamsUtilsTest.java @@ -25,10 +25,13 @@ import android.net.InetAddresses; import android.net.ipsec.ike.ChildSaProposal; import android.net.ipsec.ike.IkeTrafficSelector; import android.net.ipsec.ike.TunnelModeChildSessionParams; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -37,7 +40,10 @@ import java.net.Inet4Address; import java.net.Inet6Address; import java.util.concurrent.TimeUnit; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class TunnelModeChildSessionParamsUtilsTest { // Package private for use in EncryptedTunnelParamsUtilsTest diff --git a/tests/vcn/java/android/net/vcn/util/MtuUtilsTest.java b/tests/vcn/java/android/net/vcn/util/MtuUtilsTest.java index 47638b002f37..99c7aa72146b 100644 --- a/tests/vcn/java/android/net/vcn/util/MtuUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/util/MtuUtilsTest.java @@ -33,9 +33,12 @@ import static org.junit.Assert.assertTrue; import static java.util.Collections.emptyList; import android.net.ipsec.ike.ChildSaProposal; +import android.os.Build; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -43,7 +46,10 @@ import org.junit.runner.RunWith; import java.util.Arrays; import java.util.List; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class MtuUtilsTest { private void verifyUnderlyingMtuZero(boolean isIpv4) { diff --git a/tests/vcn/java/android/net/vcn/util/PersistableBundleUtilsTest.java b/tests/vcn/java/android/net/vcn/util/PersistableBundleUtilsTest.java index c84e60086b37..f7786af840ee 100644 --- a/tests/vcn/java/android/net/vcn/util/PersistableBundleUtilsTest.java +++ b/tests/vcn/java/android/net/vcn/util/PersistableBundleUtilsTest.java @@ -21,10 +21,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,7 +38,10 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Objects; -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class PersistableBundleUtilsTest { private static final String TEST_KEY = "testKey"; diff --git a/tests/vcn/java/com/android/server/VcnManagementServiceTest.java b/tests/vcn/java/com/android/server/VcnManagementServiceTest.java index 26a2a0636792..3cccbc419425 100644 --- a/tests/vcn/java/com/android/server/VcnManagementServiceTest.java +++ b/tests/vcn/java/com/android/server/VcnManagementServiceTest.java @@ -41,6 +41,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; @@ -79,6 +80,7 @@ import android.net.vcn.VcnManager; import android.net.vcn.VcnUnderlyingNetworkPolicy; import android.net.vcn.util.PersistableBundleUtils; import android.net.vcn.util.PersistableBundleUtils.PersistableBundleWrapper; +import android.os.Build; import android.os.IBinder; import android.os.ParcelUuid; import android.os.PersistableBundle; @@ -93,7 +95,6 @@ import android.telephony.TelephonyManager; import android.util.ArraySet; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.server.VcnManagementService.VcnCallback; import com.android.server.VcnManagementService.VcnStatusCallbackInfo; @@ -101,6 +102,8 @@ import com.android.server.vcn.TelephonySubscriptionTracker; import com.android.server.vcn.Vcn; import com.android.server.vcn.VcnContext; import com.android.server.vcn.VcnNetworkProvider; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Rule; @@ -117,8 +120,10 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; -/** Tests for {@link VcnManagementService}. */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnManagementServiceTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @@ -1084,6 +1089,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set<Integer> restrictedTransports = new ArraySet<>(); restrictedTransports.add(TRANSPORT_CELLULAR); restrictedTransports.add(TRANSPORT_WIFI); @@ -1105,6 +1114,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig_noRestrictPolicyConfigured() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set<Integer> restrictedTransports = Collections.singleton(TRANSPORT_WIFI); final PersistableBundleWrapper carrierConfig = @@ -1119,6 +1132,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfig_noCarrierConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + final Set<Integer> restrictedTransports = Collections.singleton(TRANSPORT_WIFI); final TelephonySubscriptionSnapshot lastSnapshot = @@ -1130,6 +1147,10 @@ public class VcnManagementServiceTest { @Test public void testGetRestrictedTransportsFromCarrierConfigAndVcnConfig() { + assumeTrue( + "Configuring restricted transport types is only allowed on a debuggable build", + Build.isDebuggable()); + // Configure restricted transport in CarrierConfig final Set<Integer> restrictedTransportInCarrierConfig = Collections.singleton(TRANSPORT_WIFI); diff --git a/tests/vcn/java/com/android/server/vcn/TelephonySubscriptionTrackerTest.java b/tests/vcn/java/com/android/server/vcn/TelephonySubscriptionTrackerTest.java index 77f82f0d8cf4..6276be27fbf5 100644 --- a/tests/vcn/java/com/android/server/vcn/TelephonySubscriptionTrackerTest.java +++ b/tests/vcn/java/com/android/server/vcn/TelephonySubscriptionTrackerTest.java @@ -54,6 +54,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.vcn.VcnManager; +import android.os.Build; import android.os.Handler; import android.os.ParcelUuid; import android.os.PersistableBundle; @@ -69,9 +70,10 @@ import android.util.ArrayMap; import android.util.ArraySet; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.modules.utils.HandlerExecutor; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; @@ -87,8 +89,10 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -/** Tests for TelephonySubscriptionTracker */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class TelephonySubscriptionTrackerTest { private static final String PACKAGE_NAME = diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java index 74db6a5211a0..6608dda95a4b 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java @@ -70,16 +70,18 @@ import android.net.vcn.VcnGatewayConnectionConfigTest; import android.net.vcn.VcnManager.VcnErrorCode; import android.net.vcn.VcnTransportInfo; import android.net.vcn.util.MtuUtils; +import android.os.Build; import android.os.PersistableBundle; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.server.vcn.VcnGatewayConnection.VcnChildSessionCallback; import com.android.server.vcn.VcnGatewayConnection.VcnChildSessionConfiguration; import com.android.server.vcn.VcnGatewayConnection.VcnIkeSession; import com.android.server.vcn.VcnGatewayConnection.VcnNetworkAgent; import com.android.server.vcn.routeselection.UnderlyingNetworkRecord; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; @@ -94,8 +96,10 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; -/** Tests for VcnGatewayConnection.ConnectedState */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnectionTestBase { private static final int PARALLEL_SA_COUNT = 4; diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java index 3c70759a2fa6..f6123d29f35a 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectingStateTest.java @@ -26,17 +26,22 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import android.net.ipsec.ike.IkeSessionParams; +import android.os.Build; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -/** Tests for VcnGatewayConnection.ConnectingState */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionConnectingStateTest extends VcnGatewayConnectionTestBase { private VcnIkeSession mIkeSession; diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectedStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectedStateTest.java index f3eb82f46de7..7cfaf5be5111 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectedStateTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectedStateTest.java @@ -30,16 +30,21 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import android.net.IpSecManager; +import android.os.Build; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -/** Tests for VcnGatewayConnection.DisconnectedState */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionDisconnectedStateTest extends VcnGatewayConnectionTestBase { @Before diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectingStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectingStateTest.java index 78aefad9f8ff..9132d830c54e 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectingStateTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionDisconnectingStateTest.java @@ -23,15 +23,21 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import android.os.Build; + import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -/** Tests for VcnGatewayConnection.DisconnectedState */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionDisconnectingStateTest extends VcnGatewayConnectionTestBase { @Before diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionRetryTimeoutStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionRetryTimeoutStateTest.java index 6568cdd44377..d5ef4e028709 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionRetryTimeoutStateTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionRetryTimeoutStateTest.java @@ -27,15 +27,21 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import android.os.Build; + import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -/** Tests for VcnGatewayConnection.RetryTimeoutState */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionRetryTimeoutStateTest extends VcnGatewayConnectionTestBase { private long mFirstRetryInterval; diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java index b9fe76a24d20..5283322682ee 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionTest.java @@ -61,15 +61,17 @@ import android.net.vcn.VcnGatewayConnectionConfigTest; import android.net.vcn.VcnManager; import android.net.vcn.VcnTransportInfo; import android.net.wifi.WifiInfo; +import android.os.Build; import android.os.ParcelUuid; import android.os.Process; import android.telephony.SubscriptionInfo; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.server.vcn.TelephonySubscriptionTracker.TelephonySubscriptionSnapshot; import com.android.server.vcn.routeselection.UnderlyingNetworkRecord; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; @@ -87,8 +89,10 @@ import java.util.UUID; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; -/** Tests for TelephonySubscriptionTracker */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnGatewayConnectionTest extends VcnGatewayConnectionTestBase { private static final int TEST_UID = Process.myUid() + 1; diff --git a/tests/vcn/java/com/android/server/vcn/VcnNetworkProviderTest.java b/tests/vcn/java/com/android/server/vcn/VcnNetworkProviderTest.java index e9026e22b6b2..2b92428918db 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnNetworkProviderTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnNetworkProviderTest.java @@ -29,12 +29,14 @@ import android.annotation.NonNull; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkRequest; +import android.os.Build; import android.os.test.TestLooper; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.server.vcn.VcnNetworkProvider.NetworkRequestListener; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; @@ -44,8 +46,10 @@ import org.mockito.ArgumentCaptor; import java.util.ArrayList; import java.util.List; -/** Tests for TelephonySubscriptionTracker */ -@RunWith(AndroidJUnit4.class) +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) @SmallTest public class VcnNetworkProviderTest { private static final int TEST_SCORE_UNSATISFIED = 0; diff --git a/tests/vcn/java/com/android/server/vcn/VcnTest.java b/tests/vcn/java/com/android/server/vcn/VcnTest.java index 6d269686e42f..bd4aeba761da 100644 --- a/tests/vcn/java/com/android/server/vcn/VcnTest.java +++ b/tests/vcn/java/com/android/server/vcn/VcnTest.java @@ -49,20 +49,26 @@ import android.net.Uri; import android.net.vcn.VcnConfig; import android.net.vcn.VcnGatewayConnectionConfig; import android.net.vcn.VcnGatewayConnectionConfigTest; +import android.os.Build; import android.os.ParcelUuid; import android.os.test.TestLooper; import android.provider.Settings; import android.telephony.TelephonyManager; import android.util.ArraySet; +import androidx.test.filters.SmallTest; + import com.android.server.VcnManagementService.VcnCallback; import com.android.server.vcn.TelephonySubscriptionTracker.TelephonySubscriptionSnapshot; import com.android.server.vcn.Vcn.VcnGatewayStatusCallback; import com.android.server.vcn.Vcn.VcnUserMobileDataStateListener; import com.android.server.vcn.VcnNetworkProvider.NetworkRequestListener; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.util.ArrayList; @@ -73,6 +79,11 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class VcnTest { private static final String PKG_NAME = VcnTest.class.getPackage().getName(); private static final ParcelUuid TEST_SUB_GROUP = new ParcelUuid(new UUID(0, 0)); diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/IpSecPacketLossDetectorTest.java b/tests/vcn/java/com/android/server/vcn/routeselection/IpSecPacketLossDetectorTest.java index c11b6bb3435d..53a36d3e4d6a 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/IpSecPacketLossDetectorTest.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/IpSecPacketLossDetectorTest.java @@ -44,16 +44,22 @@ import static org.mockito.Mockito.when; import android.content.BroadcastReceiver; import android.content.Intent; import android.net.IpSecTransformState; +import android.os.Build; import android.os.OutcomeReceiver; import android.os.PowerManager; +import androidx.test.filters.SmallTest; + import com.android.server.vcn.routeselection.IpSecPacketLossDetector.PacketLossCalculationResult; import com.android.server.vcn.routeselection.IpSecPacketLossDetector.PacketLossCalculator; import com.android.server.vcn.routeselection.NetworkMetricMonitor.IpSecTransformWrapper; import com.android.server.vcn.routeselection.NetworkMetricMonitor.NetworkMetricMonitorCallback; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; @@ -63,6 +69,11 @@ import java.util.Arrays; import java.util.BitSet; import java.util.concurrent.TimeUnit; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class IpSecPacketLossDetectorTest extends NetworkEvaluationTestBase { private static final String TAG = IpSecPacketLossDetectorTest.class.getSimpleName(); diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java index 4f34f9f8f74c..a9c637f7c943 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java @@ -42,16 +42,28 @@ import android.net.vcn.VcnGatewayConnectionConfig; import android.net.vcn.VcnManager; import android.net.vcn.VcnUnderlyingNetworkTemplate; import android.net.vcn.VcnWifiUnderlyingNetworkTemplate; +import android.os.Build; import android.os.PersistableBundle; import android.util.ArraySet; +import androidx.test.filters.SmallTest; + +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; + import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import java.util.Collections; import java.util.List; import java.util.Set; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class NetworkPriorityClassifierTest extends NetworkEvaluationTestBase { private UnderlyingNetworkRecord mWifiNetworkRecord; private UnderlyingNetworkRecord mCellNetworkRecord; diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkControllerTest.java b/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkControllerTest.java index e540932d0e1f..99c508c139ec 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkControllerTest.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkControllerTest.java @@ -58,6 +58,7 @@ import android.net.vcn.VcnCellUnderlyingNetworkTemplate; import android.net.vcn.VcnCellUnderlyingNetworkTemplateTest; import android.net.vcn.VcnGatewayConnectionConfigTest; import android.net.vcn.VcnUnderlyingNetworkTemplate; +import android.os.Build; import android.os.ParcelUuid; import android.os.test.TestLooper; import android.telephony.CarrierConfigManager; @@ -65,6 +66,8 @@ import android.telephony.SubscriptionInfo; import android.telephony.TelephonyManager; import android.util.ArraySet; +import androidx.test.filters.SmallTest; + import com.android.server.vcn.TelephonySubscriptionTracker.TelephonySubscriptionSnapshot; import com.android.server.vcn.VcnContext; import com.android.server.vcn.VcnNetworkProvider; @@ -73,9 +76,12 @@ import com.android.server.vcn.routeselection.UnderlyingNetworkController.Network import com.android.server.vcn.routeselection.UnderlyingNetworkController.UnderlyingNetworkControllerCallback; import com.android.server.vcn.routeselection.UnderlyingNetworkController.UnderlyingNetworkListener; import com.android.server.vcn.routeselection.UnderlyingNetworkEvaluator.NetworkEvaluatorCallback; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; @@ -89,6 +95,11 @@ import java.util.List; import java.util.Set; import java.util.UUID; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class UnderlyingNetworkControllerTest { private static final ParcelUuid SUB_GROUP = new ParcelUuid(new UUID(0, 0)); private static final int INITIAL_SUB_ID_1 = 1; diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkEvaluatorTest.java b/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkEvaluatorTest.java index a315b0690ec5..27c1bc105bde 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkEvaluatorTest.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/UnderlyingNetworkEvaluatorTest.java @@ -38,19 +38,30 @@ import static org.mockito.Mockito.when; import android.net.IpSecTransform; import android.net.vcn.VcnGatewayConnectionConfig; +import android.os.Build; + +import androidx.test.filters.SmallTest; import com.android.server.vcn.routeselection.NetworkMetricMonitor.NetworkMetricMonitorCallback; import com.android.server.vcn.routeselection.UnderlyingNetworkEvaluator.Dependencies; import com.android.server.vcn.routeselection.UnderlyingNetworkEvaluator.NetworkEvaluatorCallback; +import com.android.testutils.DevSdkIgnoreRule; +import com.android.testutils.DevSdkIgnoreRunner; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import java.util.concurrent.TimeUnit; +// TODO: b/374174952 After B finalization, use Sdk36ModuleController to ensure VCN tests only run on +// Android B/B+ +@RunWith(DevSdkIgnoreRunner.class) +@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.VANILLA_ICE_CREAM) +@SmallTest public class UnderlyingNetworkEvaluatorTest extends NetworkEvaluationTestBase { private static final int PENALTY_TIMEOUT_MIN = 10; private static final long PENALTY_TIMEOUT_MS = TimeUnit.MINUTES.toMillis(PENALTY_TIMEOUT_MIN); 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/fonts/Android.bp b/tools/fonts/Android.bp index f8629f9bd0b8..07caa9a979d9 100644 --- a/tools/fonts/Android.bp +++ b/tools/fonts/Android.bp @@ -23,11 +23,6 @@ package { python_defaults { name: "fonts_python_defaults", - version: { - py3: { - embedded_launcher: true, - }, - }, } python_binary_host { 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/tools/lint/fix/Android.bp b/tools/lint/fix/Android.bp index ddacf57c3a3e..43f21221ae5a 100644 --- a/tools/lint/fix/Android.bp +++ b/tools/lint/fix/Android.bp @@ -25,11 +25,6 @@ python_binary_host { name: "lint_fix", main: "soong_lint_fix.py", srcs: ["soong_lint_fix.py"], - version: { - py3: { - embedded_launcher: true, - }, - }, } python_library_host { diff --git a/tools/lint/global/integration_tests/Android.bp b/tools/lint/global/integration_tests/Android.bp index 05ba405d2c52..f88709375c98 100644 --- a/tools/lint/global/integration_tests/Android.bp +++ b/tools/lint/global/integration_tests/Android.bp @@ -65,9 +65,4 @@ python_test_host { "AndroidGlobalLintTestNoAidl_py", "AndroidGlobalLintTestMissingAnnotation_py", ], - version: { - py3: { - embedded_launcher: true, - }, - }, } diff --git a/tools/processors/view_inspector/OWNERS b/tools/processors/view_inspector/OWNERS index 0473f54e57ca..38d21e141f43 100644 --- a/tools/processors/view_inspector/OWNERS +++ b/tools/processors/view_inspector/OWNERS @@ -1,3 +1,2 @@ alanv@google.com -ashleyrose@google.com -aurimas@google.com
\ No newline at end of file +aurimas@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 |