Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4808692 authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Bubble flicker test: Ensure the notification shade is opened" into tm-dev am: ab6aaa76

parents b0974a50 ab6aaa76
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.wm.shell.flicker.bubble
package com.android.wm.shell.flicker.bubble


import android.platform.test.annotations.Presubmit
import android.platform.test.annotations.Presubmit
import android.view.WindowInsets
import android.view.WindowManager
import androidx.test.filters.FlakyTest
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
import androidx.test.filters.RequiresDevice
import androidx.test.uiautomator.By
import androidx.test.uiautomator.By
@@ -59,6 +61,16 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
                }
                }
            }
            }
            transitions {
            transitions {
                // Swipe & wait for the notification shade to expand so all can be seen
                val wm = context.getSystemService(WindowManager::class.java)
                val metricInsets = wm.getCurrentWindowMetrics().windowInsets
                val insets = metricInsets.getInsetsIgnoringVisibility(
                        WindowInsets.Type.statusBars()
                        or WindowInsets.Type.displayCutout())
                device.swipe(100, insets.top + 100, 100, device.getDisplayHeight() / 2, 4)
                device.waitForIdle(2000)
                instrumentation.uiAutomation.syncInputTransactions()

                val notification = device.wait(Until.findObject(
                val notification = device.wait(Until.findObject(
                    By.text("BubbleChat")), FIND_OBJECT_TIMEOUT)
                    By.text("BubbleChat")), FIND_OBJECT_TIMEOUT)
                notification?.click() ?: error("Notification not found")
                notification?.click() ?: error("Notification not found")
+4 −9
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.app.Person;
import android.app.Person;
import android.app.RemoteInput;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.graphics.Point;
import android.graphics.Point;
@@ -116,24 +115,20 @@ public class BubbleHelper {
    private Notification.Builder getNotificationBuilder(int id) {
    private Notification.Builder getNotificationBuilder(int id) {
        Person chatBot = new Person.Builder()
        Person chatBot = new Person.Builder()
                .setBot(true)
                .setBot(true)
                .setName("BubbleBot")
                .setName("BubbleChat")
                .setImportant(true)
                .setImportant(true)
                .build();
                .build();

        RemoteInput remoteInput = new RemoteInput.Builder("key")
                .setLabel("Reply")
                .build();

        String shortcutId = "BubbleChat";
        String shortcutId = "BubbleChat";
        return new Notification.Builder(mContext, CHANNEL_ID)
        return new Notification.Builder(mContext, CHANNEL_ID)
                .setChannelId(CHANNEL_ID)
                .setChannelId(CHANNEL_ID)
                .setShortcutId(shortcutId)
                .setShortcutId(shortcutId)
                .setContentTitle("BubbleChat")
                .setContentIntent(PendingIntent.getActivity(mContext, 0,
                .setContentIntent(PendingIntent.getActivity(mContext, 0,
                        new Intent(mContext, LaunchBubbleActivity.class),
                        new Intent(mContext, LaunchBubbleActivity.class),
                        PendingIntent.FLAG_UPDATE_CURRENT))
                        PendingIntent.FLAG_UPDATE_CURRENT))
                .setStyle(new Notification.MessagingStyle(chatBot)
                .setStyle(new Notification.MessagingStyle(chatBot)
                        .setConversationTitle("BubbleChat")
                        .setConversationTitle("BubbleChat")
                        .addMessage("Hello? This is bubble: " + id,
                        .addMessage("BubbleChat",
                                SystemClock.currentThreadTimeMillis() - 300000, chatBot)
                                SystemClock.currentThreadTimeMillis() - 300000, chatBot)
                        .addMessage("Is it me, " + id + ", you're looking for?",
                        .addMessage("Is it me, " + id + ", you're looking for?",
                                SystemClock.currentThreadTimeMillis(), chatBot)
                                SystemClock.currentThreadTimeMillis(), chatBot)