Loading core/java/android/service/notification/TEST_MAPPING 0 → 100644 +49 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "CtsNotificationTestCases", "options": [ { "exclude-annotation": "android.platform.test.annotations.FlakyTest" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" }, { "exclude-annotation": "android.platform.test.annotations.LargeTest" }, { "exclude-annotation": "androidx.test.filters.LargeTest" } ] }, { "name": "FrameworksUiServicesTests", "options": [ { "exclude-annotation": "android.platform.test.annotations.FlakyTest" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" }, { "exclude-annotation": "android.platform.test.annotations.LargeTest" }, { "exclude-annotation": "androidx.test.filters.LargeTest" } ] } ], "postsubmit": [ { "name": "CtsNotificationTestCases" } ] } core/java/android/view/contentprotection/ContentProtectionEventProcessor.java +26 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class ContentProtectionEventProcessor { ContentCaptureEvent.TYPE_VIEW_DISAPPEARED, ContentCaptureEvent.TYPE_VIEW_TEXT_CHANGED))); private static final int RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS = 150; @NonNull private final RingBuffer<ContentCaptureEvent> mEventBuffer; @NonNull private final Handler mHandler; Loading @@ -93,6 +95,8 @@ public class ContentProtectionEventProcessor { @Nullable public Instant mLastFlushTime; private int mResetLoginRemainingEventsToProcess; public ContentProtectionEventProcessor( @NonNull RingBuffer<ContentCaptureEvent> eventBuffer, @NonNull Handler handler, Loading Loading @@ -130,6 +134,8 @@ public class ContentProtectionEventProcessor { mSuspiciousTextDetected |= isSuspiciousText(event); if (mPasswordFieldDetected && mSuspiciousTextDetected) { loginDetected(); } else { maybeResetLoginFlags(); } } Loading @@ -139,8 +145,28 @@ public class ContentProtectionEventProcessor { || Instant.now().isAfter(mLastFlushTime.plus(MIN_DURATION_BETWEEN_FLUSHING))) { flush(); } resetLoginFlags(); } @UiThread private void resetLoginFlags() { mPasswordFieldDetected = false; mSuspiciousTextDetected = false; mResetLoginRemainingEventsToProcess = 0; } @UiThread private void maybeResetLoginFlags() { if (mPasswordFieldDetected || mSuspiciousTextDetected) { if (mResetLoginRemainingEventsToProcess <= 0) { mResetLoginRemainingEventsToProcess = RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS; } else { mResetLoginRemainingEventsToProcess--; if (mResetLoginRemainingEventsToProcess <= 0) { resetLoginFlags(); } } } } @UiThread Loading core/java/android/window/TransitionInfo.java +10 −0 Original line number Diff line number Diff line Loading @@ -549,6 +549,16 @@ public final class TransitionInfo implements Parcelable { } } /** * Updates the callsites of all the surfaces in this transition, which aids in the debugging of * lingering surfaces. */ public void setUnreleasedWarningCallSiteForAllSurfaces(String callsite) { for (int i = mChanges.size() - 1; i >= 0; --i) { mChanges.get(i).getLeash().setUnreleasedWarningCallSite(callsite); } } /** * Makes a copy of this as if it were parcel'd and unparcel'd. This implies that surfacecontrol * refcounts are incremented which allows the "remote" receiver to release them without breaking Loading core/tests/coretests/src/android/view/contentprotection/ContentProtectionEventProcessorTest.java +52 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public class ContentProtectionEventProcessorTest { private static final Set<Integer> EVENT_TYPES_TO_STORE = ImmutableSet.of(TYPE_VIEW_APPEARED, TYPE_VIEW_DISAPPEARED, TYPE_VIEW_TEXT_CHANGED); private static final int RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS = 150; @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule(); @Mock private RingBuffer<ContentCaptureEvent> mMockEventBuffer; Loading Loading @@ -231,6 +233,56 @@ public class ContentProtectionEventProcessorTest { verifyZeroInteractions(mMockContentCaptureManager); } @Test public void processEvent_loginDetected_belowResetLimit() throws Exception { when(mMockEventBuffer.toArray()).thenReturn(BUFFERED_EVENTS); mContentProtectionEventProcessor.mSuspiciousTextDetected = true; ContentCaptureEvent event = createAndroidPasswordFieldEvent( ANDROID_CLASS_NAME, InputType.TYPE_TEXT_VARIATION_PASSWORD); for (int i = 0; i < RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS; i++) { mContentProtectionEventProcessor.processEvent(PROCESS_EVENT); } assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isTrue(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); mContentProtectionEventProcessor.processEvent(event); assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer).clear(); verify(mMockEventBuffer).toArray(); assertOnLoginDetected(); } @Test public void processEvent_loginDetected_aboveResetLimit() throws Exception { mContentProtectionEventProcessor.mSuspiciousTextDetected = true; ContentCaptureEvent event = createAndroidPasswordFieldEvent( ANDROID_CLASS_NAME, InputType.TYPE_TEXT_VARIATION_PASSWORD); for (int i = 0; i < RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS + 1; i++) { mContentProtectionEventProcessor.processEvent(PROCESS_EVENT); } assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); mContentProtectionEventProcessor.processEvent(event); assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isTrue(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); } @Test public void processEvent_multipleLoginsDetected_belowFlushThreshold() throws Exception { when(mMockEventBuffer.toArray()).thenReturn(BUFFERED_EVENTS); Loading libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml +14 −7 Original line number Diff line number Diff line Loading @@ -13,13 +13,20 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group android:translateY="8.0"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="128dp" android:height="4dp" android:viewportWidth="128" android:viewportHeight="4" > <group> <clip-path android:pathData="M2 0H126C127.105 0 128 0.895431 128 2C128 3.10457 127.105 4 126 4H2C0.895431 4 0 3.10457 0 2C0 0.895431 0.895431 0 2 0Z" /> <path android:fillColor="@android:color/black" android:pathData="M3,5V3H21V5Z"/> android:pathData="M0 0V4H128V0" android:fillColor="@android:color/black" /> </group> </vector> Loading
core/java/android/service/notification/TEST_MAPPING 0 → 100644 +49 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "CtsNotificationTestCases", "options": [ { "exclude-annotation": "android.platform.test.annotations.FlakyTest" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" }, { "exclude-annotation": "android.platform.test.annotations.LargeTest" }, { "exclude-annotation": "androidx.test.filters.LargeTest" } ] }, { "name": "FrameworksUiServicesTests", "options": [ { "exclude-annotation": "android.platform.test.annotations.FlakyTest" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" }, { "exclude-annotation": "android.platform.test.annotations.LargeTest" }, { "exclude-annotation": "androidx.test.filters.LargeTest" } ] } ], "postsubmit": [ { "name": "CtsNotificationTestCases" } ] }
core/java/android/view/contentprotection/ContentProtectionEventProcessor.java +26 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class ContentProtectionEventProcessor { ContentCaptureEvent.TYPE_VIEW_DISAPPEARED, ContentCaptureEvent.TYPE_VIEW_TEXT_CHANGED))); private static final int RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS = 150; @NonNull private final RingBuffer<ContentCaptureEvent> mEventBuffer; @NonNull private final Handler mHandler; Loading @@ -93,6 +95,8 @@ public class ContentProtectionEventProcessor { @Nullable public Instant mLastFlushTime; private int mResetLoginRemainingEventsToProcess; public ContentProtectionEventProcessor( @NonNull RingBuffer<ContentCaptureEvent> eventBuffer, @NonNull Handler handler, Loading Loading @@ -130,6 +134,8 @@ public class ContentProtectionEventProcessor { mSuspiciousTextDetected |= isSuspiciousText(event); if (mPasswordFieldDetected && mSuspiciousTextDetected) { loginDetected(); } else { maybeResetLoginFlags(); } } Loading @@ -139,8 +145,28 @@ public class ContentProtectionEventProcessor { || Instant.now().isAfter(mLastFlushTime.plus(MIN_DURATION_BETWEEN_FLUSHING))) { flush(); } resetLoginFlags(); } @UiThread private void resetLoginFlags() { mPasswordFieldDetected = false; mSuspiciousTextDetected = false; mResetLoginRemainingEventsToProcess = 0; } @UiThread private void maybeResetLoginFlags() { if (mPasswordFieldDetected || mSuspiciousTextDetected) { if (mResetLoginRemainingEventsToProcess <= 0) { mResetLoginRemainingEventsToProcess = RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS; } else { mResetLoginRemainingEventsToProcess--; if (mResetLoginRemainingEventsToProcess <= 0) { resetLoginFlags(); } } } } @UiThread Loading
core/java/android/window/TransitionInfo.java +10 −0 Original line number Diff line number Diff line Loading @@ -549,6 +549,16 @@ public final class TransitionInfo implements Parcelable { } } /** * Updates the callsites of all the surfaces in this transition, which aids in the debugging of * lingering surfaces. */ public void setUnreleasedWarningCallSiteForAllSurfaces(String callsite) { for (int i = mChanges.size() - 1; i >= 0; --i) { mChanges.get(i).getLeash().setUnreleasedWarningCallSite(callsite); } } /** * Makes a copy of this as if it were parcel'd and unparcel'd. This implies that surfacecontrol * refcounts are incremented which allows the "remote" receiver to release them without breaking Loading
core/tests/coretests/src/android/view/contentprotection/ContentProtectionEventProcessorTest.java +52 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public class ContentProtectionEventProcessorTest { private static final Set<Integer> EVENT_TYPES_TO_STORE = ImmutableSet.of(TYPE_VIEW_APPEARED, TYPE_VIEW_DISAPPEARED, TYPE_VIEW_TEXT_CHANGED); private static final int RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS = 150; @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule(); @Mock private RingBuffer<ContentCaptureEvent> mMockEventBuffer; Loading Loading @@ -231,6 +233,56 @@ public class ContentProtectionEventProcessorTest { verifyZeroInteractions(mMockContentCaptureManager); } @Test public void processEvent_loginDetected_belowResetLimit() throws Exception { when(mMockEventBuffer.toArray()).thenReturn(BUFFERED_EVENTS); mContentProtectionEventProcessor.mSuspiciousTextDetected = true; ContentCaptureEvent event = createAndroidPasswordFieldEvent( ANDROID_CLASS_NAME, InputType.TYPE_TEXT_VARIATION_PASSWORD); for (int i = 0; i < RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS; i++) { mContentProtectionEventProcessor.processEvent(PROCESS_EVENT); } assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isTrue(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); mContentProtectionEventProcessor.processEvent(event); assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer).clear(); verify(mMockEventBuffer).toArray(); assertOnLoginDetected(); } @Test public void processEvent_loginDetected_aboveResetLimit() throws Exception { mContentProtectionEventProcessor.mSuspiciousTextDetected = true; ContentCaptureEvent event = createAndroidPasswordFieldEvent( ANDROID_CLASS_NAME, InputType.TYPE_TEXT_VARIATION_PASSWORD); for (int i = 0; i < RESET_LOGIN_TOTAL_EVENTS_TO_PROCESS + 1; i++) { mContentProtectionEventProcessor.processEvent(PROCESS_EVENT); } assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isFalse(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); mContentProtectionEventProcessor.processEvent(event); assertThat(mContentProtectionEventProcessor.mPasswordFieldDetected).isTrue(); assertThat(mContentProtectionEventProcessor.mSuspiciousTextDetected).isFalse(); verify(mMockEventBuffer, never()).clear(); verify(mMockEventBuffer, never()).toArray(); } @Test public void processEvent_multipleLoginsDetected_belowFlushThreshold() throws Exception { when(mMockEventBuffer.toArray()).thenReturn(BUFFERED_EVENTS); Loading
libs/WindowManager/Shell/res/drawable/decor_handle_dark.xml +14 −7 Original line number Diff line number Diff line Loading @@ -13,13 +13,20 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group android:translateY="8.0"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="128dp" android:height="4dp" android:viewportWidth="128" android:viewportHeight="4" > <group> <clip-path android:pathData="M2 0H126C127.105 0 128 0.895431 128 2C128 3.10457 127.105 4 126 4H2C0.895431 4 0 3.10457 0 2C0 0.895431 0.895431 0 2 0Z" /> <path android:fillColor="@android:color/black" android:pathData="M3,5V3H21V5Z"/> android:pathData="M0 0V4H128V0" android:fillColor="@android:color/black" /> </group> </vector>