diff options
376 files changed, 6751 insertions, 1449 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/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java index ecbfc7169945..10ec2bfcb49a 100644 --- a/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java +++ b/apct-tests/perftests/core/src/android/libcore/regression/ExpensiveObjectsPerfTest.java @@ -75,8 +75,19 @@ public class ExpensiveObjectsPerfTest { @Test(timeout = 900000) public void timeNewCollator() { BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + int i = 0; while (state.keepRunning()) { Collator.getInstance(Locale.US); + + if (++i % 1000 == 0) { + state.pauseTiming(); + // GC and finalize occasionally to avoid GC for alloc and/or + // blocking on finalization during benchmark time. + // See: b/394961590 + System.gc(); + System.runFinalization(); + state.resumeTiming(); + } } } @@ -84,8 +95,19 @@ public class ExpensiveObjectsPerfTest { public void timeClonedCollator() { Collator c = Collator.getInstance(Locale.US); BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); + int i = 0; while (state.keepRunning()) { c.clone(); + + if (++i % 1000 == 0) { + state.pauseTiming(); + // GC and finalize occasionally to avoid GC for alloc and/or + // blocking on finalization during benchmark time. + // See: b/394961590 + System.gc(); + System.runFinalization(); + state.resumeTiming(); + } } } 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 965093c9ab38..31ffa8cd4e9f 100644 --- a/api/OWNERS +++ b/api/OWNERS @@ -1,4 +1,3 @@ -hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS @@ -9,4 +8,4 @@ per-file *.go,go.mod,go.work,go.work.sum = file:platform/build/soong:/OWNERS per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION} # For metalava team to disable lint checks in platform -per-file Android.bp = aurimas@google.com,emberrose@google.com +per-file Android.bp = aurimas@google.com 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/cmds/svc/src/com/android/commands/svc/OWNERS b/cmds/svc/src/com/android/commands/svc/OWNERS index d5a5d7b3b858..a901dfdeddfb 100644 --- a/cmds/svc/src/com/android/commands/svc/OWNERS +++ b/cmds/svc/src/com/android/commands/svc/OWNERS @@ -1,2 +1,2 @@ # Bug component: 48448 -per-file NfcCommand.java = file:platform/packages/apps/Nfc:/OWNERS +per-file NfcCommand.java = file:platform/packages/modules/Nfc:/OWNERS diff --git a/core/api/current.txt b/core/api/current.txt index 5acb9bff2841..d8e3a0138bcb 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -18977,13 +18977,13 @@ package android.hardware.biometrics { public class BiometricManager { method @Deprecated @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public int canAuthenticate(); method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public int canAuthenticate(int); - method @FlaggedApi("android.hardware.biometrics.last_authentication_time") @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public long getLastAuthenticationTime(int); + method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public long getLastAuthenticationTime(int); method @NonNull @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public android.hardware.biometrics.BiometricManager.Strings getStrings(int); field public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1; // 0x1 field public static final int BIOMETRIC_ERROR_NONE_ENROLLED = 11; // 0xb field public static final int BIOMETRIC_ERROR_NO_HARDWARE = 12; // 0xc field public static final int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15; // 0xf - field @FlaggedApi("android.hardware.biometrics.last_authentication_time") public static final long BIOMETRIC_NO_AUTHENTICATION = -1L; // 0xffffffffffffffffL + field public static final long BIOMETRIC_NO_AUTHENTICATION = -1L; // 0xffffffffffffffffL field public static final int BIOMETRIC_SUCCESS = 0; // 0x0 } @@ -19033,7 +19033,7 @@ package android.hardware.biometrics { field public static final int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2; // 0x2 field public static final int BIOMETRIC_ERROR_USER_CANCELED = 10; // 0xa field public static final int BIOMETRIC_ERROR_VENDOR = 8; // 0x8 - field @FlaggedApi("android.hardware.biometrics.last_authentication_time") public static final long BIOMETRIC_NO_AUTHENTICATION = -1L; // 0xffffffffffffffffL + field public static final long BIOMETRIC_NO_AUTHENTICATION = -1L; // 0xffffffffffffffffL } public abstract static class BiometricPrompt.AuthenticationCallback { diff --git a/core/java/android/accessibilityservice/OWNERS b/core/java/android/accessibilityservice/OWNERS index 1265dfa2c441..dac64f47ba7e 100644 --- a/core/java/android/accessibilityservice/OWNERS +++ b/core/java/android/accessibilityservice/OWNERS @@ -1,4 +1,7 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. # Android Accessibility Framework owners include /services/accessibility/OWNERS
\ No newline at end of file diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 7273e64846c0..e88d7ab3a725 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -550,35 +550,35 @@ public class ActivityManager { public static final int START_ASSISTANT_NOT_ACTIVE_SESSION = FIRST_START_FATAL_ERROR_CODE + 11; /** - * Result for IActivityManaqer.startActivity: the activity was started + * Result for IActivityManager.startActivity: the activity was started * successfully as normal. * @hide */ public static final int START_SUCCESS = FIRST_START_SUCCESS_CODE; /** - * Result for IActivityManaqer.startActivity: the caller asked that the Intent not + * Result for IActivityManager.startActivity: the caller asked that the Intent not * be executed if it is the recipient, and that is indeed the case. * @hide */ public static final int START_RETURN_INTENT_TO_CALLER = FIRST_START_SUCCESS_CODE + 1; /** - * Result for IActivityManaqer.startActivity: activity was started or brought forward in an + * Result for IActivityManager.startActivity: activity was started or brought forward in an * existing task which was brought to the foreground. * @hide */ public static final int START_TASK_TO_FRONT = FIRST_START_SUCCESS_CODE + 2; /** - * Result for IActivityManaqer.startActivity: activity wasn't really started, but + * Result for IActivityManager.startActivity: activity wasn't really started, but * the given Intent was given to the existing top activity. * @hide */ public static final int START_DELIVERED_TO_TOP = FIRST_START_SUCCESS_CODE + 3; /** - * Result for IActivityManaqer.startActivity: request was canceled because + * Result for IActivityManager.startActivity: request was canceled because * app switches are temporarily canceled to ensure the user's last request * (such as pressing home) is performed. * @hide @@ -586,7 +586,7 @@ public class ActivityManager { public static final int START_SWITCHES_CANCELED = FIRST_START_NON_FATAL_ERROR_CODE; /** - * Result for IActivityManaqer.startActivity: a new activity was attempted to be started + * Result for IActivityManager.startActivity: a new activity was attempted to be started * while in Lock Task Mode. * @hide */ @@ -594,55 +594,55 @@ public class ActivityManager { FIRST_START_NON_FATAL_ERROR_CODE + 1; /** - * Result for IActivityManaqer.startActivity: a new activity start was aborted. Never returned + * Result for IActivityManager.startActivity: a new activity start was aborted. Never returned * externally. * @hide */ public static final int START_ABORTED = FIRST_START_NON_FATAL_ERROR_CODE + 2; /** - * Flag for IActivityManaqer.startActivity: do special start mode where + * Flag for IActivityManager.startActivity: do special start mode where * a new activity is launched only if it is needed. * @hide */ public static final int START_FLAG_ONLY_IF_NEEDED = 1<<0; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * debugging. * @hide */ public static final int START_FLAG_DEBUG = 1<<1; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * allocation tracking. * @hide */ public static final int START_FLAG_TRACK_ALLOCATION = 1<<2; /** - * Flag for IActivityManaqer.startActivity: launch the app with + * Flag for IActivityManager.startActivity: launch the app with * native debugging support. * @hide */ public static final int START_FLAG_NATIVE_DEBUGGING = 1<<3; /** - * Flag for IActivityManaqer.startActivity: launch the app for + * Flag for IActivityManager.startActivity: launch the app for * debugging and suspend threads. * @hide */ public static final int START_FLAG_DEBUG_SUSPEND = 1 << 4; /** - * Result for IActivityManaqer.broadcastIntent: success! + * Result for IActivityManager.broadcastIntent: success! * @hide */ public static final int BROADCAST_SUCCESS = 0; /** - * Result for IActivityManaqer.broadcastIntent: attempt to broadcast + * Result for IActivityManager.broadcastIntent: attempt to broadcast * a sticky intent without appropriate permission. * @hide */ @@ -656,20 +656,20 @@ public class ActivityManager { public static final int BROADCAST_FAILED_USER_STOPPED = -2; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent type is unknown. + * Type for IActivityManager.getIntentSender: this PendingIntent type is unknown. * @hide */ public static final int INTENT_SENDER_UNKNOWN = 0; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a sendBroadcast operation. * @hide */ public static final int INTENT_SENDER_BROADCAST = 1; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startActivity operation. * @hide */ @@ -677,21 +677,21 @@ public class ActivityManager { public static final int INTENT_SENDER_ACTIVITY = 2; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for an activity result operation. * @hide */ public static final int INTENT_SENDER_ACTIVITY_RESULT = 3; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startService operation. * @hide */ public static final int INTENT_SENDER_SERVICE = 4; /** - * Type for IActivityManaqer.getIntentSender: this PendingIntent is + * Type for IActivityManager.getIntentSender: this PendingIntent is * for a startForegroundService operation. * @hide */ diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 7eacaac29d4b..bb35e6cf1bfa 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -190,6 +190,7 @@ public class Instrumentation { * @param arguments Any additional arguments that were supplied when the * instrumentation was started. */ + @android.ravenwood.annotation.RavenwoodKeep public void onCreate(Bundle arguments) { } diff --git a/core/java/android/app/contentsuggestions/OWNERS b/core/java/android/app/contentsuggestions/OWNERS index 5f8de77c9dda..3d21a6a2b58f 100644 --- a/core/java/android/app/contentsuggestions/OWNERS +++ b/core/java/android/app/contentsuggestions/OWNERS @@ -1,4 +1,3 @@ # Bug component: 643919 hackz@google.com -volnov@google.com diff --git a/core/java/android/app/ondeviceintelligence/OWNERS b/core/java/android/app/ondeviceintelligence/OWNERS index 85e9e653e6fb..0e8110aeee1b 100644 --- a/core/java/android/app/ondeviceintelligence/OWNERS +++ b/core/java/android/app/ondeviceintelligence/OWNERS @@ -3,4 +3,3 @@ sandeepbandaru@google.com shivanker@google.com hackz@google.com -volnov@google.com diff --git a/core/java/android/app/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..ad2b50e66728 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; @@ -361,6 +363,7 @@ public abstract class BroadcastReceiver { } } + @android.ravenwood.annotation.RavenwoodKeep public BroadcastReceiver() { } diff --git a/core/java/android/content/integrity/OWNERS b/core/java/android/content/integrity/OWNERS index 20c758aedd67..ca65fdab99b1 100644 --- a/core/java/android/content/integrity/OWNERS +++ b/core/java/android/content/integrity/OWNERS @@ -1,5 +1,4 @@ # Bug component: 722021 toddke@android.com -toddke@google.com patb@google.com diff --git a/core/java/android/content/pm/parsing/OWNERS b/core/java/android/content/pm/parsing/OWNERS index 8049d5cb7fa2..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/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java index 9355937b0963..caf80d32f9e8 100644 --- a/core/java/android/hardware/biometrics/BiometricConstants.java +++ b/core/java/android/hardware/biometrics/BiometricConstants.java @@ -319,6 +319,5 @@ public interface BiometricConstants { * Returned from {@link BiometricManager#getLastAuthenticationTime(int)} when there has * been no successful authentication for the given authenticator since boot. */ - @FlaggedApi(Flags.FLAG_LAST_AUTHENTICATION_TIME) long BIOMETRIC_NO_AUTHENTICATION = -1; } diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index a4f7485fcaa5..078787ac31ce 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -113,7 +113,6 @@ public class BiometricManager { * Returned from {@link BiometricManager#getLastAuthenticationTime(int)} when no matching * successful authentication has been performed since boot. */ - @FlaggedApi(Flags.FLAG_LAST_AUTHENTICATION_TIME) public static final long BIOMETRIC_NO_AUTHENTICATION = BiometricConstants.BIOMETRIC_NO_AUTHENTICATION; @@ -770,7 +769,6 @@ public class BiometricManager { */ @RequiresPermission(USE_BIOMETRIC) @ElapsedRealtimeLong - @FlaggedApi(Flags.FLAG_LAST_AUTHENTICATION_TIME) public long getLastAuthenticationTime( @BiometricManager.Authenticators.Types int authenticators) { if (authenticators == 0 diff --git a/core/java/android/hardware/biometrics/flags.aconfig b/core/java/android/hardware/biometrics/flags.aconfig index 047d1fa4f49a..b4c9f4ba3313 100644 --- a/core/java/android/hardware/biometrics/flags.aconfig +++ b/core/java/android/hardware/biometrics/flags.aconfig @@ -2,14 +2,6 @@ package: "android.hardware.biometrics" container: "system" flag { - name: "last_authentication_time" - is_exported: true - namespace: "wallet_integration" - description: "Feature flag for adding getLastAuthenticationTime API to BiometricManager" - bug: "301979982" -} - -flag { name: "add_key_agreement_crypto_object" is_exported: true namespace: "biometrics" 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/Binder.java b/core/java/android/os/Binder.java index 86dc20c497e6..ed75491b8e21 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -149,11 +149,6 @@ public class Binder implements IBinder { private static volatile boolean sStackTrackingEnabled = false; /** - * The extension binder object - */ - private IBinder mExtension = null; - - /** * Enable Binder IPC stack tracking. If enabled, every binder transaction will be logged to * {@link TransactionTracker}. * @@ -1239,9 +1234,7 @@ public class Binder implements IBinder { /** @hide */ @Override - public final @Nullable IBinder getExtension() { - return mExtension; - } + public final native @Nullable IBinder getExtension(); /** * Set the binder extension. @@ -1249,12 +1242,7 @@ public class Binder implements IBinder { * * @hide */ - public final void setExtension(@Nullable IBinder extension) { - mExtension = extension; - setExtensionNative(extension); - } - - private final native void setExtensionNative(@Nullable IBinder extension); + public final native void setExtension(@Nullable IBinder extension); /** * Default implementation rewinds the parcels and calls onTransact. On 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/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index 46ae9d8682ee..320641ded0f9 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -25,8 +25,6 @@ import android.system.OsConstants; import dalvik.system.VMRuntime; -import libcore.io.IoUtils; - import java.io.Closeable; import java.io.FileDescriptor; import java.io.IOException; @@ -65,7 +63,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor, mMemoryRegistration)); + new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** @@ -278,6 +276,7 @@ public final class SharedMemory implements Parcelable, Closeable { */ @Override public void close() { + mFileDescriptor.setInt$(-1); if (mCleaner != null) { mCleaner.clean(); mCleaner = null; @@ -327,20 +326,21 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - private FileDescriptor mFd; + private int mFd; private MemoryRegistration mMemoryReference; - private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { + private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; - IoUtils.setFdOwner(mFd, this); mMemoryReference = memoryReference; } @Override public void run() { - IoUtils.closeQuietly(mFd); - mFd = null; - + try { + FileDescriptor fd = new FileDescriptor(); + fd.setInt$(mFd); + Os.close(fd); + } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; } diff --git a/core/java/android/os/flags.aconfig b/core/java/android/os/flags.aconfig index e2f8f99f1aac..a1a1e313dd9d 100644 --- a/core/java/android/os/flags.aconfig +++ b/core/java/android/os/flags.aconfig @@ -19,6 +19,13 @@ flag { } flag { + name: "disable_madvise_artfile_default" + namespace: "system_performance" + description: "Disables madvise of .art files by default during app start." + bug: "382110550" +} + +flag { name: "disallow_cellular_null_ciphers_restriction" namespace: "cellular_security" description: "Guards a new UserManager user restriction that admins can use to require cellular encryption on their managed devices." 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/accessibility/OWNERS b/core/java/android/view/accessibility/OWNERS index f62b33f1f753..799ef0091f71 100644 --- a/core/java/android/view/accessibility/OWNERS +++ b/core/java/android/view/accessibility/OWNERS @@ -1,4 +1,7 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. # Android Accessibility Framework owners include /services/accessibility/OWNERS 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/accessibility/OWNERS b/core/java/com/android/internal/accessibility/OWNERS index 1265dfa2c441..dac64f47ba7e 100644 --- a/core/java/com/android/internal/accessibility/OWNERS +++ b/core/java/com/android/internal/accessibility/OWNERS @@ -1,4 +1,7 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. # Android Accessibility Framework owners include /services/accessibility/OWNERS
\ No newline at end of file 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/graphics/palette/OWNERS b/core/java/com/android/internal/graphics/palette/OWNERS index 731dca9b128f..df867252c01c 100644 --- a/core/java/com/android/internal/graphics/palette/OWNERS +++ b/core/java/com/android/internal/graphics/palette/OWNERS @@ -1,3 +1,2 @@ -# Bug component: 484670
-dupin@google.com
-jamesoleary@google.com
\ No newline at end of file +# Bug component: 484670 +dupin@google.com 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/BaseCommand.java b/core/java/com/android/internal/os/BaseCommand.java index c85b5d7aa7a6..af763e4c5fa9 100644 --- a/core/java/com/android/internal/os/BaseCommand.java +++ b/core/java/com/android/internal/os/BaseCommand.java @@ -58,15 +58,23 @@ public abstract class BaseCommand { mRawArgs = args; mArgs.init(null, null, null, null, args, 0); + int status = 1; try { onRun(); + status = 0; } catch (IllegalArgumentException e) { onShowUsage(System.err); System.err.println(); System.err.println("Error: " + e.getMessage()); + status = 0; } catch (Exception e) { e.printStackTrace(System.err); - System.exit(1); + } finally { + System.out.flush(); + System.err.flush(); + } + if (status != 0) { + System.exit(status); } } diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index e60879e02b4b..38dc198fa9f8 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -429,6 +429,27 @@ public class ZygoteInit { null /*dependentPackages*/, null /*dependencies*/, false /*isNative*/)); } + if (Flags.enableMediaAndLocationPreload()) { + // As these libraries are technically optional and not necessarily inherited from + // base_system.mk, only cache them if they exist. + final String mediaJarPath = "/system/framework/com.android.media.remotedisplay.jar"; + if (new File(mediaJarPath).exists()) { + libs.add(new SharedLibraryInfo( + mediaJarPath, null /*packageName*/, + null /*codePaths*/, null /*name*/, 0 /*version*/, + SharedLibraryInfo.TYPE_BUILTIN, null /*declaringPackage*/, + null /*dependentPackages*/, null /*dependencies*/, false /*isNative*/)); + } + final String locationJarPath = "/system/framework/com.android.location.provider.jar"; + if (new File(locationJarPath).exists()) { + libs.add(new SharedLibraryInfo( + locationJarPath, null /*packageName*/, + null /*codePaths*/, null /*name*/, 0 /*version*/, + SharedLibraryInfo.TYPE_BUILTIN, null /*declaringPackage*/, + null /*dependentPackages*/, null /*dependencies*/, false /*isNative*/)); + } + } + // WindowManager Extensions is an optional shared library that is required for WindowManager // Jetpack to fully function. Since it is a widely used library, preload it to improve apps // startup performance. diff --git a/core/java/com/android/internal/os/flags.aconfig b/core/java/com/android/internal/os/flags.aconfig index f82df859f49c..16d471b52b79 100644 --- a/core/java/com/android/internal/os/flags.aconfig +++ b/core/java/com/android/internal/os/flags.aconfig @@ -53,6 +53,13 @@ flag { } flag { + name: "enable_media_and_location_preload" + namespace: "system_performance" + description: "Enables zygote preload of non-BCP media and location libraries." + bug: "241474956" +} + +flag { name: "use_transaction_codes_for_unknown_methods" namespace: "stability" description: "Use transaction codes when the method names is unknown" 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 54facab0c3f4..c606744df150 100644 --- a/core/java/com/android/internal/widget/remotecompose/OWNERS +++ b/core/java/com/android/internal/widget/remotecompose/OWNERS @@ -1,8 +1,6 @@ nicolasroard@google.com hoford@google.com -jnichol@google.com sihua@google.com sunnygoyal@google.com oscarad@google.com pinyaoting@google.com -zakcohen@google.com diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 411315ee2800..c76e8e9ef3ce 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -42,6 +42,8 @@ cc_library_shared_for_libandroid_runtime { "-DU_USING_ICU_NAMESPACE=0", + "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", + "-Wall", "-Werror", "-Wextra", @@ -288,6 +290,7 @@ cc_library_shared_for_libandroid_runtime { ], static_libs: [ + "android.os.flags-aconfig-cc", "libasync_safe", "libbinderthreadstateutils", "libdmabufinfo", diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 3bfc1028dd6a..0e4da86b7cc3 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -22,6 +22,7 @@ #include <android-base/parsebool.h> #include <android-base/properties.h> #include <android/graphics/jni_runtime.h> +#include <android_os.h> #include <android_runtime/AndroidRuntime.h> #include <assert.h> #include <binder/IBinder.h> @@ -887,9 +888,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote, bool p madviseWillNeedFileSizeOdex, "-XMadviseWillNeedOdexFileSize:"); - parseRuntimeOption("dalvik.vm.madvise.artfile.size", - madviseWillNeedFileSizeArt, - "-XMadviseWillNeedArtFileSize:"); + // Historically, dalvik.vm.madvise.artfile.size was set to UINT_MAX by default. With the + // disable_madvise_art_default flag rollout, we use this default only when the flag is disabled. + // TODO(b/382110550): Remove this property/flag entirely after validating and ramping. + const char* madvise_artfile_size_default = + android::os::disable_madvise_artfile_default() ? "" : "4294967295"; + parseRuntimeOption("dalvik.vm.madvise.artfile.size", madviseWillNeedFileSizeArt, + "-XMadviseWillNeedArtFileSize:", madvise_artfile_size_default); /* * Profile related options. diff --git a/core/jni/android_content_res_ObbScanner.cpp b/core/jni/android_content_res_ObbScanner.cpp index 760037f63195..5b412ab19e16 100644 --- a/core/jni/android_content_res_ObbScanner.cpp +++ b/core/jni/android_content_res_ObbScanner.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "ObbScanner" diff --git a/core/jni/android_graphics_BLASTBufferQueue.cpp b/core/jni/android_graphics_BLASTBufferQueue.cpp index b9c3bf73f11c..ed547ef7bb1c 100644 --- a/core/jni/android_graphics_BLASTBufferQueue.cpp +++ b/core/jni/android_graphics_BLASTBufferQueue.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "BLASTBufferQueue" diff --git a/core/jni/android_graphics_GraphicBuffer.cpp b/core/jni/android_graphics_GraphicBuffer.cpp index d5765f1907d5..61dbb32c3b9f 100644 --- a/core/jni/android_graphics_GraphicBuffer.cpp +++ b/core/jni/android_graphics_GraphicBuffer.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "GraphicBuffer" diff --git a/core/jni/android_graphics_SurfaceTexture.cpp b/core/jni/android_graphics_SurfaceTexture.cpp index 8dd63cc07b8a..93d1e2eef9e7 100644 --- a/core/jni/android_graphics_SurfaceTexture.cpp +++ b/core/jni/android_graphics_SurfaceTexture.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #undef LOG_TAG #define LOG_TAG "SurfaceTexture" diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index 3f74fac35bb7..13c4fb7517d3 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "Camera-JNI" diff --git a/core/jni/android_hardware_HardwareBuffer.cpp b/core/jni/android_hardware_HardwareBuffer.cpp index 2ea2158d1884..c8059f39a34a 100644 --- a/core/jni/android_hardware_HardwareBuffer.cpp +++ b/core/jni/android_hardware_HardwareBuffer.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "HardwareBuffer" diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp index 56ea52d2ad8b..2864a5718f33 100644 --- a/core/jni/android_hardware_SensorManager.cpp +++ b/core/jni/android_hardware_SensorManager.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "SensorManager" #include <nativehelper/JNIHelp.h> diff --git a/core/jni/android_hardware_camera2_CameraMetadata.cpp b/core/jni/android_hardware_camera2_CameraMetadata.cpp index 041fed74c573..e343438f1260 100644 --- a/core/jni/android_hardware_camera2_CameraMetadata.cpp +++ b/core/jni/android_hardware_camera2_CameraMetadata.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code // #define LOG_NDEBUG 0 #include <memory> diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp index 82570be8e329..828f2eb76c60 100644 --- a/core/jni/android_hardware_camera2_DngCreator.cpp +++ b/core/jni/android_hardware_camera2_DngCreator.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "DngCreator_JNI" diff --git a/core/jni/android_hardware_input_InputWindowHandle.cpp b/core/jni/android_hardware_input_InputWindowHandle.cpp index 69f633420a0d..bfc5419d5d50 100644 --- a/core/jni/android_hardware_input_InputWindowHandle.cpp +++ b/core/jni/android_hardware_input_InputWindowHandle.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "InputWindowHandle" diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp index f9d00edce3fa..c76395921914 100644 --- a/core/jni/android_media_AudioRecord.cpp +++ b/core/jni/android_media_AudioRecord.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp index 9bccf5af7096..a50fb898691c 100644 --- a/core/jni/android_media_AudioSystem.cpp +++ b/core/jni/android_media_AudioSystem.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp index 1557f9ed47a5..a660f0bb5d18 100644 --- a/core/jni/android_media_AudioTrack.cpp +++ b/core/jni/android_media_AudioTrack.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "AudioTrack-JNI" diff --git a/core/jni/android_media_AudioVolumeGroupCallback.cpp b/core/jni/android_media_AudioVolumeGroupCallback.cpp index cb4ddbd119d5..d130a4bc68fa 100644 --- a/core/jni/android_media_AudioVolumeGroupCallback.cpp +++ b/core/jni/android_media_AudioVolumeGroupCallback.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 diff --git a/core/jni/android_media_RemoteDisplay.cpp b/core/jni/android_media_RemoteDisplay.cpp index 3b517f1eafe0..cf96f027bd5e 100644 --- a/core/jni/android_media_RemoteDisplay.cpp +++ b/core/jni/android_media_RemoteDisplay.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "RemoteDisplay" diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp index cc4657ded596..3c590c37adac 100644 --- a/core/jni/android_media_ToneGenerator.cpp +++ b/core/jni/android_media_ToneGenerator.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "ToneGenerator" #include <stdio.h> diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp index 917d28348d04..7e9beefdc38c 100644 --- a/core/jni/android_opengl_EGL14.cpp +++ b/core/jni/android_opengl_EGL14.cpp @@ -632,7 +632,7 @@ not_valid_surface: if (producer == NULL) goto not_valid_surface; - window = new android::Surface(producer, true); + window = android::sp<android::Surface>::make(producer, true); if (window == NULL) goto not_valid_surface; diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp index 734b5f497e2e..8060e6232482 100644 --- a/core/jni/android_os_HwBinder.cpp +++ b/core/jni/android_os_HwBinder.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "android_os_HwBinder" diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp index e554b44233b5..df579af0acb4 100644 --- a/core/jni/android_os_HwBlob.cpp +++ b/core/jni/android_os_HwBlob.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "android_os_HwBlob" diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp index c7866524668f..727455c21e02 100644 --- a/core/jni/android_os_HwParcel.cpp +++ b/core/jni/android_os_HwParcel.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "android_os_HwParcel" diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp index d2d7213e5761..3b567092f6a6 100644 --- a/core/jni/android_os_HwRemoteBinder.cpp +++ b/core/jni/android_os_HwRemoteBinder.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code //#define LOG_NDEBUG 0 #define LOG_TAG "JHwRemoteBinder" diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp index 30d9ea19be39..d5d5521eb8c8 100644 --- a/core/jni/android_os_MessageQueue.cpp +++ b/core/jni/android_os_MessageQueue.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "MessageQueue-JNI" diff --git a/core/jni/android_tracing_PerfettoDataSource.cpp b/core/jni/android_tracing_PerfettoDataSource.cpp index fec28987e7e6..ea896e1678a7 100644 --- a/core/jni/android_tracing_PerfettoDataSource.cpp +++ b/core/jni/android_tracing_PerfettoDataSource.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "NativeJavaPerfettoDs" @@ -489,4 +490,4 @@ int register_android_tracing_PerfettoDataSource(JNIEnv* env) { return 0; } -} // namespace android
\ No newline at end of file +} // namespace android diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index e85b33e2f7b7..7f545164dbc3 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #define LOG_TAG "JavaBinder" -//#define LOG_NDEBUG 0 +// #define LOG_NDEBUG 0 #include "android_util_Binder.h" @@ -74,7 +73,6 @@ static struct bindernative_offsets_t jmethodID mExecTransact; jmethodID mGetInterfaceDescriptor; jmethodID mTransactionCallback; - jmethodID mGetExtension; // Object state. jfieldID mObject; @@ -479,7 +477,7 @@ public: if (b) return b; // b/360067751: constructor may trigger GC, so call outside lock - b = new JavaBBinder(env, obj); + b = sp<JavaBBinder>::make(env, obj); { AutoMutex _l(mLock); @@ -490,12 +488,8 @@ public: if (mVintf) { ::android::internal::Stability::markVintf(b.get()); } - if (mSetExtensionCalled) { - jobject javaIBinderObject = env->CallObjectMethod(obj, gBinderOffsets.mGetExtension); - sp<IBinder> extensionFromJava = ibinderForJavaObject(env, javaIBinderObject); - if (extensionFromJava != nullptr) { - b.get()->setExtension(extensionFromJava); - } + if (mExtension != nullptr) { + b.get()->setExtension(mExtension); } mBinder = b; ALOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%" PRId32 "\n", @@ -521,12 +515,21 @@ public: mVintf = false; } + sp<IBinder> getExtension() { + AutoMutex _l(mLock); + sp<JavaBBinder> b = mBinder.promote(); + if (b != nullptr) { + return b.get()->getExtension(); + } + return mExtension; + } + void setExtension(const sp<IBinder>& extension) { AutoMutex _l(mLock); - mSetExtensionCalled = true; + mExtension = extension; sp<JavaBBinder> b = mBinder.promote(); if (b != nullptr) { - b.get()->setExtension(extension); + b.get()->setExtension(mExtension); } } @@ -538,7 +541,8 @@ private: // is too much binder state here, we can think about making JavaBBinder an // sp here (avoid recreating it) bool mVintf = false; - bool mSetExtensionCalled = false; + + sp<IBinder> mExtension; }; // ---------------------------------------------------------------------------- @@ -640,11 +644,17 @@ public: } else { mObject = env->NewGlobalRef(object); } + } + + void onFirstRef() override { + T::onFirstRef(); + + sp<RecipientList<T>> list = mList.promote(); // These objects manage their own lifetimes so are responsible for final bookkeeping. // The list holds a strong reference to this object. LOG_DEATH_FREEZE("%s Adding JavaRecipient %p to RecipientList %p", logPrefix<T>(), this, list.get()); - list->add(this); + list->add(sp<JavaRecipient>::fromExisting(this)); } void clearReference() { @@ -652,7 +662,7 @@ public: if (list != NULL) { LOG_DEATH_FREEZE("%s Removing JavaRecipient %p from RecipientList %p", logPrefix<T>(), this, list.get()); - list->remove(this); + list->remove(sp<JavaRecipient>::fromExisting(this)); } else { LOG_DEATH_FREEZE("%s clearReference() on JavaRecipient %p but RecipientList wp purged", logPrefix<T>(), this); @@ -934,7 +944,7 @@ struct BinderProxyNativeData { // Frozen state change callbacks for mObject. Reference counted only because // JavaFrozenStateChangeCallback hold a weak reference that can be // temporarily promoted. - sp<FrozenStateChangeCallbackList> mFrozenStateChangCallbackList; + sp<FrozenStateChangeCallbackList> mFrozenStateChangeCallbackList; }; BinderProxyNativeData* getBPNativeData(JNIEnv* env, jobject obj) { @@ -959,8 +969,8 @@ jobject javaObjectForIBinder(JNIEnv* env, const sp<IBinder>& val) } BinderProxyNativeData* nativeData = new BinderProxyNativeData(); - nativeData->mOrgue = new DeathRecipientList; - nativeData->mFrozenStateChangCallbackList = new FrozenStateChangeCallbackList; + nativeData->mOrgue = sp<DeathRecipientList>::make(); + nativeData->mFrozenStateChangeCallbackList = sp<FrozenStateChangeCallbackList>::make(); nativeData->mObject = val; jobject object = env->CallStaticObjectMethod(gBinderProxyOffsets.mClass, @@ -1244,6 +1254,10 @@ static void android_os_Binder_blockUntilThreadAvailable(JNIEnv* env, jobject cla return IPCThreadState::self()->blockUntilThreadAvailable(); } +static jobject android_os_Binder_getExtension(JNIEnv* env, jobject obj) { + JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject); + return javaObjectForIBinder(env, jbh->getExtension()); +} static void android_os_Binder_setExtension(JNIEnv* env, jobject obj, jobject extensionObject) { JavaBBinderHolder* jbh = (JavaBBinderHolder*) env->GetLongField(obj, gBinderOffsets.mObject); @@ -1286,7 +1300,8 @@ static const JNINativeMethod gBinderMethods[] = { { "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder }, { "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer }, { "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable }, - { "setExtensionNative", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension }, + { "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension }, + { "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension }, }; // clang-format on @@ -1303,8 +1318,6 @@ static int int_register_android_os_Binder(JNIEnv* env) gBinderOffsets.mTransactionCallback = GetStaticMethodIDOrDie(env, clazz, "transactionCallback", "(IIII)V"); gBinderOffsets.mObject = GetFieldIDOrDie(env, clazz, "mObject", "J"); - gBinderOffsets.mGetExtension = GetMethodIDOrDie(env, clazz, "getExtension", - "()Landroid/os/IBinder;"); return RegisterMethodsOrDie( env, kBinderPathName, @@ -1563,8 +1576,8 @@ static void android_os_BinderProxy_linkToDeath(JNIEnv* env, jobject obj, LOG_DEATH_FREEZE("linkToDeath: binder=%p recipient=%p\n", target, recipient); if (!target->localBinder()) { - DeathRecipientList* list = nd->mOrgue.get(); - sp<JavaDeathRecipient> jdr = new JavaDeathRecipient(env, recipient, list); + sp<DeathRecipientList> list = nd->mOrgue; + sp<JavaDeathRecipient> jdr = sp<JavaDeathRecipient>::make(env, recipient, list); status_t err = target->linkToDeath(jdr, NULL, flags); if (err != NO_ERROR) { // Failure adding the death recipient, so clear its reference @@ -1640,7 +1653,7 @@ static void android_os_BinderProxy_addFrozenStateChangeCallback( LOG_DEATH_FREEZE("addFrozenStateChangeCallback: binder=%p callback=%p\n", target, callback); if (!target->localBinder()) { - FrozenStateChangeCallbackList* list = nd->mFrozenStateChangCallbackList.get(); + sp<FrozenStateChangeCallbackList> list = nd->mFrozenStateChangeCallbackList; auto jfscc = sp<JavaFrozenStateChangeCallback>::make(env, callback, list); status_t err = target->addFrozenStateChangeCallback(jfscc); if (err != NO_ERROR) { @@ -1674,7 +1687,7 @@ static jboolean android_os_BinderProxy_removeFrozenStateChangeCallback(JNIEnv* e status_t err = NAME_NOT_FOUND; // If we find the matching callback, proceed to unlink using that - FrozenStateChangeCallbackList* list = nd->mFrozenStateChangCallbackList.get(); + FrozenStateChangeCallbackList* list = nd->mFrozenStateChangeCallbackList.get(); sp<JavaRecipient<IBinder::FrozenStateChangeCallback> > origJFSCC = list->find(callback); LOG_DEATH_FREEZE(" removeFrozenStateChangeCallback found list %p and JFSCC %p", list, origJFSCC.get()); @@ -1703,7 +1716,7 @@ static void BinderProxy_destroy(void* rawNativeData) BinderProxyNativeData * nativeData = (BinderProxyNativeData *) rawNativeData; LOG_DEATH_FREEZE("Destroying BinderProxy: binder=%p drl=%p fsccl=%p\n", nativeData->mObject.get(), nativeData->mOrgue.get(), - nativeData->mFrozenStateChangCallbackList.get()); + nativeData->mFrozenStateChangeCallbackList.get()); delete nativeData; IPCThreadState::self()->flushCommands(); } diff --git a/core/jni/android_view_CompositionSamplingListener.cpp b/core/jni/android_view_CompositionSamplingListener.cpp index 59c01dc37593..28616a063730 100644 --- a/core/jni/android_view_CompositionSamplingListener.cpp +++ b/core/jni/android_view_CompositionSamplingListener.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "CompositionSamplingListener" diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index f007cc5a23bd..8587cb27523d 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "DisplayEventReceiver" diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp index 3a1e8835c8db..0b350c5721d8 100644 --- a/core/jni/android_view_InputEventReceiver.cpp +++ b/core/jni/android_view_InputEventReceiver.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "InputEventReceiver" #define ATRACE_TAG ATRACE_TAG_INPUT diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp index 88b02baab924..01309b795567 100644 --- a/core/jni/android_view_InputEventSender.cpp +++ b/core/jni/android_view_InputEventSender.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "InputEventSender" diff --git a/core/jni/android_view_InputQueue.cpp b/core/jni/android_view_InputQueue.cpp index 50d2cbe2ce74..17165d8a03fe 100644 --- a/core/jni/android_view_InputQueue.cpp +++ b/core/jni/android_view_InputQueue.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "InputQueue" diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index ac6298d3d0b4..312c2067d396 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "Surface" diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 17c89f88b441..3f6698b8df14 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "SurfaceControl" #define LOG_NDEBUG 0 diff --git a/core/jni/android_view_SurfaceControlHdrLayerInfoListener.cpp b/core/jni/android_view_SurfaceControlHdrLayerInfoListener.cpp index 443f99a78f02..09cb8116d04b 100644 --- a/core/jni/android_view_SurfaceControlHdrLayerInfoListener.cpp +++ b/core/jni/android_view_SurfaceControlHdrLayerInfoListener.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "SurfaceControlHdrLayerInfoListener" diff --git a/core/jni/android_view_SurfaceSession.cpp b/core/jni/android_view_SurfaceSession.cpp index 0aac07d17cdc..6ad109e80752 100644 --- a/core/jni/android_view_SurfaceSession.cpp +++ b/core/jni/android_view_SurfaceSession.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "SurfaceSession" diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp index 391f515af115..21fe1f020b29 100644 --- a/core/jni/android_view_TextureView.cpp +++ b/core/jni/android_view_TextureView.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #include "jni.h" #include <nativehelper/JNIHelp.h> diff --git a/core/jni/android_view_TunnelModeEnabledListener.cpp b/core/jni/android_view_TunnelModeEnabledListener.cpp index d9ab9571cfbe..fd78a94fc2d9 100644 --- a/core/jni/android_view_TunnelModeEnabledListener.cpp +++ b/core/jni/android_view_TunnelModeEnabledListener.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "TunnelModeEnabledListener" diff --git a/core/jni/android_window_InputTransferToken.cpp b/core/jni/android_window_InputTransferToken.cpp index 5bcea9b7c401..f92d128c7077 100644 --- a/core/jni/android_window_InputTransferToken.cpp +++ b/core/jni/android_window_InputTransferToken.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "InputTransferToken" @@ -137,4 +138,4 @@ int register_android_window_InputTransferToken(JNIEnv* env) { return err; } -} // namespace android
\ No newline at end of file +} // namespace android diff --git a/core/jni/android_window_ScreenCapture.cpp b/core/jni/android_window_ScreenCapture.cpp index 1a52fb74a1e9..59ff746a60a1 100644 --- a/core/jni/android_window_ScreenCapture.cpp +++ b/core/jni/android_window_ScreenCapture.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "ScreenCapture" // #define LOG_NDEBUG 0 diff --git a/core/jni/android_window_WindowInfosListener.cpp b/core/jni/android_window_WindowInfosListener.cpp index c39d5e20aa1c..30846ef99d60 100644 --- a/core/jni/android_window_WindowInfosListener.cpp +++ b/core/jni/android_window_WindowInfosListener.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #define LOG_TAG "WindowInfosListener" 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/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 5aea8485d0c1..75330be2624d 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#undef ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION // TODO:remove this and fix code #include <nativehelper/JNIHelp.h> #include <android_runtime/AndroidRuntime.h> 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/nfc/OWNERS b/core/proto/android/nfc/OWNERS index ca16721eacc1..36823aee4dbb 100644 --- a/core/proto/android/nfc/OWNERS +++ b/core/proto/android/nfc/OWNERS @@ -1 +1 @@ -include platform/packages/apps/Nfc:/OWNERS
\ No newline at end of file +include platform/packages/modules/Nfc:/OWNERS
\ No newline at end of file diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 45c4ea08c09b..c084bdda5c01 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -8910,7 +8910,7 @@ android:permission="android.permission.BIND_JOB_SERVICE" > </service> - <service android:name="com.android.server.ZramMaintenance" + <service android:name="com.android.server.memory.ZramMaintenance" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE" > </service> 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 c01a8a95e021..c735b2712aed 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3183,6 +3183,14 @@ as private. {@see android.view.Display#FLAG_PRIVATE} --> <integer-array translatable="false" name="config_localPrivateDisplayPorts"></integer-array> + <!-- Controls if local secondary displays should be able to steal focus and become top display. + Value specified in the array represents physical port address of each display and displays + in this list due to flag dependencies will be marked with the following flags: + {@see android.view.Display#FLAG_STEAL_TOP_FOCUS_DISABLED} + {@see android.view.Display#FLAG_OWN_FOCUS} --> + <integer-array translatable="false" name="config_localNotStealTopFocusDisplayPorts"> + </integer-array> + <!-- The default mode for the default display. One of the following values (See Display.java): 0 - COLOR_MODE_DEFAULT 7 - COLOR_MODE_SRGB diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index a3d5be79cad2..cbdf5a1ecb1b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -425,6 +425,7 @@ <java-symbol type="bool" name="config_enableProximityService" /> <java-symbol type="bool" name="config_enableVirtualDeviceManager" /> <java-symbol type="array" name="config_localPrivateDisplayPorts" /> + <java-symbol type="array" name="config_localNotStealTopFocusDisplayPorts" /> <java-symbol type="integer" name="config_defaultDisplayDefaultColorMode" /> <java-symbol type="bool" name="config_enableAppWidgetService" /> <java-symbol type="dimen" name="config_pictureInPictureMinAspectRatio" /> diff --git a/core/tests/coretests/src/android/content/pm/OWNERS b/core/tests/coretests/src/android/content/pm/OWNERS index 867336515ce3..c4c40dcaa87a 100644 --- a/core/tests/coretests/src/android/content/pm/OWNERS +++ b/core/tests/coretests/src/android/content/pm/OWNERS @@ -1,5 +1,4 @@ include /core/java/android/content/pm/OWNERS per-file AppSearchPersonTest.java = file:/core/java/android/content/pm/SHORTCUT_OWNERS -per-file SigningDetailsTest.java = cbrubaker@google.com per-file SigningDetailsTest.java = mpgroover@google.com diff --git a/core/tests/featureflagtests/OWNERS b/core/tests/featureflagtests/OWNERS index 2ff4f5ab8807..6784f2891009 100644 --- a/core/tests/featureflagtests/OWNERS +++ b/core/tests/featureflagtests/OWNERS @@ -1,2 +1 @@ -sbasi@google.com -tmfang@google.com
\ No newline at end of file +tmfang@google.com diff --git a/data/etc/OWNERS b/data/etc/OWNERS index 85dae631cac3..1251fce1ce19 100644 --- a/data/etc/OWNERS +++ b/data/etc/OWNERS @@ -1,11 +1,9 @@ include /PACKAGE_MANAGER_OWNERS -cbrubaker@google.com hackbod@android.com hackbod@google.com jeffv@google.com jsharkey@android.com -jsharkey@google.com lorenzo@google.com yamasani@google.com diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 7b96699f7f71..d06fadb1e108 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -210,6 +210,7 @@ <assign-permission name="android.permission.STATSCOMPANION" uid="statsd" /> <assign-permission name="android.permission.UPDATE_APP_OPS_STATS" uid="statsd" /> + <assign-permission name="android.permission.REGISTER_STATS_PULL_ATOM" uid="mmd" /> <assign-permission name="android.permission.REGISTER_STATS_PULL_ATOM" uid="gpu_service" /> <assign-permission name="android.permission.REGISTER_STATS_PULL_ATOM" uid="keystore" /> diff --git a/data/fonts/script/test/test_commandline.py b/data/fonts/script/test/test_commandline.py index 75318cc10e68..dbcba417c5e1 100755 --- a/data/fonts/script/test/test_commandline.py +++ b/data/fonts/script/test/test_commandline.py @@ -75,20 +75,20 @@ class CommandlineTest(unittest.TestCase): functools.partial(CommandlineTest.fileread, filemap), ) - self.assertEquals("output.xml", args.outfile) + self.assertEqual("output.xml", args.outfile) - self.assertEquals(1, len(args.aliases)) - self.assertEquals("sans-serif-thin", args.aliases[0].name) - self.assertEquals("sans-serif", args.aliases[0].to) - self.assertEquals(100, args.aliases[0].weight) + self.assertEqual(1, len(args.aliases)) + self.assertEqual("sans-serif-thin", args.aliases[0].name) + self.assertEqual("sans-serif", args.aliases[0].to) + self.assertEqual(100, args.aliases[0].weight) - self.assertEquals(2, len(args.fallback)) + self.assertEqual(2, len(args.fallback)) # Order is not a part of expectation. Check the expected lang is included. langs = set(["und-Arab", "und-Ethi"]) self.assertTrue(args.fallback[0].lang in langs) self.assertTrue(args.fallback[1].lang in langs) - self.assertEquals(3, len(args.families)) + self.assertEqual(3, len(args.families)) # Order is not a part of expectation. Check the expected name is included. names = set(["sans-serif", "sans-serif-condensed", "roboto-flex"]) self.assertTrue(args.families[0].name in names) diff --git a/data/fonts/script/test/test_xml_builder.py b/data/fonts/script/test/test_xml_builder.py index 24a033b43cbc..f15c51379b46 100755 --- a/data/fonts/script/test/test_xml_builder.py +++ b/data/fonts/script/test/test_xml_builder.py @@ -328,16 +328,16 @@ class XmlBuilderTest(unittest.TestCase): self.expect_xml(xml) def expect_xml(self, xml): - self.assertEquals("sans-serif", xml.families[0].name) # _SANS_SERIF - self.assertEquals("serif", xml.families[1].name) # _SERIF - self.assertEquals("und-Arab", xml.families[2].lang) # __ARABIC - self.assertEquals("elegant", xml.families[2].variant) - self.assertEquals("und-Arab", xml.families[3].lang) # _ARABIC_UI - self.assertEquals("zh-Hans", xml.families[4].lang) # _HANS (_HANS_SERIF) - self.assertEquals(2, len(xml.families[4].fonts)) - self.assertEquals("serif", xml.families[4].fonts[1].fallback_for) - self.assertEquals("ja", xml.families[5].lang) # _HANS (_HANS_SERIF) - self.assertEquals("serif", xml.families[5].fonts[1].fallback_for) + self.assertEqual("sans-serif", xml.families[0].name) # _SANS_SERIF + self.assertEqual("serif", xml.families[1].name) # _SERIF + self.assertEqual("und-Arab", xml.families[2].lang) # __ARABIC + self.assertEqual("elegant", xml.families[2].variant) + self.assertEqual("und-Arab", xml.families[3].lang) # _ARABIC_UI + self.assertEqual("zh-Hans", xml.families[4].lang) # _HANS (_HANS_SERIF) + self.assertEqual(2, len(xml.families[4].fonts)) + self.assertEqual("serif", xml.families[4].fonts[1].fallback_for) + self.assertEqual("ja", xml.families[5].lang) # _HANS (_HANS_SERIF) + self.assertEqual("serif", xml.families[5].fonts[1].fallback_for) if __name__ == "__main__": 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/keystore/java/android/security/GateKeeper.java b/keystore/java/android/security/GateKeeper.java index 464714fe2895..c2792e1f2394 100644 --- a/keystore/java/android/security/GateKeeper.java +++ b/keystore/java/android/security/GateKeeper.java @@ -28,7 +28,7 @@ import android.service.gatekeeper.IGateKeeperService; * * @hide */ -public abstract class GateKeeper { +public final class GateKeeper { public static final long INVALID_SECURE_USER_ID = 0; diff --git a/keystore/java/android/security/keystore/ArrayUtils.java b/keystore/java/android/security/keystore/ArrayUtils.java index f22b6041800f..6472ca9957d0 100644 --- a/keystore/java/android/security/keystore/ArrayUtils.java +++ b/keystore/java/android/security/keystore/ArrayUtils.java @@ -23,7 +23,7 @@ import java.util.function.Consumer; /** * @hide */ -public abstract class ArrayUtils { +public final class ArrayUtils { private ArrayUtils() {} public static String[] nullToEmpty(String[] array) { diff --git a/keystore/java/android/security/keystore/Utils.java b/keystore/java/android/security/keystore/Utils.java index e58b1ccb5370..c38ce8e86a15 100644 --- a/keystore/java/android/security/keystore/Utils.java +++ b/keystore/java/android/security/keystore/Utils.java @@ -23,7 +23,7 @@ import java.util.Date; * * @hide */ -abstract class Utils { +public final class Utils { private Utils() {} static Date cloneIfNotNull(Date value) { diff --git a/keystore/java/android/security/keystore2/KeyStore2ParameterUtils.java b/keystore/java/android/security/keystore2/KeyStore2ParameterUtils.java index 1394bd443f03..9d306ce1ed38 100644 --- a/keystore/java/android/security/keystore2/KeyStore2ParameterUtils.java +++ b/keystore/java/android/security/keystore2/KeyStore2ParameterUtils.java @@ -38,7 +38,9 @@ import java.util.function.Consumer; /** * @hide */ -public abstract class KeyStore2ParameterUtils { +public final class KeyStore2ParameterUtils { + + private KeyStore2ParameterUtils() {} /** * This function constructs a {@link KeyParameter} expressing a boolean value. diff --git a/keystore/java/android/security/keystore2/KeymasterUtils.java b/keystore/java/android/security/keystore2/KeymasterUtils.java index 614e3684c417..02f3f578d03e 100644 --- a/keystore/java/android/security/keystore2/KeymasterUtils.java +++ b/keystore/java/android/security/keystore2/KeymasterUtils.java @@ -16,13 +16,10 @@ package android.security.keystore2; -import android.security.keymaster.KeymasterArguments; import android.security.keymaster.KeymasterDefs; -import android.security.keystore.KeyProperties; import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; -import java.security.ProviderException; import java.security.spec.ECGenParameterSpec; import java.security.spec.ECParameterSpec; import java.security.spec.InvalidParameterSpecException; @@ -30,7 +27,7 @@ import java.security.spec.InvalidParameterSpecException; /** * @hide */ -public abstract class KeymasterUtils { +public final class KeymasterUtils { private KeymasterUtils() {} @@ -86,47 +83,6 @@ public abstract class KeymasterUtils { } } - /** - * Adds {@code KM_TAG_MIN_MAC_LENGTH} tag, if necessary, to the keymaster arguments for - * generating or importing a key. This tag may only be needed for symmetric keys (e.g., HMAC, - * AES-GCM). - */ - public static void addMinMacLengthAuthorizationIfNecessary(KeymasterArguments args, - int keymasterAlgorithm, - int[] keymasterBlockModes, - int[] keymasterDigests) { - switch (keymasterAlgorithm) { - case KeymasterDefs.KM_ALGORITHM_AES: - if (com.android.internal.util.ArrayUtils.contains( - keymasterBlockModes, KeymasterDefs.KM_MODE_GCM)) { - // AES GCM key needs the minimum length of AEAD tag specified. - args.addUnsignedInt(KeymasterDefs.KM_TAG_MIN_MAC_LENGTH, - AndroidKeyStoreAuthenticatedAESCipherSpi.GCM - .MIN_SUPPORTED_TAG_LENGTH_BITS); - } - break; - case KeymasterDefs.KM_ALGORITHM_HMAC: - // HMAC key needs the minimum length of MAC set to the output size of the associated - // digest. This is because we do not offer a way to generate shorter MACs and - // don't offer a way to verify MACs (other than by generating them). - if (keymasterDigests.length != 1) { - throw new ProviderException( - "Unsupported number of authorized digests for HMAC key: " - + keymasterDigests.length - + ". Exactly one digest must be authorized"); - } - int keymasterDigest = keymasterDigests[0]; - int digestOutputSizeBits = getDigestOutputSizeBits(keymasterDigest); - if (digestOutputSizeBits == -1) { - throw new ProviderException( - "HMAC key authorized for unsupported digest: " - + KeyProperties.Digest.fromKeymaster(keymasterDigest)); - } - args.addUnsignedInt(KeymasterDefs.KM_TAG_MIN_MAC_LENGTH, digestOutputSizeBits); - break; - } - } - static String getEcCurveFromKeymaster(int ecCurve) { switch (ecCurve) { case android.hardware.security.keymint.EcCurve.P_224: diff --git a/libs/WindowManager/Shell/OWNERS b/libs/WindowManager/Shell/OWNERS index 394093c6ab30..ab2f3ef94eb6 100644 --- a/libs/WindowManager/Shell/OWNERS +++ b/libs/WindowManager/Shell/OWNERS @@ -1,7 +1,7 @@ -xutan@google.com +jorgegil@google.com pbdr@google.com pragyabajoria@google.com # Give submodule owners in shell resource approval -per-file res*/*/*.xml = atsjenk@google.com, hwwang@google.com, jorgegil@google.com, lbill@google.com, madym@google.com, vaniadesmonda@google.com, pbdr@google.com, tkachenkoi@google.com, mpodolian@google.com, liranb@google.com, pragyabajoria@google.com, uysalorhan@google.com, gsennton@google.com, mattsziklay@google.com, mdehaini@google.com +per-file res*/*/*.xml = atsjenk@google.com, hwwang@google.com, lbill@google.com, madym@google.com, vaniadesmonda@google.com, pbdr@google.com, mpodolian@google.com, liranb@google.com, pragyabajoria@google.com, uysalorhan@google.com, gsennton@google.com, mattsziklay@google.com, mdehaini@google.com per-file res*/*/tv_*.xml = bronger@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/desktopmode/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS index afdda8ff865e..47b3ae8fc11b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/OWNERS @@ -3,7 +3,6 @@ atsjenk@google.com jorgegil@google.com madym@google.com pbdr@google.com -tkachenkoi@google.com vaniadesmonda@google.com pragyabajoria@google.com uysalorhan@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 83b5bf658459..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,9 +2,7 @@ atsjenk@google.com jorgegil@google.com madym@google.com -nmusgrave@google.com pbdr@google.com -tkachenkoi@google.com vaniadesmonda@google.com pragyabajoria@google.com uysalorhan@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/src/com/android/wm/shell/windowdecor/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS index 3f828f547920..992402528f4f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/OWNERS @@ -1,3 +1,2 @@ -jorgegil@google.com mattsziklay@google.com mdehaini@google.com diff --git a/libs/WindowManager/Shell/tests/OWNERS b/libs/WindowManager/Shell/tests/OWNERS index 65e50f86e8fe..5ba90ac66e78 100644 --- a/libs/WindowManager/Shell/tests/OWNERS +++ b/libs/WindowManager/Shell/tests/OWNERS @@ -11,7 +11,6 @@ atsjenk@google.com jorgegil@google.com vaniadesmonda@google.com pbdr@google.com -tkachenkoi@google.com mpodolian@google.com jeremysim@google.com peanutbutter@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/Android.bp b/libs/androidfw/Android.bp index a13dd78a23a1..104ba018fb62 100644 --- a/libs/androidfw/Android.bp +++ b/libs/androidfw/Android.bp @@ -287,6 +287,7 @@ cc_benchmark { "tests/AttributeResolution_bench.cpp", "tests/CursorWindow_bench.cpp", "tests/Generic_bench.cpp", + "tests/LocaleDataLookup_bench.cpp", "tests/SparseEntry_bench.cpp", "tests/Theme_bench.cpp", ], diff --git a/libs/androidfw/LocaleDataLookup.cpp b/libs/androidfw/LocaleDataLookup.cpp index 6e751a77f355..9aacdcb9ca92 100644 --- a/libs/androidfw/LocaleDataLookup.cpp +++ b/libs/androidfw/LocaleDataLookup.cpp @@ -7518,6 +7518,13 @@ const char* lookupLikelyScript(uint32_t packed_lang_region) { } } +/* + * TODO: Consider turning the below switch statement into binary search + * to save the disk space when the table is larger in the future. + * Disassembled code shows that the jump table emitted by clang can be + * 4x larger than the data in disk size, but it depends on the optimization option. + * However, a switch statement will benefit from the future of compiler improvement. + */ bool isLocaleRepresentative(uint32_t language_and_region, const char* script) { const uint64_t packed_locale = ((static_cast<uint64_t>(language_and_region)) << 32u) | @@ -14864,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/androidfw/tests/LocaleDataLookup_bench.cpp b/libs/androidfw/tests/LocaleDataLookup_bench.cpp new file mode 100644 index 000000000000..60ce3b944551 --- /dev/null +++ b/libs/androidfw/tests/LocaleDataLookup_bench.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#include "benchmark/benchmark.h" + +#include "androidfw/LocaleDataLookup.h" + +namespace android { + +static void BM_LocaleDataLookupIsLocaleRepresentative(benchmark::State& state) { + for (auto&& _ : state) { + isLocaleRepresentative(packLocale("en", "US"), "Latn"); + isLocaleRepresentative(packLocale("es", "ES"), "Latn"); + isLocaleRepresentative(packLocale("zh", "CN"), "Hans"); + isLocaleRepresentative(packLocale("pt", "BR"), "Latn"); + isLocaleRepresentative(packLocale("ar", "EG"), "Arab"); + isLocaleRepresentative(packLocale("hi", "IN"), "Deva"); + isLocaleRepresentative(packLocale("jp", "JP"), "Jpan"); + } +} +BENCHMARK(BM_LocaleDataLookupIsLocaleRepresentative); + +static void BM_LocaleDataLookupLikelyScript(benchmark::State& state) { + for (auto&& _ : state) { + lookupLikelyScript(packLocale("en", "")); + lookupLikelyScript(packLocale("es", "")); + lookupLikelyScript(packLocale("zh", "")); + lookupLikelyScript(packLocale("pt", "")); + lookupLikelyScript(packLocale("ar", "")); + lookupLikelyScript(packLocale("hi", "")); + lookupLikelyScript(packLocale("jp", "")); + lookupLikelyScript(packLocale("en", "US")); + lookupLikelyScript(packLocale("es", "ES")); + lookupLikelyScript(packLocale("zh", "CN")); + lookupLikelyScript(packLocale("pt", "BR")); + lookupLikelyScript(packLocale("ar", "EG")); + lookupLikelyScript(packLocale("hi", "IN")); + lookupLikelyScript(packLocale("jp", "JP")); + } +} +BENCHMARK(BM_LocaleDataLookupLikelyScript); + + +} // namespace android diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index 23cd3ce965ff..c75db29c6699 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -203,6 +203,9 @@ java_sdk_library { visibility: [ "//frameworks/base", // Framework ], + impl_library_visibility: [ + "//frameworks/base/ravenwood", + ], srcs: [ ":framework-graphics-srcs", @@ -227,6 +230,14 @@ java_sdk_library { } filegroup { + name: "framework-graphics-ravenwood-policies", + srcs: [ + "framework-graphics-ravenwood-policies.txt", + ], + visibility: ["//frameworks/base/ravenwood"], +} + +filegroup { name: "framework-graphics-srcs", srcs: [ "apex/java/**/*.java", diff --git a/libs/hwui/OWNERS b/libs/hwui/OWNERS index bc174599a4d3..9c06fd5f0225 100644 --- a/libs/hwui/OWNERS +++ b/libs/hwui/OWNERS @@ -3,8 +3,7 @@ alecmouri@google.com djsollen@google.com jreck@google.com -njawad@google.com -scroggo@google.com +nscobie@google.com sumir@google.com # For text, e.g. Typeface, Font, Minikin, etc. diff --git a/libs/hwui/framework-graphics-ravenwood-policies.txt b/libs/hwui/framework-graphics-ravenwood-policies.txt new file mode 100644 index 000000000000..7296225ccfe8 --- /dev/null +++ b/libs/hwui/framework-graphics-ravenwood-policies.txt @@ -0,0 +1 @@ +class android.graphics.ColorMatrix keepclass diff --git a/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/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/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/MediaCodec.java b/media/java/android/media/MediaCodec.java index c9625c405faa..0bea5a98afff 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -44,6 +44,7 @@ import android.os.IHwBinder; import android.os.Looper; import android.os.Message; import android.os.PersistableBundle; +import android.os.Trace; import android.view.Surface; import java.io.IOException; @@ -3103,6 +3104,7 @@ final public class MediaCodec { int index, int offset, int size, long presentationTimeUs, int flags) throws CryptoException { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::queueInputBuffer#java"); if ((flags & BUFFER_FLAG_DECODE_ONLY) != 0 && (flags & BUFFER_FLAG_END_OF_STREAM) != 0) { throw new InvalidBufferFlagsException(EOS_AND_DECODE_ONLY_ERROR_MESSAGE); @@ -3122,6 +3124,8 @@ final public class MediaCodec { } catch (CryptoException | IllegalStateException e) { revalidateByteBuffer(mCachedInputBuffers, index, true /* input */); throw e; + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); } } @@ -3163,6 +3167,7 @@ final public class MediaCodec { public final void queueInputBuffers( int index, @NonNull ArrayDeque<BufferInfo> bufferInfos) { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::queueInputBuffers#java"); synchronized(mBufferLock) { if (mBufferMode == BUFFER_MODE_BLOCK) { throw new IncompatibleWithBlockModelException("queueInputBuffers() " @@ -3178,6 +3183,8 @@ final public class MediaCodec { } catch (CryptoException | IllegalStateException | IllegalArgumentException e) { revalidateByteBuffer(mCachedInputBuffers, index, true /* input */); throw e; + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); } } @@ -3438,6 +3445,7 @@ final public class MediaCodec { @NonNull CryptoInfo info, long presentationTimeUs, int flags) throws CryptoException { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::queueSecureInputBuffer#java"); if ((flags & BUFFER_FLAG_DECODE_ONLY) != 0 && (flags & BUFFER_FLAG_END_OF_STREAM) != 0) { throw new InvalidBufferFlagsException(EOS_AND_DECODE_ONLY_ERROR_MESSAGE); @@ -3457,6 +3465,8 @@ final public class MediaCodec { } catch (CryptoException | IllegalStateException e) { revalidateByteBuffer(mCachedInputBuffers, index, true /* input */); throw e; + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); } } @@ -3487,6 +3497,7 @@ final public class MediaCodec { int index, @NonNull ArrayDeque<BufferInfo> bufferInfos, @NonNull ArrayDeque<CryptoInfo> cryptoInfos) { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::queueSecureInputBuffers#java"); synchronized(mBufferLock) { if (mBufferMode == BUFFER_MODE_BLOCK) { throw new IncompatibleWithBlockModelException("queueSecureInputBuffers() " @@ -3502,6 +3513,8 @@ final public class MediaCodec { } catch (CryptoException | IllegalStateException | IllegalArgumentException e) { revalidateByteBuffer(mCachedInputBuffers, index, true /* input */); throw e; + } finally { + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); } } @@ -3529,6 +3542,7 @@ final public class MediaCodec { * @throws MediaCodec.CodecException upon codec error. */ public final int dequeueInputBuffer(long timeoutUs) { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::dequeueInputBuffer#java"); synchronized (mBufferLock) { if (mBufferMode == BUFFER_MODE_BLOCK) { throw new IncompatibleWithBlockModelException("dequeueInputBuffer() " @@ -3542,6 +3556,7 @@ final public class MediaCodec { validateInputByteBufferLocked(mCachedInputBuffers, res); } } + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); return res; } @@ -4039,6 +4054,7 @@ final public class MediaCodec { * Finish building a queue request and queue the buffers with tunings. */ public void queue() { + Trace.traceBegin(Trace.TRACE_TAG_VIDEO, "MediaCodec::queueRequest-queue#java"); if (!isAccessible()) { throw new IllegalStateException("The request is stale"); } @@ -4067,6 +4083,7 @@ final public class MediaCodec { mTuningKeys, mTuningValues); } clear(); + Trace.traceEnd(Trace.TRACE_TAG_VIDEO); } @NonNull QueueRequest clear() { 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/OWNERS b/media/java/android/media/OWNERS index 8cc42e0bd9b5..a600017119e2 100644 --- a/media/java/android/media/OWNERS +++ b/media/java/android/media/OWNERS @@ -1,6 +1,7 @@ # Bug component: 1344 -fgoldfain@google.com +pshehane@google.com elaurent@google.com +etalvala@google.com lajos@google.com jmtrivi@google.com @@ -15,4 +16,5 @@ per-file ExifInterface.java,ExifInterfaceUtils.java,IMediaHTTPConnection.aidl,IM # Haptics team also works on Ringtone per-file *Ringtone* = file:/services/core/java/com/android/server/vibrator/OWNERS +per-file flags/media_better_together.aconfig = file:platform/frameworks/av:/media/janitors/better_together_OWNERS per-file flags/projection.aconfig = file:projection/OWNERS 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/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java index 371b47fe3421..22f4182ee37b 100644 --- a/media/java/android/media/session/MediaSessionManager.java +++ b/media/java/android/media/session/MediaSessionManager.java @@ -155,11 +155,6 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Notifies that a new {@link MediaSession2} with type {@link Session2Token#TYPE_SESSION} is * created. * <p> @@ -283,16 +278,16 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Gets a list of {@link Session2Token} with type {@link Session2Token#TYPE_SESSION} for the * current user. * <p> * Although this API can be used without any restriction, each session owners can accept or * reject your uses of {@link MediaSession2}. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. * * @return A list of {@link Session2Token}. */ @@ -417,12 +412,12 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Adds a listener to be notified when the {@link #getSession2Tokens()} changes. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. * * @param listener The listener to add */ @@ -433,12 +428,12 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Adds a listener to be notified when the {@link #getSession2Tokens()} changes. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. * * @param listener The listener to add * @param handler The handler to call listener on. @@ -451,16 +446,16 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Adds a listener to be notified when the {@link #getSession2Tokens()} changes. * <p> * The calling application needs to hold the * {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL} permission in order to * add listeners for user ids that do not belong to current process. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. * * @param userHandle The userHandle to listen for changes on * @param listener The listener to add @@ -496,12 +491,12 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Removes the {@link OnSession2TokensChangedListener} to stop receiving session token updates. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. * * @param listener The listener to remove. */ @@ -1061,13 +1056,13 @@ public final class MediaSessionManager { } /** - * This API is not generally intended for third party application developers. - * Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a> - * <a href="{@docRoot}reference/androidx/media2/session/package-summary.html">Media2 session - * Library</a> for consistent behavior across all devices. - * <p> * Listens for changes to the {@link #getSession2Tokens()}. This can be added * using {@link #addOnSession2TokensChangedListener(OnSession2TokensChangedListener, Handler)}. + * <p> + * This API is not generally intended for third party application developers. Apps wanting media + * session functionality should use the + * <a href="{@docRoot}reference/androidx/media3/session/package-summary.html">AndroidX Media3 + * Session Library</a>. */ public interface OnSession2TokensChangedListener { /** 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 8419ce761a4a..ae54c18eb135 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -16,7 +16,9 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaCodec-JNI" +#define ATRACE_TAG ATRACE_TAG_VIDEO #include <utils/Log.h> +#include <utils/Trace.h> #include <type_traits> @@ -1230,63 +1232,73 @@ static void AMessageToCryptoInfo(JNIEnv * env, const jobject & obj, sp<ABuffer> ivBuffer; CryptoPlugin::Mode mode; CryptoPlugin::Pattern pattern; - CHECK(msg->findInt32("mode", (int*)&mode)); - CHECK(msg->findSize("numSubSamples", &numSubSamples)); - CHECK(msg->findBuffer("subSamples", &subSamplesBuffer)); - CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks)); - CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks)); - CHECK(msg->findBuffer("iv", &ivBuffer)); - CHECK(msg->findBuffer("key", &keyBuffer)); - - // subsamples + CryptoPlugin::SubSample *samplesArray = nullptr; + ScopedLocalRef<jbyteArray> keyArray(env, env->NewByteArray(16)); + ScopedLocalRef<jbyteArray> ivArray(env, env->NewByteArray(16)); + jboolean isCopy; + sp<RefBase> cryptoInfosObj; + if (msg->findObject("cryptoInfos", &cryptoInfosObj)) { + sp<CryptoInfosWrapper> cryptoInfos((CryptoInfosWrapper*)cryptoInfosObj.get()); + CHECK(!cryptoInfos->value.empty() && (cryptoInfos->value[0] != nullptr)); + std::unique_ptr<CodecCryptoInfo> &info = cryptoInfos->value[0]; + mode = info->mMode; + numSubSamples = info->mNumSubSamples; + samplesArray = info->mSubSamples; + pattern = info->mPattern; + if (info->mKey != nullptr) { + jbyte * dstKey = env->GetByteArrayElements(keyArray.get(), &isCopy); + memcpy(dstKey, info->mKey, 16); + env->ReleaseByteArrayElements(keyArray.get(), dstKey, 0); + } + if (info->mIv != nullptr) { + jbyte * dstIv = env->GetByteArrayElements(ivArray.get(), &isCopy); + memcpy(dstIv, info->mIv, 16); + env->ReleaseByteArrayElements(ivArray.get(), dstIv, 0); + } + } else { + CHECK(msg->findInt32("mode", (int*)&mode)); + CHECK(msg->findSize("numSubSamples", &numSubSamples)); + CHECK(msg->findBuffer("subSamples", &subSamplesBuffer)); + CHECK(msg->findInt32("encryptBlocks", (int32_t *)&pattern.mEncryptBlocks)); + CHECK(msg->findInt32("skipBlocks", (int32_t *)&pattern.mSkipBlocks)); + CHECK(msg->findBuffer("iv", &ivBuffer)); + CHECK(msg->findBuffer("key", &keyBuffer)); + samplesArray = + (CryptoPlugin::SubSample*)(subSamplesBuffer.get()->data()); + if (keyBuffer.get() != nullptr && keyBuffer->size() > 0) { + jbyte * dstKey = env->GetByteArrayElements(keyArray.get(), &isCopy); + memcpy(dstKey, keyBuffer->data(), keyBuffer->size()); + env->ReleaseByteArrayElements(keyArray.get(), dstKey, 0); + } + if (ivBuffer.get() != nullptr && ivBuffer->size() > 0) { + jbyte * dstIv = env->GetByteArrayElements(ivArray.get(), &isCopy); + memcpy(dstIv, ivBuffer->data(), ivBuffer->size()); + env->ReleaseByteArrayElements(ivArray.get(), dstIv, 0); + } + } ScopedLocalRef<jintArray> samplesOfEncryptedDataArr(env, env->NewIntArray(numSubSamples)); ScopedLocalRef<jintArray> samplesOfClearDataArr(env, env->NewIntArray(numSubSamples)); - jboolean isCopy; - jint *dstEncryptedSamples = - env->GetIntArrayElements(samplesOfEncryptedDataArr.get(), &isCopy); - jint * dstClearSamples = - env->GetIntArrayElements(samplesOfClearDataArr.get(), &isCopy); - - CryptoPlugin::SubSample * samplesArray = - (CryptoPlugin::SubSample*)(subSamplesBuffer.get()->data()); - - for(int i = 0 ; i < numSubSamples ; i++) { - dstEncryptedSamples[i] = samplesArray[i].mNumBytesOfEncryptedData; - dstClearSamples[i] = samplesArray[i].mNumBytesOfClearData; - } - env->ReleaseIntArrayElements(samplesOfEncryptedDataArr.get(), dstEncryptedSamples, 0); - env->ReleaseIntArrayElements(samplesOfClearDataArr.get(), dstClearSamples, 0); - // key and iv - jbyteArray keyArray = NULL; - jbyteArray ivArray = NULL; - if (keyBuffer.get() != nullptr && keyBuffer->size() > 0) { - keyArray = env->NewByteArray(keyBuffer->size()); - jbyte * dstKey = env->GetByteArrayElements(keyArray, &isCopy); - memcpy(dstKey, keyBuffer->data(), keyBuffer->size()); - env->ReleaseByteArrayElements(keyArray,dstKey,0); - } - if (ivBuffer.get() != nullptr && ivBuffer->size() > 0) { - ivArray = env->NewByteArray(ivBuffer->size()); - jbyte *dstIv = env->GetByteArrayElements(ivArray, &isCopy); - memcpy(dstIv, ivBuffer->data(), ivBuffer->size()); - env->ReleaseByteArrayElements(ivArray, dstIv,0); - } - // set samples, key and iv + if (numSubSamples > 0) { + jint *dstEncryptedSamples = + env->GetIntArrayElements(samplesOfEncryptedDataArr.get(), &isCopy); + jint * dstClearSamples = + env->GetIntArrayElements(samplesOfClearDataArr.get(), &isCopy); + for(int i = 0 ; i < numSubSamples ; i++) { + dstEncryptedSamples[i] = samplesArray[i].mNumBytesOfEncryptedData; + dstClearSamples[i] = samplesArray[i].mNumBytesOfClearData; + } + env->ReleaseIntArrayElements(samplesOfEncryptedDataArr.get(), dstEncryptedSamples, 0); + env->ReleaseIntArrayElements(samplesOfClearDataArr.get(), dstClearSamples, 0); + } env->CallVoidMethod( obj, gFields.cryptoInfoSetID, (jint)numSubSamples, samplesOfClearDataArr.get(), samplesOfEncryptedDataArr.get(), - keyArray, - ivArray, + keyArray.get(), + ivArray.get(), mode); - if (keyArray != NULL) { - env->DeleteLocalRef(keyArray); - } - if (ivArray != NULL) { - env->DeleteLocalRef(ivArray); - } // set pattern env->CallVoidMethod( obj, @@ -2106,7 +2118,7 @@ static void android_media_MediaCodec_queueInputBuffer( jlong timestampUs, jint flags) { ALOGV("android_media_MediaCodec_queueInputBuffer"); - + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueInputBuffer#jni"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); if (codec == NULL || codec->initCheck() != OK) { @@ -2192,6 +2204,7 @@ static void android_media_MediaCodec_queueInputBuffers( jint index, jobjectArray objArray) { ALOGV("android_media_MediaCodec_queueInputBuffers"); + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueInputBuffers#jni"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); if (codec == NULL || codec->initCheck() != OK || objArray == NULL) { throwExceptionAsNecessary(env, INVALID_OPERATION, codec); @@ -2431,6 +2444,7 @@ static void android_media_MediaCodec_queueSecureInputBuffer( jobject cryptoInfoObj, jlong timestampUs, jint flags) { + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueSecureInputBuffer#jni"); ALOGV("android_media_MediaCodec_queueSecureInputBuffer"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); @@ -2641,6 +2655,7 @@ static void android_media_MediaCodec_queueSecureInputBuffers( jint index, jobjectArray bufferInfosObjs, jobjectArray cryptoInfoObjs) { + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueSecureInputBuffers#jni"); ALOGV("android_media_MediaCodec_queueSecureInputBuffers"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); @@ -2685,6 +2700,7 @@ static void android_media_MediaCodec_queueSecureInputBuffers( } static jobject android_media_MediaCodec_mapHardwareBuffer(JNIEnv *env, jclass, jobject bufferObj) { + ScopedTrace trace(ATRACE_TAG, "MediaCodec::mapHardwareBuffer#jni"); ALOGV("android_media_MediaCodec_mapHardwareBuffer"); AHardwareBuffer *hardwareBuffer = android_hardware_HardwareBuffer_getNativeHardwareBuffer( env, bufferObj); @@ -2974,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; @@ -3028,6 +3049,7 @@ static void extractBufferFromContext( static void android_media_MediaCodec_native_queueLinearBlock( JNIEnv *env, jobject thiz, jint index, jobject bufferObj, jobjectArray cryptoInfoArray, jobjectArray objArray, jobject keys, jobject values) { + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueLinearBlock#jni"); ALOGV("android_media_MediaCodec_native_queueLinearBlock"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); @@ -3145,6 +3167,7 @@ static void android_media_MediaCodec_native_queueHardwareBuffer( JNIEnv *env, jobject thiz, jint index, jobject bufferObj, jlong presentationTimeUs, jint flags, jobject keys, jobject values) { ALOGV("android_media_MediaCodec_native_queueHardwareBuffer"); + ScopedTrace trace(ATRACE_TAG, "MediaCodec::queueHardwareBuffer#jni"); sp<JMediaCodec> codec = getMediaCodec(env, thiz); 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/nfc-extras/OWNERS b/nfc-extras/OWNERS index 35e9713f5715..2b82bc8ad073 100644 --- a/nfc-extras/OWNERS +++ b/nfc-extras/OWNERS @@ -1,2 +1,2 @@ # Bug component: 48448 -include platform/packages/apps/Nfc:/OWNERS +include platform/packages/modules/Nfc:/OWNERS diff --git a/nfc-non-updatable/OWNERS b/nfc-non-updatable/OWNERS index f46dccd97974..47f209ffa9fa 100644 --- a/nfc-non-updatable/OWNERS +++ b/nfc-non-updatable/OWNERS @@ -1,2 +1,2 @@ # Bug component: 48448 -include platform/packages/apps/Nfc:/OWNERS
\ No newline at end of file +include platform/packages/modules/Nfc:/OWNERS
\ No newline at end of file diff --git a/nfc-non-updatable/flags/flags.aconfig b/nfc-non-updatable/flags/flags.aconfig index 54ded0cddffa..eb30bbe1bfe7 100644 --- a/nfc-non-updatable/flags/flags.aconfig +++ b/nfc-non-updatable/flags/flags.aconfig @@ -198,10 +198,6 @@ flag { bug: "380892385" } -flag { - name: "nfc_hce_latency_events" - is_exported: true - namespace: "wallet_integration" - description: "Enables tracking latency for HCE" - bug: "379849603" -} +# Unless you are adding a flag for a file under nfc-non-updatable, you should +# not add a flag here for Android 16+ targeting features. Use the flags +# in com.android.nfc.module.flags (packages/modules/Nfc/flags) instead. diff --git a/nfc-non-updatable/java/android/nfc/cardemulation/ApduServiceInfo.java b/nfc-non-updatable/java/android/nfc/cardemulation/ApduServiceInfo.java index 93d6eb73dcae..f2a68afbfcbe 100644 --- a/nfc-non-updatable/java/android/nfc/cardemulation/ApduServiceInfo.java +++ b/nfc-non-updatable/java/android/nfc/cardemulation/ApduServiceInfo.java @@ -70,6 +70,11 @@ import java.util.regex.Pattern; public final class ApduServiceInfo implements Parcelable { private static final String TAG = "ApduServiceInfo"; + private static final Pattern PLPF_PATTERN = + Pattern.compile("[0-9A-Fa-f]{2,}[0-9A-Fa-f,\\?,\\*\\.]*"); + private static final Pattern PLF_PATTERN = + Pattern.compile("[0-9A-Fa-f]{2,}"); + /** * Component level {@link android.content.pm.PackageManager.Property PackageManager * .Property} for a system application to change its icon and label @@ -472,7 +477,12 @@ public final class ApduServiceInfo implements Parcelable { boolean autoTransact = a.getBoolean( com.android.internal.R.styleable.PollingLoopFilter_autoTransact, false); - if (!mOnHost && !autoTransact) { + boolean isValidFilter = PLF_PATTERN.matcher(plf).matches() + && plf.length() % 2 == 0; + if (!isValidFilter) { + Log.e(TAG, "Ignoring polling-loop-filter " + plf + + " it is not a valid filter"); + } else if (!mOnHost && !autoTransact) { Log.e(TAG, "Ignoring polling-loop-filter " + plf + " for offhost service that isn't autoTransact"); } else { @@ -489,8 +499,12 @@ public final class ApduServiceInfo implements Parcelable { boolean autoTransact = a.getBoolean( com.android.internal.R.styleable.PollingLoopFilter_autoTransact, false); - if (!mOnHost && !autoTransact) { - Log.e(TAG, "Ignoring polling-loop-filter " + plf + boolean isValidFilter = PLPF_PATTERN.matcher(plf).matches(); + if (!isValidFilter) { + Log.e(TAG, "Ignoring polling-loop-pattern-filter " + plf + + " it is not a valid pattern filter"); + } else if (!mOnHost && !autoTransact) { + Log.e(TAG, "Ignoring polling-loop-pattern-filter " + plf + " for offhost service that isn't autoTransact"); } else { mAutoTransactPatterns.put(Pattern.compile(plf), autoTransact); @@ -572,8 +586,10 @@ public final class ApduServiceInfo implements Parcelable { if (mAutoTransact.getOrDefault(plf.toUpperCase(Locale.ROOT), false)) { return true; } - List<Pattern> patternMatches = mAutoTransactPatterns.keySet().stream() - .filter(p -> p.matcher(plf).matches()).toList(); + boolean isPattern = plf.contains("?") || plf.contains("*"); + List<Pattern> patternMatches = mAutoTransactPatterns.keySet().stream().filter( + p -> isPattern ? p.toString().equals(plf) : p.matcher(plf).matches()).toList(); + if (patternMatches == null || patternMatches.size() == 0) { return false; } @@ -812,10 +828,16 @@ public final class ApduServiceInfo implements Parcelable { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public void addPollingLoopFilter(@NonNull String pollingLoopFilter, boolean autoTransact) { + if (!PLF_PATTERN.matcher(pollingLoopFilter).matches() + || pollingLoopFilter.length() % 2 != 0) { + throw new IllegalArgumentException( + "Polling loop filter must contain an even number of characters 0-9 or A-F" + ); + } if (!mOnHost && !autoTransact) { return; } - mAutoTransact.put(pollingLoopFilter, autoTransact); + mAutoTransact.put(pollingLoopFilter.toUpperCase(Locale.ROOT), autoTransact); } /** @@ -840,10 +862,16 @@ public final class ApduServiceInfo implements Parcelable { @FlaggedApi(Flags.FLAG_NFC_READ_POLLING_LOOP) public void addPollingLoopPatternFilter(@NonNull String pollingLoopPatternFilter, boolean autoTransact) { + if (!PLPF_PATTERN.matcher(pollingLoopPatternFilter).matches()) { + throw new IllegalArgumentException( + "Polling loop pattern filter is invalid" + ); + } if (!mOnHost && !autoTransact) { return; } - mAutoTransactPatterns.put(Pattern.compile(pollingLoopPatternFilter), autoTransact); + mAutoTransactPatterns.put(Pattern.compile( + pollingLoopPatternFilter.toUpperCase(Locale.ROOT)), autoTransact); } /** diff --git a/omapi/OWNERS b/omapi/OWNERS index 39c5c5bdeb09..375d643f7ed1 100644 --- a/omapi/OWNERS +++ b/omapi/OWNERS @@ -1,2 +1,2 @@ # Bug component: 456592 -include platform/packages/apps/Nfc:/OWNERS +include platform/packages/modules/Nfc:/OWNERS diff --git a/omapi/java/android/se/OWNERS b/omapi/java/android/se/OWNERS index 39c5c5bdeb09..375d643f7ed1 100644 --- a/omapi/java/android/se/OWNERS +++ b/omapi/java/android/se/OWNERS @@ -1,2 +1,2 @@ # Bug component: 456592 -include platform/packages/apps/Nfc:/OWNERS +include platform/packages/modules/Nfc:/OWNERS diff --git a/omapi/java/android/se/omapi/OWNERS b/omapi/java/android/se/omapi/OWNERS index 39c5c5bdeb09..375d643f7ed1 100644 --- a/omapi/java/android/se/omapi/OWNERS +++ b/omapi/java/android/se/omapi/OWNERS @@ -1,2 +1,2 @@ # Bug component: 456592 -include platform/packages/apps/Nfc:/OWNERS +include platform/packages/modules/Nfc:/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/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/media/OWNERS b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS index d58add4bb5eb..a34876dd1e0e 100644 --- a/packages/SettingsLib/src/com/android/settingslib/media/OWNERS +++ b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS @@ -3,5 +3,8 @@ ethibodeau@google.com michaelmikhil@google.com apotapov@google.com +# Output Switcher OWNERS +file:/packages/SystemUI/src/com/android/systemui/media/dialog/OWNERS + #Android Media - For minor changes and renames only. aquilescanta@google.com #{LAST_RESORT_SUGGESTION} 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/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java index 60fae3f1fea9..ea40ae4b7dd2 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java @@ -456,11 +456,16 @@ final class SettingsState { @GuardedBy("mLock") private void loadAconfigDefaultValuesLocked(List<String> filePaths) { for (String fileName : filePaths) { - try (FileInputStream inputStream = new FileInputStream(fileName)) { - loadAconfigDefaultValues( - inputStream.readAllBytes(), mNamespaceDefaults, mAconfigDefaultFlags); - } catch (IOException e) { - Slog.e(LOG_TAG, "failed to read protobuf", e); + File f = new File(fileName); + if (f.isFile() && f.canRead()) { + try (FileInputStream inputStream = new FileInputStream(fileName)) { + loadAconfigDefaultValues( + inputStream.readAllBytes(), mNamespaceDefaults, mAconfigDefaultFlags); + } catch (IOException e) { + Slog.e(LOG_TAG, "failed to read protobuf", e); + } + } else { + Slog.d(LOG_TAG, "No protobuf file at " + fileName); } } } diff --git a/packages/Shell/OWNERS b/packages/Shell/OWNERS index dd939bbe041e..b9ddee5026be 100644 --- a/packages/Shell/OWNERS +++ b/packages/Shell/OWNERS @@ -3,12 +3,9 @@ set noparent jsharkey@android.com felipeal@google.com nandana@google.com -svetoslavganov@google.com hackbod@google.com yamasani@google.com -toddke@google.com patb@google.com -cbrubaker@google.com omakoto@google.com michaelwr@google.com ronish@google.com diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS index 7fadcc4e6065..09c0cf7a2ac1 100644 --- a/packages/SystemUI/OWNERS +++ b/packages/SystemUI/OWNERS @@ -13,7 +13,6 @@ alexflo@google.com andonian@google.com amiko@google.com austindelgado@google.com -aroederer@google.com arteiro@google.com asc@google.com awickham@google.com @@ -103,7 +102,6 @@ stwu@google.com syeonlee@google.com sunnygoyal@google.com thiruram@google.com -tkachenkoi@google.com tracyzhou@google.com tsuji@google.com twickham@google.com diff --git a/packages/SystemUI/plugin_core/proguard.flags b/packages/SystemUI/plugin_core/proguard.flags index 6240898b3b93..8b78ba47fdfc 100644 --- a/packages/SystemUI/plugin_core/proguard.flags +++ b/packages/SystemUI/plugin_core/proguard.flags @@ -8,4 +8,7 @@ -keep interface com.android.systemui.plugins.annotations.** { *; } --keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification @com.android.systemui.plugins.annotations.** class * +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification @com.android.systemui.plugins.annotations.** class * { + void <init>(); +} diff --git a/packages/SystemUI/proguard_common.flags b/packages/SystemUI/proguard_common.flags index 02b2bcf8e40d..2224837748a1 100644 --- a/packages/SystemUI/proguard_common.flags +++ b/packages/SystemUI/proguard_common.flags @@ -12,8 +12,14 @@ # Note that we restrict this to SysUISingleton classes, as other registering # classes should either *always* unregister or *never* register from their # constructor. We also keep callback class names for easier debugging. --keepnames @com.android.systemui.util.annotations.WeaklyReferencedCallback class * --keepnames class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback ** +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keepnames @com.android.systemui.util.annotations.WeaklyReferencedCallback class * { + void <init>(); +} +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keepnames class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback ** { + void <init>(); +} -if @com.android.systemui.util.annotations.WeaklyReferencedCallback class * -keepclassmembers,allowaccessmodification @com.android.systemui.dagger.SysUISingleton class * { <1> *; @@ -23,10 +29,16 @@ <1> *; } --keep class androidx.core.app.CoreComponentFactory +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keep class androidx.core.app.CoreComponentFactory { + void <init>(); +} # Keep the wm shell lib --keep class com.android.wm.shell.* +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keep class com.android.wm.shell.* { + void <init>(); +} # Keep the protolog group methods that are called by the generated code -keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { *; 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/accessibility/OWNERS b/packages/SystemUI/src/com/android/systemui/accessibility/OWNERS index 1ed8c068f974..5a59b7aaef56 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/accessibility/OWNERS @@ -1,4 +1,7 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. include /core/java/android/view/accessibility/OWNERS jonesriley@google.com
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS b/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS index b65d29c6a0bb..329aa07fdd9e 100644 --- a/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/ailabs/OWNERS @@ -3,7 +3,5 @@ dupin@google.com linyuh@google.com pauldpong@google.com -praveenj@google.com vicliang@google.com -mfolkerts@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/notetask/OWNERS b/packages/SystemUI/src/com/android/systemui/notetask/OWNERS index 0ec996be72de..9b4902a9e7b2 100644 --- a/packages/SystemUI/src/com/android/systemui/notetask/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/notetask/OWNERS @@ -6,5 +6,4 @@ madym@google.com mgalhardo@google.com petrcermak@google.com stevenckng@google.com -tkachenkoi@google.com -vanjan@google.com
\ No newline at end of file +vanjan@google.com diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegate.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegate.java index 89b9eee52f2a..70221a37a8e4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogDelegate.java @@ -565,8 +565,10 @@ public class InternetDialogDelegate implements } mSecondaryMobileNetworkLayout = mDialogView.findViewById( R.id.secondary_mobile_network_layout); - mSecondaryMobileNetworkLayout.setOnClickListener( - this::onClickConnectedSecondarySub); + if (mCanConfigMobileData) { + mSecondaryMobileNetworkLayout.setOnClickListener( + this::onClickConnectedSecondarySub); + } mSecondaryMobileNetworkLayout.setBackground(mBackgroundOn); TextView mSecondaryMobileTitleText = mDialogView.requireViewById( @@ -599,7 +601,8 @@ public class InternetDialogDelegate implements mDialogView.requireViewById(R.id.secondary_settings_icon); mSecondaryMobileSettingsIcon.setColorFilter( dialog.getContext().getColor(R.color.connected_network_primary_color)); - + mSecondaryMobileSettingsIcon.setVisibility(mCanConfigMobileData ? + View.VISIBLE : View.INVISIBLE); // set secondary visual for default data sub mMobileNetworkLayout.setBackground(mBackgroundOff); mMobileTitleText.setTextAppearance(R.style.TextAppearance_InternetDialog); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS b/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS index 5558ab1e2af2..d284cde2356f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/OWNERS @@ -3,7 +3,6 @@ set noparent # Bug component: 78010 aioana@google.com -aroederer@google.com iyz@google.com jeffdq@google.com juliacr@google.com 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/stylus/OWNERS b/packages/SystemUI/src/com/android/systemui/stylus/OWNERS index 0ec996be72de..9b4902a9e7b2 100644 --- a/packages/SystemUI/src/com/android/systemui/stylus/OWNERS +++ b/packages/SystemUI/src/com/android/systemui/stylus/OWNERS @@ -6,5 +6,4 @@ madym@google.com mgalhardo@google.com petrcermak@google.com stevenckng@google.com -tkachenkoi@google.com -vanjan@google.com
\ No newline at end of file +vanjan@google.com 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/notetask/OWNERS b/packages/SystemUI/tests/src/com/android/systemui/notetask/OWNERS index 0ec996be72de..9b4902a9e7b2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/OWNERS +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/OWNERS @@ -6,5 +6,4 @@ madym@google.com mgalhardo@google.com petrcermak@google.com stevenckng@google.com -tkachenkoi@google.com -vanjan@google.com
\ No newline at end of file +vanjan@google.com diff --git a/packages/SystemUI/tests/src/com/android/systemui/stylus/OWNERS b/packages/SystemUI/tests/src/com/android/systemui/stylus/OWNERS index 0ec996be72de..9b4902a9e7b2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/stylus/OWNERS +++ b/packages/SystemUI/tests/src/com/android/systemui/stylus/OWNERS @@ -6,5 +6,4 @@ madym@google.com mgalhardo@google.com petrcermak@google.com stevenckng@google.com -tkachenkoi@google.com -vanjan@google.com
\ No newline at end of file +vanjan@google.com 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/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 3cb6c5a6bd16..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,12 +43,15 @@ 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; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.HandlerThread; import android.os.Looper; +import android.os.Message; import android.os.Process_ravenwood; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; @@ -73,6 +75,7 @@ import com.android.ravenwood.common.SneakyThrow; import com.android.server.LocalServices; import com.android.server.compat.PlatformCompat; +import org.junit.AssumptionViolatedException; import org.junit.internal.management.ManagementFactory; import org.junit.runner.Description; @@ -80,7 +83,9 @@ 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; import java.util.Objects; import java.util.Random; @@ -91,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. @@ -101,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 @@ -135,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( @@ -181,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 @@ -188,6 +222,7 @@ public class RavenwoodRuntimeEnvironmentController { sInitialized = true; // This is the first call. + final long start = System.currentTimeMillis(); try { globalInitInner(); } catch (Throwable th) { @@ -196,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. @@ -210,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: @@ -228,9 +267,9 @@ public class RavenwoodRuntimeEnvironmentController { RuntimeInit.redirectLogStreams(); dumpCommandLineArgs(); - - // We haven't initialized liblog yet, so directly write to System.out here. - RavenwoodCommonUtils.log(TAG, "globalInitInner()"); + dumpEnvironment(); + dumpJavaProperties(); + dumpOtherInfo(); // Make sure libravenwood_runtime is loaded. System.load(RavenwoodCommonUtils.getJniLibraryPath(RAVENWOOD_NATIVE_RUNTIME_NAME)); @@ -241,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()), @@ -256,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", @@ -283,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()); @@ -329,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); @@ -378,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() { @@ -452,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) { @@ -470,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-----"); } } @@ -524,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; @@ -564,4 +715,50 @@ public class RavenwoodRuntimeEnvironmentController { Log.v(TAG, " " + arg); } } + + 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()); + } + + private static void dumpEnvironment() { + Log.v(TAG, "Environment:"); + dumpMap(System.getenv()); + } + + private static void dumpMap(Map<?, ?> map) { + for (var key : map.keySet().stream().sorted().toList()) { + Log.v(TAG, " " + key + "=" + map.get(key)); + } + } + private static void dumpOtherInfo() { + Log.v(TAG, "Other key information:"); + var jloc = Locale.getDefault(); + Log.v(TAG, " java.util.Locale=" + jloc + " / " + jloc.toLanguageTag()); + var uloc = ULocale.getDefault(); + Log.v(TAG, " android.icu.util.ULocale=" + uloc + " / " + uloc.toLanguageTag()); + + var jtz = java.util.TimeZone.getDefault(); + Log.v(TAG, " java.util.TimeZone=" + jtz.getDisplayName() + " / " + jtz); + + var itz = android.icu.util.TimeZone.getDefault(); + Log.v(TAG, " android.icu.util.TimeZone=" + itz.getDisplayName() + " / " + itz); + } } 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_initializer.cpp b/ravenwood/runtime-jni/ravenwood_initializer.cpp index 391c5d56b212..8a35ade649b2 100644 --- a/ravenwood/runtime-jni/ravenwood_initializer.cpp +++ b/ravenwood/runtime-jni/ravenwood_initializer.cpp @@ -26,6 +26,10 @@ #include <fcntl.h> #include <set> +#include <fstream> +#include <iostream> +#include <string> +#include <cstdlib> #include "jni_helper.h" @@ -182,17 +186,82 @@ static jboolean removeSystemProperty(JNIEnv* env, jclass, jstring javaKey) { } } +// Find the PPID of child_pid using /proc/N/stat. The 4th field is the PPID. +// Also returns child_pid's process name (2nd field). +static pid_t getppid_of(pid_t child_pid, std::string& out_process_name) { + if (child_pid < 0) { + return -1; + } + std::string stat_file = "/proc/" + std::to_string(child_pid) + "/stat"; + std::ifstream stat_stream(stat_file); + if (!stat_stream.is_open()) { + ALOGW("Unable to open '%s': %s", stat_file.c_str(), strerror(errno)); + return -1; + } + + std::string field; + int field_count = 0; + while (std::getline(stat_stream, field, ' ')) { + if (++field_count == 4) { + return atoi(field.c_str()); + } + if (field_count == 2) { + out_process_name = field; + } + } + ALOGW("Unexpected format in '%s'", stat_file.c_str()); + return -1; +} + +// Find atest's PID. Climb up the process tree, and find "atest-py3". +static pid_t find_atest_pid() { + auto ret = getpid(); // self (isolation runner process) + + while (ret != -1) { + std::string proc; + ret = getppid_of(ret, proc); + if (proc == "(atest-py3)") { + return ret; + } + } + + return ret; +} + +// If $RAVENWOOD_LOG_OUT is set, redirect stdout/err to this file. +// Originally it was added to allow to monitor log in realtime, with +// RAVENWOOD_LOG_OUT=$(tty) atest... +// +// As a special case, if $RAVENWOOD_LOG_OUT is set to "-", we try to find +// atest's process and send the output to its stdout. It's sort of hacky, but +// this allows shell redirection to work on Ravenwood output too, +// so e.g. `atest ... |tee atest.log` would work on Ravenwood's output. +// (which wouldn't work with `RAVENWOOD_LOG_OUT=$(tty)`). +// +// Otherwise -- if $RAVENWOOD_LOG_OUT isn't set -- atest/tradefed just writes +// the test's output to its own log file. static void maybeRedirectLog() { auto ravenwoodLogOut = getenv("RAVENWOOD_LOG_OUT"); - if (ravenwoodLogOut == NULL) { + if (ravenwoodLogOut == NULL || *ravenwoodLogOut == '\0') { return; } - ALOGI("RAVENWOOD_LOG_OUT set. Redirecting output to %s", ravenwoodLogOut); + std::string path; + if (strcmp("-", ravenwoodLogOut) == 0) { + pid_t ppid = find_atest_pid(); + if (ppid < 0) { + ALOGI("RAVENWOOD_LOG_OUT set to '-', but unable to find atest's PID"); + return; + } + path = std::format("/proc/{}/fd/1", ppid); + } else { + path = ravenwoodLogOut; + } + ALOGI("RAVENWOOD_LOG_OUT set. Redirecting output to '%s'", path.c_str()); // Redirect stdin / stdout to /dev/tty. - int ttyFd = open(ravenwoodLogOut, O_WRONLY | O_APPEND); + int ttyFd = open(path.c_str(), O_WRONLY | O_APPEND); if (ttyFd == -1) { - ALOGW("$RAVENWOOD_LOG_OUT is set to %s, but failed to open: %s ", ravenwoodLogOut, + ALOGW("$RAVENWOOD_LOG_OUT is set, but failed to open '%s': %s ", path.c_str(), strerror(errno)); return; } 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/OWNERS b/services/accessibility/OWNERS index 4e1175034b5b..ab1e9ffe3bfe 100644 --- a/services/accessibility/OWNERS +++ b/services/accessibility/OWNERS @@ -1,4 +1,7 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. # Android Accessibility Framework owners danielnorman@google.com diff --git a/services/accessibility/java/com/android/server/accessibility/magnification/OWNERS b/services/accessibility/java/com/android/server/accessibility/magnification/OWNERS new file mode 100644 index 000000000000..ff812ad7e7e6 --- /dev/null +++ b/services/accessibility/java/com/android/server/accessibility/magnification/OWNERS @@ -0,0 +1,8 @@ +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 770744. + +juchengchou@google.com +chenjean@google.com +chihtinglo@google.com diff --git a/services/core/Android.bp b/services/core/Android.bp index 717a2d46be0b..1f22f086284c 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -243,6 +243,7 @@ java_library_static { "aconfig_new_storage_flags_lib", "powerstats_flags_lib", "locksettings_flags_lib", + "MmdProperties", "mmd_flags_lib", ], javac_shard_size: 50, @@ -274,9 +275,15 @@ java_genrule { out: ["services.core.priorityboosted.jar"], } +java_genrule_combiner { + name: "services.core.combined", + static_libs: ["services.core.priorityboosted"], + headers: ["services.core.unboosted"], +} + java_library { name: "services.core", - static_libs: ["services.core.priorityboosted"], + static_libs: ["services.core.combined"], } java_library_host { diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java index 23cee9db2138..16209b1dc3d3 100644 --- a/services/core/java/com/android/server/BootReceiver.java +++ b/services/core/java/com/android/server/BootReceiver.java @@ -50,6 +50,7 @@ import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; import com.android.server.am.DropboxRateLimiter; +import libcore.io.IoUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -147,6 +148,10 @@ public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { + if (!Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { + return; + } + // Log boot events in the background to avoid blocking the main thread with I/O new Thread() { @Override @@ -212,6 +217,8 @@ public class BootReceiver extends BroadcastReceiver { } catch (Exception e) { Slog.wtf(TAG, "Error watching for trace events", e); return 0; // Unregister the handler. + } finally { + IoUtils.closeQuietly(fd); } return OnFileDescriptorEventListener.EVENT_INPUT; } diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS index ef769cf6217c..6858e2941ff9 100644 --- a/services/core/java/com/android/server/OWNERS +++ b/services/core/java/com/android/server/OWNERS @@ -9,7 +9,6 @@ per-file DisplayThread.java = michaelwr@google.com, ogunwale@google.com # Zram writeback per-file ZramWriteback.java = minchan@google.com, rajekumar@google.com -per-file ZramMaintenance.java = kawasin@google.com # ServiceWatcher per-file ServiceWatcher.java = sooniln@google.com diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index 19676ebdbfcd..ebaf6bc95a5e 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -126,6 +126,7 @@ import android.provider.Downloads; import android.provider.MediaStore; import android.provider.Settings; import android.service.storage.ExternalStorageService; +import android.sysprop.MmdProperties; import android.text.TextUtils; import android.text.format.DateUtils; import android.util.ArrayMap; @@ -155,6 +156,7 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; +import com.android.server.memory.ZramMaintenance; import com.android.server.pm.Installer; import com.android.server.pm.UserManagerInternal; import com.android.server.storage.AppFuseBridge; @@ -933,22 +935,21 @@ class StorageManagerService extends IStorageManager.Stub // Start scheduling nominally-daily fstrim operations MountServiceIdler.scheduleIdlePass(mContext); - // Toggle zram-enable system property in response to settings - mContext.getContentResolver().registerContentObserver( - Settings.Global.getUriFor(Settings.Global.ZRAM_ENABLED), - false /*notifyForDescendants*/, - new ContentObserver(null /* current thread */) { - @Override - public void onChange(boolean selfChange) { - refreshZramSettings(); - } - }); - refreshZramSettings(); - - if (mmdEnabled()) { - // TODO: b/375432472 - Start zram maintenance only when zram is enabled. + if (mmdEnabled() && MmdProperties.mmd_zram_enabled().orElse(false)) { ZramMaintenance.startZramMaintenance(mContext); } else { + // Toggle zram-enable system property in response to settings + mContext.getContentResolver().registerContentObserver( + Settings.Global.getUriFor(Settings.Global.ZRAM_ENABLED), + false /*notifyForDescendants*/, + new ContentObserver(null /* current thread */) { + @Override + public void onChange(boolean selfChange) { + refreshZramSettings(); + } + }); + refreshZramSettings(); + // Schedule zram writeback unless zram is disabled by persist.sys.zram_enabled String zramPropValue = SystemProperties.get(ZRAM_ENABLED_PROPERTY); if (!zramPropValue.equals("0") @@ -982,7 +983,7 @@ class StorageManagerService extends IStorageManager.Stub // sole writer. SystemProperties.set(ZRAM_ENABLED_PROPERTY, desiredPropertyValue); // Schedule writeback only if zram is being enabled. - if (!mmdEnabled() && desiredPropertyValue.equals("1") + if (desiredPropertyValue.equals("1") && mContext.getResources().getBoolean( com.android.internal.R.bool.config_zramWriteback)) { ZramWriteback.scheduleZramWriteback(mContext); 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/am/AppBatteryTracker.java b/services/core/java/com/android/server/am/AppBatteryTracker.java index 374abe0256c1..0bc816e78e7b 100644 --- a/services/core/java/com/android/server/am/AppBatteryTracker.java +++ b/services/core/java/com/android/server/am/AppBatteryTracker.java @@ -818,8 +818,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy> void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.println("APP BATTERY STATE TRACKER:"); - // Force an update. - updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + if (mInjector.getActivityManagerInternal().isBooted()) { + // Force an update. + updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + } // Force a check. scheduleBgBatteryUsageStatsCheck(); // Wait for its completion (as it runs in handler thread for the sake of thread safe) @@ -878,8 +880,10 @@ final class AppBatteryTracker extends BaseAppStateTracker<AppBatteryPolicy> @Override void dumpAsProto(ProtoOutputStream proto, int uid) { - // Force an update. - updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + if (mInjector.getActivityManagerInternal().isBooted()) { + // Force an update. + updateBatteryUsageStatsIfNecessary(mInjector.currentTimeMillis(), true); + } synchronized (mLock) { final SparseArray<ImmutableBatteryUsage> uidConsumers = mUidBatteryUsageInWindow; if (uid != android.os.Process.INVALID_UID) { 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/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index b09a192990c8..8d0118173030 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -14153,6 +14153,7 @@ public class AudioService extends IAudioService.Stub for (AudioMix mix : mMixes) { mix.setVirtualDeviceId(mAttributionSource.getDeviceId()); } + mAudioSystem.registerPolicyMixes(mMixes, false); return mAudioSystem.registerPolicyMixes(mMixes, true); } finally { Binder.restoreCallingIdentity(identity); @@ -14677,11 +14678,13 @@ public class AudioService extends IAudioService.Stub final String key = "additional_output_device_delay"; final String reply = AudioSystem.getParameters( key + "=" + device.getInternalType() + "," + device.getAddress()); - long delayMillis; - try { - delayMillis = Long.parseLong(reply.substring(key.length() + 1)); - } catch (NullPointerException e) { - delayMillis = 0; + long delayMillis = 0; + if (reply.contains(key)) { + try { + delayMillis = Long.parseLong(reply.substring(key.length() + 1)); + } catch (NullPointerException e) { + delayMillis = 0; + } } return delayMillis; } @@ -14707,11 +14710,13 @@ public class AudioService extends IAudioService.Stub final String key = "max_additional_output_device_delay"; final String reply = AudioSystem.getParameters( key + "=" + device.getInternalType() + "," + device.getAddress()); - long delayMillis; - try { - delayMillis = Long.parseLong(reply.substring(key.length() + 1)); - } catch (NullPointerException e) { - delayMillis = 0; + long delayMillis = 0; + if (reply.contains(key)) { + try { + delayMillis = Long.parseLong(reply.substring(key.length() + 1)); + } catch (NullPointerException e) { + delayMillis = 0; + } } return delayMillis; } diff --git a/services/core/java/com/android/server/biometrics/AuthService.java b/services/core/java/com/android/server/biometrics/AuthService.java index 2d802b21cf03..b6768c9c087a 100644 --- a/services/core/java/com/android/server/biometrics/AuthService.java +++ b/services/core/java/com/android/server/biometrics/AuthService.java @@ -38,7 +38,6 @@ import android.hardware.biometrics.AuthenticationStateListener; import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.ComponentInfoInternal; -import android.hardware.biometrics.Flags; import android.hardware.biometrics.IAuthService; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricService; @@ -399,12 +398,6 @@ public class AuthService extends SystemService { final long identity = Binder.clearCallingIdentity(); try { - // We can't do this above because we need the READ_DEVICE_CONFIG permission, which - // the calling user may not possess. - if (!Flags.lastAuthenticationTime()) { - throw new UnsupportedOperationException(); - } - return mBiometricService.getLastAuthenticationTime(userId, authenticators); } finally { Binder.restoreCallingIdentity(identity); diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index bd1a2679110d..bc1e3c7171be 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -43,7 +43,6 @@ import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.biometrics.BiometricConstants; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.BiometricStateListener; -import android.hardware.biometrics.Flags; import android.hardware.biometrics.IBiometricAuthenticator; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricSensorReceiver; @@ -100,8 +99,8 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; -import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; /** @@ -784,10 +783,6 @@ public class BiometricService extends SystemService { int userId, @Authenticators.Types int authenticators) { super.getLastAuthenticationTime_enforcePermission(); - if (!Flags.lastAuthenticationTime()) { - throw new UnsupportedOperationException(); - } - Slogf.d(TAG, "getLastAuthenticationTime(userId=%d, authenticators=0x%x)", userId, authenticators); diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index 0570b2ab510b..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; @@ -725,6 +724,11 @@ final class LocalDisplayAdapter extends DisplayAdapter { if (isDisplayPrivate(physicalAddress)) { mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE; } + + if (isDisplayStealTopFocusDisabled(physicalAddress)) { + mInfo.flags |= DisplayDeviceInfo.FLAG_OWN_FOCUS; + mInfo.flags |= DisplayDeviceInfo.FLAG_STEAL_TOP_FOCUS_DISABLED; + } } if (DisplayCutout.getMaskBuiltInDisplayCutout(res, mInfo.uniqueId)) { @@ -982,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 { @@ -1395,6 +1401,23 @@ final class LocalDisplayAdapter extends DisplayAdapter { } return false; } + + private boolean isDisplayStealTopFocusDisabled(DisplayAddress.Physical physicalAddress) { + if (physicalAddress == null) { + return false; + } + final Resources res = getOverlayContext().getResources(); + int[] ports = res.getIntArray(R.array.config_localNotStealTopFocusDisplayPorts); + if (ports != null) { + int port = physicalAddress.getPort(); + for (int p : ports) { + if (p == port) { + return true; + } + } + } + return false; + } } private boolean hdrTypesEqual(int[] modeHdrTypes, int[] recordHdrTypes) { @@ -1446,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/recoverablekeystore/OWNERS b/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS index bb487fb52c9f..ebf7e6bed064 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/OWNERS +++ b/services/core/java/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/core/java/com/android/server/logcat/OWNERS b/services/core/java/com/android/server/logcat/OWNERS index 33e1873d91fa..2913cc9bf19e 100644 --- a/services/core/java/com/android/server/logcat/OWNERS +++ b/services/core/java/com/android/server/logcat/OWNERS @@ -3,6 +3,5 @@ cbrubaker@google.com eunjeongshin@google.com georgechan@google.com -jsharkey@google.com wenhaowang@google.com xiaozhenl@google.com diff --git a/services/core/java/com/android/server/memory/OWNERS b/services/core/java/com/android/server/memory/OWNERS new file mode 100644 index 000000000000..dc0e89892e43 --- /dev/null +++ b/services/core/java/com/android/server/memory/OWNERS @@ -0,0 +1,3 @@ +include /MEMORY_OWNERS + +per-file ZramMaintenance.java = kawasin@google.com diff --git a/services/core/java/com/android/server/ZramMaintenance.java b/services/core/java/com/android/server/memory/ZramMaintenance.java index cdb48122e321..560d2d741dd9 100644 --- a/services/core/java/com/android/server/ZramMaintenance.java +++ b/services/core/java/com/android/server/memory/ZramMaintenance.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.server; +package com.android.server.memory; import android.app.job.JobInfo; import android.app.job.JobParameters; @@ -24,11 +24,15 @@ import android.content.ComponentName; import android.content.Context; import android.os.IBinder; import android.os.IMmd; +import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; +import android.provider.DeviceConfig; import android.util.Slog; +import com.android.internal.annotations.VisibleForTesting; + import java.time.Duration; /** @@ -46,43 +50,45 @@ public class ZramMaintenance extends JobService { private static final String TAG = ZramMaintenance.class.getName(); // Job id must be unique across all clients of the same uid. ZramMaintenance uses the bug number // as the job id. - private static final int JOB_ID = 375432472; + @VisibleForTesting + public static final int JOB_ID = 375432472; private static final ComponentName sZramMaintenance = new ComponentName("android", ZramMaintenance.class.getName()); + @VisibleForTesting + public static final String KEY_CHECK_STATUS = "check_status"; + private static final String SYSTEM_PROPERTY_PREFIX = "mm."; private static final String FIRST_DELAY_SECONDS_PROP = - "mm.zram.maintenance.first_delay_seconds"; + "zram.maintenance.first_delay_seconds"; // The default is 1 hour. private static final long DEFAULT_FIRST_DELAY_SECONDS = 3600; private static final String PERIODIC_DELAY_SECONDS_PROP = - "mm.zram.maintenance.periodic_delay_seconds"; + "zram.maintenance.periodic_delay_seconds"; // The default is 1 hour. private static final long DEFAULT_PERIODIC_DELAY_SECONDS = 3600; private static final String REQUIRE_DEVICE_IDLE_PROP = - "mm.zram.maintenance.require_device_idle"; + "zram.maintenance.require_device_idle"; private static final boolean DEFAULT_REQUIRE_DEVICE_IDLE = true; private static final String REQUIRE_BATTERY_NOT_LOW_PROP = - "mm.zram.maintenance.require_battry_not_low"; + "zram.maintenance.require_battery_not_low"; private static final boolean DEFAULT_REQUIRE_BATTERY_NOT_LOW = true; @Override public boolean onStartJob(JobParameters params) { - IBinder binder = ServiceManager.getService("mmd"); - if (binder != null) { - IMmd mmd = IMmd.Stub.asInterface(binder); - try { - mmd.doZramMaintenance(); - } catch (RemoteException e) { - Slog.e(TAG, "Failed to doZramMaintenance", e); + new Thread("ZramMaintenance") { + @Override + public void run() { + try { + IBinder binder = ServiceManager.getService("mmd"); + IMmd mmd = IMmd.Stub.asInterface(binder); + startJob(ZramMaintenance.this, params, mmd); + } finally { + jobFinished(params, false); + } } - } else { - Slog.w(TAG, "binder not found"); - } - Duration delay = Duration.ofSeconds(SystemProperties.getLong(PERIODIC_DELAY_SECONDS_PROP, - DEFAULT_PERIODIC_DELAY_SECONDS)); - scheduleZramMaintenance(this, delay); + }.start(); return true; } @@ -92,27 +98,75 @@ public class ZramMaintenance extends JobService { } /** + * This is public to test ZramMaintenance logic. + * + * <p> + * We need to pass mmd as parameter because we can't mock "IMmd.Stub.asInterface". + * + * <p> + * Since IMmd.isZramMaintenanceSupported() is blocking call, this method should be executed on + * a worker thread. + */ + @VisibleForTesting + public static void startJob(Context context, JobParameters params, IMmd mmd) { + boolean checkStatus = params.getExtras().getBoolean(KEY_CHECK_STATUS); + if (mmd != null) { + try { + if (checkStatus && !mmd.isZramMaintenanceSupported()) { + Slog.i(TAG, "zram maintenance is not supported"); + return; + } + // Status check is required before the first doZramMaintenanceAsync() call once. + checkStatus = false; + + mmd.doZramMaintenanceAsync(); + } catch (RemoteException e) { + Slog.e(TAG, "Failed to binder call to mmd", e); + } + } else { + Slog.w(TAG, "binder not found"); + } + Duration delay = Duration.ofSeconds(getLongProperty(PERIODIC_DELAY_SECONDS_PROP, + DEFAULT_PERIODIC_DELAY_SECONDS)); + scheduleZramMaintenance(context, delay, checkStatus); + } + + /** * Starts periodical zram maintenance. */ public static void startZramMaintenance(Context context) { Duration delay = Duration.ofSeconds( - SystemProperties.getLong(FIRST_DELAY_SECONDS_PROP, DEFAULT_FIRST_DELAY_SECONDS)); - scheduleZramMaintenance(context, delay); + getLongProperty(FIRST_DELAY_SECONDS_PROP, DEFAULT_FIRST_DELAY_SECONDS)); + scheduleZramMaintenance(context, delay, true); } - private static void scheduleZramMaintenance(Context context, Duration delay) { + private static void scheduleZramMaintenance(Context context, Duration delay, + boolean checkStatus) { JobScheduler js = context.getSystemService(JobScheduler.class); if (js != null) { + final PersistableBundle bundle = new PersistableBundle(); + bundle.putBoolean(KEY_CHECK_STATUS, checkStatus); js.schedule(new JobInfo.Builder(JOB_ID, sZramMaintenance) .setMinimumLatency(delay.toMillis()) .setRequiresDeviceIdle( - SystemProperties.getBoolean(REQUIRE_DEVICE_IDLE_PROP, + getBooleanProperty(REQUIRE_DEVICE_IDLE_PROP, DEFAULT_REQUIRE_DEVICE_IDLE)) .setRequiresBatteryNotLow( - SystemProperties.getBoolean(REQUIRE_BATTERY_NOT_LOW_PROP, + getBooleanProperty(REQUIRE_BATTERY_NOT_LOW_PROP, DEFAULT_REQUIRE_BATTERY_NOT_LOW)) + .setExtras(bundle) .build()); } } + + private static long getLongProperty(String name, long defaultValue) { + return DeviceConfig.getLong(DeviceConfig.NAMESPACE_MM, name, + SystemProperties.getLong(SYSTEM_PROPERTY_PREFIX + name, defaultValue)); + } + + private static boolean getBooleanProperty(String name, boolean defaultValue) { + return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_MM, name, + SystemProperties.getBoolean(SYSTEM_PROPERTY_PREFIX + name, defaultValue)); + } } diff --git a/services/core/java/com/android/server/notification/OWNERS b/services/core/java/com/android/server/notification/OWNERS index 9f16662fd749..43c68d10b3ce 100644 --- a/services/core/java/com/android/server/notification/OWNERS +++ b/services/core/java/com/android/server/notification/OWNERS @@ -2,8 +2,7 @@ juliacr@google.com yurilin@google.com -aroederer@google.com matiashe@google.com valiiftime@google.com jeffdq@google.com -dsandler@android.com
\ No newline at end of file +dsandler@android.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..9edbaa8fadd9 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -5144,7 +5144,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { "Session " + sessionId + " is a parent of multi-package session and " + "requestUserPreapproval on the parent session isn't supported."); } - + if (statusReceiver == null) { + throw new IllegalArgumentException("Status receiver cannot be null."); + } synchronized (mLock) { assertPreparedAndNotSealedLocked("request of session " + sessionId); mPreapprovalDetails = details; @@ -5497,6 +5499,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { */ private static void sendOnUserActionRequired(Context context, IntentSender target, int sessionId, Intent intent) { + if (target == null) { + Slog.e(TAG, "Missing receiver for pending user action."); + return; + } final Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_SESSION_ID, sessionId); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_PENDING_USER_ACTION); diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 2a03dcbdfbc5..6f9d53d1320a 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -1476,7 +1476,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService ArchiveState archiveState; synchronized (mLock) { PackageSetting ps = mSettings.getPackageLPr(packageName); - if (ps == null) { + if (ps == null || snapshot.shouldFilterApplication(ps, binderUid, userId)) { return null; } var psi = ps.getUserStateOrDefault(userId); 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/ShutdownCheckPoints.java b/services/core/java/com/android/server/power/ShutdownCheckPoints.java index dafaa7d5f134..399e214aa955 100644 --- a/services/core/java/com/android/server/power/ShutdownCheckPoints.java +++ b/services/core/java/com/android/server/power/ShutdownCheckPoints.java @@ -350,17 +350,23 @@ public final class ShutdownCheckPoints { private final ShutdownCheckPoints mInstance; private final File mBaseFile; + private final File mBaseDir; private final int mFileCountLimit; FileDumperThread(ShutdownCheckPoints instance, File baseFile, int fileCountLimit) { mInstance = instance; mBaseFile = baseFile; + mBaseDir = baseFile.getParentFile(); mFileCountLimit = fileCountLimit; } @Override public void run() { - mBaseFile.getParentFile().mkdirs(); + if (!mBaseDir.exists()) { + mBaseDir.mkdirs(); + mBaseDir.setExecutable(true, false); + mBaseDir.setReadable(true, false); + } File[] checkPointFiles = listCheckPointsFiles(); int filesToDelete = checkPointFiles.length - mFileCountLimit + 1; @@ -375,7 +381,7 @@ public final class ShutdownCheckPoints { private File[] listCheckPointsFiles() { String filePrefix = mBaseFile.getName() + "-"; - File[] files = mBaseFile.getParentFile().listFiles(new FilenameFilter() { + File[] files = mBaseDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (!name.startsWith(filePrefix)) { @@ -412,6 +418,7 @@ public final class ShutdownCheckPoints { } } mBaseFile.renameTo(file); + file.setReadable(true, false); } } } diff --git a/services/core/java/com/android/server/power/stats/OWNERS b/services/core/java/com/android/server/power/stats/OWNERS index 4068e2bc03b7..208b2ddb5e54 100644 --- a/services/core/java/com/android/server/power/stats/OWNERS +++ b/services/core/java/com/android/server/power/stats/OWNERS @@ -1 +1,4 @@ +# Bug component: 987260 +set noparent + include /BATTERY_STATS_OWNERS diff --git a/services/core/java/com/android/server/security/OWNERS b/services/core/java/com/android/server/security/OWNERS index fa4bf228c683..7a31a0006bb9 100644 --- a/services/core/java/com/android/server/security/OWNERS +++ b/services/core/java/com/android/server/security/OWNERS @@ -3,5 +3,6 @@ include /core/java/android/security/OWNERS per-file *AttestationVerification* = file:/core/java/android/security/attestationverification/OWNERS +per-file *CertificateRevocationStatus* = file:/core/java/android/security/attestationverification/OWNERS per-file FileIntegrity*.java = victorhsieh@google.com per-file KeyChainSystemService.java = file:platform/packages/apps/KeyChain:/OWNERS diff --git a/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java b/services/core/java/com/android/server/sensorprivacy/SensorPrivacyService.java index 81217014bafe..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; @@ -536,8 +535,12 @@ public final class SensorPrivacyService extends SystemService { user.getIdentifier()); String inputMethodPackageName = null; if (inputMethodComponent != null) { - inputMethodPackageName = ComponentName.unflattenFromString( - inputMethodComponent).getPackageName(); + ComponentName component = ComponentName.unflattenFromString(inputMethodComponent); + if (component != null) { + inputMethodPackageName = component.getPackageName(); + } else { + Log.w(TAG, "Failed to parse inputMethodComponent: " + inputMethodComponent); + } } int capability; @@ -2004,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/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/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 4f9b1ccce6b1..1a3f54ae9a18 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -723,8 +723,14 @@ public class WindowManagerService extends IWindowManager.Stub new WallpaperVisibilityListeners(); IDisplayChangeWindowController mDisplayChangeController = null; - private final DeathRecipient mDisplayChangeControllerDeath = - () -> mDisplayChangeController = null; + private final DeathRecipient mDisplayChangeControllerDeath = new DeathRecipient() { + @Override + public void binderDied() { + synchronized (mGlobalLock) { + mDisplayChangeController = null; + } + } + }; final DisplayWindowListenerController mDisplayNotificationController; final TaskSystemBarsListenerController mTaskSystemBarsListenerController; 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..8d87925fbe45 100644 --- a/services/core/jni/stats/OWNERS +++ b/services/core/jni/stats/OWNERS @@ -1,8 +1,6 @@ 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/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 7972d9c6fba3..e4ab7685d787 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -875,6 +875,17 @@ public final class SystemServer implements Dumpable { SystemServiceRegistry.sEnableServiceNotFoundWtf = true; + // Prepare the thread pool for init tasks that can be parallelized + SystemServerInitThreadPool tp = SystemServerInitThreadPool.start(); + mDumper.addDumpable(tp); + + if (android.server.Flags.earlySystemConfigInit()) { + // SystemConfig init is expensive, so enqueue the work as early as possible to allow + // concurrent execution before it's needed (typically by ActivityManagerService). + // As native library loading is also expensive, this is a good place to start. + startSystemConfigInit(t); + } + // Initialize native services. System.loadLibrary("android_servers"); @@ -907,9 +918,6 @@ public final class SystemServer implements Dumpable { mDumper.addDumpable(mSystemServiceManager); LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); - // Prepare the thread pool for init tasks that can be parallelized - SystemServerInitThreadPool tp = SystemServerInitThreadPool.start(); - mDumper.addDumpable(tp); // Lazily load the pre-installed system font map in SystemServer only if we're not doing // the optimized font loading in the FontManagerService. @@ -1057,6 +1065,14 @@ public final class SystemServer implements Dumpable { } } + private void startSystemConfigInit(TimingsTraceAndSlog t) { + Slog.i(TAG, "Reading configuration..."); + final String tagSystemConfig = "ReadingSystemConfig"; + t.traceBegin(tagSystemConfig); + SystemServerInitThreadPool.submit(SystemConfig::getInstance, tagSystemConfig); + t.traceEnd(); + } + private void createSystemContext() { ActivityThread activityThread = ActivityThread.systemMain(); mSystemContext = activityThread.getSystemContext(); @@ -1095,11 +1111,11 @@ public final class SystemServer implements Dumpable { mDumper.addDumpable(watchdog); t.traceEnd(); - Slog.i(TAG, "Reading configuration..."); - final String TAG_SYSTEM_CONFIG = "ReadingSystemConfig"; - t.traceBegin(TAG_SYSTEM_CONFIG); - SystemServerInitThreadPool.submit(SystemConfig::getInstance, TAG_SYSTEM_CONFIG); - t.traceEnd(); + // Legacy entry point for starting SystemConfig init, only needed if the early init flag is + // disabled and we haven't already triggered init before bootstrap services. + if (!android.server.Flags.earlySystemConfigInit()) { + startSystemConfigInit(t); + } // Orchestrates some ProtoLogging functionality. if (android.tracing.Flags.clientSideProtoLogging()) { diff --git a/services/java/com/android/server/flags.aconfig b/services/java/com/android/server/flags.aconfig index ec74ef191b81..7ab209aa5efb 100644 --- a/services/java/com/android/server/flags.aconfig +++ b/services/java/com/android/server/flags.aconfig @@ -10,6 +10,13 @@ flag { } flag { + namespace: "system_performance" + name: "early_system_config_init" + description: "Perform earlier initialization of SystemConfig in system server startup." + bug: "383869534" +} + +flag { name: "remove_text_service" namespace: "wear_frameworks" description: "Remove TextServiceManagerService on Wear" 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/proguard.flags b/services/proguard.flags index cdd41abf6c7c..1ab10dcd847b 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -15,7 +15,10 @@ # APIs referenced by dependent JAR files and modules # TODO(b/300514883): Pull @SystemApi keep rules from system-api.pro. --keep interface android.annotation.SystemApi +# TODO(b/373579455): Evaluate if <init> needs to be kept. +-keep interface android.annotation.SystemApi { + void <init>(); +} -keep @android.annotation.SystemApi class * { public protected *; } diff --git a/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java b/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java index 120cc84193cd..0dd645587cc7 100644 --- a/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java +++ b/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java @@ -250,6 +250,34 @@ public class LocalDisplayAdapterTest { PORT_C, false); } + /** + * Confirm that display is marked as trusted, has own focus, disables steal top focus when it + * is listed in com.android.internal.R.array.config_localNotStealTopFocusDisplayPorts. + */ + @Test + public void testStealTopFocusDisabledDisplay() throws Exception { + setUpDisplay(new FakeDisplay(PORT_A)); + setUpDisplay(new FakeDisplay(PORT_B)); + setUpDisplay(new FakeDisplay(PORT_C)); + updateAvailableDisplays(); + + doReturn(new int[]{ PORT_B }).when(mMockedResources).getIntArray( + com.android.internal.R.array.config_localNotStealTopFocusDisplayPorts); + mAdapter.registerLocked(); + + waitForHandlerToComplete(mHandler, HANDLER_WAIT_MS); + + // This should not have the flags + assertNotStealTopFocusFlag(mListener.addedDisplays.get(0).getDisplayDeviceInfoLocked(), + PORT_A, false); + // This should have the flags + assertNotStealTopFocusFlag(mListener.addedDisplays.get(1).getDisplayDeviceInfoLocked(), + PORT_B, true); + // This should not have the flags + assertNotStealTopFocusFlag(mListener.addedDisplays.get(2).getDisplayDeviceInfoLocked(), + PORT_C, false); + } + @Test public void testSupportedDisplayModesGetOverriddenWhenDisplayIsUpdated() throws InterruptedException { @@ -314,6 +342,42 @@ public class LocalDisplayAdapterTest { } /** + * Confirm that all local displays are not trusted, do not have their own focus, and do not + * steal top focus when config_localNotStealTopFocusDisplayPorts is empty: + */ + @Test + public void testDisplayFlagsForNoConfigLocalNotStealTopFocusDisplayPorts() throws Exception { + setUpDisplay(new FakeDisplay(PORT_A)); + setUpDisplay(new FakeDisplay(PORT_C)); + updateAvailableDisplays(); + + // config_localNotStealTopFocusDisplayPorts is null + mAdapter.registerLocked(); + + waitForHandlerToComplete(mHandler, HANDLER_WAIT_MS); + + // This should not have the flags + assertNotStealTopFocusFlag(mListener.addedDisplays.get(0).getDisplayDeviceInfoLocked(), + PORT_A, false); + // This should not have the flags + assertNotStealTopFocusFlag(mListener.addedDisplays.get(1).getDisplayDeviceInfoLocked(), + PORT_C, false); + } + + private static void assertNotStealTopFocusFlag( + DisplayDeviceInfo info, int expectedPort, boolean shouldHaveFlags) { + final DisplayAddress.Physical address = (DisplayAddress.Physical) info.address; + assertNotNull(address); + assertEquals(expectedPort, address.getPort()); + assertEquals(DISPLAY_MODEL, address.getModel()); + assertEquals(shouldHaveFlags, + (info.flags & DisplayDeviceInfo.FLAG_STEAL_TOP_FOCUS_DISABLED) != 0); + assertEquals(shouldHaveFlags, (info.flags & DisplayDeviceInfo.FLAG_OWN_FOCUS) != 0); + // display is always trusted since it is created by the system + assertEquals(true, (info.flags & DisplayDeviceInfo.FLAG_TRUSTED) != 0); + } + + /** * Confirm that external display uses physical density. */ @Test 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/ondeviceintelligencetests/OWNERS b/services/tests/ondeviceintelligencetests/OWNERS index a4fc7582a785..d08d34ad3108 100644 --- a/services/tests/ondeviceintelligencetests/OWNERS +++ b/services/tests/ondeviceintelligencetests/OWNERS @@ -1,3 +1,2 @@ shiqing@google.com sandeepbandaru@google.com -shivanker@google.com 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/accessibility/OWNERS b/services/tests/servicestests/src/com/android/server/accessibility/OWNERS index c824c3948e2d..c7c23f081044 100644 --- a/services/tests/servicestests/src/com/android/server/accessibility/OWNERS +++ b/services/tests/servicestests/src/com/android/server/accessibility/OWNERS @@ -1,3 +1,6 @@ -# Bug component: 44215 +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 44215. include /core/java/android/view/accessibility/OWNERS diff --git a/services/tests/servicestests/src/com/android/server/accessibility/magnification/OWNERS b/services/tests/servicestests/src/com/android/server/accessibility/magnification/OWNERS new file mode 100644 index 000000000000..9592bfdfa73b --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/accessibility/magnification/OWNERS @@ -0,0 +1,6 @@ +# Bug component: 1530954 +# +# The above component is for automated test bugs. If you are a human looking to report +# a bug in this codebase then please use component 770744. + +include /services/accessibility/java/com/android/server/accessibility/magnification/OWNERS diff --git a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java index 9cd3186f99f3..83753ccf1cbe 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/AuthServiceTest.java @@ -44,7 +44,6 @@ import android.content.pm.PackageManager; import android.content.res.Resources; import android.hardware.biometrics.AuthenticationStateListener; import android.hardware.biometrics.BiometricManager; -import android.hardware.biometrics.Flags; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricService; import android.hardware.biometrics.IBiometricServiceReceiver; @@ -506,23 +505,9 @@ public class AuthServiceTest { eq(callback)); } - @Test(expected = UnsupportedOperationException.class) - public void testGetLastAuthenticationTime_flaggedOff_throwsUnsupportedOperationException() - throws Exception { - mSetFlagsRule.disableFlags(Flags.FLAG_LAST_AUTHENTICATION_TIME); - setInternalAndTestBiometricPermissions(mContext, true /* hasPermission */); - - mAuthService = new AuthService(mContext, mInjector); - mAuthService.onStart(); - - mAuthService.mImpl.getLastAuthenticationTime(0, - BiometricManager.Authenticators.BIOMETRIC_STRONG); - } - @Test - public void testGetLastAuthenticationTime_flaggedOn_callsBiometricService() + public void testGetLastAuthenticationTime_callsBiometricService() throws Exception { - mSetFlagsRule.enableFlags(Flags.FLAG_LAST_AUTHENTICATION_TIME); setInternalAndTestBiometricPermissions(mContext, true /* hasPermission */); mAuthService = new AuthService(mContext, mInjector); diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java index b4b36125f770..ddc35ed55901 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java @@ -1936,20 +1936,9 @@ public class BiometricServiceTest { verifyNoMoreInteractions(callback); } - @Test(expected = UnsupportedOperationException.class) - public void testGetLastAuthenticationTime_flagOff_throwsUnsupportedOperationException() - throws RemoteException { - mSetFlagsRule.disableFlags(Flags.FLAG_LAST_AUTHENTICATION_TIME); - - mBiometricService = new BiometricService(mContext, mInjector, mBiometricHandlerProvider); - mBiometricService.mImpl.getLastAuthenticationTime(0, Authenticators.BIOMETRIC_STRONG); - } - @Test - public void testGetLastAuthenticationTime_flagOn_callsKeystoreAuthorization() + public void testGetLastAuthenticationTime_callsKeystoreAuthorization() throws RemoteException { - mSetFlagsRule.enableFlags(Flags.FLAG_LAST_AUTHENTICATION_TIME); - final int[] hardwareAuthenticators = new int[] { HardwareAuthenticatorType.PASSWORD, HardwareAuthenticatorType.FINGERPRINT 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/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/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/services/tests/servicestests/src/com/android/server/media/projection/OWNERS b/services/tests/servicestests/src/com/android/server/media/projection/OWNERS index 832bcd9d70e6..3caf7faa13ec 100644 --- a/services/tests/servicestests/src/com/android/server/media/projection/OWNERS +++ b/services/tests/servicestests/src/com/android/server/media/projection/OWNERS @@ -1 +1,2 @@ +# Bug component: 1345447 include /media/java/android/media/projection/OWNERS diff --git a/services/tests/servicestests/src/com/android/server/memory/OWNERS b/services/tests/servicestests/src/com/android/server/memory/OWNERS new file mode 100644 index 000000000000..4df08c1fbc2e --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/memory/OWNERS @@ -0,0 +1,3 @@ +include /MEMORY_OWNERS + +per-file ZramMaintenanceTest.kt = kawasin@google.com diff --git a/services/tests/servicestests/src/com/android/server/memory/ZramMaintenanceTest.kt b/services/tests/servicestests/src/com/android/server/memory/ZramMaintenanceTest.kt new file mode 100644 index 000000000000..1f59f45b05bf --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/memory/ZramMaintenanceTest.kt @@ -0,0 +1,154 @@ +/* + * 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.server.memory + +import android.app.job.JobInfo +import android.app.job.JobParameters +import android.app.job.JobScheduler +import android.os.IMmd +import android.os.PersistableBundle +import android.os.RemoteException +import android.testing.TestableContext +import androidx.test.filters.SmallTest +import androidx.test.platform.app.InstrumentationRegistry + +import com.google.common.truth.Truth.assertThat + +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mock +import org.mockito.Mockito.any +import org.mockito.Mockito.never +import org.mockito.Mockito.times +import org.mockito.Mockito.verify +import org.mockito.Mockito.`when` +import org.mockito.MockitoAnnotations + +private fun generateJobParameters(jobId: Int, extras: PersistableBundle): JobParameters { + return JobParameters( + null, "", jobId, extras, null, null, 0, false, false, false, null, null, null + ) +} + +@SmallTest +@RunWith(JUnit4::class) +class ZramMaintenanceTest { + private val context = TestableContext(InstrumentationRegistry.getInstrumentation().context) + + @Captor + private lateinit var jobInfoCaptor: ArgumentCaptor<JobInfo> + + @Mock + private lateinit var mockJobScheduler: JobScheduler + + @Mock + private lateinit var mockMmd: IMmd + + @Before + @Throws(RemoteException::class) + fun setUp() { + MockitoAnnotations.initMocks(this) + context.addMockSystemService(JobScheduler::class.java, mockJobScheduler) + } + + @Test + fun startZramMaintenance() { + ZramMaintenance.startZramMaintenance(context) + + verify(mockJobScheduler, times(1)).schedule(jobInfoCaptor.capture()) + val job = jobInfoCaptor.value + assertThat(job.id).isEqualTo(ZramMaintenance.JOB_ID) + assertThat(job.extras.getBoolean(ZramMaintenance.KEY_CHECK_STATUS)).isTrue() + } + + @Test + fun startJobForFirstTime() { + val extras = PersistableBundle() + extras.putBoolean(ZramMaintenance.KEY_CHECK_STATUS, true) + val params = generateJobParameters( + ZramMaintenance.JOB_ID, + extras, + ) + `when`(mockMmd.isZramMaintenanceSupported()).thenReturn(true) + + ZramMaintenance.startJob(context, params, mockMmd) + + verify(mockMmd, times(1)).isZramMaintenanceSupported() + verify(mockMmd, times(1)).doZramMaintenanceAsync() + verify(mockJobScheduler, times(1)).schedule(jobInfoCaptor.capture()) + val nextJob = jobInfoCaptor.value + assertThat(nextJob.id).isEqualTo(ZramMaintenance.JOB_ID) + assertThat(nextJob.extras.getBoolean(ZramMaintenance.KEY_CHECK_STATUS)).isFalse() + } + + @Test + fun startJobWithoutCheckStatus() { + val extras = PersistableBundle() + extras.putBoolean(ZramMaintenance.KEY_CHECK_STATUS, false) + val params = generateJobParameters( + ZramMaintenance.JOB_ID, + extras, + ) + + ZramMaintenance.startJob(context, params, mockMmd) + + verify(mockMmd, never()).isZramMaintenanceSupported() + verify(mockMmd, times(1)).doZramMaintenanceAsync() + verify(mockJobScheduler, times(1)).schedule(jobInfoCaptor.capture()) + val nextJob = jobInfoCaptor.value + assertThat(nextJob.id).isEqualTo(ZramMaintenance.JOB_ID) + assertThat(nextJob.extras.getBoolean(ZramMaintenance.KEY_CHECK_STATUS)).isFalse() + } + + @Test + fun startJobZramIsDisabled() { + val extras = PersistableBundle() + extras.putBoolean(ZramMaintenance.KEY_CHECK_STATUS, true) + val params = generateJobParameters( + ZramMaintenance.JOB_ID, + extras, + ) + `when`(mockMmd.isZramMaintenanceSupported()).thenReturn(false) + + ZramMaintenance.startJob(context, params, mockMmd) + + verify(mockMmd, times(1)).isZramMaintenanceSupported() + verify(mockMmd, never()).doZramMaintenanceAsync() + verify(mockJobScheduler, never()).schedule(any()) + } + + @Test + fun startJobMmdIsNotReadyYet() { + val extras = PersistableBundle() + extras.putBoolean(ZramMaintenance.KEY_CHECK_STATUS, true) + val params = generateJobParameters( + ZramMaintenance.JOB_ID, + extras, + ) + + ZramMaintenance.startJob(context, params, null) + + verify(mockJobScheduler, times(1)).schedule(jobInfoCaptor.capture()) + val nextJob = jobInfoCaptor.value + assertThat(nextJob.id).isEqualTo(ZramMaintenance.JOB_ID) + assertThat(nextJob.extras.getBoolean(ZramMaintenance.KEY_CHECK_STATUS)).isTrue() + } +}
\ No newline at end of file diff --git a/services/usb/java/com/android/server/usb/UsbPortManager.java b/services/usb/java/com/android/server/usb/UsbPortManager.java index 55a89239b864..86468b0cf821 100644 --- a/services/usb/java/com/android/server/usb/UsbPortManager.java +++ b/services/usb/java/com/android/server/usb/UsbPortManager.java @@ -200,7 +200,11 @@ public class UsbPortManager implements IBinder.DeathRecipient { mHandler.sendEmptyMessage(MSG_SYSTEM_READY); } - private void updateContaminantNotification() { + private void updateContaminantNotificationLocked() { + if (mNotificationManager == null) { + return; + } + PortInfo currentPortInfo = null; Resources r = mContext.getResources(); int contaminantStatus = UsbPortStatus.CONTAMINANT_DETECTION_NOT_DETECTED; @@ -1171,7 +1175,7 @@ public class UsbPortManager implements IBinder.DeathRecipient { private void handlePortLocked(PortInfo portInfo, IndentingPrintWriter pw) { sendPortChangedBroadcastLocked(portInfo); logToStatsd(portInfo, pw); - updateContaminantNotification(); + updateContaminantNotificationLocked(); } private void handlePortAddedLocked(PortInfo portInfo, IndentingPrintWriter pw) { @@ -1433,6 +1437,9 @@ public class UsbPortManager implements IBinder.DeathRecipient { case MSG_SYSTEM_READY: { mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + synchronized (mLock) { + updateContaminantNotificationLocked(); + } break; } } 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/CompanionDeviceMultiDeviceTests/host/Android.bp b/tests/CompanionDeviceMultiDeviceTests/host/Android.bp index a0e047759dab..1fb18a6bb391 100644 --- a/tests/CompanionDeviceMultiDeviceTests/host/Android.bp +++ b/tests/CompanionDeviceMultiDeviceTests/host/Android.bp @@ -39,13 +39,4 @@ python_test_host { device_common_data: [ ":cdm_snippet_legacy", ], - version: { - py2: { - enabled: false, - }, - py3: { - enabled: true, - embedded_launcher: true, - }, - }, } 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/SharedLibrary/lib/Android.bp b/tests/SharedLibrary/lib/Android.bp index 0595cb1e116a..abfd0e869b45 100644 --- a/tests/SharedLibrary/lib/Android.bp +++ b/tests/SharedLibrary/lib/Android.bp @@ -15,6 +15,7 @@ android_app { export_package_resources: true, privileged: true, optimize: { + keep_runtime_invisible_annotations: true, proguard_flags_files: ["proguard.proguard"], }, } diff --git a/tests/SharedLibrary/lib/proguard.proguard b/tests/SharedLibrary/lib/proguard.proguard index e5dfbe1c453d..699fbdaaadad 100644 --- a/tests/SharedLibrary/lib/proguard.proguard +++ b/tests/SharedLibrary/lib/proguard.proguard @@ -1,6 +1,8 @@ -keepparameternames -keepattributes Exceptions,InnerClasses,Signature,Deprecated, - SourceFile,LineNumberTable,*Annotation*,EnclosingMethod + SourceFile,LineNumberTable,EnclosingMethod, + RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations, + RuntimeVisibleTypeAnnotations,AnnotationDefault -keep public class * { public protected *; 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/aosp/upload_aosp.sh b/tools/aosp/upload_aosp.sh new file mode 100755 index 000000000000..c36057b302cb --- /dev/null +++ b/tools/aosp/upload_aosp.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +set -eu + +DRYRUN=false +VERBOSE=false +DEST_BRANCH_NAME="main" +AOSP_URL="" + +function log_info() { + echo -e "\033[32m$1\033[m" +} + +function log_warn() { + echo -e "\033[33m$1\033[m" +} + +function log_fatal() { + echo -e "\033[31mERROR: $1\033[m" > /dev/stderr + exit 1 +} + +while [[ $# -gt 0 ]]; do + case $1 in + -b|--branch) + DEST_BRANCH_NAME=$2 + shift + shift + ;; + -v|--verbose) + set -x + VERBOSE=true + shift + ;; + -n|--dryrun) + DRYRUN=true + shift + ;; + -u|--url) + AOSP_URL=$2 + shift + shift + ;; + --help) + echo "$0 <options>" + echo + echo "Options:" + echo " -b, --branch <branch> : destination AOSP branch, default is $DEST_BRANCH_NAME" + echo " -n, --dryrun : do not upload CL" + echo " -u, --url : AOSP repo URL. Default is to use existing 'aosp' remote or guess the URL." + echo " -v, --verbose : show verbose output" + echo + exit 0 + ;; + -*|--*) + echo "Unknown option $i" + exit 1 + ;; + *) + ;; + esac +done + +if $VERBOSE; then + log_info "DRYRUN=$DRYRUN" + log_info "DEST_BRANCH_NAME=$DEST_BRANCH_NAME" +fi + +current_branch=$(git branch --no-color --show-current) +if [ -z "$current_branch" ]; then + log_fatal "use 'repo start' first" +fi + +tmp_branch="aosp_$current_branch" + +if [ -z "$AOSP_URL" ]; then + AOSP_URL=$(git config --get remote.goog.url | sed 's/googleplex-//') +fi + +if $VERBOSE; then + log_info "AOSP_URL=$AOSP_URL" + log_info "current_branch=$current_branch" + log_info "tmp_branch=$tmp_branch" +fi + +log_info "Running repo hooks..." +repo upload -c . -n -y + +log_info "Setting up AOSP repo..." +existing_aosp_url=$(git config --get remote.aosp.url 2>/dev/null || true) +if [ -z "$existing_aosp_url" ]; then + git remote add aosp $AOSP_URL +elif [ "$existing_aosp_url" != "$AOSP_URL"]; then + log_warn "Remote 'aosp' uses $existing_aosp_url. Expected $AOSP_URL" +fi + +log_info "Fetching '$DEST_BRANCH_NAME'" +git fetch aosp $DEST_BRANCH_NAME + +log_info "Creating $tmp_branch and cherry-picking..." +git branch -D $tmp_branch 2>/dev/null || true +git checkout -b $tmp_branch +git branch --set-upstream-to aosp/$DEST_BRANCH_NAME +git reset --hard aosp/$DEST_BRANCH_NAME +git cherry-pick goog/$DEST_BRANCH_NAME..$current_branch + +if $DRYRUN; then + log_info "Dryrun specified, skipping CL upload" +else + log_info "Pushing to AOSP..." + git push aosp HEAD:refs/for/$DEST_BRANCH_NAME +fi + +log_info "Cleaning up..." +git checkout $current_branch +git branch -D $tmp_branch
\ No newline at end of file diff --git a/tools/codegen/OWNERS b/tools/codegen/OWNERS index c9bd260ca7ae..e69de29bb2d1 100644 --- a/tools/codegen/OWNERS +++ b/tools/codegen/OWNERS @@ -1 +0,0 @@ -chiuwinson@google.com diff --git a/tools/hiddenapi/OWNERS b/tools/hiddenapi/OWNERS index dc82aac9d41c..d1e36b953e7f 100644 --- a/tools/hiddenapi/OWNERS +++ b/tools/hiddenapi/OWNERS @@ -1,6 +1,5 @@ # compat-team@ for changes to hiddenapi files mathewi@google.com -satayev@google.com # soong-team@ as the files these tools protect are tightly coupled with Soong file:platform/build/soong:/OWNERS diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS index 8e4569ee2a30..4035e19158c6 100644 --- a/tools/lint/OWNERS +++ b/tools/lint/OWNERS @@ -1,6 +1,5 @@ mattgilbride@google.com azharaa@google.com -jsharkey@google.com per-file *CallingSettingsNonUserGetterMethods* = file:/packages/SettingsProvider/OWNERS per-file *RegisterReceiverFlagDetector* = jacobhobbie@google.com diff --git a/tools/localedata/extract_icu_data.py b/tools/localedata/extract_icu_data.py index ec531275af1c..899cd7f9ce5e 100755 --- a/tools/localedata/extract_icu_data.py +++ b/tools/localedata/extract_icu_data.py @@ -180,7 +180,14 @@ def pack_script_to_uint32(script): def dump_representative_locales(representative_locales): """Dump the set of representative locales.""" - print() + print(''' +/* + * TODO: Consider turning the below switch statement into binary search + * to save the disk space when the table is larger in the future. + * Disassembled code shows that the jump table emitted by clang can be + * 4x larger than the data in disk size, but it depends on the optimization option. + * However, a switch statement will benefit from the future of compiler improvement. + */''') print('bool isLocaleRepresentative(uint32_t language_and_region, const char* script) {') print(' const uint64_t packed_locale =') print(' ((static_cast<uint64_t>(language_and_region)) << 32u) |') 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 |