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

Commit f26c0ad8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add SplitScreenUtils#enterSplitViaIntent for FlickerTests" into...

Merge "Add SplitScreenUtils#enterSplitViaIntent for FlickerTests" into udc-qpr-dev am: 41ec4ba6 am: 7cf97b68

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23728175



Change-Id: I865e47adca3e71bbcd3e46c758f91966993be7bb
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2e0161f1 7cf97b68
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.server.wm.flicker.helpers.NonResizeableAppHelper
import com.android.server.wm.flicker.helpers.NotificationAppHelper
import com.android.server.wm.flicker.helpers.NotificationAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.helpers.SimpleAppHelper
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.flicker.testapp.ActivityOptions
import com.android.server.wm.flicker.testapp.ActivityOptions.SplitScreen.Primary
import com.android.wm.shell.flicker.LAUNCHER_UI_PACKAGE_NAME
import com.android.wm.shell.flicker.LAUNCHER_UI_PACKAGE_NAME
import com.android.wm.shell.flicker.SYSTEM_UI_PACKAGE_NAME
import com.android.wm.shell.flicker.SYSTEM_UI_PACKAGE_NAME
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNotNull
@@ -112,6 +113,17 @@ internal object SplitScreenUtils {
        waitForSplitComplete(wmHelper, primaryApp, secondaryApp)
        waitForSplitComplete(wmHelper, primaryApp, secondaryApp)
    }
    }


    fun enterSplitViaIntent(
            wmHelper: WindowManagerStateHelper,
            primaryApp: StandardAppHelper,
            secondaryApp: StandardAppHelper
    ) {
        val stringExtras = mapOf(Primary.EXTRA_LAUNCH_ADJACENT to "true")
        primaryApp.launchViaIntent(wmHelper, null, null,
                stringExtras)
        waitForSplitComplete(wmHelper, primaryApp, secondaryApp)
    }

    fun splitFromOverview(tapl: LauncherInstrumentation, device: UiDevice) {
    fun splitFromOverview(tapl: LauncherInstrumentation, device: UiDevice) {
        // Note: The initial split position in landscape is different between tablet and phone.
        // Note: The initial split position in landscape is different between tablet and phone.
        // In landscape, tablet will let the first app split to right side, and phone will
        // In landscape, tablet will let the first app split to right side, and phone will
+0 −1
Original line number Original line Diff line number Diff line
@@ -52,7 +52,6 @@ class UnlockKeyguardToSplitScreen(override val flicker: LegacyFlickerTest) :
    /** {@inheritDoc} */
    /** {@inheritDoc} */
    override val transition: FlickerBuilder.() -> Unit
    override val transition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            defaultSetup(this)
            defaultTeardown(this)
            defaultTeardown(this)
            thisTransition(this)
            thisTransition(this)
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ open class UnlockKeyguardToSplitScreenBenchmark(override val flicker: LegacyFlic
    SplitScreenBase(flicker) {
    SplitScreenBase(flicker) {
    protected val thisTransition: FlickerBuilder.() -> Unit
    protected val thisTransition: FlickerBuilder.() -> Unit
        get() = {
        get() = {
            setup { SplitScreenUtils.enterSplit(wmHelper, tapl, device, primaryApp, secondaryApp) }
            setup { SplitScreenUtils.enterSplitViaIntent(wmHelper, primaryApp, secondaryApp) }
            transitions {
            transitions {
                device.sleep()
                device.sleep()
                wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
                wmHelper.StateSyncBuilder().withAppTransitionIdle().waitForAndVerify()
+2 −0
Original line number Original line Diff line number Diff line
@@ -186,6 +186,8 @@ public class ActivityOptions {
            public static final String LABEL = "SplitScreenPrimaryActivity";
            public static final String LABEL = "SplitScreenPrimaryActivity";
            public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE,
            public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE,
                    FLICKER_APP_PACKAGE + ".SplitScreenActivity");
                    FLICKER_APP_PACKAGE + ".SplitScreenActivity");

            public static final String EXTRA_LAUNCH_ADJACENT = "launch_adjacent";
        }
        }


        public static class Secondary {
        public static class Secondary {
+18 −0
Original line number Original line Diff line number Diff line
@@ -16,9 +16,14 @@


package com.android.server.wm.flicker.testapp;
package com.android.server.wm.flicker.testapp;


import static com.android.server.wm.flicker.testapp.ActivityOptions.SplitScreen.Primary.EXTRA_LAUNCH_ADJACENT;

import android.app.Activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Bundle;


import androidx.annotation.Nullable;

public class SplitScreenActivity extends Activity {
public class SplitScreenActivity extends Activity {


    @Override
    @Override
@@ -26,4 +31,17 @@ public class SplitScreenActivity extends Activity {
        super.onCreate(icicle);
        super.onCreate(icicle);
        setContentView(R.layout.activity_splitscreen);
        setContentView(R.layout.activity_splitscreen);
    }
    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        final boolean startSecondaryActivity = getIntent().hasExtra(EXTRA_LAUNCH_ADJACENT);
        if (startSecondaryActivity) {
            final Intent intent = new Intent(this, SplitScreenSecondaryActivity.class);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
            startActivity(intent);
        }
    }
}
}