diff options
86 files changed, 558 insertions, 184 deletions
diff --git a/boot/boot-image-profile-extra.txt b/boot/boot-image-profile-extra.txt index fd51f9cbcee1..ced0d176f174 100644 --- a/boot/boot-image-profile-extra.txt +++ b/boot/boot-image-profile-extra.txt @@ -45,3 +45,24 @@ HSPLandroid/os/MessageQueue$OnFileDescriptorEventListener;->* HSPLandroid/os/MessageQueue$StackNodeType;->* HSPLandroid/os/MessageQueue$StateNode;->* HSPLandroid/os/MessageQueue$TimedParkStateNode;->* +HSPLandroid/os/PerfettoTrace$Category;->* +HSPLandroid/os/PerfettoTrace;->* +HSPLandroid/os/PerfettoTrackEventExtra;->* +HSPLandroid/os/PerfettoTrackEventExtra$BuilderImpl;->* +HSPLandroid/os/PerfettoTrackEventExtra$NoOpBuilder;->* +HSPLandroid/os/PerfettoTrackEventExtra$ArgBool;->* +HSPLandroid/os/PerfettoTrackEventExtra$ArgInt64;->* +HSPLandroid/os/PerfettoTrackEventExtra$ArgDouble;->* +HSPLandroid/os/PerfettoTrackEventExtra$ArgString;->* +HSPLandroid/os/PerfettoTrackEventExtra$CounterInt64;->* +HSPLandroid/os/PerfettoTrackEventExtra$CounterDouble;->* +HSPLandroid/os/PerfettoTrackEventExtra$CounterTrack;->* +HSPLandroid/os/PerfettoTrackEventExtra$NamedTrack;->* +HSPLandroid/os/PerfettoTrackEventExtra$Flow;->* +HSPLandroid/os/PerfettoTrackEventExtra$Proto;->* +HSPLandroid/os/PerfettoTrackEventExtra$FieldInt64;->* +HSPLandroid/os/PerfettoTrackEventExtra$FieldDouble;->* +HSPLandroid/os/PerfettoTrackEventExtra$FieldString;->* +HSPLandroid/os/PerfettoTrackEventExtra$FieldNested;->* +HSPLandroid/os/PerfettoTrackEventExtra$Pool;->* +HSPLandroid/os/PerfettoTrackEventExtra$RingBuffer;->* diff --git a/core/java/android/os/CombinedMessageQueue/MessageQueue.java b/core/java/android/os/CombinedMessageQueue/MessageQueue.java index 877f130a8b5a..349a2f0a181d 100644 --- a/core/java/android/os/CombinedMessageQueue/MessageQueue.java +++ b/core/java/android/os/CombinedMessageQueue/MessageQueue.java @@ -24,8 +24,6 @@ import android.annotation.TestApi; import android.app.ActivityThread; import android.app.Instrumentation; import android.compat.annotation.UnsupportedAppUsage; -import android.os.Process; -import android.os.UserHandle; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodRedirect; import android.ravenwood.annotation.RavenwoodRedirectionClass; @@ -95,6 +93,13 @@ public final class MessageQueue { private int mAsyncMessageCount; /** + * @hide + */ + private final AtomicLong mMessageCount = new AtomicLong(); + private final Thread mThread; + private final long mTid; + + /** * Select between two implementations of message queue. The legacy implementation is used * by default as it provides maximum compatibility with applications and tests that * reach into MessageQueue via the mMessages field. The concurrent implemmentation is used for @@ -128,6 +133,8 @@ public final class MessageQueue { mUseConcurrent = sIsProcessAllowedToUseConcurrent && !isInstrumenting(); mQuitAllowed = quitAllowed; mPtr = nativeInit(); + mThread = Thread.currentThread(); + mTid = Process.myTid(); } private static void initIsProcessAllowedToUseConcurrent() { @@ -218,6 +225,32 @@ public final class MessageQueue { } } + private void decAndTraceMessageCount() { + mMessageCount.decrementAndGet(); + traceMessageCount(); + } + + private void incAndTraceMessageCount(Message msg, long when) { + mMessageCount.incrementAndGet(); + msg.mSendingThreadName = Thread.currentThread().getName(); + msg.mEventId.set(PerfettoTrace.getFlowId()); + + traceMessageCount(); + PerfettoTrace.instant(PerfettoTrace.MQ_CATEGORY, "message_queue_send") + .addFlow(msg.mEventId.get()) + .addArg("receiving_thread", mThread.getName()) + .addArg("delay", when - SystemClock.uptimeMillis()) + .addArg("what", msg.what) + .emit(); + } + + /** @hide */ + private void traceMessageCount() { + PerfettoTrace.counter(PerfettoTrace.MQ_CATEGORY, mMessageCount.get()) + .usingThreadCounterTrack(mTid, mThread.getName()) + .emit(); + } + // Disposes of the underlying message queue. // Must only be called on the looper thread or the finalizer. private void dispose() { @@ -800,6 +833,7 @@ public final class MessageQueue { Message msg = nextMessage(false, false); if (msg != null) { msg.markInUse(); + decAndTraceMessageCount(); return msg; } @@ -909,6 +943,7 @@ public final class MessageQueue { if (msg.isAsynchronous()) { mAsyncMessageCount--; } + decAndTraceMessageCount(); if (TRACE) { Trace.setCounter("MQ.Delivered", mMessagesDelivered.incrementAndGet()); } @@ -1075,6 +1110,7 @@ public final class MessageQueue { msg.markInUse(); msg.arg1 = token; + incAndTraceMessageCount(msg, when); if (!enqueueMessageUnchecked(msg, when)) { Log.wtf(TAG_C, "Unexpected error while adding sync barrier!"); @@ -1090,6 +1126,7 @@ public final class MessageQueue { msg.markInUse(); msg.when = when; msg.arg1 = token; + incAndTraceMessageCount(msg, when); if (Flags.messageQueueTailTracking() && mLast != null && mLast.when <= when) { /* Message goes to tail of list */ @@ -1196,6 +1233,7 @@ public final class MessageQueue { needWake = mMessages == null || mMessages.target != null; } p.recycleUnchecked(); + decAndTraceMessageCount(); // If the loop is quitting then it is already awake. // We can assume mPtr != 0 when mQuitting is false. @@ -1252,6 +1290,8 @@ public final class MessageQueue { msg.markInUse(); msg.when = when; + incAndTraceMessageCount(msg, when); + Message p = mMessages; boolean needWake; if (p == null || when == 0 || when < p.when) { @@ -1391,6 +1431,7 @@ public final class MessageQueue { if (msg.isAsynchronous()) { mAsyncMessageCount--; } + decAndTraceMessageCount(); if (TRACE) { Trace.setCounter("MQ.Delivered", mMessagesDelivered.incrementAndGet()); } @@ -1642,6 +1683,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); p = n; } @@ -1660,6 +1702,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -1718,6 +1761,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -1759,6 +1803,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); p = n; } @@ -1777,6 +1822,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -1832,6 +1878,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); p = n; } @@ -1850,6 +1897,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -1904,6 +1952,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); p = n; } @@ -1921,6 +1970,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -1976,6 +2026,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); p = n; } @@ -1993,6 +2044,7 @@ public final class MessageQueue { mAsyncMessageCount--; } n.recycleUnchecked(); + decAndTraceMessageCount(); p.next = nn; if (p.next == null) { mLast = p; @@ -2027,6 +2079,8 @@ public final class MessageQueue { mMessages = null; mLast = null; mAsyncMessageCount = 0; + mMessageCount.set(0); + traceMessageCount(); } private void removeAllFutureMessagesLocked() { @@ -2057,6 +2111,7 @@ public final class MessageQueue { mAsyncMessageCount--; } p.recycleUnchecked(); + decAndTraceMessageCount(); } while (n != null); } } @@ -2701,6 +2756,7 @@ public final class MessageQueue { MessageNode node = new MessageNode(msg, seq); msg.when = when; msg.markInUse(); + incAndTraceMessageCount(msg, when); if (DEBUG) { Log.d(TAG_C, "Insert message what: " + msg.what + " when: " + msg.when + " seq: " @@ -2828,6 +2884,7 @@ public final class MessageQueue { if (removeMatches) { if (p.removeFromStack()) { p.mMessage.recycleUnchecked(); + decAndTraceMessageCount(); if (mMessageCounts.incrementCancelled()) { nativeWake(mPtr); } @@ -2870,6 +2927,7 @@ public final class MessageQueue { found = true; if (queue.remove(msg)) { msg.mMessage.recycleUnchecked(); + decAndTraceMessageCount(); } } else { return true; diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java index 2fe4871e08dd..d16e4473d55f 100644 --- a/core/java/android/os/Looper.java +++ b/core/java/android/os/Looper.java @@ -199,7 +199,12 @@ public final class Looper { return false; } - // This must be in a local variable, in case a UI event sets the logger + PerfettoTrace.begin(PerfettoTrace.MQ_CATEGORY, "message_queue_receive") + .addArg("sending_thread", msg.mSendingThreadName) + .addTerminatingFlow(msg.mEventId.get()) + .emit(); + + // This must be in a local variabe, in case a UI event sets the logger final Printer logging = me.mLogging; if (logging != null) { logging.println(">>>>> Dispatching to " + msg.target + " " @@ -289,6 +294,7 @@ public final class Looper { + msg.callback + " what=" + msg.what); } + PerfettoTrace.end(PerfettoTrace.MQ_CATEGORY).emit(); msg.recycleUnchecked(); return true; diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index 702fdc2bbaa6..b22d1774d967 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -23,6 +23,8 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.annotations.VisibleForTesting; +import java.util.concurrent.atomic.AtomicInteger; + /** * * Defines a message containing a description and arbitrary data object that can be @@ -37,6 +39,13 @@ import com.android.internal.annotations.VisibleForTesting; @android.ravenwood.annotation.RavenwoodKeepWholeClass public final class Message implements Parcelable { /** + * For tracing + * + * @hide Only for use within the system server. + */ + public final AtomicInteger mEventId = new AtomicInteger(); + + /** * User-defined message code so that the recipient can identify * what this message is about. Each {@link Handler} has its own name-space * for message codes, so you do not need to worry about yours conflicting @@ -101,6 +110,13 @@ public final class Message implements Parcelable { */ public int workSourceUid = UID_NONE; + /** + * Sending thread + * + * @hide + */ + public String mSendingThreadName; + /** If set message is in use. * This flag is set when the message is enqueued and remains set while it * is delivered and afterwards when it is recycled. The flag is only cleared diff --git a/core/java/android/os/PerfettoTrace.java b/core/java/android/os/PerfettoTrace.java index 68f1570154ff..741d542ecb3b 100644 --- a/core/java/android/os/PerfettoTrace.java +++ b/core/java/android/os/PerfettoTrace.java @@ -16,6 +16,8 @@ package android.os; +import com.android.internal.ravenwood.RavenwoodEnvironment; + import dalvik.annotation.optimization.CriticalNative; import dalvik.annotation.optimization.FastNative; @@ -32,6 +34,7 @@ import java.util.concurrent.atomic.AtomicInteger; * * @hide */ +@android.ravenwood.annotation.RavenwoodKeepWholeClass public final class PerfettoTrace { private static final String TAG = "PerfettoTrace"; @@ -48,11 +51,14 @@ public final class PerfettoTrace { */ private static final AtomicInteger sFlowEventId = new AtomicInteger(); + public static final PerfettoTrace.Category MQ_CATEGORY = new PerfettoTrace.Category("mq"); + /** * Perfetto category a trace event belongs to. * Registering a category is not sufficient to capture events within the category, it must * also be enabled in the trace config. */ + @android.ravenwood.annotation.RavenwoodKeepWholeClass public static final class Category implements PerfettoTrackEventExtra.PerfettoPointer { private static final NativeAllocationRegistry sRegistry = NativeAllocationRegistry.createMalloced( @@ -97,12 +103,16 @@ public final class PerfettoTrace { mSeverity = severity; mPtr = native_init(name, tag, severity); mExtraPtr = native_get_extra_ptr(mPtr); - sRegistry.registerNativeAllocation(this, mPtr); + if (!RavenwoodEnvironment.getInstance().isRunningOnRavenwood()) { + sRegistry.registerNativeAllocation(this, mPtr); + } } @FastNative + @android.ravenwood.annotation.RavenwoodReplace private static native long native_init(String name, String tag, String severity); @CriticalNative + @android.ravenwood.annotation.RavenwoodReplace private static native long native_delete(); @CriticalNative private static native void native_register(long ptr); @@ -111,8 +121,24 @@ public final class PerfettoTrace { @CriticalNative private static native boolean native_is_enabled(long ptr); @CriticalNative + @android.ravenwood.annotation.RavenwoodReplace private static native long native_get_extra_ptr(long ptr); + private static long native_init$ravenwood(String name, String tag, String severity) { + // Tracing currently completely disabled under Ravenwood + return 0; + } + + private static long native_delete$ravenwood() { + // Tracing currently completely disabled under Ravenwood + return 0; + } + + private static long native_get_extra_ptr$ravenwood(long ptr) { + // Tracing currently completely disabled under Ravenwood + return 0; + } + /** * Register the category. */ @@ -134,10 +160,16 @@ public final class PerfettoTrace { /** * Whether the category is enabled or not. */ + @android.ravenwood.annotation.RavenwoodReplace public boolean isEnabled() { return IS_FLAG_ENABLED && native_is_enabled(mPtr); } + public boolean isEnabled$ravenwood() { + // Tracing currently completely disabled under Ravenwood + return false; + } + /** * Whether the category is registered or not. */ @@ -340,4 +372,11 @@ public final class PerfettoTrace { public static void register(boolean isBackendInProcess) { native_register(isBackendInProcess); } + + /** + * Registers categories with Perfetto. + */ + public static void registerCategories() { + MQ_CATEGORY.register(); + } } diff --git a/core/java/android/os/PerfettoTrackEventExtra.java b/core/java/android/os/PerfettoTrackEventExtra.java index e034fb3726e3..72b909e64c70 100644 --- a/core/java/android/os/PerfettoTrackEventExtra.java +++ b/core/java/android/os/PerfettoTrackEventExtra.java @@ -16,6 +16,8 @@ package android.os; +import com.android.internal.ravenwood.RavenwoodEnvironment; + import dalvik.annotation.optimization.CriticalNative; import dalvik.annotation.optimization.FastNative; @@ -29,6 +31,7 @@ import java.util.function.Supplier; * * @hide */ +@android.ravenwood.annotation.RavenwoodKeepWholeClass public final class PerfettoTrackEventExtra { private static final int DEFAULT_EXTRA_CACHE_SIZE = 5; private static final Builder NO_OP_BUILDER = new NoOpBuilder(); @@ -305,6 +308,7 @@ public final class PerfettoTrackEventExtra { Builder endNested(); } + @android.ravenwood.annotation.RavenwoodKeepWholeClass public static final class NoOpBuilder implements Builder { @Override public void emit() {} @@ -759,7 +763,9 @@ public final class PerfettoTrackEventExtra { private PerfettoTrackEventExtra() { mPtr = native_init(); - sRegistry.registerNativeAllocation(this, mPtr); + if (!RavenwoodEnvironment.getInstance().isRunningOnRavenwood()) { + sRegistry.registerNativeAllocation(this, mPtr); + } } /** @@ -1342,8 +1348,10 @@ public final class PerfettoTrackEventExtra { } @CriticalNative + @android.ravenwood.annotation.RavenwoodReplace private static native long native_init(); @CriticalNative + @android.ravenwood.annotation.RavenwoodReplace private static native long native_delete(); @CriticalNative private static native void native_add_arg(long ptr, long extraPtr); @@ -1351,4 +1359,14 @@ public final class PerfettoTrackEventExtra { private static native void native_clear_args(long ptr); @FastNative private static native void native_emit(int type, long tag, String name, long ptr); + + private static long native_init$ravenwood() { + // Tracing currently completely disabled under Ravenwood + return 0; + } + + private static long native_delete$ravenwood() { + // Tracing currently completely disabled under Ravenwood + return 0; + } } diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java index 09e6a45dc294..bf4c4d16fe19 100644 --- a/core/java/android/os/Trace.java +++ b/core/java/android/os/Trace.java @@ -544,5 +544,6 @@ public final class Trace { */ public static void registerWithPerfetto() { PerfettoTrace.register(false /* isBackendInProcess */); + PerfettoTrace.registerCategories(); } } diff --git a/core/java/android/window/DesktopModeFlags.java b/core/java/android/window/DesktopModeFlags.java index 9468301ac996..4170193b2ad9 100644 --- a/core/java/android/window/DesktopModeFlags.java +++ b/core/java/android/window/DesktopModeFlags.java @@ -63,6 +63,9 @@ public enum DesktopModeFlags { DISABLE_NON_RESIZABLE_APP_SNAP_RESIZE(Flags::disableNonResizableAppSnapResizing, true), ENABLE_WINDOWING_SCALED_RESIZING(Flags::enableWindowingScaledResizing, true), ENABLE_DESKTOP_WINDOWING_TASK_LIMIT(Flags::enableDesktopWindowingTaskLimit, true), + ENABLE_DESKTOP_WINDOWING_APP_TO_WEB(Flags::enableDesktopWindowingAppToWeb, true), + ENABLE_DESKTOP_WINDOWING_APP_TO_WEB_EDUCATION( + Flags::enableDesktopWindowingAppToWebEducation, true), ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION(Flags::enableDesktopWindowingBackNavigation, true), ENABLE_WINDOWING_EDGE_DRAG_RESIZE(Flags::enableWindowingEdgeDragResize, true), ENABLE_DESKTOP_WINDOWING_TASKBAR_RUNNING_APPS( diff --git a/core/tests/coretests/src/android/os/PerfettoTraceTest.java b/core/tests/coretests/src/android/os/PerfettoTraceTest.java index 0b5a44665d2b..91efacf0dcc3 100644 --- a/core/tests/coretests/src/android/os/PerfettoTraceTest.java +++ b/core/tests/coretests/src/android/os/PerfettoTraceTest.java @@ -59,6 +59,8 @@ import perfetto.protos.TrackEventOuterClass.TrackEvent; import java.util.List; import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; /** * This class is used to test the native tracing support. Run this test @@ -77,6 +79,8 @@ public class PerfettoTraceTest { private static final String BAR = "bar"; private static final Category FOO_CATEGORY = new Category(FOO); + private static final int MESSAGE = 1234567; + private static final int MESSAGE_COUNT = 3; private final Set<String> mCategoryNames = new ArraySet<>(); private final Set<String> mEventNames = new ArraySet<>(); @@ -592,6 +596,89 @@ public class PerfettoTraceTest { assertThat(mDebugAnnotationNames).doesNotContain("before"); } + @Test + @RequiresFlagsEnabled(android.os.Flags.FLAG_PERFETTO_SDK_TRACING_V2) + public void testMessageQueue() throws Exception { + TraceConfig traceConfig = getTraceConfig("mq"); + + PerfettoTrace.MQ_CATEGORY.register(); + final HandlerThread thread = new HandlerThread("test"); + thread.start(); + final Handler handler = thread.getThreadHandler(); + final CountDownLatch latch = new CountDownLatch(1); + + PerfettoTrace.Session session = new PerfettoTrace.Session(true, + getTraceConfig("mq").toByteArray()); + + handler.sendEmptyMessage(MESSAGE); + handler.sendEmptyMessageDelayed(MESSAGE, 10); + handler.sendEmptyMessage(MESSAGE); + handler.postDelayed(() -> { + latch.countDown(); + }, 10); + assertThat(latch.await(100, TimeUnit.MILLISECONDS)).isTrue(); + + byte[] traceBytes = session.close(); + + Trace trace = Trace.parseFrom(traceBytes); + + boolean hasTrackEvent = false; + int instantCount = 0; + int counterCount = 0; + int beginCount = 0; + int endCount = 0; + + Set<Long> flowIds = new ArraySet<>(); + for (TracePacket packet: trace.getPacketList()) { + TrackEvent event; + if (packet.hasTrackEvent()) { + hasTrackEvent = true; + event = packet.getTrackEvent(); + } else { + continue; + } + + List<DebugAnnotation> annotations = event.getDebugAnnotationsList(); + switch (event.getType()) { + case TrackEvent.Type.TYPE_INSTANT: + if (annotations.get(2).getIntValue() == MESSAGE) { + instantCount++; + assertThat(annotations.get(0).getStringValue()).isEqualTo("test"); + assertThat(event.getFlowIdsCount()).isEqualTo(1); + flowIds.addAll(event.getFlowIdsList()); + } + break; + case TrackEvent.Type.TYPE_COUNTER: + counterCount++; + break; + case TrackEvent.Type.TYPE_SLICE_BEGIN: + annotations = event.getDebugAnnotationsList(); + if (flowIds.containsAll(event.getTerminatingFlowIdsList())) { + beginCount++; + assertThat(event.getTerminatingFlowIdsCount()).isEqualTo(1); + } + break; + case TrackEvent.Type.TYPE_SLICE_END: + endCount++; + break; + default: + break; + } + collectInternedData(packet); + } + + assertThat(hasTrackEvent).isTrue(); + assertThat(mCategoryNames).contains("mq"); + assertThat(mEventNames).contains("message_queue_send"); + assertThat(mEventNames).contains("message_queue_receive"); + assertThat(mDebugAnnotationNames).contains("what"); + assertThat(mDebugAnnotationNames).contains("delay"); + assertThat(instantCount).isEqualTo(MESSAGE_COUNT); + assertThat(beginCount).isEqualTo(MESSAGE_COUNT); + assertThat(endCount).isAtLeast(MESSAGE_COUNT); + assertThat(counterCount).isAtLeast(MESSAGE_COUNT); + } + private TrackEvent getTrackEvent(Trace trace, int idx) { int curIdx = 0; for (TracePacket packet: trace.getPacketList()) { diff --git a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java index 36c73e2e979e..c42ddd3412be 100644 --- a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java +++ b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java @@ -44,8 +44,11 @@ public class InstallOverlayTests extends BaseHostJUnit4Test { "com.android.server.om.hosttest.update_overlay_test"; private static final String DEVICE_TEST_CLS = DEVICE_TEST_PKG + ".UpdateOverlayTest"; + private int mCurrentUserid; + @Before public void ensureNoOverlays() throws Exception { + mCurrentUserid = getDevice().getCurrentUser(); // Make sure we're starting with a clean slate. for (String pkg : ALL_PACKAGES) { assertFalse(pkg + " should not be installed", isPackageInstalled(pkg)); @@ -62,7 +65,7 @@ public class InstallOverlayTests extends BaseHostJUnit4Test { @After public void uninstallOverlays() throws Exception { for (String pkg : ALL_PACKAGES) { - uninstallPackage(pkg); + getDevice().uninstallPackageForUser(pkg, mCurrentUserid); } } @@ -166,7 +169,7 @@ public class InstallOverlayTests extends BaseHostJUnit4Test { installPackage("OverlayHostTests_AppOverlayV1.apk"); assertTrue(getDevice().executeShellCommand("cat /data/system/overlays.xml") .contains(APP_OVERLAY_PACKAGE_NAME)); - uninstallPackage(APP_OVERLAY_PACKAGE_NAME); + getDevice().uninstallPackageForUser(APP_OVERLAY_PACKAGE_NAME, mCurrentUserid); delay(); assertFalse(getDevice().executeShellCommand("cat /data/system/overlays.xml") .contains(APP_OVERLAY_PACKAGE_NAME)); @@ -200,12 +203,12 @@ public class InstallOverlayTests extends BaseHostJUnit4Test { } private void installPackage(String pkg) throws Exception { - super.installPackage(pkg); + super.installPackageAsUser(pkg, true /* grantPermission */, mCurrentUserid); delay(); } private void installInstantPackage(String pkg) throws Exception { - super.installPackage(pkg, "--instant"); + super.installPackageAsUser(pkg, true /* grantPermission */, mCurrentUserid, "--instant"); delay(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/OWNERS index 752d2fd721a5..8ab53eaa5eea 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/OWNERS +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/OWNERS @@ -1,2 +1,3 @@ # WM Shell sub-module dagger owners -jorgegil@google.com
\ No newline at end of file +jorgegil@google.com +madym@google.com
\ No newline at end of file diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java index c1a6240516c1..afb234899339 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java @@ -483,7 +483,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin boolean hasGlobalFocus, @NonNull Region displayExclusionRegion) { Trace.beginSection("DesktopModeWindowDecoration#relayout"); - if (Flags.enableDesktopWindowingAppToWeb()) { + if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_APP_TO_WEB.isTrue()) { setCapturedLink(taskInfo.capturedLink, taskInfo.capturedLinkTimestamp); } diff --git a/libs/androidfw/TypeWrappers.cpp b/libs/androidfw/TypeWrappers.cpp index 970463492c1a..2a20106b6ee1 100644 --- a/libs/androidfw/TypeWrappers.cpp +++ b/libs/androidfw/TypeWrappers.cpp @@ -18,8 +18,11 @@ namespace android { -TypeVariant::TypeVariant(const ResTable_type* data) : data(data), mLength(dtohl(data->entryCount)) { - if (data->flags & ResTable_type::FLAG_SPARSE) { +TypeVariant::TypeVariant(const ResTable_type* data) + : data(data) + , mLength(dtohl(data->entryCount)) + , mSparse(data->flags & ResTable_type::FLAG_SPARSE) { + if (mSparse) { const uint32_t entryCount = dtohl(data->entryCount); const uintptr_t containerEnd = reinterpret_cast<uintptr_t>(data) + dtohl(data->header.size); const uint32_t* const entryIndices = reinterpret_cast<const uint32_t*>( @@ -40,18 +43,18 @@ TypeVariant::iterator& TypeVariant::iterator::operator++() { mIndex = mTypeVariant->mLength; } - const ResTable_type* type = mTypeVariant->data; - if ((type->flags & ResTable_type::FLAG_SPARSE) == 0) { + if (!mTypeVariant->mSparse) { return *this; } // Need to adjust |mSparseIndex| as well if we've passed its current element. + const ResTable_type* type = mTypeVariant->data; const uint32_t entryCount = dtohl(type->entryCount); - const auto entryIndices = reinterpret_cast<const uint32_t*>( - reinterpret_cast<uintptr_t>(type) + dtohs(type->header.headerSize)); if (mSparseIndex >= entryCount) { return *this; // done } + const auto entryIndices = reinterpret_cast<const uint32_t*>( + reinterpret_cast<uintptr_t>(type) + dtohs(type->header.headerSize)); const auto element = (const ResTable_sparseTypeEntry*)(entryIndices + mSparseIndex); if (mIndex > dtohs(element->idx)) { ++mSparseIndex; @@ -79,7 +82,7 @@ const ResTable_entry* TypeVariant::iterator::operator*() const { } uint32_t entryOffset; - if (type->flags & ResTable_type::FLAG_SPARSE) { + if (mTypeVariant->mSparse) { if (mSparseIndex >= entryCount) { return nullptr; } diff --git a/libs/androidfw/include/androidfw/TypeWrappers.h b/libs/androidfw/include/androidfw/TypeWrappers.h index db641b78a4e4..d901af3c908b 100644 --- a/libs/androidfw/include/androidfw/TypeWrappers.h +++ b/libs/androidfw/include/androidfw/TypeWrappers.h @@ -14,8 +14,7 @@ * limitations under the License. */ -#ifndef __TYPE_WRAPPERS_H -#define __TYPE_WRAPPERS_H +#pragma once #include <androidfw/ResourceTypes.h> #include <utils/ByteOrder.h> @@ -54,7 +53,7 @@ struct TypeVariant { enum class Kind { Begin, End }; iterator(const TypeVariant* tv, Kind kind) : mTypeVariant(tv) { - mSparseIndex = mIndex = kind == Kind::Begin ? 0 : tv->mLength; + mSparseIndex = mIndex = (kind == Kind::Begin ? 0 : tv->mLength); // mSparseIndex here is technically past the number of sparse entries, but it is still // ok as it is enough to infer that this is the end iterator. } @@ -75,9 +74,11 @@ struct TypeVariant { const ResTable_type* data; private: - size_t mLength; + // For a dense table, this is the number of the elements. + // For a sparse table, this is the index of the last element + 1. + // In both cases, it can be used for iteration as the upper loop bound as in |i < mLength|. + uint32_t mLength; + bool mSparse; }; } // namespace android - -#endif // __TYPE_WRAPPERS_H diff --git a/libs/androidfw/tests/TypeWrappers_test.cpp b/libs/androidfw/tests/TypeWrappers_test.cpp index d66e05805484..69c24c5d8956 100644 --- a/libs/androidfw/tests/TypeWrappers_test.cpp +++ b/libs/androidfw/tests/TypeWrappers_test.cpp @@ -121,6 +121,7 @@ TEST(TypeVariantIteratorTest, shouldIterateOverTypeWithoutErrors) { values.push_back(std::nullopt); values.push_back(std::nullopt); values.push_back(Res_value{ sizeof(Res_value), 0, Res_value::TYPE_STRING, 0x87654321}); + values.push_back(std::nullopt); // test for combinations of compact_entry and short_offsets for (size_t i = 0; i < 8; i++) { @@ -191,6 +192,17 @@ TEST(TypeVariantIteratorTest, shouldIterateOverTypeWithoutErrors) { ++iter; + ASSERT_EQ(uint32_t(9), iter.index()); + ASSERT_TRUE(NULL == *iter); + if (sparse) { + // Sparse iterator doesn't know anything beyond the last entry. + ASSERT_EQ(v.endEntries(), iter); + } else { + ASSERT_NE(v.endEntries(), iter); + } + + ++iter; + ASSERT_EQ(v.endEntries(), iter); } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt index eb1f1d9c52f4..5c983656225e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/data/repository/CommunalSettingsRepositoryImplTest.kt @@ -51,6 +51,7 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage +import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -78,6 +79,32 @@ class CommunalSettingsRepositoryImplTest(flags: FlagsParameterization?) : SysuiT setKeyguardFeaturesDisabled(PRIMARY_USER, KEYGUARD_DISABLE_FEATURES_NONE) setKeyguardFeaturesDisabled(SECONDARY_USER, KEYGUARD_DISABLE_FEATURES_NONE) setKeyguardFeaturesDisabled(WORK_PROFILE, KEYGUARD_DISABLE_FEATURES_NONE) + + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault, + false, + ) + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault, + false, + ) + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault, + false, + ) + } + + @After + fun tearDown() { + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault + ) + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault + ) + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault + ) } @EnableFlags(FLAG_COMMUNAL_HUB) @@ -334,6 +361,18 @@ class CommunalSettingsRepositoryImplTest(flags: FlagsParameterization?) : SysuiT } @Test + fun whenToDream_charging_defaultValue() = + kosmos.runTest { + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault, + true, + ) + + val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) + assertThat(whenToDreamState).isEqualTo(WhenToDream.WHILE_CHARGING) + } + + @Test fun whenToDream_docked() = kosmos.runTest { val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) @@ -348,6 +387,18 @@ class CommunalSettingsRepositoryImplTest(flags: FlagsParameterization?) : SysuiT } @Test + fun whenToDream_docked_defaultValue() = + kosmos.runTest { + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault, + true, + ) + + val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) + assertThat(whenToDreamState).isEqualTo(WhenToDream.WHILE_DOCKED) + } + + @Test fun whenToDream_postured() = kosmos.runTest { val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) @@ -362,6 +413,18 @@ class CommunalSettingsRepositoryImplTest(flags: FlagsParameterization?) : SysuiT } @Test + fun whenToDream_postured_defaultValue() = + kosmos.runTest { + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault, + true, + ) + + val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) + assertThat(whenToDreamState).isEqualTo(WhenToDream.WHILE_POSTURED) + } + + @Test fun whenToDream_default() = kosmos.runTest { val whenToDreamState by collectLastValue(underTest.getWhenToDreamState(PRIMARY_USER)) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt index ff137b768b65..c3cc3e66f81f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/domain/interactor/CommunalInteractorTest.kt @@ -21,6 +21,7 @@ import android.app.admin.DevicePolicyManager import android.app.admin.devicePolicyManager import android.content.Intent import android.content.pm.UserInfo +import android.content.res.mainResources import android.os.UserHandle import android.os.UserManager import android.os.userManager @@ -85,6 +86,7 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.advanceTimeBy +import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -106,7 +108,10 @@ class CommunalInteractorTest(flags: FlagsParameterization) : SysuiTestCase() { UserInfo(/* id= */ 0, /* name= */ "primary user", /* flags= */ UserInfo.FLAG_MAIN) private val secondaryUser = UserInfo(/* id= */ 1, /* name= */ "secondary user", /* flags= */ 0) - private val kosmos = testKosmos().useUnconfinedTestDispatcher() + private val kosmos = + testKosmos() + .apply { mainResources = mContext.orCreateTestableResources.resources } + .useUnconfinedTestDispatcher() private val Kosmos.underTest by Kosmos.Fixture { communalInteractor } @@ -122,6 +127,32 @@ class CommunalInteractorTest(flags: FlagsParameterization) : SysuiTestCase() { kosmos.fakeFeatureFlagsClassic.set(Flags.COMMUNAL_SERVICE_ENABLED, true) mSetFlagsRule.enableFlags(FLAG_COMMUNAL_HUB) + + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault, + false, + ) + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault, + false, + ) + mContext.orCreateTestableResources.addOverride( + com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault, + false, + ) + } + + @After + fun tearDown() { + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault + ) + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault + ) + mContext.orCreateTestableResources.removeOverride( + com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault + ) } @Test diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/dump/DumpHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/dump/DumpHandlerTest.kt index 597629219634..09c4231b7178 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/dump/DumpHandlerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dump/DumpHandlerTest.kt @@ -275,7 +275,9 @@ class DumpHandlerTest : SysuiTestCase() { @Test fun testDumpAllProtoDumpables() { + @Suppress("DEPRECATION") dumpManager.registerDumpable("protoDumpable1", protoDumpable1) + @Suppress("DEPRECATION") dumpManager.registerDumpable("protoDumpable2", protoDumpable2) val args = arrayOf(DumpHandler.PROTO) @@ -287,7 +289,9 @@ class DumpHandlerTest : SysuiTestCase() { @Test fun testDumpSingleProtoDumpable() { + @Suppress("DEPRECATION") dumpManager.registerDumpable("protoDumpable1", protoDumpable1) + @Suppress("DEPRECATION") dumpManager.registerDumpable("protoDumpable2", protoDumpable2) val args = arrayOf(DumpHandler.PROTO, "protoDumpable1") diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorParameterizedTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorParameterizedTest.kt index 6899d23bcfd7..e126b4d7265c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorParameterizedTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorParameterizedTest.kt @@ -57,7 +57,6 @@ import platform.test.runner.parameterized.Parameters @SmallTest @RunWith(ParameterizedAndroidJunit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyboardTouchpadEduInteractorParameterizedTest(private val gestureType: GestureType) : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt index dc393c01dce1..adcd849db49a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/education/domain/interactor/KeyboardTouchpadEduInteractorTest.kt @@ -50,7 +50,6 @@ import org.mockito.kotlin.verify @SmallTest @RunWith(AndroidJUnit4::class) -@kotlinx.coroutines.ExperimentalCoroutinesApi class KeyboardTouchpadEduInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() private val testScope = kosmos.testScope diff --git a/packages/SystemUI/src/com/android/systemui/BootCompleteCacheImpl.kt b/packages/SystemUI/src/com/android/systemui/BootCompleteCacheImpl.kt index 3a9a238d90a6..cadef52ce4cc 100644 --- a/packages/SystemUI/src/com/android/systemui/BootCompleteCacheImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/BootCompleteCacheImpl.kt @@ -41,7 +41,7 @@ class BootCompleteCacheImpl @Inject constructor(dumpManager: DumpManager) : } init { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) } @GuardedBy("listeners") diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt index 21569c13fab4..64a46c0d7f00 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.kt @@ -131,7 +131,7 @@ abstract class UdfpsAnimationViewController<T : UdfpsAnimationView>( override fun onViewAttached() { dialogManager.registerListener(dialogListener) - dumpManager.registerDumpable(dumpTag, this) + dumpManager.registerNormalDumpable(dumpTag, this) udfpsOverlayInteractor.setHandleTouches(shouldHandle = !shouldPauseAuth()) } diff --git a/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt b/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt index abd101693b43..4c291a0c5a2e 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/data/repository/CommunalSettingsRepository.kt @@ -111,6 +111,18 @@ constructor( @Named(DEFAULT_BACKGROUND_TYPE) private val defaultBackgroundType: CommunalBackgroundType, ) : CommunalSettingsRepository { + private val dreamsActivatedOnSleepByDefault by lazy { + resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault) + } + + private val dreamsActivatedOnDockByDefault by lazy { + resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault) + } + + private val dreamsActivatedOnPosturedByDefault by lazy { + resources.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnPosturedByDefault) + } + override fun getFlagEnabled(): Boolean { return if (getV2FlagEnabled()) { true @@ -178,27 +190,27 @@ constructor( .emitOnStart() .map { if ( - secureSettings.getIntForUser( + secureSettings.getBoolForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, - 0, + dreamsActivatedOnSleepByDefault, user.id, - ) == 1 + ) ) { WhenToDream.WHILE_CHARGING } else if ( - secureSettings.getIntForUser( + secureSettings.getBoolForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, - 0, + dreamsActivatedOnDockByDefault, user.id, - ) == 1 + ) ) { WhenToDream.WHILE_DOCKED } else if ( - secureSettings.getIntForUser( + secureSettings.getBoolForUser( Settings.Secure.SCREENSAVER_ACTIVATE_ON_POSTURED, - 0, + dreamsActivatedOnPosturedByDefault, user.id, - ) == 1 + ) ) { WhenToDream.WHILE_POSTURED } else { diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingControllerImpl.kt index a5f29aa658be..f3eff607dedd 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsListingControllerImpl.kt @@ -122,7 +122,7 @@ constructor( init { Log.d(TAG, "Initializing") - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) serviceListing.addCallback(serviceListingCallback) serviceListing.setListening(true) serviceListing.reload() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepository.kt index aa28c5b90090..a9729eaad266 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardQuickAffordanceRepository.kt @@ -124,7 +124,7 @@ constructor( init { legacySettingSyncer.startSyncing() - dumpManager.registerDumpable("KeyguardQuickAffordances", Dumpster()) + dumpManager.registerNormalDumpable("KeyguardQuickAffordances", Dumpster()) } /** diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt index 3eac12d2b24c..ea5f81c75405 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImpl.kt @@ -306,7 +306,7 @@ class LegacyMediaDataManagerImpl( } init { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) // Initialize the internal processing pipeline. The listeners at the front of the pipeline // are set as internal listeners so that they receive events. From there, events are diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt index ad84a5eb74ab..0a70e78bf039 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/resume/MediaResumeListener.kt @@ -141,7 +141,7 @@ constructor( init { if (useMediaResumption) { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) val unlockFilter = IntentFilter() unlockFilter.addAction(Intent.ACTION_USER_UNLOCKED) broadcastDispatcher.registerReceiver( diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt index f05029b2d55f..c604bfb2d5c1 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/MediaCarouselController.kt @@ -343,7 +343,7 @@ constructor( .stateIn(applicationScope, SharingStarted.Eagerly, true) init { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) mediaFrame = inflateMediaCarousel() mediaCarousel = mediaFrame.requireViewById(R.id.media_carousel_scroller) pageIndicator = mediaFrame.requireViewById(R.id.media_page_indicator) diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt index 67d390d4f10d..79a513f24995 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyConfig.kt @@ -85,7 +85,7 @@ class PrivacyConfig @Inject constructor( } init { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) deviceConfigProxy.addOnPropertiesChangedListener( DeviceConfig.NAMESPACE_PRIVACY, uiExecutor, diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt index eb8ef9bf3e50..f9a7205c56f5 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt @@ -98,7 +98,7 @@ class PrivacyItemController @Inject constructor( } init { - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) privacyConfig.addCallback(optionsCallback) } diff --git a/packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt b/packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt index a48d4d4d3b5f..1f02d5a2d0bc 100644 --- a/packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/settings/UserTrackerImpl.kt @@ -151,7 +151,7 @@ internal constructor( registerUserSwitchObserver() - dumpManager.registerDumpable(TAG, this) + dumpManager.registerNormalDumpable(TAG, this) } override fun onReceive(context: Context, intent: Intent) { diff --git a/packages/SystemUI/src/com/android/systemui/shade/transition/ScrimShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/shade/transition/ScrimShadeTransitionController.kt index e38e53d67f61..e5349deaa811 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/transition/ScrimShadeTransitionController.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/transition/ScrimShadeTransitionController.kt @@ -43,7 +43,7 @@ constructor( shadeExpansionStateManager.addExpansionListener(this::onPanelExpansionChanged) onPanelExpansionChanged(currentState) shadeExpansionStateManager.addStateListener(this::onPanelStateChanged) - dumpManager.registerDumpable( + dumpManager.registerNormalDumpable( ScrimShadeTransitionController::class.java.simpleName, this::dump ) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt index 7358c513eaff..9d5d87f6db7c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/layout/StatusBarContentInsetsProvider.kt @@ -185,7 +185,7 @@ constructor( override fun start() { configurationController.addCallback(this) - dumpManager.registerDumpable(dumpableName, this) + dumpManager.registerNormalDumpable(dumpableName, this) commandRegistry.registerCommand(commandName) { StatusBarInsetsCommand( object : StatusBarInsetsCommand.Callback { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt index bac2c47f51c7..f822ee97807e 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt @@ -95,7 +95,6 @@ import org.mockito.kotlin.clearInvocations @RunWith(AndroidJUnit4::class) @SmallTest -@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class) class ClockEventControllerTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/data/repository/AccessibilityQsShortcutsRepositoryImplForDeviceTest.kt b/packages/SystemUI/tests/src/com/android/systemui/accessibility/data/repository/AccessibilityQsShortcutsRepositoryImplForDeviceTest.kt index 4e0ebae6a902..c6ede0c8c602 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/data/repository/AccessibilityQsShortcutsRepositoryImplForDeviceTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/data/repository/AccessibilityQsShortcutsRepositoryImplForDeviceTest.kt @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.FakeSettings import com.android.systemui.utils.FieldSetter import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -55,7 +54,6 @@ import org.mockito.junit.MockitoRule * can't mock the AccessibilityShortcutInfo for test. MultiValentTest doesn't compile when using * newly introduced methods and constants. */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class AccessibilityQsShortcutsRepositoryImplForDeviceTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt index 4baca713e19f..5249620dbdd0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt @@ -63,7 +63,6 @@ import com.android.systemui.testKosmos import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.google.common.truth.Truth.assertThat import dagger.Lazy -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -89,7 +88,6 @@ private const val DISPLAY_HEIGHT = 1920 private const val SENSOR_WIDTH = 30 private const val SENSOR_HEIGHT = 60 -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingButtonViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingButtonViewModelTest.kt index 655b2cc2dece..f3aaa3d3c7aa 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingButtonViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingButtonViewModelTest.kt @@ -32,7 +32,6 @@ import com.android.systemui.res.R import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent @@ -43,7 +42,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDeviceItemActionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDeviceItemActionInteractorTest.kt index e61acc4e1d0b..9ae57153f3ef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDeviceItemActionInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/AudioSharingDeviceItemActionInteractorTest.kt @@ -33,7 +33,6 @@ import com.android.systemui.plugins.activityStarter import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.After @@ -56,7 +55,6 @@ import org.mockito.kotlin.whenever @SmallTest @RunWith(AndroidTestingRunner::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class AudioSharingDeviceItemActionInteractorTest : SysuiTestCase() { @get:Rule val mockitoRule: MockitoRule = MockitoJUnit.rule() private val kosmos = testKosmos().apply { testDispatcher = UnconfinedTestDispatcher() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt index a56c2cb25542..242d31a26b13 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/BluetoothTileDialogViewModelTest.kt @@ -45,7 +45,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow @@ -67,7 +66,6 @@ import org.mockito.junit.MockitoRule @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) @EnableFlags(Flags.FLAG_BLUETOOTH_QS_TILE_DIALOG_AUTO_ON_TOGGLE) class BluetoothTileDialogViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt index 8d9fa6ad6e08..e50035d0067e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderContentProviderTest.kt @@ -41,7 +41,6 @@ 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() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderTest.kt index 76c3349c25ba..de70bca7e96c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/graphics/ImageLoaderTest.kt @@ -29,7 +29,6 @@ import org.junit.Test import org.junit.runner.RunWith @SmallTest -@kotlinx.coroutines.ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) class ImageLoaderTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/CustomizationProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/CustomizationProviderTest.kt index a3c3d2cdbb43..32b8bb49de96 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/CustomizationProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/CustomizationProviderTest.kt @@ -70,7 +70,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -84,7 +83,6 @@ import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidTestingRunner::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorParameterizedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorParameterizedTest.kt index ab691c630f97..a17125388ed6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorParameterizedTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorParameterizedTest.kt @@ -59,7 +59,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.FakeSettings import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest @@ -79,7 +78,6 @@ import platform.test.runner.parameterized.Parameter import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @DisableSceneContainer diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorSceneContainerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorSceneContainerTest.kt index caf08efc4b32..2648c9c6496e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorSceneContainerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorSceneContainerTest.kt @@ -60,7 +60,6 @@ import com.android.systemui.util.mockito.whenever import com.android.systemui.util.settings.FakeSettings import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest @@ -79,7 +78,6 @@ import platform.test.runner.parameterized.Parameter import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @FlakyTest( bugId = 292574995, detail = "on certain architectures all permutations with startActivity=true is causing failures", diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt index 418972055324..df24bff43c08 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySectionTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.shade.NotificationPanelView import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import org.junit.Before @@ -49,7 +48,6 @@ import org.mockito.Mock import org.mockito.Mockito.mock import org.mockito.MockitoAnnotations -@ExperimentalCoroutinesApi @RunWith(AndroidJUnit4::class) @SmallTest class DefaultDeviceEntrySectionTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt index 051aba3d593f..26c13f2a2519 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardQuickAffordancesCombinedViewModelTest.kt @@ -77,7 +77,6 @@ import com.android.systemui.util.settings.fakeSettings import com.google.common.truth.Truth import kotlin.math.min import kotlin.test.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.map @@ -90,7 +89,6 @@ import org.mockito.Mock import org.mockito.Mockito import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class KeyguardQuickAffordancesCombinedViewModelTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/lifecycle/RepeatWhenAttachedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/lifecycle/RepeatWhenAttachedTest.kt index e3aeaa85873d..fe5acb5668ac 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/lifecycle/RepeatWhenAttachedTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/lifecycle/RepeatWhenAttachedTest.kt @@ -28,7 +28,6 @@ import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.DisposableHandle -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.launch @@ -52,7 +51,6 @@ import org.mockito.junit.MockitoJUnit import org.mockito.kotlin.KArgumentCaptor import org.mockito.kotlin.argumentCaptor -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(JUnit4::class) class RepeatWhenAttachedTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt index 676d8fa06d82..122af0639030 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/LegacyMediaDataManagerImplTest.kt @@ -73,7 +73,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runCurrent @@ -117,7 +116,6 @@ private const val SESSION_EMPTY_TITLE = "" private const val USER_ID = 0 private val DISMISS_INTENT = Intent().apply { action = "dismiss" } -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(ParameterizedAndroidJunit4::class) diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataFilterImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataFilterImplTest.kt index 811d2e2b2b06..b731c4f18c7f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataFilterImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataFilterImplTest.kt @@ -49,7 +49,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import java.util.concurrent.Executor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -81,7 +80,6 @@ private const val SMARTSPACE_KEY = "SMARTSPACE_KEY" private const val SMARTSPACE_PACKAGE = "SMARTSPACE_PKG" private val SMARTSPACE_INSTANCE_ID = InstanceId.fakeInstanceId(456)!! -@ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt index 496b31990b9d..f9e8cbfc491c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessorTest.kt @@ -80,7 +80,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runCurrent @@ -123,7 +122,6 @@ private const val SESSION_EMPTY_TITLE = "" private const val USER_ID = 0 private val DISMISS_INTENT = Intent().apply { action = "dismiss" } -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(ParameterizedAndroidJunit4::class) diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerTest.kt index 6c8a46f19f2b..a2bd5ec28f08 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaCarouselControllerTest.kt @@ -79,7 +79,6 @@ import java.util.Locale import javax.inject.Provider import junit.framework.Assert.assertEquals import junit.framework.Assert.assertTrue -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -112,7 +111,6 @@ private val SMARTSPACE_KEY = "smartspace" private const val PAUSED_LOCAL = "paused local" private const val PLAYING_LOCAL = "playing local" -@ExperimentalCoroutinesApi @SmallTest @TestableLooper.RunWithLooper(setAsMainLooper = true) @RunWith(ParameterizedAndroidJunit4::class) diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManagerTest.kt index 072caa74df20..6ca4ae2d2259 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/controller/MediaHierarchyManagerTest.kt @@ -61,7 +61,6 @@ import com.android.systemui.util.mockito.nullable import com.android.systemui.util.settings.FakeSettings import com.android.systemui.utils.os.FakeHandler import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest @@ -86,7 +85,6 @@ import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.atLeastOnce import org.mockito.kotlin.lastValue -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) @@ -458,7 +456,6 @@ class MediaHierarchyManagerTest : SysuiTestCase() { assertThat(mediaHierarchyManager.isCurrentlyInGuidedTransformation()).isTrue() } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun isCurrentlyInGuidedTransformation_hostsVisible_expandImmediateEnabled_returnsFalse() = testScope.runTest { diff --git a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt index 69539743f96f..042eb871e3c9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskControllerTest.kt @@ -70,7 +70,6 @@ import com.android.wm.shell.bubbles.Bubbles import com.google.common.truth.Truth.assertThat import java.util.Optional import kotlin.test.assertNotNull -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runCurrent @@ -90,7 +89,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.whenever /** atest SystemUITests:NoteTaskControllerTest */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) internal class NoteTaskControllerTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskInitializerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskInitializerTest.kt index 266cb51cc855..8a4f1ad13b78 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskInitializerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/NoteTaskInitializerTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.util.time.FakeSystemClock import com.android.wm.shell.bubbles.Bubbles import com.google.common.truth.Truth.assertThat import java.util.Optional -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Before import org.junit.Rule import org.junit.Test @@ -60,7 +59,7 @@ import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.MockitoAnnotations.initMocks /** atest SystemUITests:NoteTaskInitializerTest */ -@OptIn(ExperimentalCoroutinesApi::class, InternalNoteTaskApi::class) +@OptIn(InternalNoteTaskApi::class) @SmallTest @RunWith(AndroidJUnit4::class) internal class NoteTaskInitializerTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/notetask/quickaffordance/NoteTaskQuickAffordanceConfigTest.kt b/packages/SystemUI/tests/src/com/android/systemui/notetask/quickaffordance/NoteTaskQuickAffordanceConfigTest.kt index b7fb759eb138..8d7de7e04a03 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/notetask/quickaffordance/NoteTaskQuickAffordanceConfigTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/notetask/quickaffordance/NoteTaskQuickAffordanceConfigTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.notetask.quickaffordance import android.app.role.RoleManager @@ -48,7 +46,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runTest import org.junit.After diff --git a/packages/SystemUI/tests/src/com/android/systemui/reardisplay/RearDisplayCoreStartableTest.kt b/packages/SystemUI/tests/src/com/android/systemui/reardisplay/RearDisplayCoreStartableTest.kt index c8faa81adffa..cf54df8565d3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/reardisplay/RearDisplayCoreStartableTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/reardisplay/RearDisplayCoreStartableTest.kt @@ -45,7 +45,6 @@ import org.mockito.kotlin.whenever /** atest SystemUITests:com.android.systemui.reardisplay.RearDisplayCoreStartableTest */ @SmallTest -@kotlinx.coroutines.ExperimentalCoroutinesApi class RearDisplayCoreStartableTest : SysuiTestCase() { private val kosmos = testKosmos().useUnconfinedTestDispatcher() diff --git a/packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplTest.kt index f695c13a9e62..1474defa1662 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplTest.kt @@ -38,7 +38,6 @@ import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat import com.google.common.truth.TruthJUnit.assume import java.util.concurrent.Executor -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -58,7 +57,6 @@ import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(Parameterized::class) class UserTrackerImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt index 6724f82dfd99..732561e0979b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/GlanceableHubContainerControllerTest.kt @@ -69,7 +69,6 @@ import com.android.systemui.statusbar.lockscreen.lockscreenSmartspaceController import com.android.systemui.statusbar.notification.stack.notificationStackScrollLayoutController import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -87,7 +86,6 @@ import org.mockito.kotlin.spy import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@ExperimentalCoroutinesApi @RunWith(AndroidTestingRunner::class) @TestableLooper.RunWithLooper(setAsMainLooper = true) @SmallTest diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt index 49d6909c1f93..856ece7e7ff3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt @@ -89,7 +89,6 @@ import com.android.systemui.window.ui.viewmodel.WindowRootViewModel import com.google.common.truth.Truth.assertThat import java.util.Optional import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.test.TestScope @@ -116,7 +115,6 @@ import org.mockito.kotlin.clearInvocations import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) @RunWithLooper(setAsMainLooper = true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt index cfc00a918f61..b7040ee2a11e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt @@ -35,7 +35,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.mock -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.After @@ -69,7 +68,6 @@ private fun <T> anyObject(): T { @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(AndroidJUnit4::class) -@OptIn(ExperimentalCoroutinesApi::class) class LockscreenShadeTransitionControllerTest : SysuiTestCase() { private val kosmos = testKosmos().apply { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SplitShadeLockScreenOverScrollerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SplitShadeLockScreenOverScrollerTest.kt index 98487f7ac059..f8154ddb2a5f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/SplitShadeLockScreenOverScrollerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/SplitShadeLockScreenOverScrollerTest.kt @@ -3,7 +3,6 @@ package com.android.systemui.statusbar import android.testing.TestableLooper import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import kotlinx.coroutines.ExperimentalCoroutinesApi import com.android.systemui.SysuiTestCase import com.android.systemui.dump.DumpManager import com.android.systemui.plugins.qs.QS @@ -30,7 +29,6 @@ class SplitShadeLockScreenOverScrollerTest : SysuiTestCase() { private val configurationController = FakeConfigurationController() - @OptIn(ExperimentalCoroutinesApi::class) @Mock private lateinit var scrimController: ScrimController @Mock private lateinit var statusBarStateController: SysuiStatusBarStateController private var qS: QS? = null diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt index 77ca51c5efcb..3c4aeccec2eb 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImplTest.kt @@ -41,7 +41,6 @@ import com.android.systemui.statusbar.window.StatusBarWindowController import com.android.systemui.statusbar.window.StatusBarWindowControllerStore import com.android.systemui.util.time.FakeSystemClock import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy @@ -64,7 +63,6 @@ import org.mockito.kotlin.whenever @RunWith(AndroidJUnit4::class) @RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class SystemStatusAnimationSchedulerImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/IconManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/IconManagerTest.kt index c4ef4f978ff8..a16f2f6161ff 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/IconManagerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/IconManagerTest.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - package com.android.systemui.statusbar.notification.icon import android.app.ActivityManager @@ -43,7 +41,6 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntryB import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt index 8645a40319f4..7cc1ac1d3806 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt @@ -75,7 +75,6 @@ import com.android.systemui.util.kotlin.JavaAdapter import com.android.systemui.wmshell.BubblesManager import java.util.Optional import kotlin.test.assertEquals -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import org.junit.Assert @@ -98,7 +97,6 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.whenever /** Tests for [NotificationGutsManager] with the scene container enabled. */ -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelImplTest.kt index 8beed01ffbe4..f4c0e367871f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelImplTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.runBlocking @@ -39,7 +38,6 @@ import org.junit.runner.RunWith import org.mockito.MockitoAnnotations @SmallTest -@OptIn(ExperimentalCoroutinesApi::class) @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") @RunWith(AndroidJUnit4::class) class AirplaneModeViewModelImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/model/SystemUiCarrierConfigTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/model/SystemUiCarrierConfigTest.kt index 4a2f6f281566..df74404aaaf8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/model/SystemUiCarrierConfigTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/model/SystemUiCarrierConfigTest.kt @@ -25,12 +25,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class SystemUiCarrierConfigTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/CarrierConfigRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/CarrierConfigRepositoryImplTest.kt index 7d101be4e748..d074fc256133 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/CarrierConfigRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/CarrierConfigRepositoryImplTest.kt @@ -29,7 +29,6 @@ import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.model.SystemUiCarrierConfigTest.Companion.createTestConfig import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.test.TestScope @@ -45,7 +44,6 @@ import org.mockito.MockitoAnnotations import org.mockito.MockitoSession import org.mockito.quality.Strictness -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class CarrierConfigRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcherTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcherTest.kt index 36f5236c3936..d05590521fab 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcherTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/MobileRepositorySwitcherTest.kt @@ -50,7 +50,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn @@ -70,7 +69,6 @@ import org.mockito.MockitoAnnotations * switches over when the value of `demoMode` changes */ @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileRepositorySwitcherTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt index fd23655ffc1c..02ad90cb4269 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt @@ -50,7 +50,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import java.io.PrintWriter import java.io.StringWriter -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -69,7 +68,6 @@ import org.mockito.Mockito.verify * properly switches over when the value of `isCarrierMerged` changes. */ @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class FullMobileConnectionRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt index 3a25ecb27404..df5c6e916931 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt @@ -98,7 +98,6 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -115,7 +114,6 @@ import org.mockito.kotlin.any import org.mockito.kotlin.argumentCaptor @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class MobileConnectionRepositoryTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionTelephonySmokeTests.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionTelephonySmokeTests.kt index 0d82c79fea79..ec260fcc7a65 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionTelephonySmokeTests.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionTelephonySmokeTests.kt @@ -49,7 +49,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityMod import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -92,7 +91,6 @@ import org.mockito.MockitoAnnotations * 5. Assert that B has the state sent in step #2 */ @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest class MobileConnectionTelephonySmokeTests : SysuiTestCase() { private lateinit var underTest: MobileConnectionRepositoryImpl diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt index 6c60f55a3904..d1d6e27332b0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionsRepositoryTest.kt @@ -79,7 +79,6 @@ import com.android.wifitrackerlib.WifiEntry import com.android.wifitrackerlib.WifiPickerTracker import com.google.common.truth.Truth.assertThat import java.util.UUID -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -101,7 +100,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.whenever @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest // This is required because our [SubscriptionManager.OnSubscriptionsChangedListener] uses a looper // to run the callback and this makes the looper place nicely with TestScope etc. diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/view/ModernStatusBarMobileViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/view/ModernStatusBarMobileViewTest.kt index 84846a16f39a..ce99e595504d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/view/ModernStatusBarMobileViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/ui/view/ModernStatusBarMobileViewTest.kt @@ -44,7 +44,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.repository.FakeConnec import com.android.systemui.testKosmos import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -57,7 +56,6 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidTestingRunner::class) @RunWithLooper(setAsMainLooper = true) -@OptIn(ExperimentalCoroutinesApi::class) class ModernStatusBarMobileViewTest : SysuiTestCase() { private val kosmos = testKosmos() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt index 599729d953d4..6a8b783acf73 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/data/prod/DeviceBasedSatelliteRepositoryImplTest.kt @@ -53,7 +53,6 @@ import com.google.common.truth.Truth.assertThat import java.util.Optional import java.util.function.Consumer import kotlin.test.Test -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent @@ -71,7 +70,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.doThrow @Suppress("EXPERIMENTAL_IS_NOT_ENABLED") -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/repository/ConnectivityRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/repository/ConnectivityRepositoryImplTest.kt index 88f262bec123..8a0159ce174e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/repository/ConnectivityRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/data/repository/ConnectivityRepositoryImplTest.kt @@ -47,7 +47,6 @@ import com.android.systemui.statusbar.pipeline.shared.data.repository.Connectivi import com.android.systemui.testKosmos import com.android.systemui.tuner.TunerService import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before @@ -60,7 +59,6 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) class ConnectivityRepositoryImplTest : SysuiTestCase() { diff --git a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt index 383e75bb5122..e202d0ecfa23 100644 --- a/ravenwood/texts/ravenwood-annotation-allowed-classes.txt +++ b/ravenwood/texts/ravenwood-annotation-allowed-classes.txt @@ -151,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 diff --git a/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java b/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java index 40fb8b671d0c..1fe674890a99 100644 --- a/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java +++ b/services/accessibility/java/com/android/server/accessibility/autoclick/AutoclickController.java @@ -500,6 +500,11 @@ public class AutoclickController extends BaseEventStreamTransformation { mMetaState = state; } + @VisibleForTesting + int getMetaStateForTesting() { + return mMetaState; + } + /** * Updates delay that should be used when scheduling clicks. The delay will be used only for * clicks scheduled after this point (pending click tasks are not affected). diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java index e8a222625b1b..32c4e9b1727e 100644 --- a/services/core/java/com/android/server/appop/AppOpsService.java +++ b/services/core/java/com/android/server/appop/AppOpsService.java @@ -551,6 +551,11 @@ public class AppOpsService extends IAppOpsService.Stub { @VisibleForTesting final Constants mConstants; + /** + * Some processes in the user may still be running when trying to drop the user's state + */ + private static final long REMOVE_USER_DELAY = 5000L; + @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) final class UidState { public final int uid; @@ -6820,14 +6825,17 @@ public class AppOpsService extends IAppOpsService.Stub { @Override public void removeUser(int userHandle) throws RemoteException { checkSystemUid("removeUser"); - synchronized (AppOpsService.this) { - final int tokenCount = mOpUserRestrictions.size(); - for (int i = tokenCount - 1; i >= 0; i--) { - ClientUserRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i); - opRestrictions.removeUser(userHandle); + mHandler.postDelayed(() -> { + Slog.i(TAG, "Removing user " + userHandle + " from AppOpsService"); + synchronized (AppOpsService.this) { + final int tokenCount = mOpUserRestrictions.size(); + for (int i = tokenCount - 1; i >= 0; i--) { + ClientUserRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i); + opRestrictions.removeUser(userHandle); + } + removeUidsForUserLocked(userHandle); } - removeUidsForUserLocked(userHandle); - } + }, REMOVE_USER_DELAY); } @Override diff --git a/services/core/java/com/android/server/input/KeyGestureController.java b/services/core/java/com/android/server/input/KeyGestureController.java index fb5ce5b4e5fa..41f58ae76a4d 100644 --- a/services/core/java/com/android/server/input/KeyGestureController.java +++ b/services/core/java/com/android/server/input/KeyGestureController.java @@ -809,7 +809,7 @@ final class KeyGestureController { if (firstDown) { handleKeyGesture(deviceId, new int[]{KeyEvent.KEYCODE_FULLSCREEN}, /* modifierState = */0, - KeyGestureEvent.KEY_GESTURE_TYPE_MAXIMIZE_FREEFORM_WINDOW, + KeyGestureEvent.KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION, KeyGestureEvent.ACTION_GESTURE_COMPLETE, displayId, focusedToken, /* flags = */0, /* appLaunchData = */null); } diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java index 8710438d76b3..0c2b712fc3ab 100644 --- a/services/core/java/com/android/server/om/OverlayManagerService.java +++ b/services/core/java/com/android/server/om/OverlayManagerService.java @@ -403,6 +403,20 @@ public final class OverlayManagerService extends SystemService { return userIds; } + /** + * Ensure that the caller has permission to interact with the given userId. + * If the calling user is not the same as the provided user, the caller needs + * to hold the INTERACT_ACROSS_USERS_FULL permission (or be system uid or + * root). + * + * @param userId the user to interact with + * @param message message for any SecurityException + */ + static int handleIncomingUser(final int userId, @NonNull final String message) { + return ActivityManager.handleIncomingUser(Binder.getCallingPid(), + Binder.getCallingUid(), userId, false, true, message, null); + } + private void handlePackageAdd(String packageName, Bundle extras, int userId) { final boolean replacing = extras.getBoolean(Intent.EXTRA_REPLACING, false); if (replacing) { @@ -1037,7 +1051,7 @@ public final class OverlayManagerService extends SystemService { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { final DumpState dumpState = new DumpState(); - dumpState.setUserId(UserHandle.USER_ALL); + int userId = UserHandle.USER_ALL; int opti = 0; while (opti < args.length) { @@ -1064,9 +1078,7 @@ public final class OverlayManagerService extends SystemService { return; } try { - final int userId = UserHandle.parseUserArg(args[opti]); - final int realUserId = handleIncomingUser(userId, "dump"); - dumpState.setUserId(realUserId); + userId = UserHandle.parseUserArg(args[opti]); opti++; } catch (Exception e) { pw.println("Error: " + e.getMessage()); @@ -1105,6 +1117,9 @@ public final class OverlayManagerService extends SystemService { } enforceDumpPermission("dump"); + final int realUserId = userId != UserHandle.USER_ALL + ? handleIncomingUser(userId, "dump") : userId; + dumpState.setUserId(realUserId); synchronized (mLock) { mImpl.dump(pw, dumpState); if (dumpState.getPackageName() == null) { @@ -1114,20 +1129,6 @@ public final class OverlayManagerService extends SystemService { } /** - * Ensure that the caller has permission to interact with the given userId. - * If the calling user is not the same as the provided user, the caller needs - * to hold the INTERACT_ACROSS_USERS_FULL permission (or be system uid or - * root). - * - * @param userId the user to interact with - * @param message message for any SecurityException - */ - private int handleIncomingUser(final int userId, @NonNull final String message) { - return ActivityManager.handleIncomingUser(Binder.getCallingPid(), - Binder.getCallingUid(), userId, false, true, message, null); - } - - /** * Enforce that the caller holds the DUMP permission (or is system or root). * * @param message used as message if SecurityException is thrown diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java index 0e9ec4d71421..02c0190224d0 100644 --- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java +++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java @@ -715,20 +715,11 @@ final class OverlayManagerServiceImpl { } void dump(@NonNull final PrintWriter pw, @NonNull DumpState dumpState) { - Pair<OverlayIdentifier, String> overlayIdmap = null; - if (dumpState.getPackageName() != null) { - OverlayIdentifier id = new OverlayIdentifier(dumpState.getPackageName(), - dumpState.getOverlayName()); - OverlayInfo oi = mSettings.getNullableOverlayInfo(id, USER_SYSTEM); - if (oi != null) { - overlayIdmap = new Pair<>(id, oi.baseCodePath); - } - } - // settings mSettings.dump(pw, dumpState); // idmap data + final var overlayIdmap = mSettings.getIdentifierAndBaseCodePath(dumpState); if (dumpState.getField() == null) { Set<Pair<OverlayIdentifier, String>> allIdmaps = (overlayIdmap != null) ? Set.of(overlayIdmap) : mSettings.getAllIdentifiersAndBaseCodePaths(); diff --git a/services/core/java/com/android/server/om/OverlayManagerSettings.java b/services/core/java/com/android/server/om/OverlayManagerSettings.java index f9758fcd5d01..e6b1c5f640f2 100644 --- a/services/core/java/com/android/server/om/OverlayManagerSettings.java +++ b/services/core/java/com/android/server/om/OverlayManagerSettings.java @@ -212,17 +212,41 @@ final class OverlayManagerSettings { } Set<String> getAllBaseCodePaths() { + // Overlays installed for multiple users have the same code path, avoid duplicates with Set. final Set<String> paths = new ArraySet<>(); mItems.forEach(item -> paths.add(item.mBaseCodePath)); return paths; } Set<Pair<OverlayIdentifier, String>> getAllIdentifiersAndBaseCodePaths() { + // Overlays installed for multiple users have the same code path, avoid duplicates with Set. final Set<Pair<OverlayIdentifier, String>> set = new ArraySet<>(); - mItems.forEach(item -> set.add(new Pair(item.mOverlay, item.mBaseCodePath))); + mItems.forEach(item -> set.add(new Pair<>(item.mOverlay, item.mBaseCodePath))); return set; } + @Nullable + Pair<OverlayIdentifier, String> getIdentifierAndBaseCodePath(@NonNull DumpState dumpState) { + if (dumpState.getPackageName() == null) { + return null; + } + OverlayIdentifier id = new OverlayIdentifier(dumpState.getPackageName(), + dumpState.getOverlayName()); + final int userId = dumpState.getUserId(); + for (int i = 0; i < mItems.size(); i++) { + final var item = mItems.get(i); + if (userId != UserHandle.USER_ALL && userId != item.mUserId) { + continue; + } + if (!id.equals(item.mOverlay)) { + continue; + } + // Overlays installed for multiple users have the same code path, return first found. + return new Pair<>(id, item.mBaseCodePath); + } + return null; + } + @NonNull List<OverlayInfo> removeIf(@NonNull final Predicate<OverlayInfo> predicate, final int userId) { return removeIf(info -> (predicate.test(info) && info.userId == userId)); diff --git a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java index b7f21125148c..39a6b1895c3a 100644 --- a/services/core/java/com/android/server/om/OverlayManagerShellCommand.java +++ b/services/core/java/com/android/server/om/OverlayManagerShellCommand.java @@ -17,6 +17,7 @@ package com.android.server.om; import static com.android.internal.content.om.OverlayConfig.PARTITION_ORDER_FILE_PATH; +import static com.android.server.om.OverlayManagerService.handleIncomingUser; import android.annotation.NonNull; import android.annotation.Nullable; @@ -145,7 +146,7 @@ final class OverlayManagerShellCommand extends ShellCommand { out.println(" Load a package and print the value of a given resource"); out.println(" applying the current configuration and enabled overlays."); out.println(" For a more fine-grained alternative, use 'idmap2 lookup'."); - out.println(" fabricate [--user USER_ID] [--target-name OVERLAYABLE] --target PACKAGE"); + out.println(" fabricate [--target-name OVERLAYABLE] --target PACKAGE"); out.println(" --name NAME [--file FILE] "); out.println(" PACKAGE:TYPE/NAME ENCODED-TYPE-ID|TYPE-NAME ENCODED-VALUE"); out.println(" Create an overlay from a single resource. Caller must be root. Example:"); @@ -160,7 +161,7 @@ final class OverlayManagerShellCommand extends ShellCommand { final PrintWriter out = getOutPrintWriter(); final PrintWriter err = getErrPrintWriter(); - int userId = UserHandle.USER_SYSTEM; + int userId = UserHandle.USER_CURRENT; String opt; while ((opt = getNextOption()) != null) { switch (opt) { @@ -234,7 +235,7 @@ final class OverlayManagerShellCommand extends ShellCommand { private int runEnableDisable(final boolean enable) throws RemoteException { final PrintWriter err = getErrPrintWriter(); - int userId = UserHandle.USER_SYSTEM; + int userId = UserHandle.USER_CURRENT; String opt; while ((opt = getNextOption()) != null) { switch (opt) { @@ -269,7 +270,6 @@ final class OverlayManagerShellCommand extends ShellCommand { return 1; } - int userId = UserHandle.USER_SYSTEM; String targetPackage = ""; String targetOverlayable = ""; String name = ""; @@ -278,9 +278,6 @@ final class OverlayManagerShellCommand extends ShellCommand { String config = null; while ((opt = getNextOption()) != null) { switch (opt) { - case "--user": - userId = UserHandle.parseUserArg(getNextArgRequired()); - break; case "--target": targetPackage = getNextArgRequired(); break; @@ -442,7 +439,7 @@ final class OverlayManagerShellCommand extends ShellCommand { private int runEnableExclusive() throws RemoteException { final PrintWriter err = getErrPrintWriter(); - int userId = UserHandle.USER_SYSTEM; + int userId = UserHandle.USER_CURRENT; boolean inCategory = false; String opt; while ((opt = getNextOption()) != null) { @@ -469,7 +466,7 @@ final class OverlayManagerShellCommand extends ShellCommand { private int runSetPriority() throws RemoteException { final PrintWriter err = getErrPrintWriter(); - int userId = UserHandle.USER_SYSTEM; + int userId = UserHandle.USER_CURRENT; String opt; while ((opt = getNextOption()) != null) { switch (opt) { @@ -498,7 +495,7 @@ final class OverlayManagerShellCommand extends ShellCommand { final PrintWriter out = getOutPrintWriter(); final PrintWriter err = getErrPrintWriter(); - int userId = UserHandle.USER_SYSTEM; + int userId = UserHandle.USER_CURRENT; boolean verbose = false; String opt; while ((opt = getNextOption()) != null) { @@ -525,15 +522,16 @@ final class OverlayManagerShellCommand extends ShellCommand { return 1; } + final int realUserId = handleIncomingUser(userId, "runLookup"); final Resources res; try { res = mContext - .createContextAsUser(UserHandle.of(userId), /* flags */ 0) + .createContextAsUser(UserHandle.of(realUserId), /* flags */ 0) .getPackageManager() .getResourcesForApplication(packageToLoad); } catch (PackageManager.NameNotFoundException e) { err.println(String.format("Error: failed to get resources for package %s for user %d", - packageToLoad, userId)); + packageToLoad, realUserId)); return 1; } final AssetManager assets = res.getAssets(); diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index 906befc1edcc..0d88a9b1f8ee 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -145,6 +145,7 @@ import android.util.SparseIntArray; import android.view.Display; import android.webkit.URLUtil; import android.window.ActivityWindowInfo; +import android.window.DesktopModeFlags; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; @@ -161,7 +162,6 @@ import com.android.server.companion.virtual.VirtualDeviceManagerInternal; import com.android.server.pm.SaferIntentUtils; import com.android.server.utils.Slogf; import com.android.server.wm.ActivityMetricsLogger.LaunchingState; -import com.android.window.flags.Flags; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -2974,7 +2974,8 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { @Override public void accept(ActivityRecord r) { - if (Flags.enableDesktopWindowingAppToWeb() && mInfo.capturedLink == null) { + if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_APP_TO_WEB.isTrue() + && mInfo.capturedLink == null) { setCapturedLink(r); } if (r.mLaunchCookie != null) { diff --git a/services/tests/servicestests/src/com/android/server/accessibility/autoclick/AutoclickControllerTest.java b/services/tests/servicestests/src/com/android/server/accessibility/autoclick/AutoclickControllerTest.java index f02bdae1d9e6..5d476ec95e2e 100644 --- a/services/tests/servicestests/src/com/android/server/accessibility/autoclick/AutoclickControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/accessibility/autoclick/AutoclickControllerTest.java @@ -20,6 +20,8 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat import static com.android.server.testutils.MockitoUtilsKt.eq; +import static com.google.common.truth.Truth.assertThat; + import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.testng.AssertJUnit.assertEquals; @@ -35,6 +37,7 @@ import android.testing.AndroidTestingRunner; import android.testing.TestableContext; import android.testing.TestableLooper; import android.view.InputDevice; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; @@ -193,6 +196,39 @@ public class AutoclickControllerTest { } @Test + @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR) + public void onKeyEvent_modifierKey_doNotUpdateMetaStateWhenControllerIsNull() { + assertThat(mController.mClickScheduler).isNull(); + + injectFakeKeyEvent(KeyEvent.KEYCODE_ALT_LEFT, KeyEvent.META_ALT_ON); + + assertThat(mController.mClickScheduler).isNull(); + } + + @Test + @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR) + public void onKeyEvent_modifierKey_updateMetaStateWhenControllerNotNull() { + injectFakeMouseActionDownEvent(); + + int metaState = KeyEvent.META_ALT_ON | KeyEvent.META_META_ON; + injectFakeKeyEvent(KeyEvent.KEYCODE_ALT_LEFT, metaState); + + assertThat(mController.mClickScheduler).isNotNull(); + assertThat(mController.mClickScheduler.getMetaStateForTesting()).isEqualTo(metaState); + } + + @Test + @EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR) + public void onKeyEvent_modifierKey_cancelAutoClickWhenAdditionalRegularKeyPresssed() { + injectFakeMouseActionDownEvent(); + + injectFakeKeyEvent(KeyEvent.KEYCODE_J, KeyEvent.META_ALT_ON); + + assertThat(mController.mClickScheduler).isNotNull(); + assertThat(mController.mClickScheduler.getMetaStateForTesting()).isEqualTo(0); + } + + @Test public void onDestroy_clearClickScheduler() { injectFakeMouseActionDownEvent(); @@ -232,6 +268,17 @@ public class AutoclickControllerTest { mController.onMotionEvent(event, event, /* policyFlags= */ 0); } + private void injectFakeKeyEvent(int keyCode, int modifiers) { + KeyEvent keyEvent = new KeyEvent( + /* downTime= */ 0, + /* eventTime= */ 0, + /* action= */ KeyEvent.ACTION_DOWN, + /* code= */ keyCode, + /* repeat= */ 0, + /* metaState= */ modifiers); + mController.onKeyEvent(keyEvent, /* policyFlags= */ 0); + } + private MotionEvent getFakeMotionDownEvent() { return MotionEvent.obtain( /* downTime= */ 0, diff --git a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt index 36db955c3085..37bdf6b8614d 100644 --- a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt +++ b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt @@ -1111,9 +1111,9 @@ class KeyGestureControllerTests { intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE) ), TestData( - "FULLSCREEN -> Maximizes a task to fit the screen", + "FULLSCREEN -> Turns a task into fullscreen", intArrayOf(KeyEvent.KEYCODE_FULLSCREEN), - KeyGestureEvent.KEY_GESTURE_TYPE_MAXIMIZE_FREEFORM_WINDOW, + KeyGestureEvent.KEY_GESTURE_TYPE_MULTI_WINDOW_NAVIGATION, intArrayOf(KeyEvent.KEYCODE_FULLSCREEN), 0, intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE) |