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

Commit 71cb599d authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge changes from topic "testapp-refactor"

* changes:
  4/ Delete flicker test apps from WMShell package
  3/ Update flicker tests to compatibilize with new apps
  2/ Update app helpers for new apps
  1/ Add test apps from WM shell package into flicker
parents cec66307 ec667f9f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,6 +48,6 @@ android_test {
        "wm-flicker-common-assertions",
        "wm-flicker-common-app-helpers",
        "platform-test-annotations",
        "wmshell-flicker-test-components",
        "flickertestapplib",
    ],
}
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true"/>
        <option name="test-file-name" value="WMShellFlickerTests.apk"/>
        <option name="test-file-name" value="WMShellFlickerTestApp.apk" />
        <option name="test-file-name" value="FlickerTestApp.apk" />
    </target_preparer>
    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
        <option name="package" value="com.android.wm.shell.flicker"/>
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.flicker

import android.app.Instrumentation
import android.content.Context
import android.provider.Settings
import android.util.Log
import com.android.compatibility.common.util.SystemUtil
import java.io.IOException

object MultiWindowUtils {
    private fun executeShellCommand(instrumentation: Instrumentation, cmd: String) {
        try {
            SystemUtil.runShellCommand(instrumentation, cmd)
        } catch (e: IOException) {
            Log.e(MultiWindowUtils::class.simpleName, "executeShellCommand error! $e")
        }
    }

    fun getDevEnableNonResizableMultiWindow(context: Context): Int =
        Settings.Global.getInt(context.contentResolver,
            Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW)

    fun setDevEnableNonResizableMultiWindow(context: Context, configValue: Int) =
        Settings.Global.putInt(context.contentResolver,
            Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, configValue)

    fun setSupportsNonResizableMultiWindow(instrumentation: Instrumentation, configValue: Int) =
        executeShellCommand(
            instrumentation,
            createConfigSupportsNonResizableMultiWindowCommand(configValue))

    fun resetMultiWindowConfig(instrumentation: Instrumentation) =
        executeShellCommand(instrumentation, resetMultiWindowConfigCommand)

    private fun createConfigSupportsNonResizableMultiWindowCommand(configValue: Int): String =
        "wm set-multi-window-config --supportsNonResizable $configValue"

    private const val resetMultiWindowConfigCommand: String = "wm reset-multi-window-config"
}
+3 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.flicker.bubble
import android.app.INotificationManager
import android.app.NotificationManager
import android.content.Context
import android.content.pm.PackageManager
import android.os.ServiceManager
import android.view.Surface
import androidx.test.uiautomator.By
@@ -28,9 +29,9 @@ import com.android.server.wm.flicker.Flicker
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.helpers.LaunchBubbleHelper
import com.android.server.wm.flicker.helpers.SYSTEMUI_PACKAGE
import com.android.wm.shell.flicker.BaseTest
import com.android.wm.shell.flicker.helpers.LaunchBubbleHelper
import org.junit.runners.Parameterized

/**
@@ -47,7 +48,7 @@ abstract class BaseBubbleScreen(
            ServiceManager.getService(Context.NOTIFICATION_SERVICE))

    private val uid = context.packageManager.getApplicationInfo(
            testApp.`package`, 0).uid
            testApp.`package`, PackageManager.ApplicationInfoFlags.of(0)).uid

    @JvmOverloads
    protected open fun buildTransition(
+0 −27
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.flicker.helpers

import android.app.Instrumentation
import com.android.server.wm.traces.parser.toFlickerComponent
import com.android.wm.shell.flicker.testapp.Components

class FixedAppHelper(instrumentation: Instrumentation) : BaseAppHelper(
    instrumentation,
    Components.FixedActivity.LABEL,
    Components.FixedActivity.COMPONENT.toFlickerComponent()
)
 No newline at end of file
Loading