diff options
Diffstat (limited to 'tests')
209 files changed, 9728 insertions, 5241 deletions
diff --git a/tests/AccessibilityEventsLogger/AndroidManifest.xml b/tests/AccessibilityEventsLogger/AndroidManifest.xml index d86769f570c5..a5713679786f 100644 --- a/tests/AccessibilityEventsLogger/AndroidManifest.xml +++ b/tests/AccessibilityEventsLogger/AndroidManifest.xml @@ -16,25 +16,23 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - package="com.android.tests.accessibilityeventlogger" - android:versionCode="1" - android:versionName="0.0" > - - <uses-sdk - android:minSdkVersion="18" - android:targetSdkVersion="18" /> - - <application - android:allowBackup="true" - android:enabled="true" - android:label="@string/app_name" > - - <service - android:name=".AELogger" - android:enabled="true" - android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" - android:configChanges="locale" > + xmlns:tools="http://schemas.android.com/tools" + package="com.android.tests.accessibilityeventlogger" + android:versionCode="1" + android:versionName="0.0"> + + <uses-sdk android:minSdkVersion="18" + android:targetSdkVersion="18"/> + + <application android:allowBackup="true" + android:enabled="true" + android:label="@string/app_name"> + + <service android:name=".AELogger" + android:enabled="true" + android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" + android:configChanges="locale" + android:exported="true"> <intent-filter> <action android:name="android.accessibilityservice.AccessibilityService"/> @@ -43,9 +41,8 @@ <category android:name="android.accessibilityservice.category.FEEDBACK_AUDIBLE"/> </intent-filter> - <meta-data - android:name="android.accessibilityservice" - android:resource="@xml/accessibilityservice" /> + <meta-data android:name="android.accessibilityservice" + android:resource="@xml/accessibilityservice"/> </service> </application> </manifest> diff --git a/tests/AccessoryDisplay/sink/AndroidManifest.xml b/tests/AccessoryDisplay/sink/AndroidManifest.xml index 72d498f2d855..2aee9693ff17 100644 --- a/tests/AccessoryDisplay/sink/AndroidManifest.xml +++ b/tests/AccessoryDisplay/sink/AndroidManifest.xml @@ -15,26 +15,27 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.accessorydisplay.sink" > + package="com.android.accessorydisplay.sink"> <uses-feature android:name="android.hardware.usb.host"/> - <uses-sdk android:minSdkVersion="18" /> + <uses-sdk android:minSdkVersion="18"/> <application android:label="@string/app_name" - android:icon="@drawable/ic_app" - android:hardwareAccelerated="true"> + android:icon="@drawable/ic_app" + android:hardwareAccelerated="true"> <activity android:name=".SinkActivity" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo"> + android:label="@string/app_name" + android:theme="@android:style/Theme.Holo" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" - android:resource="@xml/usb_device_filter"/> + android:resource="@xml/usb_device_filter"/> </activity> </application> diff --git a/tests/AccessoryDisplay/source/AndroidManifest.xml b/tests/AccessoryDisplay/source/AndroidManifest.xml index d3edcb838877..4611e1de466c 100644 --- a/tests/AccessoryDisplay/source/AndroidManifest.xml +++ b/tests/AccessoryDisplay/source/AndroidManifest.xml @@ -15,26 +15,27 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.accessorydisplay.source" > + package="com.android.accessorydisplay.source"> <uses-feature android:name="android.hardware.usb.accessory"/> - <uses-sdk android:minSdkVersion="18" /> + <uses-sdk android:minSdkVersion="18"/> <application android:label="@string/app_name" - android:icon="@drawable/ic_app" - android:hardwareAccelerated="true"> + android:icon="@drawable/ic_app" + android:hardwareAccelerated="true"> <activity android:name=".SourceActivity" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo"> + android:label="@string/app_name" + android:theme="@android:style/Theme.Holo" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" - android:resource="@xml/usb_accessory_filter"/> + android:resource="@xml/usb_accessory_filter"/> </activity> </application> diff --git a/tests/ActivityManagerPerfTests/stub-app/AndroidManifest.xml b/tests/ActivityManagerPerfTests/stub-app/AndroidManifest.xml index a57f64c320c8..6bdeea06053f 100644 --- a/tests/ActivityManagerPerfTests/stub-app/AndroidManifest.xml +++ b/tests/ActivityManagerPerfTests/stub-app/AndroidManifest.xml @@ -16,39 +16,34 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.stubs.am"> + package="com.android.stubs.am"> <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/> - <application android:label="Android TestCase" > - <provider - android:authorities="@string/authority" - android:name=".TestContentProvider" - android:exported="true" /> - <receiver - android:name=".TestBroadcastReceiver" - android:exported="true"> + <application android:label="Android TestCase"> + <provider android:authorities="@string/authority" + android:name=".TestContentProvider" + android:exported="true"/> + <receiver android:name=".TestBroadcastReceiver" + android:exported="true"> <intent-filter> - <action android:name="com.android.stubs.am.ACTION_BROADCAST_TEST" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="com.android.stubs.am.ACTION_BROADCAST_TEST"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </receiver> - <service - android:name=".InitService" - android:exported="true" /> - <service - android:name=".TestService" - android:exported="true" /> - <activity - android:name=".TestActivity" - android:excludeFromRecents="true" - android:turnScreenOn="true" - android:launchMode="singleTask"> + <service android:name=".InitService" + android:exported="true"/> + <service android:name=".TestService" + android:exported="true"/> + <activity android:name=".TestActivity" + android:excludeFromRecents="true" + android:turnScreenOn="true" + android:launchMode="singleTask" + android:exported="true"> <intent-filter> - <action android:name="com.android.stubs.am.ACTION_START_TEST_ACTIVITY" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="com.android.stubs.am.ACTION_START_TEST_ACTIVITY"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> </manifest> - diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/OomAdjPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/OomAdjPerfTest.java index 1d3ff06e6bf1..5d6a4a3541c1 100644 --- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/OomAdjPerfTest.java +++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/OomAdjPerfTest.java @@ -22,13 +22,13 @@ import android.content.Context; import android.net.Uri; import android.os.HandlerThread; import android.perftests.utils.ManualBenchmarkState; -import android.perftests.utils.PerfManualStatusReporter; import android.perftests.utils.TraceMarkParser; import android.perftests.utils.TraceMarkParser.TraceMarkLine; import android.perftests.utils.TraceMarkParser.TraceMarkSlice; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; +import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.perftests.am.util.AtraceUtils; import com.android.frameworks.perftests.am.util.TargetPackageUtils; @@ -36,10 +36,8 @@ import com.android.frameworks.perftests.am.util.Utils; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.util.ArrayList; import java.util.List; @@ -53,9 +51,9 @@ import java.util.List; * into the stats; when there are enough samples in the stats, the test will * stop and output the mean/stddev time spent on the updateOomAdjLocked. */ -@RunWith(JUnit4.class) +@RunWith(AndroidJUnit4.class) @LargeTest -public final class OomAdjPerfTest { +public final class OomAdjPerfTest extends BasePerfTest { private static final String TAG = "OomAdjPerfTest"; private static final boolean VERBOSE = true; @@ -74,8 +72,6 @@ public final class OomAdjPerfTest { private static final String ATRACE_CATEGORY = "am"; private static final String ATRACE_OOMADJ_PREFIX = "updateOomAdj_"; - @Rule - public PerfManualStatusReporter mPerfManualStatusReporter = new PerfManualStatusReporter(); private TraceMarkParser mTraceMarkParser = new TraceMarkParser(this::shouldFilterTraceLine); private final ArrayList<Long> mDurations = new ArrayList<Long>(); private Context mContext; diff --git a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java index ba2064005937..e1b508b424f5 100644 --- a/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java +++ b/tests/ActivityManagerPerfTests/tests/src/com/android/frameworks/perftests/am/tests/ServiceStartPerfTest.java @@ -25,14 +25,30 @@ import androidx.test.runner.AndroidJUnit4; import com.android.frameworks.perftests.am.util.Constants; import com.android.frameworks.perftests.am.util.TargetPackageUtils; +import com.android.frameworks.perftests.am.util.Utils; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class ServiceStartPerfTest extends BasePerfTest { + private static final String STUB_PACKAGE_NAME = + "com.android.frameworks.perftests.amteststestapp"; + + @Before + public void setUp() { + super.setUp(); + Utils.runShellCommand("cmd deviceidle whitelist +" + STUB_PACKAGE_NAME); + } + + @After + public void tearDown() { + Utils.runShellCommand("cmd deviceidle whitelist -" + STUB_PACKAGE_NAME); + } /** * Tries to start the service with the given intent, throwing a RuntimeException with the diff --git a/tests/ActivityTests/AndroidManifest.xml b/tests/ActivityTests/AndroidManifest.xml index 0b3bd70ba5c9..88a5e64a92bd 100644 --- a/tests/ActivityTests/AndroidManifest.xml +++ b/tests/ActivityTests/AndroidManifest.xml @@ -15,85 +15,98 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.activity"> - <uses-permission android:name="android.permission.REAL_GET_TASKS" /> - <uses-permission android:name="android.permission.REORDER_TASKS" /> - <uses-permission android:name="android.permission.REMOVE_TASKS" /> - <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> - <uses-permission android:name="android.permission.MANAGE_USERS" /> - <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> - <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> - <uses-sdk android:targetSdkVersion="22" /> + package="com.google.android.test.activity"> + <uses-permission android:name="android.permission.REAL_GET_TASKS"/> + <uses-permission android:name="android.permission.REORDER_TASKS"/> + <uses-permission android:name="android.permission.REMOVE_TASKS"/> + <uses-permission android:name="android.permission.READ_FRAME_BUFFER"/> + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/> + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/> + <uses-permission android:name="android.permission.MANAGE_USERS"/> + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> + <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> + <uses-sdk android:targetSdkVersion="22"/> <application android:label="ActivityTest"> - <activity android:name="ActivityTestMain"> + <activity android:name="ActivityTestMain" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" android:host="www.angryredplanet.com" - android:pathPrefix="" /> + <action android:name="android.intent.action.VIEW"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.BROWSABLE"/> + <data android:scheme="http" + android:host="www.angryredplanet.com" + android:pathPrefix=""/> </intent-filter> <preferred> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" android:host="www.angryredplanet.com" - android:pathPrefix="" /> + <action android:name="android.intent.action.VIEW"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.BROWSABLE"/> + <data android:scheme="http" + android:host="www.angryredplanet.com" + android:pathPrefix=""/> </preferred> </activity> - <activity android:name="SpamActivity" android:label="Spam!" - android:documentLaunchMode="always"> + <activity android:name="SpamActivity" + android:label="Spam!" + android:documentLaunchMode="always"> </activity> - <activity android:name="DocActivity" android:label="Some doc"> + <activity android:name="DocActivity" + android:label="Some doc"> </activity> <service android:name="SingleUserService" - android:singleUser="true" android:exported="true"> + android:singleUser="true" + android:exported="true"> </service> <service android:name="ServiceUserTarget"> </service> <receiver android:name="UserTarget"> </receiver> - <service android:name="IsolatedService" android:isolatedProcess="true"> + <service android:name="IsolatedService" + android:isolatedProcess="true"> </service> - <receiver android:name="StartEmpty" android:exported="true"> + <receiver android:name="StartEmpty" + android:exported="true"> <intent-filter> - <action android:name="com.example.START_EMPTY" /> + <action android:name="com.example.START_EMPTY"/> </intent-filter> </receiver> - <service android:name="EmptyService" android:exported="true"> + <service android:name="EmptyService" + android:exported="true"> <intent-filter> - <action android:name="com.example.START_EMPTY" /> + <action android:name="com.example.START_EMPTY"/> </intent-filter> </service> <receiver android:name="SingleUserReceiver" - android:singleUser="true" android:exported="true" > + android:singleUser="true" + android:exported="true"> </receiver> <provider android:name="SingleUserProvider" - android:authorities="com.google.android.test.activity.single_user" - android:singleUser="true" android:exported="true" /> - <receiver android:name="TrackTimeReceiver" /> - <receiver android:name="AlarmSpamReceiver" /> - <receiver android:name="SlowReceiver" /> + android:authorities="com.google.android.test.activity.single_user" + android:singleUser="true" + android:exported="true"/> + <receiver android:name="TrackTimeReceiver"/> + <receiver android:name="AlarmSpamReceiver"/> + <receiver android:name="SlowReceiver"/> <activity android:name="DisableScreenshotsActivity" - android:label="DisableScreenshots" - android:theme="@style/DisableScreenshots"> + android:label="DisableScreenshots" + android:theme="@style/DisableScreenshots" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="CustomSplashscreenActivity" - android:label="CustomSplashscreen" - android:theme="@style/CustomSplashscreen"> + android:label="CustomSplashscreen" + android:theme="@style/CustomSplashscreen" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/ActivityViewTest/AndroidManifest.xml b/tests/ActivityViewTest/AndroidManifest.xml index 17eb029166f0..c84b7d904f0a 100644 --- a/tests/ActivityViewTest/AndroidManifest.xml +++ b/tests/ActivityViewTest/AndroidManifest.xml @@ -15,7 +15,7 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.activityview"> + package="com.google.android.test.activityview"> <uses-permission android:name="android.permission.INJECT_EVENTS"/> <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"/> <uses-permission android:name="android.permission.ACTIVITY_EMBEDDING"/> @@ -24,8 +24,9 @@ <uses-sdk android:targetSdkVersion="27"/> <application android:label="ActivityViewTest"> <activity android:name=".ActivityViewMainActivity" - android:label="AV Main" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> + android:label="AV Main" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> @@ -34,33 +35,33 @@ </activity> <activity android:name=".ActivityViewActivity" - android:label="AV" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" - android:windowSoftInputMode="stateHidden|adjustResize"> + android:label="AV" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" + android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewResizeActivity" - android:label="AV Resize" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" - android:windowSoftInputMode="stateHidden|adjustResize"> + android:label="AV Resize" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" + android:windowSoftInputMode="stateHidden|adjustResize"> </activity> <activity android:name=".ActivityViewScrollActivity" - android:label="AV Scroll" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" - android:windowSoftInputMode="stateHidden"> + android:label="AV Scroll" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" + android:windowSoftInputMode="stateHidden"> </activity> <activity android:name=".ActivityViewTestActivity" - android:resizeableActivity="true" - android:theme="@*android:style/Theme.NoTitleBar" - android:exported="true" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> + android:resizeableActivity="true" + android:theme="@*android:style/Theme.NoTitleBar" + android:exported="true" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> </activity> <activity android:name=".ActivityViewVisibilityActivity" - android:label="AV Visibility" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> + android:label="AV Visibility" + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> </activity> </application> </manifest> diff --git a/tests/AmSlam/AndroidManifest.xml b/tests/AmSlam/AndroidManifest.xml index 3d39e850f024..37583a946d1e 100644 --- a/tests/AmSlam/AndroidManifest.xml +++ b/tests/AmSlam/AndroidManifest.xml @@ -15,125 +15,324 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="test.amslam"> + package="test.amslam"> - <application - android:allowBackup="false" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:supportsRtl="true" - android:theme="@style/AppTheme"> - <activity android:name=".MainActivity"> + <application android:allowBackup="false" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity android:name=".MainActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <receiver - android:name=".PongReceiver" - android:exported="false" /> + <receiver android:name=".PongReceiver" + android:exported="false"/> - <service android:name=".subreceivers.PingReceiver000" android:exported="false" android:process=":ping000" /> - <service android:name=".subreceivers.PingReceiver001" android:exported="false" android:process=":ping001" /> - <service android:name=".subreceivers.PingReceiver002" android:exported="false" android:process=":ping002" /> - <service android:name=".subreceivers.PingReceiver003" android:exported="false" android:process=":ping003" /> - <service android:name=".subreceivers.PingReceiver004" android:exported="false" android:process=":ping004" /> - <service android:name=".subreceivers.PingReceiver005" android:exported="false" android:process=":ping005" /> - <service android:name=".subreceivers.PingReceiver006" android:exported="false" android:process=":ping006" /> - <service android:name=".subreceivers.PingReceiver007" android:exported="false" android:process=":ping007" /> - <service android:name=".subreceivers.PingReceiver008" android:exported="false" android:process=":ping008" /> - <service android:name=".subreceivers.PingReceiver009" android:exported="false" android:process=":ping009" /> - <service android:name=".subreceivers.PingReceiver010" android:exported="false" android:process=":ping010" /> - <service android:name=".subreceivers.PingReceiver011" android:exported="false" android:process=":ping011" /> - <service android:name=".subreceivers.PingReceiver012" android:exported="false" android:process=":ping012" /> - <service android:name=".subreceivers.PingReceiver013" android:exported="false" android:process=":ping013" /> - <service android:name=".subreceivers.PingReceiver014" android:exported="false" android:process=":ping014" /> - <service android:name=".subreceivers.PingReceiver015" android:exported="false" android:process=":ping015" /> - <service android:name=".subreceivers.PingReceiver016" android:exported="false" android:process=":ping016" /> - <service android:name=".subreceivers.PingReceiver017" android:exported="false" android:process=":ping017" /> - <service android:name=".subreceivers.PingReceiver018" android:exported="false" android:process=":ping018" /> - <service android:name=".subreceivers.PingReceiver019" android:exported="false" android:process=":ping019" /> - <service android:name=".subreceivers.PingReceiver020" android:exported="false" android:process=":ping020" /> - <service android:name=".subreceivers.PingReceiver021" android:exported="false" android:process=":ping021" /> - <service android:name=".subreceivers.PingReceiver022" android:exported="false" android:process=":ping022" /> - <service android:name=".subreceivers.PingReceiver023" android:exported="false" android:process=":ping023" /> - <service android:name=".subreceivers.PingReceiver024" android:exported="false" android:process=":ping024" /> - <service android:name=".subreceivers.PingReceiver025" android:exported="false" android:process=":ping025" /> - <service android:name=".subreceivers.PingReceiver026" android:exported="false" android:process=":ping026" /> - <service android:name=".subreceivers.PingReceiver027" android:exported="false" android:process=":ping027" /> - <service android:name=".subreceivers.PingReceiver028" android:exported="false" android:process=":ping028" /> - <service android:name=".subreceivers.PingReceiver029" android:exported="false" android:process=":ping029" /> - <service android:name=".subreceivers.PingReceiver030" android:exported="false" android:process=":ping030" /> - <service android:name=".subreceivers.PingReceiver031" android:exported="false" android:process=":ping031" /> - <service android:name=".subreceivers.PingReceiver032" android:exported="false" android:process=":ping032" /> - <service android:name=".subreceivers.PingReceiver033" android:exported="false" android:process=":ping033" /> - <service android:name=".subreceivers.PingReceiver034" android:exported="false" android:process=":ping034" /> - <service android:name=".subreceivers.PingReceiver035" android:exported="false" android:process=":ping035" /> - <service android:name=".subreceivers.PingReceiver036" android:exported="false" android:process=":ping036" /> - <service android:name=".subreceivers.PingReceiver037" android:exported="false" android:process=":ping037" /> - <service android:name=".subreceivers.PingReceiver038" android:exported="false" android:process=":ping038" /> - <service android:name=".subreceivers.PingReceiver039" android:exported="false" android:process=":ping039" /> - <service android:name=".subreceivers.PingReceiver040" android:exported="false" android:process=":ping040" /> - <service android:name=".subreceivers.PingReceiver041" android:exported="false" android:process=":ping041" /> - <service android:name=".subreceivers.PingReceiver042" android:exported="false" android:process=":ping042" /> - <service android:name=".subreceivers.PingReceiver043" android:exported="false" android:process=":ping043" /> - <service android:name=".subreceivers.PingReceiver044" android:exported="false" android:process=":ping044" /> - <service android:name=".subreceivers.PingReceiver045" android:exported="false" android:process=":ping045" /> - <service android:name=".subreceivers.PingReceiver046" android:exported="false" android:process=":ping046" /> - <service android:name=".subreceivers.PingReceiver047" android:exported="false" android:process=":ping047" /> - <service android:name=".subreceivers.PingReceiver048" android:exported="false" android:process=":ping048" /> - <service android:name=".subreceivers.PingReceiver049" android:exported="false" android:process=":ping049" /> - <service android:name=".subreceivers.PingReceiver050" android:exported="false" android:process=":ping050" /> - <service android:name=".subreceivers.PingReceiver051" android:exported="false" android:process=":ping051" /> - <service android:name=".subreceivers.PingReceiver052" android:exported="false" android:process=":ping052" /> - <service android:name=".subreceivers.PingReceiver053" android:exported="false" android:process=":ping053" /> - <service android:name=".subreceivers.PingReceiver054" android:exported="false" android:process=":ping054" /> - <service android:name=".subreceivers.PingReceiver055" android:exported="false" android:process=":ping055" /> - <service android:name=".subreceivers.PingReceiver056" android:exported="false" android:process=":ping056" /> - <service android:name=".subreceivers.PingReceiver057" android:exported="false" android:process=":ping057" /> - <service android:name=".subreceivers.PingReceiver058" android:exported="false" android:process=":ping058" /> - <service android:name=".subreceivers.PingReceiver059" android:exported="false" android:process=":ping059" /> - <service android:name=".subreceivers.PingReceiver060" android:exported="false" android:process=":ping060" /> - <service android:name=".subreceivers.PingReceiver061" android:exported="false" android:process=":ping061" /> - <service android:name=".subreceivers.PingReceiver062" android:exported="false" android:process=":ping062" /> - <service android:name=".subreceivers.PingReceiver063" android:exported="false" android:process=":ping063" /> - <service android:name=".subreceivers.PingReceiver064" android:exported="false" android:process=":ping064" /> - <service android:name=".subreceivers.PingReceiver065" android:exported="false" android:process=":ping065" /> - <service android:name=".subreceivers.PingReceiver066" android:exported="false" android:process=":ping066" /> - <service android:name=".subreceivers.PingReceiver067" android:exported="false" android:process=":ping067" /> - <service android:name=".subreceivers.PingReceiver068" android:exported="false" android:process=":ping068" /> - <service android:name=".subreceivers.PingReceiver069" android:exported="false" android:process=":ping069" /> - <service android:name=".subreceivers.PingReceiver070" android:exported="false" android:process=":ping070" /> - <service android:name=".subreceivers.PingReceiver071" android:exported="false" android:process=":ping071" /> - <service android:name=".subreceivers.PingReceiver072" android:exported="false" android:process=":ping072" /> - <service android:name=".subreceivers.PingReceiver073" android:exported="false" android:process=":ping073" /> - <service android:name=".subreceivers.PingReceiver074" android:exported="false" android:process=":ping074" /> - <service android:name=".subreceivers.PingReceiver075" android:exported="false" android:process=":ping075" /> - <service android:name=".subreceivers.PingReceiver076" android:exported="false" android:process=":ping076" /> - <service android:name=".subreceivers.PingReceiver077" android:exported="false" android:process=":ping077" /> - <service android:name=".subreceivers.PingReceiver078" android:exported="false" android:process=":ping078" /> - <service android:name=".subreceivers.PingReceiver079" android:exported="false" android:process=":ping079" /> - <service android:name=".subreceivers.PingReceiver080" android:exported="false" android:process=":ping080" /> - <service android:name=".subreceivers.PingReceiver081" android:exported="false" android:process=":ping081" /> - <service android:name=".subreceivers.PingReceiver082" android:exported="false" android:process=":ping082" /> - <service android:name=".subreceivers.PingReceiver083" android:exported="false" android:process=":ping083" /> - <service android:name=".subreceivers.PingReceiver084" android:exported="false" android:process=":ping084" /> - <service android:name=".subreceivers.PingReceiver085" android:exported="false" android:process=":ping085" /> - <service android:name=".subreceivers.PingReceiver086" android:exported="false" android:process=":ping086" /> - <service android:name=".subreceivers.PingReceiver087" android:exported="false" android:process=":ping087" /> - <service android:name=".subreceivers.PingReceiver088" android:exported="false" android:process=":ping088" /> - <service android:name=".subreceivers.PingReceiver089" android:exported="false" android:process=":ping089" /> - <service android:name=".subreceivers.PingReceiver090" android:exported="false" android:process=":ping090" /> - <service android:name=".subreceivers.PingReceiver091" android:exported="false" android:process=":ping091" /> - <service android:name=".subreceivers.PingReceiver092" android:exported="false" android:process=":ping092" /> - <service android:name=".subreceivers.PingReceiver093" android:exported="false" android:process=":ping093" /> - <service android:name=".subreceivers.PingReceiver094" android:exported="false" android:process=":ping094" /> - <service android:name=".subreceivers.PingReceiver095" android:exported="false" android:process=":ping095" /> - <service android:name=".subreceivers.PingReceiver096" android:exported="false" android:process=":ping096" /> - <service android:name=".subreceivers.PingReceiver097" android:exported="false" android:process=":ping097" /> - <service android:name=".subreceivers.PingReceiver098" android:exported="false" android:process=":ping098" /> - <service android:name=".subreceivers.PingReceiver099" android:exported="false" android:process=":ping099" /> + <service android:name=".subreceivers.PingReceiver000" + android:exported="false" + android:process=":ping000"/> + <service android:name=".subreceivers.PingReceiver001" + android:exported="false" + android:process=":ping001"/> + <service android:name=".subreceivers.PingReceiver002" + android:exported="false" + android:process=":ping002"/> + <service android:name=".subreceivers.PingReceiver003" + android:exported="false" + android:process=":ping003"/> + <service android:name=".subreceivers.PingReceiver004" + android:exported="false" + android:process=":ping004"/> + <service android:name=".subreceivers.PingReceiver005" + android:exported="false" + android:process=":ping005"/> + <service android:name=".subreceivers.PingReceiver006" + android:exported="false" + android:process=":ping006"/> + <service android:name=".subreceivers.PingReceiver007" + android:exported="false" + android:process=":ping007"/> + <service android:name=".subreceivers.PingReceiver008" + android:exported="false" + android:process=":ping008"/> + <service android:name=".subreceivers.PingReceiver009" + android:exported="false" + android:process=":ping009"/> + <service android:name=".subreceivers.PingReceiver010" + android:exported="false" + android:process=":ping010"/> + <service android:name=".subreceivers.PingReceiver011" + android:exported="false" + android:process=":ping011"/> + <service android:name=".subreceivers.PingReceiver012" + android:exported="false" + android:process=":ping012"/> + <service android:name=".subreceivers.PingReceiver013" + android:exported="false" + android:process=":ping013"/> + <service android:name=".subreceivers.PingReceiver014" + android:exported="false" + android:process=":ping014"/> + <service android:name=".subreceivers.PingReceiver015" + android:exported="false" + android:process=":ping015"/> + <service android:name=".subreceivers.PingReceiver016" + android:exported="false" + android:process=":ping016"/> + <service android:name=".subreceivers.PingReceiver017" + android:exported="false" + android:process=":ping017"/> + <service android:name=".subreceivers.PingReceiver018" + android:exported="false" + android:process=":ping018"/> + <service android:name=".subreceivers.PingReceiver019" + android:exported="false" + android:process=":ping019"/> + <service android:name=".subreceivers.PingReceiver020" + android:exported="false" + android:process=":ping020"/> + <service android:name=".subreceivers.PingReceiver021" + android:exported="false" + android:process=":ping021"/> + <service android:name=".subreceivers.PingReceiver022" + android:exported="false" + android:process=":ping022"/> + <service android:name=".subreceivers.PingReceiver023" + android:exported="false" + android:process=":ping023"/> + <service android:name=".subreceivers.PingReceiver024" + android:exported="false" + android:process=":ping024"/> + <service android:name=".subreceivers.PingReceiver025" + android:exported="false" + android:process=":ping025"/> + <service android:name=".subreceivers.PingReceiver026" + android:exported="false" + android:process=":ping026"/> + <service android:name=".subreceivers.PingReceiver027" + android:exported="false" + android:process=":ping027"/> + <service android:name=".subreceivers.PingReceiver028" + android:exported="false" + android:process=":ping028"/> + <service android:name=".subreceivers.PingReceiver029" + android:exported="false" + android:process=":ping029"/> + <service android:name=".subreceivers.PingReceiver030" + android:exported="false" + android:process=":ping030"/> + <service android:name=".subreceivers.PingReceiver031" + android:exported="false" + android:process=":ping031"/> + <service android:name=".subreceivers.PingReceiver032" + android:exported="false" + android:process=":ping032"/> + <service android:name=".subreceivers.PingReceiver033" + android:exported="false" + android:process=":ping033"/> + <service android:name=".subreceivers.PingReceiver034" + android:exported="false" + android:process=":ping034"/> + <service android:name=".subreceivers.PingReceiver035" + android:exported="false" + android:process=":ping035"/> + <service android:name=".subreceivers.PingReceiver036" + android:exported="false" + android:process=":ping036"/> + <service android:name=".subreceivers.PingReceiver037" + android:exported="false" + android:process=":ping037"/> + <service android:name=".subreceivers.PingReceiver038" + android:exported="false" + android:process=":ping038"/> + <service android:name=".subreceivers.PingReceiver039" + android:exported="false" + android:process=":ping039"/> + <service android:name=".subreceivers.PingReceiver040" + android:exported="false" + android:process=":ping040"/> + <service android:name=".subreceivers.PingReceiver041" + android:exported="false" + android:process=":ping041"/> + <service android:name=".subreceivers.PingReceiver042" + android:exported="false" + android:process=":ping042"/> + <service android:name=".subreceivers.PingReceiver043" + android:exported="false" + android:process=":ping043"/> + <service android:name=".subreceivers.PingReceiver044" + android:exported="false" + android:process=":ping044"/> + <service android:name=".subreceivers.PingReceiver045" + android:exported="false" + android:process=":ping045"/> + <service android:name=".subreceivers.PingReceiver046" + android:exported="false" + android:process=":ping046"/> + <service android:name=".subreceivers.PingReceiver047" + android:exported="false" + android:process=":ping047"/> + <service android:name=".subreceivers.PingReceiver048" + android:exported="false" + android:process=":ping048"/> + <service android:name=".subreceivers.PingReceiver049" + android:exported="false" + android:process=":ping049"/> + <service android:name=".subreceivers.PingReceiver050" + android:exported="false" + android:process=":ping050"/> + <service android:name=".subreceivers.PingReceiver051" + android:exported="false" + android:process=":ping051"/> + <service android:name=".subreceivers.PingReceiver052" + android:exported="false" + android:process=":ping052"/> + <service android:name=".subreceivers.PingReceiver053" + android:exported="false" + android:process=":ping053"/> + <service android:name=".subreceivers.PingReceiver054" + android:exported="false" + android:process=":ping054"/> + <service android:name=".subreceivers.PingReceiver055" + android:exported="false" + android:process=":ping055"/> + <service android:name=".subreceivers.PingReceiver056" + android:exported="false" + android:process=":ping056"/> + <service android:name=".subreceivers.PingReceiver057" + android:exported="false" + android:process=":ping057"/> + <service android:name=".subreceivers.PingReceiver058" + android:exported="false" + android:process=":ping058"/> + <service android:name=".subreceivers.PingReceiver059" + android:exported="false" + android:process=":ping059"/> + <service android:name=".subreceivers.PingReceiver060" + android:exported="false" + android:process=":ping060"/> + <service android:name=".subreceivers.PingReceiver061" + android:exported="false" + android:process=":ping061"/> + <service android:name=".subreceivers.PingReceiver062" + android:exported="false" + android:process=":ping062"/> + <service android:name=".subreceivers.PingReceiver063" + android:exported="false" + android:process=":ping063"/> + <service android:name=".subreceivers.PingReceiver064" + android:exported="false" + android:process=":ping064"/> + <service android:name=".subreceivers.PingReceiver065" + android:exported="false" + android:process=":ping065"/> + <service android:name=".subreceivers.PingReceiver066" + android:exported="false" + android:process=":ping066"/> + <service android:name=".subreceivers.PingReceiver067" + android:exported="false" + android:process=":ping067"/> + <service android:name=".subreceivers.PingReceiver068" + android:exported="false" + android:process=":ping068"/> + <service android:name=".subreceivers.PingReceiver069" + android:exported="false" + android:process=":ping069"/> + <service android:name=".subreceivers.PingReceiver070" + android:exported="false" + android:process=":ping070"/> + <service android:name=".subreceivers.PingReceiver071" + android:exported="false" + android:process=":ping071"/> + <service android:name=".subreceivers.PingReceiver072" + android:exported="false" + android:process=":ping072"/> + <service android:name=".subreceivers.PingReceiver073" + android:exported="false" + android:process=":ping073"/> + <service android:name=".subreceivers.PingReceiver074" + android:exported="false" + android:process=":ping074"/> + <service android:name=".subreceivers.PingReceiver075" + android:exported="false" + android:process=":ping075"/> + <service android:name=".subreceivers.PingReceiver076" + android:exported="false" + android:process=":ping076"/> + <service android:name=".subreceivers.PingReceiver077" + android:exported="false" + android:process=":ping077"/> + <service android:name=".subreceivers.PingReceiver078" + android:exported="false" + android:process=":ping078"/> + <service android:name=".subreceivers.PingReceiver079" + android:exported="false" + android:process=":ping079"/> + <service android:name=".subreceivers.PingReceiver080" + android:exported="false" + android:process=":ping080"/> + <service android:name=".subreceivers.PingReceiver081" + android:exported="false" + android:process=":ping081"/> + <service android:name=".subreceivers.PingReceiver082" + android:exported="false" + android:process=":ping082"/> + <service android:name=".subreceivers.PingReceiver083" + android:exported="false" + android:process=":ping083"/> + <service android:name=".subreceivers.PingReceiver084" + android:exported="false" + android:process=":ping084"/> + <service android:name=".subreceivers.PingReceiver085" + android:exported="false" + android:process=":ping085"/> + <service android:name=".subreceivers.PingReceiver086" + android:exported="false" + android:process=":ping086"/> + <service android:name=".subreceivers.PingReceiver087" + android:exported="false" + android:process=":ping087"/> + <service android:name=".subreceivers.PingReceiver088" + android:exported="false" + android:process=":ping088"/> + <service android:name=".subreceivers.PingReceiver089" + android:exported="false" + android:process=":ping089"/> + <service android:name=".subreceivers.PingReceiver090" + android:exported="false" + android:process=":ping090"/> + <service android:name=".subreceivers.PingReceiver091" + android:exported="false" + android:process=":ping091"/> + <service android:name=".subreceivers.PingReceiver092" + android:exported="false" + android:process=":ping092"/> + <service android:name=".subreceivers.PingReceiver093" + android:exported="false" + android:process=":ping093"/> + <service android:name=".subreceivers.PingReceiver094" + android:exported="false" + android:process=":ping094"/> + <service android:name=".subreceivers.PingReceiver095" + android:exported="false" + android:process=":ping095"/> + <service android:name=".subreceivers.PingReceiver096" + android:exported="false" + android:process=":ping096"/> + <service android:name=".subreceivers.PingReceiver097" + android:exported="false" + android:process=":ping097"/> + <service android:name=".subreceivers.PingReceiver098" + android:exported="false" + android:process=":ping098"/> + <service android:name=".subreceivers.PingReceiver099" + android:exported="false" + android:process=":ping099"/> </application> </manifest> diff --git a/tests/AppResourcesLoaders/AndroidManifest.xml b/tests/AppResourcesLoaders/AndroidManifest.xml index cb403b968abf..61011008d949 100644 --- a/tests/AppResourcesLoaders/AndroidManifest.xml +++ b/tests/AppResourcesLoaders/AndroidManifest.xml @@ -16,16 +16,17 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.example.loaders"> + package="com.android.example.loaders"> <application android:label="AppResourcesLoaders" - android:name=".LoadersApplication"> - <activity android:name=".LoaderActivity"> + android:name=".LoadersApplication"> + <activity android:name=".LoaderActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".LoaderActivityIsolated" - android:process="com.android.phone" /> + android:process="com.android.phone"/> </application> </manifest> diff --git a/tests/Assist/AndroidManifest.xml b/tests/Assist/AndroidManifest.xml index 9d4c4ad17454..2f6f50bd4f48 100644 --- a/tests/Assist/AndroidManifest.xml +++ b/tests/Assist/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2015 The Android Open Source Project ~ @@ -15,35 +16,34 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.assist"> + package="com.android.test.assist"> <application> <service android:name="AssistInteractionService" - android:label="Test Assist Interaction Service" - android:permission="android.permission.BIND_VOICE_INTERACTION" - android:process=":interactor"> + android:label="Test Assist Interaction Service" + android:permission="android.permission.BIND_VOICE_INTERACTION" + android:process=":interactor" + android:exported="true"> <meta-data android:name="android.voice_interaction" - android:resource="@xml/interaction_service" /> + android:resource="@xml/interaction_service"/> <intent-filter> - <action android:name="android.service.voice.VoiceInteractionService" /> + <action android:name="android.service.voice.VoiceInteractionService"/> </intent-filter> - <meta-data - android:name="com.android.systemui.action_assist_icon" - android:resource="@drawable/assistant" /> - <meta-data - android:name="com.android.keyguard.layout" - android:resource="@layout/keyguard_preview" /> + <meta-data android:name="com.android.systemui.action_assist_icon" + android:resource="@drawable/assistant"/> + <meta-data android:name="com.android.keyguard.layout" + android:resource="@layout/keyguard_preview"/> </service> <service android:name="AssistInteractionSessionService" - android:permission="android.permission.BIND_VOICE_INTERACTION" - android:process=":session"> + android:permission="android.permission.BIND_VOICE_INTERACTION" + android:process=":session"> </service> <activity android:name=".AboveKeyguardActivity" - android:label="Test Above Keyguard Activity" - android:theme="@android:style/Theme.NoTitleBar" - android:excludeFromRecents="true" - android:launchMode="singleTask" - android:exported="false" > + android:label="Test Above Keyguard Activity" + android:theme="@android:style/Theme.NoTitleBar" + android:excludeFromRecents="true" + android:launchMode="singleTask" + android:exported="false"> </activity> </application> </manifest> diff --git a/tests/AutoVerify/app1/Android.bp b/tests/AutoVerify/app1/Android.bp deleted file mode 100644 index 548519fa653b..000000000000 --- a/tests/AutoVerify/app1/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -android_app { - name: "AutoVerifyTest", - srcs: ["src/**/*.java"], - resource_dirs: ["res"], - platform_apis: true, - min_sdk_version: "26", - target_sdk_version: "26", - optimize: { - enabled: false, - }, -} diff --git a/tests/AutoVerify/app1/res/values/strings.xml b/tests/AutoVerify/app1/res/values/strings.xml deleted file mode 100644 index e234355041c6..000000000000 --- a/tests/AutoVerify/app1/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright 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. ---> - -<resources> - <!-- app icon label, do not translate --> - <string name="app_name" translatable="false">AutoVerify Test</string> -</resources> diff --git a/tests/AutoVerify/app2/Android.bp b/tests/AutoVerify/app2/Android.bp deleted file mode 100644 index 1c6c97bdf350..000000000000 --- a/tests/AutoVerify/app2/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -android_app { - name: "AutoVerifyTest2", - srcs: ["src/**/*.java"], - resource_dirs: ["res"], - platform_apis: true, - min_sdk_version: "26", - target_sdk_version: "26", - optimize: { - enabled: false, - }, -} diff --git a/tests/AutoVerify/app2/AndroidManifest.xml b/tests/AutoVerify/app2/AndroidManifest.xml deleted file mode 100644 index a00807883cfc..000000000000 --- a/tests/AutoVerify/app2/AndroidManifest.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.autoverify" > - - <uses-sdk android:targetSdkVersion="26" /> - - <application - android:label="@string/app_name" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - - <intent-filter android:autoVerify="true"> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" /> - <data android:scheme="https" /> - <data android:host="explicit.example.com" /> - <data android:host="*.wildcard.tld" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/AutoVerify/app2/res/values/strings.xml b/tests/AutoVerify/app2/res/values/strings.xml deleted file mode 100644 index e234355041c6..000000000000 --- a/tests/AutoVerify/app2/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright 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. ---> - -<resources> - <!-- app icon label, do not translate --> - <string name="app_name" translatable="false">AutoVerify Test</string> -</resources> diff --git a/tests/AutoVerify/app3/Android.bp b/tests/AutoVerify/app3/Android.bp deleted file mode 100644 index 70a2b77d1000..000000000000 --- a/tests/AutoVerify/app3/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -android_app { - name: "AutoVerifyTest3", - srcs: ["src/**/*.java"], - resource_dirs: ["res"], - platform_apis: true, - min_sdk_version: "26", - target_sdk_version: "26", - optimize: { - enabled: false, - }, -} diff --git a/tests/AutoVerify/app3/AndroidManifest.xml b/tests/AutoVerify/app3/AndroidManifest.xml deleted file mode 100644 index efaabc9a38d3..000000000000 --- a/tests/AutoVerify/app3/AndroidManifest.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.autoverify" > - - <uses-sdk android:targetSdkVersion="26" /> - - <application - android:label="@string/app_name" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - - <!-- does not request autoVerify --> - <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" /> - <data android:scheme="https" /> - <data android:host="explicit.example.com" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/AutoVerify/app3/res/values/strings.xml b/tests/AutoVerify/app3/res/values/strings.xml deleted file mode 100644 index e234355041c6..000000000000 --- a/tests/AutoVerify/app3/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright 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. ---> - -<resources> - <!-- app icon label, do not translate --> - <string name="app_name" translatable="false">AutoVerify Test</string> -</resources> diff --git a/tests/AutoVerify/app4/Android.bp b/tests/AutoVerify/app4/Android.bp deleted file mode 100644 index fbdae1181a7a..000000000000 --- a/tests/AutoVerify/app4/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -android_app { - name: "AutoVerifyTest4", - srcs: ["src/**/*.java"], - resource_dirs: ["res"], - platform_apis: true, - min_sdk_version: "26", - target_sdk_version: "26", - optimize: { - enabled: false, - }, -} diff --git a/tests/AutoVerify/app4/AndroidManifest.xml b/tests/AutoVerify/app4/AndroidManifest.xml deleted file mode 100644 index 1c975f8336c9..000000000000 --- a/tests/AutoVerify/app4/AndroidManifest.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.autoverify" > - - <uses-sdk android:targetSdkVersion="26" /> - - <application - android:label="@string/app_name" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - - <!-- intentionally does not autoVerify --> - <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" /> - <data android:scheme="https" /> - <data android:host="explicit.example.com" /> - <data android:host="*.wildcard.tld" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/AutoVerify/app4/res/values/strings.xml b/tests/AutoVerify/app4/res/values/strings.xml deleted file mode 100644 index e234355041c6..000000000000 --- a/tests/AutoVerify/app4/res/values/strings.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Copyright 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. ---> - -<resources> - <!-- app icon label, do not translate --> - <string name="app_name" translatable="false">AutoVerify Test</string> -</resources> diff --git a/tests/BandwidthTests/AndroidManifest.xml b/tests/BandwidthTests/AndroidManifest.xml index 19f38cabf23e..72bdd1430cb4 100644 --- a/tests/BandwidthTests/AndroidManifest.xml +++ b/tests/BandwidthTests/AndroidManifest.xml @@ -13,19 +13,22 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.bandwidthenforcement"> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + package="com.android.tests.bandwidthenforcement"> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application> - <activity android:name=".BandwidthEnforcementTestActivity"> + <activity android:name=".BandwidthEnforcementTestActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <!-- adb shell am startservice -n com.android.tests.bandwidthenforcement/.BandwidthEnforcementTestService --> - <service android:name=".BandwidthEnforcementTestService" android:exported="true" /> + <service android:name=".BandwidthEnforcementTestService" + android:exported="true"/> </application> </manifest> diff --git a/tests/BatteryWaster/AndroidManifest.xml b/tests/BatteryWaster/AndroidManifest.xml index 0d7f007f15fc..5910c187c6eb 100644 --- a/tests/BatteryWaster/AndroidManifest.xml +++ b/tests/BatteryWaster/AndroidManifest.xml @@ -1,14 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.batterywaster"> - <uses-permission android:name="android.permission.DEVICE_POWER" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> + package="com.android.batterywaster"> + <uses-permission android:name="android.permission.DEVICE_POWER"/> + <uses-permission android:name="android.permission.WAKE_LOCK"/> <application> - <activity android:name="BatteryWaster" android:label="Battery Waster"> + <activity android:name="BatteryWaster" + android:label="Battery Waster" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml index 4aead814c8a0..cea5d683a2f9 100644 --- a/tests/BiDiTests/AndroidManifest.xml +++ b/tests/BiDiTests/AndroidManifest.xml @@ -15,23 +15,24 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.bidi" - android:versionCode="1" - android:versionName="1.0"> + package="com.android.bidi" + android:versionCode="1" + android:versionName="1.0"> <application android:label="BiDiTests" - android:hardwareAccelerated="true" - android:supportsRtl="true" > + android:hardwareAccelerated="true" + android:supportsRtl="true"> <activity android:name=".BiDiTestActivity" - android:windowSoftInputMode="stateAlwaysHidden"> + android:windowSoftInputMode="stateAlwaysHidden" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="10" - android:targetSdkVersion="10"/> + android:targetSdkVersion="10"/> </manifest> diff --git a/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java b/tests/BlobStoreTestUtils/src/com/android/utils/blob/FakeBlobData.java index 2df0024bdea9..56db4f98e160 100644 --- a/tests/BlobStoreTestUtils/src/com/android/utils/blob/DummyBlobData.java +++ b/tests/BlobStoreTestUtils/src/com/android/utils/blob/FakeBlobData.java @@ -35,7 +35,7 @@ import java.security.MessageDigest; import java.util.Random; import java.util.concurrent.TimeUnit; -public class DummyBlobData { +public class FakeBlobData { private static final long DEFAULT_SIZE_BYTES = 10 * 1024L * 1024L; private final Random mRandom; @@ -47,7 +47,7 @@ public class DummyBlobData { byte[] mFileDigest; long mExpiryTimeMs; - private DummyBlobData(Builder builder) { + private FakeBlobData(Builder builder) { mRandom = new Random(builder.getRandomSeed()); mFile = new File(builder.getContext().getFilesDir(), builder.getFileName()); mFileSize = builder.getFileSize(); @@ -116,8 +116,8 @@ public class DummyBlobData { return mExpiryDurationMs; } - public DummyBlobData build() { - return new DummyBlobData(this); + public FakeBlobData build() { + return new FakeBlobData(this); } } diff --git a/tests/BrowserPowerTest/AndroidManifest.xml b/tests/BrowserPowerTest/AndroidManifest.xml index 43eeaad23f8b..003e47ef5642 100644 --- a/tests/BrowserPowerTest/AndroidManifest.xml +++ b/tests/BrowserPowerTest/AndroidManifest.xml @@ -13,34 +13,35 @@ See the License for the specific language governing permissions and limitations under the License. --> - <!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.browserpowertest"> + package="com.android.browserpowertest"> <!-- We add an application tag here just so that we can indicate that - this package needs to link against the android.test library, - which is needed when building test cases. --> + this package needs to link against the android.test library, + which is needed when building test cases. --> <application> - <uses-library android:name="android.test.runner" /> - <activity android:name="PowerTestActivity" android:label="Power"> + <uses-library android:name="android.test.runner"/> + <activity android:name="PowerTestActivity" + android:label="Power" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.TEST"/> </intent-filter> </activity> </application> <!-- - This declares that this app uses the instrumentation test runner targeting - the package of browserpowertest. To run the tests use the command: - "adb shell am instrument -w com.android.browserpowertest/.PowerTestRunner" - --> + This declares that this app uses the instrumentation test runner targeting + the package of browserpowertest. To run the tests use the command: + "adb shell am instrument -w com.android.browserpowertest/.PowerTestRunner" + --> <instrumentation android:name=".PowerTestRunner" - android:targetPackage="com.android.browserpowertest" - android:label="Test runner for Browser Power Tests." - /> + android:targetPackage="com.android.browserpowertest" + android:label="Test runner for Browser Power Tests."/> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.WRITE_SDCARD" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.WRITE_SDCARD"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> </manifest> diff --git a/tests/Camera2Tests/CameraToo/AndroidManifest.xml b/tests/Camera2Tests/CameraToo/AndroidManifest.xml index a92b5d81f660..2c1b4cbbc7d5 100644 --- a/tests/Camera2Tests/CameraToo/AndroidManifest.xml +++ b/tests/Camera2Tests/CameraToo/AndroidManifest.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- Copyright (C) 2014 The Android Open Source Project @@ -17,16 +16,16 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.camera2.cameratoo"> - <uses-permission android:name="android.permission.CAMERA" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + package="com.example.android.camera2.cameratoo"> + <uses-permission android:name="android.permission.CAMERA"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:label="CameraToo"> - <activity - android:name=".CameraTooActivity" - android:screenOrientation="portrait"> + <activity android:name=".CameraTooActivity" + android:screenOrientation="portrait" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/AndroidManifest.xml b/tests/Camera2Tests/SmartCamera/SimpleCamera/AndroidManifest.xml index 06818682192f..35a86500b78a 100644 --- a/tests/Camera2Tests/SmartCamera/SimpleCamera/AndroidManifest.xml +++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/AndroidManifest.xml @@ -13,24 +13,27 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - android:versionCode="1" - android:versionName="1.0" - package="androidx.media.filterfw.samples.simplecamera"> - <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/> - <uses-permission android:name="android.permission.CAMERA" /> + android:versionCode="1" + android:versionName="1.0" + package="androidx.media.filterfw.samples.simplecamera"> + <uses-sdk android:minSdkVersion="18" + android:targetSdkVersion="19"/> + <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:label="Smart Camera" - android:debuggable="true"> + android:debuggable="true"> <uses-library android:name="com.google.android.media.effects" - android:required="false" /> + android:required="false"/> <activity android:name=".SmartCamera" - android:label="Smart Camera" - android:screenOrientation="portrait"> + android:label="Smart Camera" + android:screenOrientation="portrait" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> diff --git a/tests/CameraPrewarmTest/AndroidManifest.xml b/tests/CameraPrewarmTest/AndroidManifest.xml index 11b2686d2932..7fafd33620b3 100644 --- a/tests/CameraPrewarmTest/AndroidManifest.xml +++ b/tests/CameraPrewarmTest/AndroidManifest.xml @@ -16,35 +16,35 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.cameraprewarm"> + package="com.google.android.test.cameraprewarm"> <application android:label="@string/activity_title"> <activity android:name=".CameraActivity" - android:theme="@android:style/Theme.NoTitleBar"> + android:theme="@android:style/Theme.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.media.action.STILL_IMAGE_CAMERA"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> - <meta-data - android:name="android.media.still_image_camera_preview_service" - android:value="com.google.android.test.cameraprewarm.PrewarmService"> + <meta-data android:name="android.media.still_image_camera_preview_service" + android:value="com.google.android.test.cameraprewarm.PrewarmService"> </meta-data> </activity> <activity android:name=".SecureCameraActivity" - android:theme="@android:style/Theme.NoTitleBar"> + android:theme="@android:style/Theme.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> - <meta-data - android:name="android.media.still_image_camera_preview_service" - android:value="com.google.android.test.cameraprewarm.PrewarmService"> + <meta-data android:name="android.media.still_image_camera_preview_service" + android:value="com.google.android.test.cameraprewarm.PrewarmService"> </meta-data> </activity> <service android:name=".PrewarmService" - android:exported="true"> + android:exported="true"> </service> </application> diff --git a/tests/CanvasCompare/AndroidManifest.xml b/tests/CanvasCompare/AndroidManifest.xml index b55e290a52dd..2734e7f07f27 100644 --- a/tests/CanvasCompare/AndroidManifest.xml +++ b/tests/CanvasCompare/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,37 +13,36 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.hwuicompare" > + package="com.android.test.hwuicompare"> - <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> - <application - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo.Light.NoActionBar"> - <activity - android:name="AutomaticActivity" - android:label="CanvasAutoCompare" > + <application android:label="@string/app_name" + android:theme="@android:style/Theme.Holo.Light.NoActionBar"> + <activity android:name="AutomaticActivity" + android:label="CanvasAutoCompare" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity - android:name="ManualActivity" - android:label="CanvasManualCompare" > + <activity android:name="ManualActivity" + android:label="CanvasManualCompare" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> </application> - <instrumentation - android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.test.hwuicompare" - android:label="HW/SW Canvas comparison tool."/> + <instrumentation android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.android.test.hwuicompare" + android:label="HW/SW Canvas comparison tool."/> </manifest> diff --git a/tests/DpiTest/AndroidManifest.xml b/tests/DpiTest/AndroidManifest.xml index a4d8c7973141..cf4c21dbe128 100644 --- a/tests/DpiTest/AndroidManifest.xml +++ b/tests/DpiTest/AndroidManifest.xml @@ -15,26 +15,34 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.dpi"> - <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="3" /> - <supports-screens android:smallScreens="true" /> + package="com.google.android.test.dpi"> + <uses-sdk android:minSdkVersion="3" + android:targetSdkVersion="3"/> + <supports-screens android:smallScreens="true"/> <compatible-screens> - <screen android:screenSize="small" android:screenDensity="ldpi" /> - <screen android:screenSize="small" android:screenDensity="xhdpi" /> - <screen android:screenSize="large" android:screenDensity="hdpi" /> - <screen android:screenSize="xlarge" android:screenDensity="mdpi" /> + <screen android:screenSize="small" + android:screenDensity="ldpi"/> + <screen android:screenSize="small" + android:screenDensity="xhdpi"/> + <screen android:screenSize="large" + android:screenDensity="hdpi"/> + <screen android:screenSize="xlarge" + android:screenDensity="mdpi"/> </compatible-screens> <application android:label="DpiTest"> - <activity android:name="DpiTestActivity"> + <activity android:name="DpiTestActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="DpiTestNoCompatActivity" android:label="DpiTestNoCompat"> + <activity android:name="DpiTestNoCompatActivity" + android:label="DpiTestNoCompat" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/FeatureSplit/base/AndroidManifest.xml b/tests/FeatureSplit/base/AndroidManifest.xml index e82b3b9d45fc..1bc07ef413df 100644 --- a/tests/FeatureSplit/base/AndroidManifest.xml +++ b/tests/FeatureSplit/base/AndroidManifest.xml @@ -15,15 +15,17 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.split.feature"> + package="com.android.test.split.feature"> - <uses-sdk android:minSdkVersion="21" /> + <uses-sdk android:minSdkVersion="21"/> <application android:label="@string/app_title"> - <activity android:name=".ActivityMain" android:label="Feature Base"> + <activity android:name=".ActivityMain" + android:label="Feature Base" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/FeatureSplit/feature1/AndroidManifest.xml b/tests/FeatureSplit/feature1/AndroidManifest.xml index 086c2c33422d..4581a85b3efb 100644 --- a/tests/FeatureSplit/feature1/AndroidManifest.xml +++ b/tests/FeatureSplit/feature1/AndroidManifest.xml @@ -15,17 +15,19 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.split.feature" - featureSplit="feature1"> + package="com.android.test.split.feature" + featureSplit="feature1"> - <uses-sdk android:minSdkVersion="21" /> - <uses-split android:name="feature2" /> + <uses-sdk android:minSdkVersion="21"/> + <uses-split android:name="feature2"/> <application> - <activity android:name=".one.One" android:label="Feature One"> + <activity android:name=".one.One" + android:label="Feature One" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/FixVibrateSetting/AndroidManifest.xml b/tests/FixVibrateSetting/AndroidManifest.xml index 007d6821498b..c2d5918a4681 100644 --- a/tests/FixVibrateSetting/AndroidManifest.xml +++ b/tests/FixVibrateSetting/AndroidManifest.xml @@ -1,13 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.fixvibratesetting"> - <uses-permission android:name="android.permission.VIBRATE" /> + package="com.android.fixvibratesetting"> + <uses-permission android:name="android.permission.VIBRATE"/> <application> - <activity android:name="FixVibrateSetting" android:label="@string/app_label"> + <activity android:name="FixVibrateSetting" + android:label="@string/app_label" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index 05f0a8e7921d..a53ea16ba7c4 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -16,15 +16,40 @@ android_test { name: "FlickerTests", - srcs: ["src/**/*.java"], + srcs: ["src/**/*.java", "src/**/*.kt"], + manifest: "AndroidManifest.xml", + test_config: "AndroidTestPhysicalDevices.xml", platform_apis: true, certificate: "platform", test_suites: ["device-tests"], libs: ["android.test.runner"], static_libs: [ + "androidx.test.ext.junit", "flickertestapplib", "flickerlib", "truth-prebuilt", - "app-helpers-core", + "launcher-helper-lib", + "launcher-aosp-tapl" ], } + + +android_test { + name: "FlickerTestsVirtual", + srcs: ["src/**/*.java", "src/**/*.kt"], + manifest: "AndroidManifest.xml", + test_config: "AndroidTestVirtualDevices.xml", + platform_apis: true, + certificate: "platform", + test_suites: ["device-tests"], + libs: ["android.test.runner"], + static_libs: [ + "androidx.test.ext.junit", + "flickertestapplib", + "flickerlib", + "truth-prebuilt", + "app-helpers-core", + "launcher-helper-lib", + "launcher-aosp-tapl" + ], +}
\ No newline at end of file diff --git a/tests/FlickerTests/AndroidManifest.xml b/tests/FlickerTests/AndroidManifest.xml index 91fb7c12b392..98e02ced8d0b 100644 --- a/tests/FlickerTests/AndroidManifest.xml +++ b/tests/FlickerTests/AndroidManifest.xml @@ -17,7 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.server.wm.flicker"> - <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/> + <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/> <!-- Read and write traces from external storage --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> @@ -29,6 +29,9 @@ <uses-permission android:name="android.permission.DUMP" /> <!-- Run layers trace --> <uses-permission android:name="android.permission.HARDWARE_TEST"/> + <!-- Workaround grant runtime permission exception from b/152733071 --> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> <application> <uses-library android:name="android.test.runner"/> </application> diff --git a/tests/FlickerTests/AndroidTest.xml b/tests/FlickerTests/AndroidTestPhysicalDevices.xml index a331ec5b52bd..16504389098c 100644 --- a/tests/FlickerTests/AndroidTest.xml +++ b/tests/FlickerTests/AndroidTestPhysicalDevices.xml @@ -10,12 +10,14 @@ <!-- prevents the phone from restarting --> <option name="force-skip-system-props" value="true" /> <!-- set WM tracing verbose level to all --> - <option name="run-command" value="adb shell cmd window tracing level all" /> + <option name="run-command" value="cmd window tracing level all" /> <!-- inform WM to log all transactions --> - <option name="run-command" value="adb shell cmd window tracing transaction" /> + <option name="run-command" value="cmd window tracing transaction" /> + <!-- restart launcher to activate TAPL --> + <option name="run-command" value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner"> - <!-- keeps the screen on during tests --> + <!-- reboot the device to teardown any crashed tests --> <option name="cleanup-action" value="REBOOT" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> @@ -25,13 +27,14 @@ </target_preparer> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> <option name="package" value="com.android.server.wm.flicker"/> - <option name="exclude-annotation" value="org.junit.Ignore" /> + <option name="include-annotation" value="androidx.test.filters.RequiresDevice" /> + <option name="exclude-annotation" value="androidx.test.filters.FlakyTest" /> <option name="shell-timeout" value="6600s" /> <option name="test-timeout" value="6000s" /> <option name="hidden-api-checks" value="false" /> </test> <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> - <option name="directory-keys" value="/sdcard/flicker" /> + <option name="directory-keys" value="/storage/emulated/0/Android/data/com.android.server.wm.flicker/files" /> <option name="collect-on-run-ended-only" value="true" /> <option name="clean-up" value="true" /> </metrics_collector> diff --git a/tests/FlickerTests/AndroidTestVirtualDevices.xml b/tests/FlickerTests/AndroidTestVirtualDevices.xml new file mode 100644 index 000000000000..222212a74cd0 --- /dev/null +++ b/tests/FlickerTests/AndroidTestVirtualDevices.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2018 Google Inc. All Rights Reserved. + --> +<configuration description="Runs WindowManager Flicker Tests"> + <option name="test-tag" value="FlickerTests" /> + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on" /> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true" /> + <!-- set WM tracing verbose level to all --> + <option name="run-command" value="cmd window tracing level all" /> + <!-- inform WM to log all transactions --> + <option name="run-command" value="cmd window tracing transaction" /> + <!-- restart launcher to activate TAPL --> + <option name="run-command" value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner"> + <!-- reboot the device to teardown any crashed tests --> + <option name="cleanup-action" value="REBOOT" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="FlickerTests.apk"/> + <option name="test-file-name" value="FlickerTestApp.apk" /> + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="com.android.server.wm.flicker"/> + <option name="exclude-annotation" value="androidx.test.filters.RequiresDevice" /> + <option name="exclude-annotation" value="androidx.test.filters.FlakyTest" /> + <option name="shell-timeout" value="6600s" /> + <option name="test-timeout" value="6000s" /> + <option name="hidden-api-checks" value="false" /> + </test> + <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector"> + <option name="directory-keys" value="/storage/emulated/0/Android/data/com.android.server.wm.flicker/files" /> + <option name="collect-on-run-ended-only" value="true" /> + <option name="clean-up" value="true" /> + </metrics_collector> +</configuration> diff --git a/tests/FlickerTests/README.md b/tests/FlickerTests/README.md index a7c9e20e0a07..6b28fdf8a8ef 100644 --- a/tests/FlickerTests/README.md +++ b/tests/FlickerTests/README.md @@ -1,146 +1,88 @@ # Flicker Test Library ## Motivation -Detect *flicker* — any discontinuous, or unpredictable behavior seen during UI transitions that is not due to performance. This is often the result of a logic error in the code and difficult to identify because the issue is transient and at times difficult to reproduce. This library helps create integration tests between `SurfaceFlinger`, `WindowManager` and `SystemUI` to identify flicker. +This set of tests use the flickerlib from `platform_testing/libraries/flicker` to execute a set of common UI transitions to detect discontinuous or unpredictable behavior. -## Adding a Test -The library builds and runs UI transitions, captures Winscope traces and exposes common assertions that can be tested against each trace. - -### Building Transitions -Start by defining common or error prone transitions using `TransitionRunner`. -```java -// Example: Build a transition that cold launches an app from launcher -TransitionRunner transition = TransitionRunner.newBuilder() - // Specify a tag to identify the transition (optional) - .withTag("OpenAppCold_" + testApp.getLauncherName()) - - // Specify preconditions to setup the device - // Wake up device and go to home screen - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - - // Setup transition under test - // Press the home button and close the app to test a cold start - .runBefore(device::pressHome) - .runBefore(testApp::exit) - - // Run the transition under test - // Open the app and wait for UI to be idle - // This is the part of the transition that will be tested. - .run(testApp::open) - .run(device::waitForIdle) - - // Perform any tear downs - // Close the app - .runAfterAll(testApp::exit) - - // Number of times to repeat the transition to catch any flaky issues - .repeat(5); -``` - - -Run the transition to get a list of `TransitionResult` for each time the transition is repeated. -```java - List<TransitionResult> results = transition.run(); -``` -`TransitionResult` contains paths to test artifacts such as Winscope traces and screen recordings. - - -### Checking Assertions -Each `TransitionResult` can be tested using an extension of the Google Truth library, `LayersTraceSubject` and `WmTraceSubject`. They try to balance test principles set out by Google Truth (not supporting nested assertions, keeping assertions simple) with providing support for common assertion use cases. - -Each trace can be represented as a ordered collection of trace entries, with an associated timestamp. Each trace entry has common assertion checks. The trace subjects expose methods to filter the range of entries and test for changing assertions. - -```java - TransitionResult result = results.get(0); - Rect displayBounds = getDisplayBounds(); +The tests are organized in packages according to the transitions they test (e.g., `rotation`, `splitscreen`). - // check all trace entries - assertThat(result).coversRegion(displayBounds).forAllEntries(); - - // check a range of entries - assertThat(result).coversRegion(displayBounds).forRange(startTime, endTime); - - // check first entry - assertThat(result).coversRegion(displayBounds).inTheBeginning(); +## Adding a Test - // check last entry - assertThat(result).coversRegion(displayBounds).atTheEnd(); +By default tests should inherit from `RotationTestBase` or `NonRotationTestBase` and must override the variable `transitionToRun` (Kotlin) or the function `getTransitionToRun()` (Java). +Only tests that are not supported by these classes should inherit directly from the `FlickerTestBase` class. - // check a change in assertions, e.g. wallpaper window is visible, - // then wallpaper window becomes and stays invisible - assertThat(result) - .showsBelowAppWindow("wallpaper") - .then() - .hidesBelowAppWindow("wallpaper") - .forAllEntries(); -``` +### Rotation animations and transitions -All assertions return `Result` which contains a `success` flag, `assertionName` string identifier, and `reason` string to provide actionable details to the user. The `reason` string is build along the way with all the details as to why the assertions failed and any hints which might help the user determine the root cause. Failed assertion message will also contain a path to the trace that was tested. Example of a failed test: +Tests that rotate the device should inherit from `RotationTestBase`. +Tests that inherit from the class automatically receive start and end rotation values. +Moreover, these tests inherit the following checks: +* all regions on the screen are covered +* status bar is always visible +* status bar rotates +* nav bar is always visible +* nav bar is rotates -``` - java.lang.AssertionError: Not true that <com.android.server.wm.flicker.LayersTrace@65da4cc> - Layers Trace can be found in: /layers_trace_emptyregion.pb - Timestamp: 2308008331271 - Assertion: coversRegion - Reason: Region to test: Rect(0, 0 - 1440, 2880) - first empty point: 0, 99 - visible regions: - StatusBar#0Rect(0, 0 - 1440, 98) - NavigationBar#0Rect(0, 2712 - 1440, 2880) - ScreenDecorOverlay#0Rect(0, 0 - 1440, 91) - ... - at com.google.common.truth.FailureStrategy.fail(FailureStrategy.java:24) - ... -``` +The default tests can be disabled by overriding the respective methods and including an `@Ignore` annotation. ---- +### Non-Rotation animations and transitions -## Running Tests +`NonRotationTestBase` was created to make it easier to write tests that do not involve rotation (e.g., `Pip`, `split screen` or `IME`). +Tests that inherit from the class are automatically executed twice: once in portrait and once in landscape mode and the assertions are checked independently. +Moreover, these tests inherit the following checks: +* all regions on the screen are covered +* status bar is always visible +* nav bar is always visible -The tests can be run as any other Android JUnit tests. `platform_testing/tests/flicker` uses the library to test common UI transitions. Run `atest FlickerTest` to execute these tests. +The default tests can be disabled by overriding the respective methods and including an `@Ignore` annotation. ---- +### Exceptional cases -## Other Topics -### Monitors -Monitors capture test artifacts for each transition run. They are started before each iteration of the test transition (after the `runBefore` calls) and stopped after the transition is completed. Each iteration will produce a new test artifact. The following monitors are available: +Tests that rotate the device should inherit from `RotationTestBase`. +This class allows the test to be freely configured and does not provide any assertions. -#### LayersTraceMonitor -Captures Layers trace. This monitor is started by default. Build a transition with `skipLayersTrace()` to disable this monitor. -#### WindowManagerTraceMonitor -Captures Window Manager trace. This monitor is started by default. Build a transition with `skipWindowManagerTrace()` to disable this monitor. -#### WindowAnimationFrameStatsMonitor -Captures WindowAnimationFrameStats for the transition. This monitor is started by default and is used to eliminate *janky* runs. If an iteration has skipped frames, as determined by WindowAnimationFrameStats, the results for the iteration is skipped. If the list of results is empty after all iterations are completed, then the test should fail. Build a transition with `includeJankyRuns()` to disable this monitor. -#### ScreenRecorder -Captures screen to a video file. This monitor is disabled by default. Build a transition with `recordEachRun()` to capture each transition or build with `recordAllRuns()` to capture every transition including setup and teardown. ---- +### Example -### Extending Assertions - -To add a new assertion, add a function to one of the trace entry classes, `LayersTrace.Entry` or `WindowManagerTrace.Entry`. +Start by defining common or error prone transitions using `TransitionRunner`. +```kotlin +@LargeTest +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class MyTest( + beginRotationName: String, + beginRotation: Int +) : NonRotationTestBase(beginRotationName, beginRotation) { + init { + mTestApp = MyAppHelper(InstrumentationRegistry.getInstrumentation()) + } -```java - // Example adds an assertion to the check if layer is hidden by parent. - Result isHiddenByParent(String layerName) { - // Result should contain a details if assertion fails for any reason - // such as if layer is not found or layer is not hidden by parent - // or layer has no parent. - // ... + override val transitionToRun: TransitionRunner + get() = TransitionRunner.newBuilder() + .withTag("myTest") + .recordAllRuns() + .runBefore { device.pressHome() } + .runBefore { device.waitForIdle() } + .run { testApp.open() } + .runAfter{ testApp.exit() } + .repeat(2) + .includeJankyRuns() + .build() + + @Test + fun myWMTest() { + checkResults { + WmTraceSubject.assertThat(it) + .showsAppWindow(MyTestApp) + .forAllEntries() + } } -``` -Then add a function to the trace subject `LayersTraceSubject` or `WmTraceSubject` which will add the assertion for testing. When the assertion is evaluated, the trace will first be filtered then the assertion will be applied to the remaining entries. -```java - public LayersTraceSubject isHiddenByParent(String layerName) { - mChecker.add(entry -> entry.isHiddenByParent(layerName), - "isHiddenByParent(" + layerName + ")"); - return this; + @Test + fun mySFTest() { + checkResults { + LayersTraceSubject.assertThat(it) + .showsLayer(MyTestApp) + .forAllEntries() + } } +} ``` - -To use the new assertion: -```java - // Check if "Chrome" layer is hidden by parent in the first trace entry. - assertThat(result).isHiddenByParent("Chrome").inTheBeginning(); -```
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java deleted file mode 100644 index ad64840aaee2..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ChangeAppRotationTest.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static android.view.Surface.rotationToString; - -import static com.android.server.wm.flicker.CommonTransitions.changeAppRotation; -import static com.android.server.wm.flicker.WindowUtils.getAppPosition; -import static com.android.server.wm.flicker.WindowUtils.getNavigationBarPosition; -import static com.android.server.wm.flicker.WindowUtils.getStatusBarPosition; -import static com.android.server.wm.flicker.WmTraceSubject.assertThat; - -import android.graphics.Rect; -import android.util.Log; -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * Cycle through supported app rotations. - * To run this test: {@code atest FlickerTest:ChangeAppRotationTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class ChangeAppRotationTest extends FlickerTestBase { - private int mBeginRotation; - private int mEndRotation; - - public ChangeAppRotationTest(String beginRotationName, String endRotationName, - int beginRotation, int endRotation) { - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - this.mBeginRotation = beginRotation; - this.mEndRotation = endRotation; - } - - @Parameters(name = "{0}-{1}") - public static Collection<Object[]> getParams() { - int[] supportedRotations = - {Surface.ROTATION_0, Surface.ROTATION_90}; - Collection<Object[]> params = new ArrayList<>(); - for (int begin : supportedRotations) { - for (int end : supportedRotations) { - if (begin != end) { - params.add(new Object[]{rotationToString(begin), rotationToString(end), begin, - end}); - } - } - } - return params; - } - - @Before - public void runTransition() { - super.runTransition( - changeAppRotation(mTestApp, mUiDevice, mBeginRotation, mEndRotation) - .includeJankyRuns().build()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_statusBarWindowIsAlwaysVisible() { - checkResults(result -> assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkPosition_navBarLayerRotatesAndScales() { - Rect startingPos = getNavigationBarPosition(mBeginRotation); - Rect endingPos = getNavigationBarPosition(mEndRotation); - checkResults(result -> { - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos) - .inTheBeginning(); - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, endingPos).atTheEnd(); - } - ); - } - - @Test - public void checkPosition_appLayerRotates() { - Rect startingPos = getAppPosition(mBeginRotation); - Rect endingPos = getAppPosition(mEndRotation); - Log.e(TAG, "startingPos=" + startingPos + " endingPos=" + endingPos); - checkResults(result -> { - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(mTestApp.getPackage(), startingPos).inTheBeginning(); - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(mTestApp.getPackage(), endingPos).atTheEnd(); - } - ); - } - - @Test - public void checkPosition_statusBarLayerScales() { - Rect startingPos = getStatusBarPosition(mBeginRotation); - Rect endingPos = getStatusBarPosition(mEndRotation); - checkResults(result -> { - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(STATUS_BAR_WINDOW_TITLE, startingPos) - .inTheBeginning(); - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(STATUS_BAR_WINDOW_TITLE, endingPos).atTheEnd(); - } - ); - } - - @Test - public void checkVisibility_screenshotLayerBecomesInvisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(mTestApp.getPackage()) - .then() - .replaceVisibleLayer(mTestApp.getPackage(), "Screenshot") - .then() - .showsLayer(mTestApp.getPackage()).and().showsLayer("Screenshot") - .then() - .replaceVisibleLayer("Screenshot", mTestApp.getPackage()) - .forAllEntries()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_navBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_statusBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java deleted file mode 100644 index 022f798e82f5..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToAppTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test IME window closing back to app window transitions. - * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class CloseImeAutoOpenWindowToAppTest extends CloseImeWindowToAppTest { - - public CloseImeAutoOpenWindowToAppTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(editTextLoseFocusToApp((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @FlakyTest(bugId = 141458352) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_imeLayerBecomesInvisible() { - super.checkVisibility_imeLayerBecomesInvisible(); - } - - @FlakyTest(bugId = 141458352) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_imeAppLayerIsAlwaysVisible() { - super.checkVisibility_imeAppLayerIsAlwaysVisible(); - } - - @FlakyTest(bugId = 141458352) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_imeAppWindowIsAlwaysVisible() { - super.checkVisibility_imeAppWindowIsAlwaysVisible(); - } - -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java deleted file mode 100644 index d6f994b5c0d5..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeAutoOpenWindowToHomeTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test IME window closing back to app window transitions. - * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class CloseImeAutoOpenWindowToHomeTest extends CloseImeWindowToHomeTest { - - public CloseImeAutoOpenWindowToHomeTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - mTestApp = new ImeAppAutoFocusHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(editTextLoseFocusToHome((ImeAppAutoFocusHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @FlakyTest(bugId = 141458352) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_imeWindowBecomesInvisible() { - super.checkVisibility_imeWindowBecomesInvisible(); - } - - @FlakyTest(bugId = 141458352) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_imeLayerBecomesInvisible() { - super.checkVisibility_imeLayerBecomesInvisible(); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java deleted file mode 100644 index 28da3af2b7c5..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToAppTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToApp; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test IME window closing back to app window transitions. - * To run this test: {@code atest FlickerTests:CloseImeWindowToAppTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class CloseImeWindowToAppTest extends NonRotationTestBase { - - static final String IME_WINDOW_TITLE = "InputMethod"; - - public CloseImeWindowToAppTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(editTextLoseFocusToApp((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_imeLayerBecomesInvisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(IME_WINDOW_TITLE) - .then() - .hidesLayer(IME_WINDOW_TITLE) - .forAllEntries()); - } - - @Test - public void checkVisibility_imeAppLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(mTestApp.getPackage()) - .forAllEntries()); - } - - @Test - public void checkVisibility_imeAppWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindowOnTop(mTestApp.getPackage()) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java deleted file mode 100644 index f740af9b89bf..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CloseImeWindowToHomeTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.editTextLoseFocusToHome; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test IME window closing to home transitions. - * To run this test: {@code atest FlickerTests:CloseImeWindowToHomeTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class CloseImeWindowToHomeTest extends NonRotationTestBase { - - static final String IME_WINDOW_TITLE = "InputMethod"; - - public CloseImeWindowToHomeTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(editTextLoseFocusToHome((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_imeWindowBecomesInvisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsImeWindow(IME_WINDOW_TITLE) - .then() - .hidesImeWindow(IME_WINDOW_TITLE) - .forAllEntries()); - } - - @Ignore("Flaky") - @Test - public void checkVisibility_imeLayerBecomesInvisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(IME_WINDOW_TITLE) - .then() - .hidesLayer(IME_WINDOW_TITLE) - .forAllEntries()); - } - - @Ignore("Flaky") - @Test - public void checkVisibility_imeAppLayerBecomesInvisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(mTestApp.getPackage()) - .then() - .hidesLayer(mTestApp.getPackage()) - .forAllEntries()); - } - - @Test - public void checkVisibility_imeAppWindowBecomesInvisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindowOnTop(mTestApp.getPackage()) - .then() - .hidesAppWindowOnTop(mTestApp.getPackage()) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt new file mode 100644 index 000000000000..69b11872e123 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonAssertions.kt @@ -0,0 +1,153 @@ +/* + * 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.server.wm.flicker + +import com.android.server.wm.flicker.dsl.EventLogAssertion +import com.android.server.wm.flicker.dsl.LayersAssertion +import com.android.server.wm.flicker.dsl.WmAssertion +import com.android.server.wm.flicker.helpers.WindowUtils + +@JvmOverloads +fun WmAssertion.statusBarWindowIsAlwaysVisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("statusBarWindowIsAlwaysVisible", enabled, bugId) { + this.showsAboveAppWindow(FlickerTestBase.STATUS_BAR_WINDOW_TITLE) + } +} + +@JvmOverloads +fun WmAssertion.navBarWindowIsAlwaysVisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("navBarWindowIsAlwaysVisible", enabled, bugId) { + this.showsAboveAppWindow(FlickerTestBase.NAVIGATION_BAR_WINDOW_TITLE) + } +} + +@JvmOverloads +fun LayersAssertion.noUncoveredRegions( + beginRotation: Int, + endRotation: Int = beginRotation, + allStates: Boolean = true, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + val startingBounds = WindowUtils.getDisplayBounds(beginRotation) + val endingBounds = WindowUtils.getDisplayBounds(endRotation) + if (allStates) { + all("noUncoveredRegions", enabled, bugId) { + if (startingBounds == endingBounds) { + this.coversAtLeastRegion(startingBounds) + } else { + this.coversAtLeastRegion(startingBounds) + .then() + .coversAtLeastRegion(endingBounds) + } + } + } else { + start("noUncoveredRegions_StartingPos") { + this.coversAtLeastRegion(startingBounds) + } + end("noUncoveredRegions_EndingPos") { + this.coversAtLeastRegion(endingBounds) + } + } +} + +@JvmOverloads +fun LayersAssertion.navBarLayerIsAlwaysVisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("navBarLayerIsAlwaysVisible", enabled, bugId) { + this.showsLayer(FlickerTestBase.NAVIGATION_BAR_WINDOW_TITLE) + } +} + +@JvmOverloads +fun LayersAssertion.statusBarLayerIsAlwaysVisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("statusBarLayerIsAlwaysVisible", enabled, bugId) { + this.showsLayer(FlickerTestBase.STATUS_BAR_WINDOW_TITLE) + } +} + +@JvmOverloads +fun LayersAssertion.navBarLayerRotatesAndScales( + beginRotation: Int, + endRotation: Int = beginRotation, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + val startingPos = WindowUtils.getNavigationBarPosition(beginRotation) + val endingPos = WindowUtils.getNavigationBarPosition(endRotation) + + start("navBarLayerRotatesAndScales_StartingPos", enabled, bugId) { + this.hasVisibleRegion(FlickerTestBase.NAVIGATION_BAR_WINDOW_TITLE, startingPos) + } + end("navBarLayerRotatesAndScales_EndingPost", enabled, bugId) { + this.hasVisibleRegion(FlickerTestBase.NAVIGATION_BAR_WINDOW_TITLE, endingPos) + } + + if (startingPos == endingPos) { + all("navBarLayerRotatesAndScales", enabled = false, bugId = 167747321) { + this.hasVisibleRegion(FlickerTestBase.NAVIGATION_BAR_WINDOW_TITLE, startingPos) + } + } +} + +@JvmOverloads +fun LayersAssertion.statusBarLayerRotatesScales( + beginRotation: Int, + endRotation: Int = beginRotation, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + val startingPos = WindowUtils.getStatusBarPosition(beginRotation) + val endingPos = WindowUtils.getStatusBarPosition(endRotation) + + start("statusBarLayerRotatesScales_StartingPos", enabled, bugId) { + this.hasVisibleRegion(FlickerTestBase.STATUS_BAR_WINDOW_TITLE, startingPos) + } + end("statusBarLayerRotatesScales_EndingPos", enabled, bugId) { + this.hasVisibleRegion(FlickerTestBase.STATUS_BAR_WINDOW_TITLE, endingPos) + } +} + +fun EventLogAssertion.focusChanges( + vararg windows: String, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all(enabled = enabled, bugId = bugId) { + this.focusChanges(windows) + } +} + +fun EventLogAssertion.focusDoesNotChange( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all(enabled = enabled, bugId = bugId) { + this.focusDoesNotChange() + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java b/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java deleted file mode 100644 index 0201a95b18bb..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/CommonTransitions.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static android.os.SystemClock.sleep; -import static android.view.Surface.rotationToString; - -import static com.android.server.wm.flicker.helpers.AutomationUtils.clearRecents; -import static com.android.server.wm.flicker.helpers.AutomationUtils.exitSplitScreen; -import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow; -import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen; -import static com.android.server.wm.flicker.helpers.AutomationUtils.stopPackage; - -import android.content.Context; -import android.content.Intent; -import android.os.RemoteException; -import android.platform.helpers.IAppHelper; -import android.support.test.uiautomator.By; -import android.support.test.uiautomator.UiDevice; -import android.support.test.uiautomator.UiObject2; -import android.support.test.uiautomator.Until; -import android.util.Rational; -import android.view.Surface; - -import com.android.server.wm.flicker.TransitionRunner.TransitionBuilder; -import com.android.server.wm.flicker.helpers.AutomationUtils; -import com.android.server.wm.flicker.helpers.ImeAppHelper; -import com.android.server.wm.flicker.helpers.PipAppHelper; - -/** - * Collection of common transitions which can be used to test different apps or scenarios. - */ -class CommonTransitions { - - public static final int ITERATIONS = 1; - private static final String TAG = "FLICKER"; - private static final long APP_LAUNCH_TIMEOUT = 10000; - - private static void setRotation(UiDevice device, int rotation) { - try { - switch (rotation) { - case Surface.ROTATION_270: - device.setOrientationLeft(); - break; - - case Surface.ROTATION_90: - device.setOrientationRight(); - break; - - case Surface.ROTATION_0: - default: - device.setOrientationNatural(); - } - // Wait for animation to complete - sleep(1000); - } catch (RemoteException e) { - throw new RuntimeException(e); - } - } - - static TransitionBuilder openAppWarm(IAppHelper testApp, UiDevice - device, int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("OpenAppWarm_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBeforeAll(() -> setRotation(device, beginRotation)) - .runBeforeAll(testApp::open) - .runBefore(device::pressHome) - .runBefore(device::waitForIdle) - .runBefore(() -> setRotation(device, beginRotation)) - .run(testApp::open) - .runAfterAll(testApp::exit) - .runAfterAll(AutomationUtils::setDefaultWait) - .repeat(ITERATIONS); - } - - static TransitionBuilder closeAppWithBackKey(IAppHelper testApp, UiDevice - device) { - return TransitionRunner.newBuilder() - .withTag("closeAppWithBackKey_" + testApp.getLauncherName()) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(testApp::open) - .runBefore(device::waitForIdle) - .run(device::pressBack) - .run(device::waitForIdle) - .runAfterAll(testApp::exit) - .runAfterAll(AutomationUtils::setDefaultWait) - .repeat(ITERATIONS); - } - - static TransitionBuilder closeAppWithHomeKey(IAppHelper testApp, UiDevice - device) { - return TransitionRunner.newBuilder() - .withTag("closeAppWithHomeKey_" + testApp.getLauncherName()) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(testApp::open) - .runBefore(device::waitForIdle) - .run(device::pressHome) - .run(device::waitForIdle) - .runAfterAll(testApp::exit) - .runAfterAll(AutomationUtils::setDefaultWait) - .repeat(ITERATIONS); - } - - static TransitionBuilder openAppCold(IAppHelper testApp, - UiDevice device, int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("OpenAppCold_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBeforeAll(() -> setRotation(device, beginRotation)) - .runBefore(testApp::exit) - .runBefore(device::waitForIdle) - .run(testApp::open) - .runAfterAll(testApp::exit) - .runAfterAll(() -> setRotation(device, Surface.ROTATION_0)) - .repeat(ITERATIONS); - } - - static TransitionBuilder changeAppRotation(IAppHelper testApp, UiDevice - device, int beginRotation, int endRotation) { - return TransitionRunner.newBuilder() - .withTag("changeAppRotation_" + testApp.getLauncherName() - + rotationToString(beginRotation) + "_" + - rotationToString(endRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBeforeAll(testApp::open) - .runBefore(() -> setRotation(device, beginRotation)) - .run(() -> setRotation(device, endRotation)) - .runAfterAll(testApp::exit) - .runAfterAll(() -> setRotation(device, Surface.ROTATION_0)) - .repeat(ITERATIONS); - } - - static TransitionBuilder changeAppRotation(Intent intent, String intentId, Context context, - UiDevice - device, int beginRotation, int endRotation) { - final String testTag = "changeAppRotation_" + intentId + "_" + - rotationToString(beginRotation) + "_" + rotationToString(endRotation); - return TransitionRunner.newBuilder() - .withTag(testTag) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBeforeAll(() -> { - context.startActivity(intent); - device.wait(Until.hasObject(By.pkg(intent.getComponent() - .getPackageName()).depth(0)), APP_LAUNCH_TIMEOUT); - } - ) - .runBefore(() -> setRotation(device, beginRotation)) - .run(() -> setRotation(device, endRotation)) - .runAfterAll(() -> stopPackage(context, intent.getComponent().getPackageName())) - .runAfterAll(() -> setRotation(device, Surface.ROTATION_0)) - .repeat(ITERATIONS); - } - - static TransitionBuilder appToSplitScreen(IAppHelper testApp, UiDevice device, - int beginRotation) { - final String testTag = "appToSplitScreen_" + testApp.getLauncherName() + "_" - + rotationToString(beginRotation); - return TransitionRunner.newBuilder() - .withTag(testTag) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBeforeAll(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .runBefore(device::waitForIdle) - .runBefore(() -> sleep(500)) - .run(() -> launchSplitScreen(device)) - .runAfter(() -> exitSplitScreen(device)) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder splitScreenToLauncher(IAppHelper testApp, UiDevice device) { - return TransitionRunner.newBuilder() - .withTag("splitScreenToLauncher_" + testApp.getLauncherName()) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(testApp::open) - .runBefore(device::waitForIdle) - .runBefore(() -> launchSplitScreen(device)) - .run(() -> exitSplitScreen(device)) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder editTextSetFocus(ImeAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("editTextSetFocus_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBefore(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .run(() -> testApp.clickEditTextWidget(device)) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom, - UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) { - String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_" - + testAppBottom.getLauncherName() + "_" - + startRatio.toString().replace("/", ":") + "_to_" - + stopRatio.toString().replace("/", ":") + "_" - + rotationToString(beginRotation); - return TransitionRunner.newBuilder() - .withTag(testTag) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBeforeAll(() -> setRotation(device, beginRotation)) - .runBeforeAll(() -> clearRecents(device)) - .runBefore(testAppBottom::open) - .runBefore(device::pressHome) - .runBefore(testAppTop::open) - .runBefore(device::waitForIdle) - .runBefore(() -> launchSplitScreen(device)) - .runBefore(() -> { - UiObject2 snapshot = device.findObject( - By.res(device.getLauncherPackageName(), "snapshot")); - snapshot.click(); - }) - .runBefore(() -> testAppBottom.clickEditTextWidget(device)) - .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio)) - .run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio)) - .runAfter(() -> exitSplitScreen(device)) - .runAfter(device::pressHome) - .runAfterAll(testAppTop::exit) - .runAfterAll(testAppBottom::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder editTextLoseFocusToHome(ImeAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("editTextLoseFocusToHome_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBefore(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .runBefore(() -> testApp.clickEditTextWidget(device)) - .run(device::pressHome) - .run(device::waitForIdle) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder editTextLoseFocusToApp(ImeAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("editTextLoseFocusToApp_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBefore(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .runBefore(() -> testApp.clickEditTextWidget(device)) - .run(device::pressBack) - .run(device::waitForIdle) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("enterPipMode_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBefore(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .run(() -> testApp.clickEnterPipButton(device)) - .runAfter(() -> testApp.closePipWindow(device)) - .runAfterAll(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("exitPipModeToHome_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .runBefore(device::pressHome) - .runBefore(() -> setRotation(device, beginRotation)) - .runBefore(testApp::open) - .run(() -> testApp.clickEnterPipButton(device)) - .run(() -> testApp.closePipWindow(device)) - .run(device::waitForIdle) - .run(testApp::exit) - .repeat(ITERATIONS); - } - - static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device, - int beginRotation) { - return TransitionRunner.newBuilder() - .withTag("exitPipModeToApp_" + testApp.getLauncherName() - + rotationToString(beginRotation)) - .recordAllRuns() - .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen) - .run(device::pressHome) - .run(() -> setRotation(device, beginRotation)) - .run(testApp::open) - .run(() -> testApp.clickEnterPipButton(device)) - .run(() -> expandPipWindow(device)) - .run(device::waitForIdle) - .run(testApp::exit) - .repeat(ITERATIONS); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java deleted file mode 100644 index 666a0b9be779..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/DebugTest.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import android.platform.helpers.IAppHelper; -import android.support.test.uiautomator.UiDevice; -import android.util.Rational; -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; - -import com.android.server.wm.flicker.helpers.ImeAppHelper; -import com.android.server.wm.flicker.helpers.PipAppHelper; - -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; - -/** - * Tests to help debug individual transitions, capture video recordings and create test cases. - */ -@LargeTest -@Ignore("Used for debugging transitions used in FlickerTests.") -@RunWith(AndroidJUnit4.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class DebugTest { - private IAppHelper testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - private UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - - /** - * atest FlickerTests:DebugTest#openAppCold - */ - @Test - public void openAppCold() { - CommonTransitions.openAppCold(testApp, uiDevice, Surface.ROTATION_0) - .recordAllRuns().build().run(); - } - - /** - * atest FlickerTests:DebugTest#openAppWarm - */ - @Test - public void openAppWarm() { - CommonTransitions.openAppWarm(testApp, uiDevice, Surface.ROTATION_0) - .recordAllRuns().build().run(); - } - - /** - * atest FlickerTests:DebugTest#changeOrientationFromNaturalToLeft - */ - @Test - public void changeOrientationFromNaturalToLeft() { - CommonTransitions.changeAppRotation(testApp, uiDevice, Surface.ROTATION_0, - Surface.ROTATION_270).recordAllRuns().build().run(); - } - - /** - * atest FlickerTests:DebugTest#closeAppWithBackKey - */ - @Test - public void closeAppWithBackKey() { - CommonTransitions.closeAppWithBackKey(testApp, uiDevice).recordAllRuns().build().run(); - } - - /** - * atest FlickerTests:DebugTest#closeAppWithHomeKey - */ - @Test - public void closeAppWithHomeKey() { - CommonTransitions.closeAppWithHomeKey(testApp, uiDevice).recordAllRuns().build().run(); - } - - /** - * atest FlickerTests:DebugTest#openAppToSplitScreen - */ - @Test - public void openAppToSplitScreen() { - CommonTransitions.appToSplitScreen(testApp, uiDevice, - Surface.ROTATION_0).includeJankyRuns().recordAllRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#splitScreenToLauncher - */ - @Test - public void splitScreenToLauncher() { - CommonTransitions.splitScreenToLauncher(testApp, - uiDevice).includeJankyRuns().recordAllRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#resizeSplitScreen - */ - @Test - public void resizeSplitScreen() { - ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0, - new Rational(1, 3), new Rational(2, 3)) - .includeJankyRuns().build().run(); - } - - // IME tests - - /** - * atest FlickerTests:DebugTest#editTextSetFocus - */ - @Test - public void editTextSetFocus() { - ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0) - .includeJankyRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#editTextLoseFocusToHome - */ - @Test - public void editTextLoseFocusToHome() { - ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0) - .includeJankyRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#editTextLoseFocusToApp - */ - @Test - public void editTextLoseFocusToApp() { - ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0) - .includeJankyRuns() - .build().run(); - } - - // PIP tests - - /** - * atest FlickerTests:DebugTest#enterPipMode - */ - @Test - public void enterPipMode() { - PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.enterPipMode(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#exitPipModeToHome - */ - @Test - public void exitPipModeToHome() { - PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.exitPipModeToHome(testApp, uiDevice, Surface.ROTATION_0) - .includeJankyRuns() - .build().run(); - } - - /** - * atest FlickerTests:DebugTest#exitPipModeToApp - */ - @Test - public void exitPipModeToApp() { - PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation()); - CommonTransitions.exitPipModeToApp(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns() - .build().run(); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java deleted file mode 100644 index 4578fa3f0b9a..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static androidx.test.InstrumentationRegistry.getInstrumentation; - -import static com.android.server.wm.flicker.helpers.AutomationUtils.setDefaultWait; - -import static com.google.common.truth.Truth.assertWithMessage; - -import android.os.Bundle; -import android.platform.helpers.IAppHelper; -import android.support.test.InstrumentationRegistry; -import android.support.test.uiautomator.UiDevice; -import android.util.Log; - -import com.android.server.wm.flicker.TransitionRunner.TransitionResult; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; - -import java.util.HashMap; -import java.util.List; -import java.util.function.Consumer; - -/** - * Base class of all Flicker test that performs common functions for all flicker tests: - * <p> - * - Caches transitions so that a transition is run once and the transition results are used by - * tests multiple times. This is needed for parameterized tests which call the BeforeClass methods - * multiple times. - * - Keeps track of all test artifacts and deletes ones which do not need to be reviewed. - * - Fails tests if results are not available for any test due to jank. - */ -public class FlickerTestBase { - public static final String TAG = "FLICKER"; - static final String NAVIGATION_BAR_WINDOW_TITLE = "NavigationBar"; - static final String STATUS_BAR_WINDOW_TITLE = "StatusBar"; - static final String DOCKED_STACK_DIVIDER = "DockedStackDivider"; - private static HashMap<String, List<TransitionResult>> transitionResults = - new HashMap<>(); - IAppHelper mTestApp; - UiDevice mUiDevice; - private List<TransitionResult> mResults; - private TransitionResult mLastResult = null; - - @Before - public void setUp() { - InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle()); - mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - } - - /** - * Teardown any system settings and clean up test artifacts from the file system. - * - * Note: test artifacts for failed tests will remain on the device. - */ - @AfterClass - public static void teardown() { - setDefaultWait(); - transitionResults.values().stream() - .flatMap(List::stream) - .forEach(result -> { - if (result.canDelete()) { - result.delete(); - } else { - if (result.layersTraceExists()) { - Log.e(TAG, "Layers trace saved to " + result.getLayersTracePath()); - } - if (result.windowManagerTraceExists()) { - Log.e(TAG, "WindowManager trace saved to " + result - .getWindowManagerTracePath - ()); - } - if (result.screenCaptureVideoExists()) { - Log.e(TAG, "Screen capture video saved to " + result - .screenCaptureVideoPath().toString()); - } - } - }); - } - - /** - * Runs a transition, returns a cached result if the transition has run before. - */ - void run(TransitionRunner transition) { - if (transitionResults.containsKey(transition.getTestTag())) { - mResults = transitionResults.get(transition.getTestTag()); - return; - } - mResults = transition.run().getResults(); - /* Fail if we don't have any results due to jank */ - assertWithMessage("No results to test because all transition runs were invalid because " - + "of Jank").that(mResults).isNotEmpty(); - transitionResults.put(transition.getTestTag(), mResults); - } - - /** - * Runs a transition, returns a cached result if the transition has run before. - */ - void runTransition(TransitionRunner transition) { - run(transition); - } - - /** - * Goes through a list of transition results and checks assertions on each result. - */ - void checkResults(Consumer<TransitionResult> assertion) { - - for (TransitionResult result : mResults) { - mLastResult = result; - assertion.accept(result); - } - mLastResult = null; - } - - /** - * Kludge to mark a file for saving. If {@code checkResults} fails, the last result is not - * cleared. This indicates the assertion failed for the result, so mark it for saving. - */ - @After - public void markArtifactsForSaving() { - if (mLastResult != null) { - mLastResult.flagForSaving(); - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.kt new file mode 100644 index 000000000000..abe7dbc57002 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/FlickerTestBase.kt @@ -0,0 +1,129 @@ +/* + * 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.server.wm.flicker + +import android.os.RemoteException +import android.os.SystemClock +import android.platform.helpers.IAppHelper +import android.view.Surface +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice + +/** + * Base class of all Flicker test that performs common functions for all flicker tests: + * + * + * - Caches transitions so that a transition is run once and the transition results are used by + * tests multiple times. This is needed for parameterized tests which call the BeforeClass methods + * multiple times. + * - Keeps track of all test artifacts and deletes ones which do not need to be reviewed. + * - Fails tests if results are not available for any test due to jank. + */ +abstract class FlickerTestBase { + val instrumentation by lazy { + InstrumentationRegistry.getInstrumentation() + } + val uiDevice by lazy { + UiDevice.getInstance(instrumentation) + } + + /** + * Build a test tag for the test + * @param testName Name of the transition(s) being tested + * @param app App being launcher + * @param rotation Initial screen rotation + * + * @return test tag with pattern <NAME>__<APP>__<ROTATION> + </ROTATION></APP></NAME> */ + protected fun buildTestTag(testName: String, app: IAppHelper, rotation: Int): String { + return buildTestTag( + testName, app, rotation, rotation, app2 = null, extraInfo = "") + } + + /** + * Build a test tag for the test + * @param testName Name of the transition(s) being tested + * @param app App being launcher + * @param beginRotation Initial screen rotation + * @param endRotation End screen rotation (if any, otherwise use same as initial) + * + * @return test tag with pattern <NAME>__<APP>__<BEGIN_ROTATION>-<END_ROTATION> + </END_ROTATION></BEGIN_ROTATION></APP></NAME> */ + protected fun buildTestTag( + testName: String, + app: IAppHelper, + beginRotation: Int, + endRotation: Int + ): String { + return buildTestTag( + testName, app, beginRotation, endRotation, app2 = null, extraInfo = "") + } + + /** + * Build a test tag for the test + * @param testName Name of the transition(s) being tested + * @param app App being launcher + * @param app2 Second app being launched (if any) + * @param beginRotation Initial screen rotation + * @param endRotation End screen rotation (if any, otherwise use same as initial) + * @param extraInfo Additional information to append to the tag + * + * @return test tag with pattern <NAME>__<APP></APP>(S)>__<ROTATION></ROTATION>(S)>[__<EXTRA>] + </EXTRA></NAME> */ + protected fun buildTestTag( + testName: String, + app: IAppHelper, + beginRotation: Int, + endRotation: Int, + app2: IAppHelper?, + extraInfo: String + ): String { + var testTag = "${testName}__${app.launcherName}" + if (app2 != null) { + testTag += "-${app2.launcherName}" + } + testTag += "__${Surface.rotationToString(beginRotation)}" + if (endRotation != beginRotation) { + testTag += "-${Surface.rotationToString(endRotation)}" + } + if (extraInfo.isNotEmpty()) { + testTag += "__$extraInfo" + } + return testTag + } + + protected fun Flicker.setRotation(rotation: Int) { + try { + when (rotation) { + Surface.ROTATION_270 -> device.setOrientationLeft() + Surface.ROTATION_90 -> device.setOrientationRight() + Surface.ROTATION_0 -> device.setOrientationNatural() + else -> device.setOrientationNatural() + } + // Wait for animation to complete + SystemClock.sleep(1000) + } catch (e: RemoteException) { + throw RuntimeException(e) + } + } + + companion object { + const val NAVIGATION_BAR_WINDOW_TITLE = "NavigationBar" + const val STATUS_BAR_WINDOW_TITLE = "StatusBar" + const val DOCKED_STACK_DIVIDER = "DockedStackDivider" + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java b/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java deleted file mode 100644 index 54941dc0f585..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker; - -import static android.view.Surface.rotationToString; - -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; - -import android.graphics.Rect; -import android.view.Surface; - -import androidx.test.filters.FlakyTest; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runners.Parameterized.Parameters; - -import java.util.ArrayList; -import java.util.Collection; - -public abstract class NonRotationTestBase extends FlickerTestBase { - - int mBeginRotation; - - public NonRotationTestBase(String beginRotationName, int beginRotation) { - this.mBeginRotation = beginRotation; - } - - @Parameters(name = "{0}") - public static Collection<Object[]> getParams() { - int[] supportedRotations = - {Surface.ROTATION_0, Surface.ROTATION_90}; - Collection<Object[]> params = new ArrayList<>(); - - for (int begin : supportedRotations) { - params.add(new Object[]{rotationToString(begin), begin}); - } - - return params; - } - - @FlakyTest(bugId = 141361128) - @Ignore("Waiting bug feedback") - @Test - public void checkCoveredRegion_noUncoveredRegions() { - Rect displayBounds = getDisplayBounds(mBeginRotation); - checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion( - displayBounds).forAllEntries()); - } - - @FlakyTest(bugId = 141361128) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_navBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @FlakyTest(bugId = 141361128) - @Ignore("Waiting bug feedback") - @Test - public void checkVisibility_statusBarLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.kt new file mode 100644 index 000000000000..e7d1f8e94dba --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/NonRotationTestBase.kt @@ -0,0 +1,36 @@ +/* + * 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.server.wm.flicker + +import android.view.Surface +import org.junit.runners.Parameterized + +abstract class NonRotationTestBase( + protected val rotationName: String, + protected val rotation: Int +) : FlickerTestBase() { + companion object { + const val SCREENSHOT_LAYER = "RotationLayer" + + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java deleted file mode 100644 index 2981ff9aefe6..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppColdTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.openAppCold; -import static com.android.server.wm.flicker.WmTraceSubject.assertThat; - -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test cold launch app from launcher. - * To run this test: {@code atest FlickerTests:OpenAppColdTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenAppColdTest extends NonRotationTestBase { - - public OpenAppColdTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - } - - @Before - public void runTransition() { - run(openAppCold(mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_wallpaperWindowBecomesInvisible() { - checkResults(result -> assertThat(result) - .showsBelowAppWindow("Wallpaper") - .then() - .hidesBelowAppWindow("Wallpaper") - .forAllEntries()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { - checkResults(result -> assertThat(result) - .showsAppWindowOnTop( - "com.android.launcher3/.Launcher") - .then() - .showsAppWindowOnTop(mTestApp.getPackage()) - .forAllEntries()); - } - - @Test - public void checkVisibility_wallpaperLayerBecomesInvisible() { - if (mBeginRotation == Surface.ROTATION_0) { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("Wallpaper") - .then() - .replaceVisibleLayer("Wallpaper", mTestApp.getPackage()) - .forAllEntries()); - } else { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("Wallpaper") - .then() - .replaceVisibleLayer("Wallpaper", "Screenshot") - .then() - .showsLayer(mTestApp.getPackage()) - .forAllEntries()); - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java deleted file mode 100644 index ddead6d321a0..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppToSplitScreenTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.appToSplitScreen; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test open app to split screen. - * To run this test: {@code atest FlickerTests:OpenAppToSplitScreenTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenAppToSplitScreenTest extends NonRotationTestBase { - - public OpenAppToSplitScreenTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - } - - @Before - public void runTransition() { - super.runTransition(appToSplitScreen(mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns() - .build()); - } - - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_dividerWindowBecomesVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .hidesAboveAppWindow(DOCKED_STACK_DIVIDER) - .then() - .showsAboveAppWindow(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } - - @Test - public void checkVisibility_dividerLayerBecomesVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hidesLayer(DOCKED_STACK_DIVIDER) - .then() - .showsLayer(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java deleted file mode 100644 index bb684d19d645..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenAppWarmTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.openAppWarm; -import static com.android.server.wm.flicker.WmTraceSubject.assertThat; - -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test warm launch app. - * To run this test: {@code atest FlickerTests:OpenAppWarmTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenAppWarmTest extends NonRotationTestBase { - - public OpenAppWarmTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - } - - @Before - public void runTransition() { - super.runTransition(openAppWarm(mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_wallpaperBecomesInvisible() { - checkResults(result -> assertThat(result) - .showsBelowAppWindow("Wallpaper") - .then() - .hidesBelowAppWindow("Wallpaper") - .forAllEntries()); - } - - @FlakyTest(bugId = 140855415) - @Ignore("Waiting bug feedback") - @Test - public void checkZOrder_appWindowReplacesLauncherAsTopWindow() { - checkResults(result -> assertThat(result) - .showsAppWindowOnTop( - "com.android.launcher3/.Launcher") - .then() - .showsAppWindowOnTop(mTestApp.getPackage()) - .forAllEntries()); - } - - @Test - public void checkVisibility_wallpaperLayerBecomesInvisible() { - if (mBeginRotation == Surface.ROTATION_0) { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("Wallpaper") - .then() - .replaceVisibleLayer("Wallpaper", mTestApp.getPackage()) - .forAllEntries()); - } else { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer("Wallpaper") - .then() - .replaceVisibleLayer("Wallpaper", "Screenshot") - .then() - .showsLayer(mTestApp.getPackage()) - .forAllEntries()); - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java deleted file mode 100644 index 91d4a056d8fb..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/OpenImeWindowTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.editTextSetFocus; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test IME window opening transitions. - * To run this test: {@code atest FlickerTests:OpenImeWindowTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class OpenImeWindowTest extends NonRotationTestBase { - - private static final String IME_WINDOW_TITLE = "InputMethod"; - - public OpenImeWindowTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - mTestApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(editTextSetFocus((ImeAppHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_imeWindowBecomesVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .hidesImeWindow(IME_WINDOW_TITLE) - .then() - .showsImeWindow(IME_WINDOW_TITLE) - .forAllEntries()); - } - - @Test - public void checkVisibility_imeLayerBecomesVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hidesLayer(IME_WINDOW_TITLE) - .then() - .showsLayer(IME_WINDOW_TITLE) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java deleted file mode 100644 index 85706bd14c5e..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToAppTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToApp; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.PipAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test Pip launch. - * To run this test: {@code atest FlickerTests:PipToAppTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class PipToAppTest extends NonRotationTestBase { - - static final String sPipWindowTitle = "PipMenuActivity"; - - public PipToAppTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - run(exitPipModeToApp((PipAppHelper) mTestApp, mUiDevice, mBeginRotation) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_pipWindowBecomesVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .skipUntilFirstAssertion() - .showsAppWindowOnTop(sPipWindowTitle) - .then() - .hidesAppWindow(sPipWindowTitle) - .forAllEntries()); - } - - @Test - public void checkVisibility_pipLayerBecomesVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .skipUntilFirstAssertion() - .showsLayer(sPipWindowTitle) - .then() - .hidesLayer(sPipWindowTitle) - .forAllEntries()); - } - - @Test - public void checkVisibility_backgroundWindowVisibleBehindPipLayer() { - checkResults(result -> WmTraceSubject.assertThat(result) - .skipUntilFirstAssertion() - .showsAppWindowOnTop(sPipWindowTitle) - .then() - .showsBelowAppWindow("Wallpaper") - .then() - .showsAppWindowOnTop(mTestApp.getPackage()) - .then() - .hidesAppWindowOnTop(mTestApp.getPackage()) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java deleted file mode 100644 index ef856dc52167..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/PipToHomeTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.exitPipModeToHome; - -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; - -import com.android.server.wm.flicker.helpers.PipAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; - -/** - * Test Pip launch. - * To run this test: {@code atest FlickerTests:PipToHomeTest} - */ -@LargeTest -@RunWith(AndroidJUnit4.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class PipToHomeTest extends FlickerTestBase { - - static final String sPipWindowTitle = "PipActivity"; - - // public PipToHomeTest(String beginRotationName, int beginRotation) { - public PipToHomeTest() { - // super(beginRotationName, beginRotation); - - this.mTestApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation()); - } - - @Before - public void runTransition() { - // run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, mBeginRotation) - run(exitPipModeToHome((PipAppHelper) mTestApp, mUiDevice, Surface.ROTATION_0) - .includeJankyRuns().build()); - } - - @Ignore - @Test - public void checkVisibility_pipWindowBecomesVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .skipUntilFirstAssertion() - .showsAppWindowOnTop(sPipWindowTitle) - .then() - .hidesAppWindow(sPipWindowTitle) - .forAllEntries()); - } - - @Test - public void checkVisibility_pipLayerBecomesVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .skipUntilFirstAssertion() - .showsLayer(sPipWindowTitle) - .then() - .hidesLayer(sPipWindowTitle) - .forAllEntries()); - } - - @Ignore - @Test - public void checkVisibility_backgroundWindowVisibleBehindPipLayer() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindowOnTop(sPipWindowTitle) - .then() - .showsBelowAppWindow("Wallpaper") - .then() - .showsAppWindowOnTop("Wallpaper") - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java deleted file mode 100644 index e36701be0cad..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/ResizeSplitScreenTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.resizeSplitScreen; -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; -import static com.android.server.wm.flicker.WindowUtils.getDockedStackDividerInset; -import static com.android.server.wm.flicker.WindowUtils.getNavigationBarHeight; - -import static com.google.common.truth.Truth.assertThat; - -import android.graphics.Rect; -import android.util.Rational; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import com.android.server.wm.flicker.helpers.ImeAppHelper; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; - -/** - * Test split screen resizing window transitions. - * To run this test: {@code atest FlickerTests:ResizeSplitScreenTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest(bugId = 140854698) -@Ignore("Waiting bug feedback") -public class ResizeSplitScreenTest extends NonRotationTestBase { - - private static String sSimpleActivity = "SimpleActivity"; - private static String sImeActivity = "ImeActivity"; - - public ResizeSplitScreenTest(String beginRotationName, int beginRotation) { - super(beginRotationName, beginRotation); - - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - } - - @Before - public void runTransition() { - ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation()); - run(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, mBeginRotation, - new Rational(1, 3), new Rational(2, 3)) - .includeJankyRuns().build()); - } - - @Test - public void checkVisibility_topAppLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(sSimpleActivity) - .forAllEntries()); - } - - @Test - public void checkVisibility_bottomAppLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(sImeActivity) - .forAllEntries()); - } - - @Test - public void checkVisibility_dividerLayerIsAlwaysVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } - - @Test - public void checkPosition_appsStartingBounds() { - Rect displayBounds = getDisplayBounds(); - checkResults(result -> { - LayersTrace entries = LayersTrace.parseFrom(result.getLayersTrace(), - result.getLayersTracePath(), result.getLayersTraceChecksum()); - - assertThat(entries.getEntries()).isNotEmpty(); - Rect startingDividerBounds = entries.getEntries().get(0).getVisibleBounds - (DOCKED_STACK_DIVIDER); - - Rect startingTopAppBounds = new Rect(0, 0, startingDividerBounds.right, - startingDividerBounds.top + getDockedStackDividerInset()); - - Rect startingBottomAppBounds = new Rect(0, - startingDividerBounds.bottom - getDockedStackDividerInset(), - displayBounds.right, - displayBounds.bottom - getNavigationBarHeight()); - - LayersTraceSubject.assertThat(result) - .hasVisibleRegion("SimpleActivity", startingTopAppBounds) - .inTheBeginning(); - - LayersTraceSubject.assertThat(result) - .hasVisibleRegion("ImeActivity", startingBottomAppBounds) - .inTheBeginning(); - }); - } - - @Test - public void checkPosition_appsEndingBounds() { - Rect displayBounds = getDisplayBounds(); - checkResults(result -> { - LayersTrace entries = LayersTrace.parseFrom(result.getLayersTrace(), - result.getLayersTracePath(), result.getLayersTraceChecksum()); - - assertThat(entries.getEntries()).isNotEmpty(); - Rect endingDividerBounds = entries.getEntries().get( - entries.getEntries().size() - 1).getVisibleBounds( - DOCKED_STACK_DIVIDER); - - Rect startingTopAppBounds = new Rect(0, 0, endingDividerBounds.right, - endingDividerBounds.top + getDockedStackDividerInset()); - - Rect startingBottomAppBounds = new Rect(0, - endingDividerBounds.bottom - getDockedStackDividerInset(), - displayBounds.right, - displayBounds.bottom - getNavigationBarHeight()); - - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(sSimpleActivity, startingTopAppBounds) - .atTheEnd(); - - LayersTraceSubject.assertThat(result) - .hasVisibleRegion(sImeActivity, startingBottomAppBounds) - .atTheEnd(); - }); - } - - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE) - .forAllEntries()); - } - - @Test - public void checkVisibility_statusBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE) - .forAllEntries()); - } - - @Test - public void checkVisibility_topAppWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindow(sSimpleActivity) - .forAllEntries()); - } - - @Test - public void checkVisibility_bottomAppWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAppWindow(sImeActivity) - .forAllEntries()); - } - - @Test - public void checkVisibility_dividerWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/RotationTestBase.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/RotationTestBase.kt new file mode 100644 index 000000000000..3b6772779029 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/RotationTestBase.kt @@ -0,0 +1,49 @@ +/* + * 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.server.wm.flicker + +import android.view.Surface +import org.junit.runners.Parameterized + +abstract class RotationTestBase( + beginRotationName: String, + endRotationName: String, + protected val beginRotation: Int, + protected val endRotation: Int +) : FlickerTestBase() { + companion object { + @Parameterized.Parameters(name = "{0}-{1}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90) + val params: MutableCollection<Array<Any>> = mutableListOf() + for (begin in supportedRotations) { + for (end in supportedRotations) { + if (begin != end) { + params.add(arrayOf( + Surface.rotationToString(begin), + Surface.rotationToString(end), + begin, + end + )) + } + } + } + return params + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java deleted file mode 100644 index 37d7c4ca2b46..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SeamlessAppRotationTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static android.view.Surface.rotationToString; - -import static com.android.server.wm.flicker.CommonTransitions.changeAppRotation; -import static com.android.server.wm.flicker.WindowUtils.getAppPosition; -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; -import static com.android.server.wm.flicker.WindowUtils.getNavigationBarPosition; -import static com.android.server.wm.flicker.testapp.ActivityOptions.EXTRA_STARVE_UI_THREAD; -import static com.android.server.wm.flicker.testapp.ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME; - -import android.content.Intent; -import android.graphics.Rect; -import android.view.Surface; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * Cycle through supported app rotations using seamless rotations. - * To run this test: {@code atest FlickerTests:SeamlessAppRotationTest} - */ -@LargeTest -@RunWith(Parameterized.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest(bugId = 147659548) -@Ignore("Waiting bug feedback") -public class SeamlessAppRotationTest extends FlickerTestBase { - private int mBeginRotation; - private int mEndRotation; - private Intent mIntent; - - public SeamlessAppRotationTest(String testId, Intent intent, int beginRotation, - int endRotation) { - this.mIntent = intent; - this.mBeginRotation = beginRotation; - this.mEndRotation = endRotation; - } - - @Parameters(name = "{0}") - public static Collection<Object[]> getParams() { - int[] supportedRotations = - {Surface.ROTATION_0, Surface.ROTATION_90}; - Collection<Object[]> params = new ArrayList<>(); - - ArrayList<Intent> testIntents = new ArrayList<>(); - - // launch test activity that supports seamless rotation - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.setComponent(SEAMLESS_ACTIVITY_COMPONENT_NAME); - testIntents.add(intent); - - // launch test activity that supports seamless rotation with a busy UI thread to miss frames - // when the app is asked to redraw - intent = new Intent(intent); - intent.putExtra(EXTRA_STARVE_UI_THREAD, true); - testIntents.add(intent); - - for (Intent testIntent : testIntents) { - for (int begin : supportedRotations) { - for (int end : supportedRotations) { - if (begin != end) { - String testId = rotationToString(begin) + "_" + rotationToString(end); - if (testIntent.getExtras() != null && - testIntent.getExtras().getBoolean(EXTRA_STARVE_UI_THREAD)) { - testId += "_" + "BUSY_UI_THREAD"; - } - params.add(new Object[]{testId, testIntent, begin, end}); - } - } - } - } - return params; - } - - @Before - public void runTransition() { - String intentId = ""; - if (mIntent.getExtras() != null && - mIntent.getExtras().getBoolean(EXTRA_STARVE_UI_THREAD)) { - intentId = "BUSY_UI_THREAD"; - } - - super.runTransition( - changeAppRotation(mIntent, intentId, InstrumentationRegistry.getContext(), - mUiDevice, mBeginRotation, mEndRotation).build()); - } - - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkPosition_navBarLayerRotatesAndScales() { - Rect startingPos = getNavigationBarPosition(mBeginRotation); - Rect endingPos = getNavigationBarPosition(mEndRotation); - if (startingPos.equals(endingPos)) { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos) - .forAllEntries()); - } else { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, startingPos) - .inTheBeginning()); - checkResults(result -> LayersTraceSubject.assertThat(result) - .hasVisibleRegion(NAVIGATION_BAR_WINDOW_TITLE, endingPos) - .atTheEnd()); - } - } - - @Test - public void checkPosition_appLayerRotates() { - Rect startingPos = getAppPosition(mBeginRotation); - Rect endingPos = getAppPosition(mEndRotation); - if (startingPos.equals(endingPos)) { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hasVisibleRegion(mIntent.getComponent().getPackageName(), startingPos) - .forAllEntries()); - } else { - checkResults(result -> LayersTraceSubject.assertThat(result) - .hasVisibleRegion(mIntent.getComponent().getPackageName(), startingPos) - .then() - .hasVisibleRegion(mIntent.getComponent().getPackageName(), endingPos) - .forAllEntries()); - } - } - - @Test - public void checkCoveredRegion_noUncoveredRegions() { - Rect startingBounds = getDisplayBounds(mBeginRotation); - Rect endingBounds = getDisplayBounds(mEndRotation); - if (startingBounds.equals(endingBounds)) { - checkResults(result -> - LayersTraceSubject.assertThat(result) - .coversRegion(startingBounds) - .forAllEntries()); - } else { - checkResults(result -> - LayersTraceSubject.assertThat(result) - .coversRegion(startingBounds) - .then() - .coversRegion(endingBounds) - .forAllEntries()); - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java b/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java deleted file mode 100644 index 85a14941a7fd..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/SplitScreenToLauncherTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2018 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.server.wm.flicker; - -import static com.android.server.wm.flicker.CommonTransitions.splitScreenToLauncher; -import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds; - -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.FlakyTest; -import androidx.test.filters.LargeTest; -import androidx.test.runner.AndroidJUnit4; - -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; - -/** - * Test open app to split screen. - * To run this test: {@code atest FlickerTests:SplitScreenToLauncherTest} - */ -@LargeTest -@RunWith(AndroidJUnit4.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -@FlakyTest(bugId = 140856143) -@Ignore("Waiting bug feedback") -public class SplitScreenToLauncherTest extends FlickerTestBase { - - public SplitScreenToLauncherTest() { - this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(), - "com.android.server.wm.flicker.testapp", "SimpleApp"); - } - - @Before - public void runTransition() { - super.runTransition(splitScreenToLauncher(mTestApp, mUiDevice).includeJankyRuns().build()); - } - - @Test - public void checkCoveredRegion_noUncoveredRegions() { - checkResults(result -> - LayersTraceSubject.assertThat(result) - .coversRegion(getDisplayBounds()).forAllEntries()); - } - - @Test - public void checkVisibility_dividerLayerBecomesInVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(DOCKED_STACK_DIVIDER) - .then() - .hidesLayer(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } - - @Test - public void checkVisibility_appLayerBecomesInVisible() { - checkResults(result -> LayersTraceSubject.assertThat(result) - .showsLayer(mTestApp.getPackage()) - .then() - .hidesLayer(mTestApp.getPackage()) - .forAllEntries()); - } - - @Test - public void checkVisibility_navBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_statusBarWindowIsAlwaysVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries()); - } - - @Test - public void checkVisibility_dividerWindowBecomesInVisible() { - checkResults(result -> WmTraceSubject.assertThat(result) - .showsAboveAppWindow(DOCKED_STACK_DIVIDER) - .then() - .hidesAboveAppWindow(DOCKED_STACK_DIVIDER) - .forAllEntries()); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java deleted file mode 100644 index 42977f549162..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/FlickerAppHelper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker.helpers; - -import android.app.Instrumentation; - -import com.android.server.wm.flicker.StandardAppHelper; - -public abstract class FlickerAppHelper extends StandardAppHelper { - - static int sFindTimeout = 10000; - static String sFlickerPackage = "com.android.server.wm.flicker.testapp"; - - public FlickerAppHelper(Instrumentation instr, String launcherName) { - super(instr, sFlickerPackage, launcherName); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java deleted file mode 100644 index 56e1118590ea..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker.helpers; - -import android.app.Instrumentation; -import android.support.test.uiautomator.UiDevice; - -public class ImeAppAutoFocusHelper extends ImeAppHelper { - - public ImeAppAutoFocusHelper(Instrumentation instr) { - super(instr, "ImeAppAutoFocus"); - } - - public void clickEditTextWidget(UiDevice device) { - // do nothing (the app is focused automatically) - } -} diff --git a/tests/AutoVerify/app2/src/com/android/test/autoverify/MainActivity.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt index 09ef47212622..d587f1e383c5 100644 --- a/tests/AutoVerify/app2/src/com/android/test/autoverify/MainActivity.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppAutoFocusHelper.kt @@ -13,3 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +package com.android.server.wm.flicker.helpers + +import android.app.Instrumentation +import androidx.test.uiautomator.UiDevice + +class ImeAppAutoFocusHelper(instr: Instrumentation) : ImeAppHelper(instr, "ImeAppAutoFocus") { + override fun openIME(device: UiDevice) { + // do nothing (the app is focused automatically) + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java deleted file mode 100644 index 098fd6d4250b..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker.helpers; - -import static android.os.SystemClock.sleep; - -import android.app.Instrumentation; -import android.support.test.uiautomator.By; -import android.support.test.uiautomator.UiDevice; -import android.support.test.uiautomator.UiObject2; - -public class ImeAppHelper extends FlickerAppHelper { - - ImeAppHelper(Instrumentation instr, String launcherName) { - super(instr, launcherName); - } - - public ImeAppHelper(Instrumentation instr) { - this(instr, "ImeApp"); - } - - public void clickEditTextWidget(UiDevice device) { - UiObject2 editText = device.findObject(By.res(getPackage(), "plain_text_input")); - editText.click(); - sleep(500); - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt new file mode 100644 index 000000000000..f4de36e99952 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/ImeAppHelper.kt @@ -0,0 +1,51 @@ +/* + * 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.server.wm.flicker.helpers + +import android.app.Instrumentation +import android.support.test.launcherhelper.ILauncherStrategy +import android.support.test.launcherhelper.LauncherStrategyFactory +import androidx.test.uiautomator.By +import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.Until +import org.junit.Assert + +open class ImeAppHelper( + instr: Instrumentation, + launcherName: String = "ImeApp", + launcherStrategy: ILauncherStrategy = LauncherStrategyFactory + .getInstance(instr) + .launcherStrategy +) : StandardAppHelper(instr, launcherName, launcherStrategy) { + open fun openIME(device: UiDevice) { + val editText = device.wait( + Until.findObject(By.res(getPackage(), "plain_text_input")), + FIND_TIMEOUT) + Assert.assertNotNull("Text field not found, this usually happens when the device " + + "was left in an unknown state (e.g. in split screen)", editText) + editText.click() + if (!device.waitForIME()) { + Assert.fail("IME did not appear") + } + } + + open fun closeIME(device: UiDevice) { + device.pressBack() + // Using only the AccessibilityInfo it is not possible to identify if the IME is active + device.waitForIdle(1000) + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java deleted file mode 100644 index d5f9a2062a17..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2019 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.server.wm.flicker.helpers; - -import static com.android.server.wm.flicker.helpers.AutomationUtils.getPipWindowSelector; - -import android.app.Instrumentation; -import android.support.test.uiautomator.By; -import android.support.test.uiautomator.UiDevice; -import android.support.test.uiautomator.UiObject2; -import android.support.test.uiautomator.Until; - -public class PipAppHelper extends FlickerAppHelper { - - public PipAppHelper(Instrumentation instr) { - super(instr, "PipApp"); - } - - public void clickEnterPipButton(UiDevice device) { - UiObject2 enterPipButton = device.findObject(By.res(getPackage(), "enter_pip")); - enterPipButton.click(); - UiObject2 pipWindow = device.wait(Until.findObject(getPipWindowSelector()), sFindTimeout); - - if (pipWindow == null) { - throw new RuntimeException("Unable to find PIP window"); - } - } - - public void closePipWindow(UiDevice device) { - AutomationUtils.closePipWindow(device); - } - -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt new file mode 100644 index 000000000000..0572a7813819 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt @@ -0,0 +1,43 @@ +/* + * 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.server.wm.flicker.helpers + +import android.app.Instrumentation +import android.support.test.launcherhelper.ILauncherStrategy +import android.support.test.launcherhelper.LauncherStrategyFactory +import androidx.test.uiautomator.By +import androidx.test.uiautomator.UiDevice +import org.junit.Assert + +class PipAppHelper( + instr: Instrumentation, + launcherStrategy: ILauncherStrategy = LauncherStrategyFactory + .getInstance(instr) + .launcherStrategy +) : StandardAppHelper(instr, "PipApp", launcherStrategy) { + fun clickEnterPipButton(device: UiDevice) { + val enterPipButton = device.findObject(By.res(getPackage(), "enter_pip")) + Assert.assertNotNull("Pip button not found, this usually happens when the device " + + "was left in an unknown state (e.g. in split screen)", enterPipButton) + enterPipButton.click() + device.hasPipWindow() + } + + fun closePipWindow(device: UiDevice) { + device.closePipWindow() + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt new file mode 100644 index 000000000000..404c7891bcad --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToAppTest.kt @@ -0,0 +1,94 @@ +/* + * 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.server.wm.flicker.ime + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test IME window closing back to app window transitions. + * To run this test: `atest FlickerTests:CloseImeWindowToAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class CloseImeAutoOpenWindowToAppTest( + rotationName: String, + rotation: Int +) : CloseImeWindowToAppTest(rotationName, rotation) { + override val testApp: ImeAppHelper + get() = ImeAppAutoFocusHelper(instrumentation) + + @Test + override fun test() { + flicker(instrumentation) { + withTag { buildTestTag("imeToAppAutoOpen", testApp, rotation) } + repeat { 1 } + setup { + eachRun { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + testApp.open() + testApp.openIME(device) + } + } + teardown { + eachRun { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + transitions { + device.pressBack() + device.waitForIdle() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + imeAppWindowIsAlwaysVisible(testApp, bugId = 141458352) + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + imeLayerBecomesInvisible(bugId = 141458352) + imeAppLayerIsAlwaysVisible(testApp, bugId = 141458352) + } + } + } + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt new file mode 100644 index 000000000000..b64811b2767d --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeAutoOpenWindowToHomeTest.kt @@ -0,0 +1,95 @@ +/* + * 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.server.wm.flicker.ime + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test IME window closing back to app window transitions. + * To run this test: `atest FlickerTests:CloseImeWindowToAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class CloseImeAutoOpenWindowToHomeTest( + rotationName: String, + rotation: Int +) : CloseImeWindowToHomeTest(rotationName, rotation) { + override val testApp: ImeAppHelper + get() = ImeAppAutoFocusHelper(instrumentation) + + @Test + override fun test() { + flicker(instrumentation) { + withTag { buildTestTag("imeToHomeAutoOpen", testApp, rotation) } + repeat { 1 } + setup { + eachRun { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + testApp.open() + testApp.openIME(device) + } + } + teardown { + eachRun { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + transitions { + device.pressHome() + device.waitForIdle() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + imeWindowBecomesInvisible(bugId = 141458352) + imeAppWindowBecomesInvisible(testApp, bugId = 157449248) + } + + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible(bugId = 140855415) + noUncoveredRegions(rotation, Surface.ROTATION_0, allStates = false) + navBarLayerRotatesAndScales(rotation, Surface.ROTATION_0, bugId = 140855415) + statusBarLayerRotatesScales(rotation, Surface.ROTATION_0) + imeLayerBecomesInvisible(bugId = 141458352) + imeAppLayerBecomesInvisible(testApp, bugId = 153739621) + } + } + } + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt new file mode 100644 index 000000000000..0940c192517e --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToAppTest.kt @@ -0,0 +1,93 @@ +/* + * 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.server.wm.flicker.ime + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test IME window closing back to app window transitions. + * To run this test: `atest FlickerTests:CloseImeWindowToAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +open class CloseImeWindowToAppTest( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + open val testApp = ImeAppHelper(instrumentation) + + @Test + open fun test() { + flicker(instrumentation) { + withTag { buildTestTag("imeToApp", testApp, rotation) } + repeat { 1 } + setup { + eachRun { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + testApp.open() + testApp.openIME(device) + } + } + teardown { + eachRun { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + transitions { + device.pressBack() + device.waitForIdle() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + imeAppWindowIsAlwaysVisible(testApp) + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + imeLayerBecomesInvisible(enabled = false) + imeAppLayerIsAlwaysVisible(testApp) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt new file mode 100644 index 000000000000..c2e87dbbf24b --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/CloseImeWindowToHomeTest.kt @@ -0,0 +1,103 @@ +/* + * 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.server.wm.flicker.ime + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.openQuickstep +import com.android.server.wm.flicker.helpers.reopenAppFromOverview +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized +/** + * Test IME window closing to home transitions. + * To run this test: `atest FlickerTests:CloseImeWindowToHomeTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +open class CloseImeWindowToHomeTest( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + open val testApp = ImeAppHelper(instrumentation) + + @Test + open fun test() { + flicker(instrumentation) { + withTag { buildTestTag("imeToHome", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + testApp.open() + } + eachRun { + device.openQuickstep() + device.reopenAppFromOverview() + this.setRotation(rotation) + testApp.openIME(device) + } + } + transitions { + device.pressHome() + device.waitForIdle() + } + teardown { + eachRun { + device.pressHome() + } + test { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + imeWindowBecomesInvisible() + imeAppWindowBecomesInvisible(testApp) + } + + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible(bugId = 140855415) + noUncoveredRegions(rotation, Surface.ROTATION_0, allStates = false) + navBarLayerRotatesAndScales(rotation, Surface.ROTATION_0, bugId = 140855415) + statusBarLayerRotatesScales(rotation, Surface.ROTATION_0) + imeLayerBecomesInvisible(bugId = 153739621) + imeAppLayerBecomesInvisible(testApp, bugId = 153739621) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ImeAssertions.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ImeAssertions.kt new file mode 100644 index 000000000000..b2be54fe068a --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/ImeAssertions.kt @@ -0,0 +1,102 @@ +/* + * 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.server.wm.flicker.ime + +import android.platform.helpers.IAppHelper +import com.android.server.wm.flicker.dsl.LayersAssertion +import com.android.server.wm.flicker.dsl.WmAssertion + +const val IME_WINDOW_TITLE = "InputMethod" + +@JvmOverloads +fun LayersAssertion.imeLayerBecomesVisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeLayerBecomesVisible", enabled, bugId) { + this.hidesLayer(IME_WINDOW_TITLE) + .then() + .showsLayer(IME_WINDOW_TITLE) + } +} + +fun LayersAssertion.imeLayerBecomesInvisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeLayerBecomesInvisible", enabled, bugId) { + this.showsLayer(IME_WINDOW_TITLE) + .then() + .hidesLayer(IME_WINDOW_TITLE) + } +} + +fun LayersAssertion.imeAppLayerIsAlwaysVisible( + testApp: IAppHelper, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeAppLayerIsAlwaysVisible", enabled, bugId) { + this.showsLayer(testApp.getPackage()) + } +} + +fun WmAssertion.imeAppWindowIsAlwaysVisible( + testApp: IAppHelper, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeAppWindowIsAlwaysVisible", enabled, bugId) { + this.showsAppWindowOnTop(testApp.getPackage()) + } +} + +fun WmAssertion.imeWindowBecomesInvisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeWindowBecomesInvisible", enabled, bugId) { + this.showsNonAppWindow(IME_WINDOW_TITLE) + .then() + .hidesNonAppWindow(IME_WINDOW_TITLE) + } +} + +fun WmAssertion.imeAppWindowBecomesInvisible( + testApp: IAppHelper, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeAppWindowBecomesInvisible", enabled, bugId) { + this.showsAppWindowOnTop(testApp.getPackage()) + .then() + .appWindowNotOnTop(testApp.getPackage()) + } +} + +fun LayersAssertion.imeAppLayerBecomesInvisible( + testApp: IAppHelper, + bugId: Int = 0, + enabled: Boolean = bugId == 0 +) { + all("imeAppLayerBecomesInvisible", enabled, bugId) { + this.skipUntilFirstAssertion() + .showsLayer(testApp.getPackage()) + .then() + .hidesLayer(testApp.getPackage()) + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt new file mode 100644 index 000000000000..11ccb69c46cf --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/ime/OpenImeWindowTest.kt @@ -0,0 +1,104 @@ +/* + * 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.server.wm.flicker.ime + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test IME window opening transitions. + * To run this test: `atest FlickerTests:OpenImeWindowTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenImeWindowTest( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + @Test + fun test() { + val testApp = ImeAppHelper(instrumentation) + + flicker(instrumentation) { + withTag { buildTestTag("openIme", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + testApp.open() + } + } + transitions { + testApp.openIME(device) + } + teardown { + eachRun { + testApp.closeIME(device) + } + test { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + + all("imeWindowBecomesVisible") { + this.skipUntilFirstAssertion() + .hidesNonAppWindow(IME_WINDOW_TITLE) + .then() + .showsNonAppWindow(IME_WINDOW_TITLE) + } + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + + imeLayerBecomesVisible() + } + } + } + } + + companion object { + private const val IME_WINDOW_TITLE = "InputMethod" + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt new file mode 100644 index 000000000000..17590723da8d --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppColdTest.kt @@ -0,0 +1,94 @@ +/* + * 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.server.wm.flicker.launch + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusChanges +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test cold launch app from launcher. + * To run this test: `atest FlickerTests:OpenAppColdTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenAppColdTest( + rotationName: String, + rotation: Int +) : OpenAppTestBase(rotationName, rotation) { + @Test + fun test() { + flicker(instrumentation) { + withTag { buildTestTag("openAppCold", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + this.setRotation(rotation) + } + } + transitions { + testApp.open() + } + teardown { + eachRun { + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + appWindowReplacesLauncherAsTopWindow() + wallpaperWindowBecomesInvisible() + } + + layersTrace { + // During testing the launcher is always in portrait mode + noUncoveredRegions(Surface.ROTATION_0, rotation, bugId = 141361128) + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation) + navBarLayerIsAlwaysVisible(enabled = rotation == Surface.ROTATION_0) + statusBarLayerIsAlwaysVisible(enabled = false) + wallpaperLayerBecomesInvisible() + } + + eventLog { + focusChanges("NexusLauncherActivity", testApp.`package`) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTestBase.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTestBase.kt new file mode 100644 index 000000000000..98e05d526bed --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppTestBase.kt @@ -0,0 +1,63 @@ +/* + * 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.server.wm.flicker.launch + +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.LayersAssertion +import com.android.server.wm.flicker.dsl.WmAssertion + +abstract class OpenAppTestBase( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + protected val testApp = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + + protected fun WmAssertion.wallpaperWindowBecomesInvisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 + ) { + all("wallpaperWindowBecomesInvisible", enabled, bugId) { + this.showsBelowAppWindow("Wallpaper") + .then() + .hidesBelowAppWindow("Wallpaper") + } + } + + protected fun WmAssertion.appWindowReplacesLauncherAsTopWindow( + bugId: Int = 0, + enabled: Boolean = bugId == 0 + ) { + all("appWindowReplacesLauncherAsTopWindow", enabled, bugId) { + this.showsAppWindowOnTop("Launcher") + .then() + .showsAppWindowOnTop("Snapshot", testApp.getPackage()) + } + } + + protected fun LayersAssertion.wallpaperLayerBecomesInvisible( + bugId: Int = 0, + enabled: Boolean = bugId == 0 + ) { + all("appWindowReplacesLauncherAsTopWindow", enabled, bugId) { + this.showsLayer("Wallpaper") + .then() + .replaceVisibleLayer("Wallpaper", testApp.getPackage()) + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt new file mode 100644 index 000000000000..acd141a8d74f --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppWarmTest.kt @@ -0,0 +1,102 @@ +/* + * 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.server.wm.flicker.launch + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusChanges +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test warm launch app. + * To run this test: `atest FlickerTests:OpenAppWarmTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenAppWarmTest( + rotationName: String, + rotation: Int +) : OpenAppTestBase(rotationName, rotation) { + @Test + fun test() { + val testApp = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + + flicker(instrumentation) { + withTag { buildTestTag("openAppWarm", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + testApp.open() + } + eachRun { + device.pressHome() + this.setRotation(rotation) + } + } + transitions { + testApp.open() + } + teardown { + eachRun { + this.setRotation(Surface.ROTATION_0) + } + test { + testApp.exit() + } + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + appWindowReplacesLauncherAsTopWindow() + wallpaperWindowBecomesInvisible(enabled = false) + } + + layersTrace { + // During testing the launcher is always in portrait mode + noUncoveredRegions(Surface.ROTATION_0, rotation, bugId = 141361128) + navBarLayerRotatesAndScales(Surface.ROTATION_0, rotation) + statusBarLayerRotatesScales(Surface.ROTATION_0, rotation) + navBarLayerIsAlwaysVisible(enabled = rotation == Surface.ROTATION_0) + statusBarLayerIsAlwaysVisible(enabled = false) + wallpaperLayerBecomesInvisible() + } + + eventLog { + focusChanges("NexusLauncherActivity", testApp.`package`) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt new file mode 100644 index 000000000000..9cfc03304fe7 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/EnterPipTest.kt @@ -0,0 +1,121 @@ +/* + * 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.server.wm.flicker.pip + +import android.view.Surface +import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.helpers.closePipWindow +import com.android.server.wm.flicker.helpers.expandPipWindow +import com.android.server.wm.flicker.helpers.hasPipWindow +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test Pip launch. + * To run this test: `atest FlickerTests:PipToAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 152738416) +class EnterPipTest( + rotationName: String, + rotation: Int +) : PipTestBase(rotationName, rotation) { + @Test + fun test() { + flicker(instrumentation) { + withTag { buildTestTag("enterPip", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + device.pressHome() + testApp.open() + this.setRotation(rotation) + } + } + teardown { + eachRun { + if (device.hasPipWindow()) { + device.closePipWindow() + } + testApp.exit() + this.setRotation(Surface.ROTATION_0) + } + test { + if (device.hasPipWindow()) { + device.closePipWindow() + } + } + } + transitions { + testApp.clickEnterPipButton(device) + device.expandPipWindow() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + all("pipWindowBecomesVisible") { + this.showsAppWindow(testApp.`package`) + .then() + .showsAppWindow(sPipWindowTitle) + } + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation, Surface.ROTATION_0, allStates = false) + navBarLayerRotatesAndScales(rotation, Surface.ROTATION_0) + statusBarLayerRotatesScales(rotation, Surface.ROTATION_0) + + all("pipLayerBecomesVisible") { + this.showsLayer(testApp.launcherName) + .then() + .showsLayer(sPipWindowTitle) + } + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +}
\ No newline at end of file diff --git a/tests/AutoVerify/app1/src/com/android/test/autoverify/MainActivity.java b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipTestBase.kt index 09ef47212622..691db7fbac5c 100644 --- a/tests/AutoVerify/app1/src/com/android/test/autoverify/MainActivity.java +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipTestBase.kt @@ -13,3 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +package com.android.server.wm.flicker.pip + +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.helpers.PipAppHelper + +abstract class PipTestBase( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + protected val testApp = PipAppHelper(instrumentation) + + companion object { + const val sPipWindowTitle = "PipMenuActivity" + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToAppTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToAppTest.kt new file mode 100644 index 000000000000..deccc908961d --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToAppTest.kt @@ -0,0 +1,119 @@ +/* + * 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.server.wm.flicker.pip + +import android.view.Surface +import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusChanges +import com.android.server.wm.flicker.helpers.closePipWindow +import com.android.server.wm.flicker.helpers.expandPipWindow +import com.android.server.wm.flicker.helpers.hasPipWindow +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test Pip launch. + * To run this test: `atest FlickerTests:PipToAppTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 152738416) +class PipToAppTest( + rotationName: String, + rotation: Int +) : PipTestBase(rotationName, rotation) { + @Test + fun test() { + flicker(instrumentation) { + withTag { buildTestTag("exitPipModeToApp", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + device.pressHome() + testApp.open() + } + eachRun { + this.setRotation(rotation) + testApp.clickEnterPipButton(device) + device.hasPipWindow() + } + } + teardown { + eachRun { + this.setRotation(Surface.ROTATION_0) + } + test { + if (device.hasPipWindow()) { + device.closePipWindow() + } + testApp.exit() + } + } + transitions { + device.expandPipWindow() + device.waitForIdle() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + + all("appReplacesPipWindow") { + this.showsAppWindow(sPipWindowTitle) + .then() + .showsAppWindowOnTop(testApp.launcherName) + } + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + + all("appReplacesPipLayer") { + this.showsLayer(sPipWindowTitle) + .then() + .showsLayer(testApp.launcherName) + } + } + + eventLog { + focusChanges( + "NexusLauncherActivity", testApp.launcherName, "NexusLauncherActivity", + bugId = 151179149) + } + } + } + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToHomeTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToHomeTest.kt new file mode 100644 index 000000000000..f40869c88d63 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/pip/PipToHomeTest.kt @@ -0,0 +1,128 @@ +/* + * 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.server.wm.flicker.pip + +import android.view.Surface +import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusChanges +import com.android.server.wm.flicker.helpers.closePipWindow +import com.android.server.wm.flicker.helpers.hasPipWindow +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test Pip launch. + * To run this test: `atest FlickerTests:PipToHomeTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 152738416) +class PipToHomeTest( + rotationName: String, + rotation: Int +) : PipTestBase(rotationName, rotation) { + @Test + fun test() { + flicker(instrumentation) { + withTag { buildTestTag("exitPipModeToApp", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + device.pressHome() + } + eachRun { + testApp.open() + this.setRotation(rotation) + testApp.clickEnterPipButton(device) + device.hasPipWindow() + } + } + teardown { + eachRun { + this.setRotation(Surface.ROTATION_0) + if (device.hasPipWindow()) { + device.closePipWindow() + } + } + test { + if (device.hasPipWindow()) { + device.closePipWindow() + } + testApp.exit() + } + } + transitions { + testApp.closePipWindow(device) + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + + all("pipWindowBecomesInvisible") { + this.showsAppWindow(sPipWindowTitle) + .then() + .hidesAppWindow(sPipWindowTitle) + } + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + // The final state is the launcher, so always in portrait mode + noUncoveredRegions(rotation, Surface.ROTATION_0, allStates = false) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + + all("pipLayerBecomesInvisible") { + this.showsLayer(sPipWindowTitle) + .then() + .hidesLayer(sPipWindowTitle) + } + } + + eventLog { + focusChanges(testApp.launcherName, "NexusLauncherActivity", bugId = 151179149) + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt new file mode 100644 index 000000000000..99218c2c586d --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/ChangeAppRotationTest.kt @@ -0,0 +1,125 @@ +/* + * 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.server.wm.flicker.rotation + +import androidx.test.filters.RequiresDevice +import android.view.Surface +import com.android.server.wm.flicker.NonRotationTestBase.Companion.SCREENSHOT_LAYER +import com.android.server.wm.flicker.RotationTestBase +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusDoesNotChange +import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Cycle through supported app rotations. + * To run this test: `atest FlickerTest:ChangeAppRotationTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class ChangeAppRotationTest( + beginRotationName: String, + endRotationName: String, + beginRotation: Int, + endRotation: Int +) : RotationTestBase(beginRotationName, endRotationName, beginRotation, endRotation) { + @Test + fun test() { + val testApp = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + + flicker(instrumentation) { + withTag { + buildTestTag("changeAppRotation", testApp, beginRotation, endRotation) + } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + testApp.open() + } + eachRun { + this.setRotation(beginRotation) + } + } + teardown { + eachRun { + this.setRotation(Surface.ROTATION_0) + } + test { + testApp.exit() + } + } + transitions { + this.setRotation(endRotation) + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + } + + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible(bugId = 140855415) + noUncoveredRegions(beginRotation, endRotation, allStates = false) + navBarLayerRotatesAndScales(beginRotation, endRotation) + statusBarLayerRotatesScales(beginRotation, endRotation) + } + + layersTrace { + val startingPos = WindowUtils.getDisplayBounds(beginRotation) + val endingPos = WindowUtils.getDisplayBounds(endRotation) + + start("appLayerRotates_StartingPos") { + this.hasVisibleRegion(testApp.getPackage(), startingPos) + } + + end("appLayerRotates_EndingPos") { + this.hasVisibleRegion(testApp.getPackage(), endingPos) + } + + all("screenshotLayerBecomesInvisible") { + this.showsLayer(testApp.getPackage()) + .then() + .showsLayer(SCREENSHOT_LAYER) + .then() + showsLayer(testApp.getPackage()) + } + } + + eventLog { + focusDoesNotChange(bugId = 151179149) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt new file mode 100644 index 000000000000..33a823d6cfc9 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/rotation/SeamlessAppRotationTest.kt @@ -0,0 +1,196 @@ +/* + * 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.server.wm.flicker.rotation + +import android.content.Intent +import android.content.Intent.FLAG_ACTIVITY_NEW_TASK +import android.view.Surface +import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice +import androidx.test.uiautomator.By +import androidx.test.uiautomator.Until +import com.android.server.wm.flicker.RotationTestBase +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusDoesNotChange +import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.flicker.helpers.stopPackage +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.testapp.ActivityOptions +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Cycle through supported app rotations using seamless rotations. + * To run this test: `atest FlickerTests:SeamlessAppRotationTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 147659548) +class SeamlessAppRotationTest( + testId: String, + private val intent: Intent, + beginRotationName: String, + endRotationName: String, + beginRotation: Int, + endRotation: Int +) : RotationTestBase(beginRotationName, endRotationName, beginRotation, endRotation) { + @Test + fun test() { + var intentId = "" + if (intent.extras?.getBoolean(ActivityOptions.EXTRA_STARVE_UI_THREAD) == true) { + intentId = "BUSY_UI_THREAD" + } + + flicker(instrumentation) { + withTag { + "changeAppRotation_" + intentId + "_" + + Surface.rotationToString(beginRotation) + "_" + + Surface.rotationToString(endRotation) + } + repeat { 1 } + setup { + eachRun { + device.wakeUpAndGoToHomeScreen() + instrumentation.targetContext.startActivity(intent) + device.wait(Until.hasObject(By.pkg(intent.component?.packageName) + .depth(0)), APP_LAUNCH_TIMEOUT) + this.setRotation(beginRotation) + } + } + teardown { + eachRun { + stopPackage( + instrumentation.targetContext, + intent.component?.packageName + ?: error("Unable to determine package name for intent")) + this.setRotation(Surface.ROTATION_0) + } + } + transitions { + this.setRotation(endRotation) + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible(bugId = 140855415) + statusBarWindowIsAlwaysVisible(bugId = 140855415) + } + + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible(bugId = 140855415) + noUncoveredRegions(beginRotation, endRotation, allStates = true) + navBarLayerRotatesAndScales(beginRotation, endRotation) + statusBarLayerRotatesScales(beginRotation, endRotation, enabled = false) + } + + layersTrace { + all("appLayerRotates"/*, bugId = 147659548*/) { + val startingPos = WindowUtils.getDisplayBounds(beginRotation) + val endingPos = WindowUtils.getDisplayBounds(endRotation) + + if (startingPos == endingPos) { + this.hasVisibleRegion( + intent.component?.packageName ?: "", + startingPos) + } else { + this.hasVisibleRegion(intent.component?.packageName ?: "", startingPos) + .then() + .hasVisibleRegion(intent.component?.packageName + ?: "", endingPos) + } + } + + all("noUncoveredRegions"/*, bugId = 147659548*/) { + val startingBounds = WindowUtils.getDisplayBounds(beginRotation) + val endingBounds = WindowUtils.getDisplayBounds(endRotation) + if (startingBounds == endingBounds) { + this.coversAtLeastRegion(startingBounds) + } else { + this.coversAtLeastRegion(startingBounds) + .then() + .coversAtLeastRegion(endingBounds) + } + } + } + + eventLog { + focusDoesNotChange(bugId = 151179149) + } + } + } + } + + companion object { + private const val APP_LAUNCH_TIMEOUT: Long = 10000 + + // launch test activity that supports seamless rotation with a busy UI thread to miss frames + // when the app is asked to redraw + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0, Surface.ROTATION_90) + val params = mutableListOf<Array<Any>>() + val testIntents = mutableListOf<Intent>() + + // launch test activity that supports seamless rotation + var intent = Intent(Intent.ACTION_MAIN) + intent.component = ActivityOptions.SEAMLESS_ACTIVITY_COMPONENT_NAME + intent.flags = FLAG_ACTIVITY_NEW_TASK + testIntents.add(intent) + + // launch test activity that supports seamless rotation with a busy UI thread to miss frames + // when the app is asked to redraw + intent = Intent(intent) + intent.putExtra(ActivityOptions.EXTRA_STARVE_UI_THREAD, true) + intent.flags = FLAG_ACTIVITY_NEW_TASK + testIntents.add(intent) + for (testIntent in testIntents) { + for (begin in supportedRotations) { + for (end in supportedRotations) { + if (begin != end) { + var testId: String = Surface.rotationToString(begin) + + "_" + Surface.rotationToString(end) + if (testIntent.extras?.getBoolean( + ActivityOptions.EXTRA_STARVE_UI_THREAD) == true) { + testId += "_" + "BUSY_UI_THREAD" + } + params.add(arrayOf( + testId, + testIntent, + Surface.rotationToString(begin), + Surface.rotationToString(end), + begin, + end)) + } + } + } + } + return params + } + } +}
\ No newline at end of file diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/OpenAppToSplitScreenTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/OpenAppToSplitScreenTest.kt new file mode 100644 index 000000000000..3b5e6694ef0f --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/OpenAppToSplitScreenTest.kt @@ -0,0 +1,120 @@ +/* + * 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.server.wm.flicker.splitscreen + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusChanges +import com.android.server.wm.flicker.helpers.exitSplitScreen +import com.android.server.wm.flicker.helpers.isInSplitScreen +import com.android.server.wm.flicker.helpers.launchSplitScreen +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test open app to split screen. + * To run this test: `atest FlickerTests:OpenAppToSplitScreenTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenAppToSplitScreenTest( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + @Test + fun test() { + val testApp = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + + flicker(instrumentation) { + withTag { buildTestTag("appToSplitScreen", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + testApp.open() + this.setRotation(rotation) + } + } + teardown { + eachRun { + if (device.isInSplitScreen()) { + device.exitSplitScreen() + } + } + test { + testApp.exit() + } + } + transitions { + device.launchSplitScreen() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + } + + layersTrace { + navBarLayerIsAlwaysVisible(bugId = 140855415) + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation, enabled = false) + navBarLayerRotatesAndScales(rotation, bugId = 140855415) + statusBarLayerRotatesScales(rotation) + + all("dividerLayerBecomesVisible") { + this.hidesLayer(DOCKED_STACK_DIVIDER) + .then() + .showsLayer(DOCKED_STACK_DIVIDER) + } + } + + eventLog { + focusChanges(testApp.`package`, + "recents_animation_input_consumer", "NexusLauncherActivity", + bugId = 151179149) + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + val supportedRotations = intArrayOf(Surface.ROTATION_0) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/ResizeSplitScreenTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/ResizeSplitScreenTest.kt new file mode 100644 index 000000000000..abf41a1fd408 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/ResizeSplitScreenTest.kt @@ -0,0 +1,190 @@ +/* + * 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.server.wm.flicker.splitscreen + +import android.graphics.Region +import android.util.Rational +import android.view.Surface +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.FlakyTest +import androidx.test.filters.RequiresDevice +import androidx.test.uiautomator.By +import com.android.server.wm.flicker.FlickerTestBase +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusDoesNotChange +import com.android.server.wm.flicker.helpers.ImeAppHelper +import com.android.server.wm.flicker.helpers.WindowUtils +import com.android.server.wm.flicker.helpers.exitSplitScreen +import com.android.server.wm.flicker.helpers.isInSplitScreen +import com.android.server.wm.flicker.helpers.launchSplitScreen +import com.android.server.wm.flicker.helpers.resizeSplitScreen +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters + +/** + * Test split screen resizing window transitions. + * To run this test: `atest FlickerTests:ResizeSplitScreenTest` + * + * Currently it runs only in 0 degrees because of b/156100803 + */ +@RequiresDevice +@RunWith(AndroidJUnit4::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FlakyTest(bugId = 159096424) +class ResizeSplitScreenTest : FlickerTestBase() { + @Test + fun test() { + val testAppTop = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + val testAppBottom = ImeAppHelper(instrumentation) + + flicker(instrumentation) { + withTag { + val description = (startRatio.toString().replace("/", "-") + "_to_" + + stopRatio.toString().replace("/", "-")) + buildTestTag("resizeSplitScreen", testAppTop, rotation, + rotation, testAppBottom, description) + } + repeat { 1 } + setup { + eachRun { + device.wakeUpAndGoToHomeScreen() + this.setRotation(rotation) + this.launcherStrategy.clearRecentAppsFromOverview() + testAppBottom.open() + device.pressHome() + testAppTop.open() + device.waitForIdle() + device.launchSplitScreen() + val snapshot = device.findObject(By.res(device.launcherPackageName, "snapshot")) + snapshot.click() + testAppBottom.openIME(device) + device.pressBack() + device.resizeSplitScreen(startRatio) + } + } + teardown { + eachRun { + device.exitSplitScreen() + device.pressHome() + testAppTop.exit() + testAppBottom.exit() + } + test { + if (device.isInSplitScreen()) { + device.exitSplitScreen() + } + } + } + transitions { + device.resizeSplitScreen(stopRatio) + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + + all("topAppWindowIsAlwaysVisible", bugId = 156223549) { + this.showsAppWindow(sSimpleActivity) + } + + all("bottomAppWindowIsAlwaysVisible", bugId = 156223549) { + this.showsAppWindow(sImeActivity) + } + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + + all("topAppLayerIsAlwaysVisible") { + this.showsLayer(sSimpleActivity) + } + + all("bottomAppLayerIsAlwaysVisible") { + this.showsLayer(sImeActivity) + } + + all("dividerLayerIsAlwaysVisible") { + this.showsLayer(DOCKED_STACK_DIVIDER) + } + + start("appsStartingBounds", enabled = false) { + val displayBounds = WindowUtils.displayBounds + val entry = this.trace.entries.firstOrNull() + ?: throw IllegalStateException("Trace is empty") + val dividerBounds = entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds + + val topAppBounds = Region(0, 0, dividerBounds.right, + dividerBounds.top + WindowUtils.dockedStackDividerInset) + val bottomAppBounds = Region(0, + dividerBounds.bottom - WindowUtils.dockedStackDividerInset, + displayBounds.right, + displayBounds.bottom - WindowUtils.navigationBarHeight) + this.hasVisibleRegion("SimpleActivity", topAppBounds) + .and() + .hasVisibleRegion("ImeActivity", bottomAppBounds) + } + + end("appsEndingBounds", enabled = false) { + val displayBounds = WindowUtils.displayBounds + val entry = this.trace.entries.lastOrNull() + ?: throw IllegalStateException("Trace is empty") + val dividerBounds = entry.getVisibleBounds(DOCKED_STACK_DIVIDER).bounds + + val topAppBounds = Region(0, 0, dividerBounds.right, + dividerBounds.top + WindowUtils.dockedStackDividerInset) + val bottomAppBounds = Region(0, + dividerBounds.bottom - WindowUtils.dockedStackDividerInset, + displayBounds.right, + displayBounds.bottom - WindowUtils.navigationBarHeight) + + this.hasVisibleRegion(sSimpleActivity, topAppBounds) + .and() + .hasVisibleRegion(sImeActivity, bottomAppBounds) + } + } + + eventLog { + focusDoesNotChange() + } + } + } + } + + companion object { + private const val sSimpleActivity = "SimpleActivity" + private const val sImeActivity = "ImeActivity" + private val rotation = Surface.ROTATION_0 + private val startRatio = Rational(1, 3) + private val stopRatio = Rational(2, 3) + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/SplitScreenToLauncherTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/SplitScreenToLauncherTest.kt new file mode 100644 index 000000000000..87c863338edb --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/splitscreen/SplitScreenToLauncherTest.kt @@ -0,0 +1,128 @@ +/* + * 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.server.wm.flicker.splitscreen + +import android.view.Surface +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.NonRotationTestBase +import com.android.server.wm.flicker.helpers.StandardAppHelper +import com.android.server.wm.flicker.dsl.flicker +import com.android.server.wm.flicker.focusDoesNotChange +import com.android.server.wm.flicker.helpers.exitSplitScreen +import com.android.server.wm.flicker.helpers.isInSplitScreen +import com.android.server.wm.flicker.helpers.launchSplitScreen +import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen +import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.navBarLayerRotatesAndScales +import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible +import com.android.server.wm.flicker.noUncoveredRegions +import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible +import com.android.server.wm.flicker.statusBarLayerRotatesScales +import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test open app to split screen. + * To run this test: `atest FlickerTests:SplitScreenToLauncherTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class SplitScreenToLauncherTest( + rotationName: String, + rotation: Int +) : NonRotationTestBase(rotationName, rotation) { + @Test + fun test() { + val testApp = StandardAppHelper(instrumentation, + "com.android.server.wm.flicker.testapp", "SimpleApp") + + flicker(instrumentation) { + withTag { buildTestTag("splitScreenToLauncher", testApp, rotation) } + repeat { 1 } + setup { + test { + device.wakeUpAndGoToHomeScreen() + } + eachRun { + testApp.open() + this.setRotation(rotation) + device.launchSplitScreen() + device.waitForIdle() + } + } + teardown { + eachRun { + testApp.exit() + } + test { + if (device.isInSplitScreen()) { + device.exitSplitScreen() + } + } + } + transitions { + device.exitSplitScreen() + } + assertions { + windowManagerTrace { + navBarWindowIsAlwaysVisible() + statusBarWindowIsAlwaysVisible() + } + + layersTrace { + navBarLayerIsAlwaysVisible() + statusBarLayerIsAlwaysVisible() + noUncoveredRegions(rotation) + navBarLayerRotatesAndScales(rotation) + statusBarLayerRotatesScales(rotation) + + // b/161435597 causes the test not to work on 90 degrees + all("dividerLayerBecomesInvisible") { + this.showsLayer(DOCKED_STACK_DIVIDER) + .then() + .hidesLayer(DOCKED_STACK_DIVIDER) + } + + all("appLayerBecomesInvisible") { + this.showsLayer(testApp.getPackage()) + .then() + .hidesLayer(testApp.getPackage()) + } + } + + eventLog { + focusDoesNotChange(bugId = 151179149) + } + } + } + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection<Array<Any>> { + // b/161435597 causes the test not to work on 90 degrees + val supportedRotations = intArrayOf(Surface.ROTATION_0) + return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) } + } + } +} diff --git a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml index 0fe968273567..4d2144061ad4 100644 --- a/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +++ b/tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml @@ -14,60 +14,62 @@ limitations under the License. --> -<manifest - xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.server.wm.flicker.testapp"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.server.wm.flicker.testapp"> - <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="27"/> - <application - android:allowBackup="false" - android:supportsRtl="true"> + <uses-sdk android:minSdkVersion="29" + android:targetSdkVersion="29"/> + <application android:allowBackup="false" + android:supportsRtl="true"> <activity android:name=".SimpleActivity" - android:taskAffinity="com.android.server.wm.flicker.testapp.SimpleActivity" - android:label="SimpleApp"> + android:taskAffinity="com.android.server.wm.flicker.testapp.SimpleActivity" + android:label="SimpleApp" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".ImeActivity" - android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivity" - android:label="ImeApp"> + android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivity" + android:label="ImeApp" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".ImeActivityAutoFocus" - android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivityAutoFocus" - android:windowSoftInputMode="stateVisible" - android:label="ImeAppAutoFocus"> + android:taskAffinity="com.android.server.wm.flicker.testapp.ImeActivityAutoFocus" + android:windowSoftInputMode="stateVisible" + android:label="ImeAppAutoFocus" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".PipActivity" - android:resizeableActivity="true" - android:supportsPictureInPicture="true" - android:configChanges= - "screenSize|smallestScreenSize|screenLayout|orientation" - android:taskAffinity="com.android.server.wm.flicker.testapp.PipActivity" - android:label="PipApp"> + android:resizeableActivity="true" + android:supportsPictureInPicture="true" + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" + android:taskAffinity="com.android.server.wm.flicker.testapp.PipActivity" + android:label="PipApp" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".SeamlessRotationActivity" - android:taskAffinity= - "com.android.server.wm.flicker.testapp.SeamlessRotationActivity" - android:configChanges="orientation|screenSize" - android:label="SeamlessApp"> + android:taskAffinity="com.android.server.wm.flicker.testapp.SeamlessRotationActivity" + android:configChanges="orientation|screenSize" + android:label="SeamlessApp" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/tests/FrameworkPerf/AndroidManifest.xml b/tests/FrameworkPerf/AndroidManifest.xml index 4fd2043ce938..07e775aeb838 100644 --- a/tests/FrameworkPerf/AndroidManifest.xml +++ b/tests/FrameworkPerf/AndroidManifest.xml @@ -1,30 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.frameworkperf"> + package="com.android.frameworkperf"> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> - <uses-permission android:name="android.permission.WAKE_LOCK" /> - <uses-sdk android:minSdkVersion="5" /> + <uses-permission android:name="android.permission.WAKE_LOCK"/> + <uses-sdk android:minSdkVersion="5"/> <application android:hardwareAccelerated="false"> - <uses-library android:name="android.test.runner" /> - <activity android:name="FrameworkPerfActivity" android:label="Framework Perf"> + <uses-library android:name="android.test.runner"/> + <activity android:name="FrameworkPerfActivity" + android:label="Framework Perf" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <service android:name="SchedulerService" - android:foregroundServiceType="dataSync|mediaPlayback|phoneCall|location|connectedDevice"> + android:foregroundServiceType="dataSync|mediaPlayback|phoneCall|location|connectedDevice"> </service> - <service android:name="TestService" android:process=":test"> + <service android:name="TestService" + android:process=":test"> </service> <service android:name="LocalTestService"> </service> - <receiver android:name="Receiver" android:exported="true"> + <receiver android:name="Receiver" + android:exported="true"> </receiver> </application> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.frameworkperf" - android:label="Framework Perf Runner" - /> + android:targetPackage="com.android.frameworkperf" + android:label="Framework Perf Runner"/> </manifest> diff --git a/tests/GamePerformance/AndroidManifest.xml b/tests/GamePerformance/AndroidManifest.xml index 2ff7fa65664e..8e6054bca0d8 100644 --- a/tests/GamePerformance/AndroidManifest.xml +++ b/tests/GamePerformance/AndroidManifest.xml @@ -16,28 +16,30 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.gameperformance" - android:versionCode="3" - android:versionName="3.0" > + package="android.gameperformance" + android:versionCode="3" + android:versionName="3.0"> <uses-sdk android:minSdkVersion="25"/> - <uses-feature android:glEsVersion="0x00020000" android:required="true" /> + <uses-feature android:glEsVersion="0x00020000" + android:required="true"/> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:theme="@style/noeffects"> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> <activity android:name="android.gameperformance.GamePerformanceActivity" - android:screenOrientation="landscape" > + android:screenOrientation="landscape" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> </application> <!-- self-instrumenting test package. --> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="android.gameperformance"> + android:targetPackage="android.gameperformance"> </instrumentation> </manifest> diff --git a/tests/GridLayoutTest/AndroidManifest.xml b/tests/GridLayoutTest/AndroidManifest.xml index 677220db8a53..6fdcda3e6ce7 100644 --- a/tests/GridLayoutTest/AndroidManifest.xml +++ b/tests/GridLayoutTest/AndroidManifest.xml @@ -15,76 +15,96 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.layout"> + package="com.android.test.layout"> <uses-permission android:name="android.permission.INTERNET"/> <uses-sdk android:minSdkVersion="11"/> <application> - <activity android:name="Activity0" android:label="Activity0"> + <activity android:name="Activity0" + android:label="Activity0" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="Activity1" android:label="Activity1"> + <activity android:name="Activity1" + android:label="Activity1" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="Activity4" android:label="Activity4"> + <activity android:name="Activity4" + android:label="Activity4" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="Activity5" android:label="Activity5"> + <activity android:name="Activity5" + android:label="Activity5" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="Activity6" android:label="Activity6"> + <activity android:name="Activity6" + android:label="Activity6" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="Activity7" android:label="Activity7"> + <activity android:name="Activity7" + android:label="Activity7" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="AlignmentTest" android:label="AlignmentTest"> + <activity android:name="AlignmentTest" + android:label="AlignmentTest" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="LinearLayoutTest" android:label="LinearLayoutTest"> + <activity android:name="LinearLayoutTest" + android:label="LinearLayoutTest" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="GridLayoutTest" android:label="GridLayoutTest"> + <activity android:name="GridLayoutTest" + android:label="GridLayoutTest" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="LayoutInsetsTest" android:label="LayoutInsetsTest"> + <activity android:name="LayoutInsetsTest" + android:label="LayoutInsetsTest" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/tests/HierarchyViewerTest/AndroidManifest.xml b/tests/HierarchyViewerTest/AndroidManifest.xml index 65f2fd3e1a9c..f4414b0c4d00 100644 --- a/tests/HierarchyViewerTest/AndroidManifest.xml +++ b/tests/HierarchyViewerTest/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2015 The Android Open Source Project ~ @@ -15,22 +16,21 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.hierarchyviewer"> + package="com.android.test.hierarchyviewer"> <application> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> - <activity - android:name=".MainActivity" - android:label="HvTest" > + <activity android:name=".MainActivity" + android:label="HvTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> - <instrumentation - android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.test.hierarchyviewer" /> + <instrumentation android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.android.test.hierarchyviewer"/> </manifest> diff --git a/tests/HugeBackup/AndroidManifest.xml b/tests/HugeBackup/AndroidManifest.xml index 923881b9b0b0..945e59bd36ed 100644 --- a/tests/HugeBackup/AndroidManifest.xml +++ b/tests/HugeBackup/AndroidManifest.xml @@ -13,30 +13,32 @@ See the License for the specific language governing permissions and limitations under the License. --> - <!-- Declare the contents of this Android application. The namespace attribute brings in the Android platform namespace, and the package supplies a unique name for the application. When writing your own application, the package name must be changed from "com.example.*" to come from a domain that you own or have control over. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.hugebackup" - android:versionCode="1" - android:versionName="1.0"> + package="com.android.hugebackup" + android:versionCode="1" + android:versionName="1.0"> <!-- The backup/restore mechanism was introduced in API version 8 --> - <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> + <uses-sdk android:minSdkVersion="8" + android:targetSdkVersion="8"/> <application android:label="Huge Backup" - android:backupAgent="HugeAgent"> + android:backupAgent="HugeAgent"> <meta-data android:name="com.google.android.backup.api_key" - android:value="AEdPqrEAAAAINyoagzQOEEpIH3yw7LYCFN7CRX4FMd6TGIGVaA" /> + android:value="AEdPqrEAAAAINyoagzQOEEpIH3yw7LYCFN7CRX4FMd6TGIGVaA"/> - <activity android:name="HugeBackupActivity"> + <activity android:name="HugeBackupActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index 7b8c154dea1e..05a59ef7fc72 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -15,1045 +15,1053 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.hwui"> + package="com.android.test.hwui"> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.CAMERA" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.CAMERA"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> - <uses-feature android:name="android.hardware.camera" /> - <uses-feature android:name="android.hardware.camera.autofocus" /> + <uses-feature android:name="android.hardware.camera"/> + <uses-feature android:name="android.hardware.camera.autofocus"/> - <uses-sdk android:minSdkVersion="21" /> + <uses-sdk android:minSdkVersion="21"/> - <application - android:label="HwUi" - android:theme="@android:style/Theme.Material.Light"> + <application android:label="HwUi" + android:theme="@android:style/Theme.Material.Light"> - <activity - android:name="HwTests" - android:label="OpenGL Renderer Tests"> + <activity android:name="HwTests" + android:label="OpenGL Renderer Tests" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity - android:name="PathOpsActivity" - android:label="Path/Ops"> + <activity android:name="PathOpsActivity" + android:label="Path/Ops" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="AssetsAtlasActivity" - android:label="Atlas/Framework"> + <activity android:name="AssetsAtlasActivity" + android:label="Atlas/Framework" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ScaledTextActivity" - android:label="Text/Scaled"> + <activity android:name="ScaledTextActivity" + android:label="Text/Scaled" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="Rotate3dTextActivity" - android:label="Text/3D Rotation"> + <activity android:name="Rotate3dTextActivity" + android:label="Text/3D Rotation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="NoAATextActivity" - android:label="Text/Aliased"> + <activity android:name="NoAATextActivity" + android:label="Text/Aliased" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ScaledPathsActivity" - android:label="Path/Scaled"> + <activity android:name="ScaledPathsActivity" + android:label="Path/Scaled" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="Alpha8BitmapActivity" - android:label="Bitmaps/Alpha8"> + <activity android:name="Alpha8BitmapActivity" + android:label="Bitmaps/Alpha8" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MipMapActivity" - android:label="Bitmaps/MipMap"> + <activity android:name="MipMapActivity" + android:label="Bitmaps/MipMap" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="DrawIntoHwBitmapActivity" - android:label="Bitmaps/DrawIntoHwBitmap"> + <activity android:name="DrawIntoHwBitmapActivity" + android:label="Bitmaps/DrawIntoHwBitmap" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PathOffsetActivity" - android:label="Path/Offset"> + <activity android:name="PathOffsetActivity" + android:label="Path/Offset" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MultiLayersActivity" - android:label="Layers/Multiple"> + <activity android:name="MultiLayersActivity" + android:label="Layers/Multiple" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TJunctionActivity" - android:label="Layers/T-Junction"> + <activity android:name="TJunctionActivity" + android:label="Layers/T-Junction" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TextPathActivity" - android:label="Text/As Path"> + <activity android:name="TextPathActivity" + android:label="Text/As Path" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GradientStopsActivity" - android:label="Gradients/Multi-stops"> + <activity android:name="GradientStopsActivity" + android:label="Gradients/Multi-stops" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PaintDrawFilterActivity" - android:label="Paint/Draw Filter"> + <activity android:name="PaintDrawFilterActivity" + android:label="Paint/Draw Filter" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="BigGradientActivity" - android:label="Gradients/Large"> + <activity android:name="BigGradientActivity" + android:label="Gradients/Large" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="DatePickerActivity" - android:label="View/DatePicker"> + + <activity android:name="DatePickerActivity" + android:label="View/DatePicker" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ClipRegionActivity" - android:label="Clip/Region 1"> + <activity android:name="ClipRegionActivity" + android:label="Clip/Region 1" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ClipRegion2Activity" - android:label="Clip/Region 2"> + <activity android:name="ClipRegion2Activity" + android:label="Clip/Region 2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ClipRegion3Activity" - android:label="Clip/Region 3"> + <activity android:name="ClipRegion3Activity" + android:label="Clip/Region 3" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ClipOutlineActivity" - android:label="Clip/Outline"> + <activity android:name="ClipOutlineActivity" + android:label="Clip/Outline" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="DisplayListLayersActivity" - android:label="Layers/Display Lists"> + <activity android:name="DisplayListLayersActivity" + android:label="Layers/Display Lists" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MatrixActivity" - android:label="Misc/Matrix"> + <activity android:name="MatrixActivity" + android:label="Misc/Matrix" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="LooperAcceleration" - android:label="Misc/LooperAcceleration"> + <activity android:name="LooperAcceleration" + android:label="Misc/LooperAcceleration" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="TextFadeActivity" - android:label="Text/Fade"> + + <activity android:name="TextFadeActivity" + android:label="Text/Fade" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MaxBitmapSizeActivity" - android:label="Bitmaps/Max Size"> + <activity android:name="MaxBitmapSizeActivity" + android:label="Bitmaps/Max Size" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TimeDialogActivity" - android:label="View/TimeDialog"> + <activity android:name="TimeDialogActivity" + android:label="View/TimeDialog" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ColoredShadowsActivity" - android:label="View/ColoredShadows" - android:theme="@style/ThemeColoredShadows"> + <activity android:name="ColoredShadowsActivity" + android:label="View/ColoredShadows" + android:theme="@style/ThemeColoredShadows" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="OpaqueActivity" - android:label="Window/Opaque"> + + <activity android:name="OpaqueActivity" + android:label="Window/Opaque" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> + </intent-filter> + </activity> + + <activity android:name="GetBitmapActivity" + android:label="TextureView/Get Bitmap" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GetBitmapActivity" - android:label="TextureView/Get Bitmap"> + <activity android:name="PictureCaptureDemo" + android:label="Debug/Picture Capture" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PictureCaptureDemo" - android:label="Debug/Picture Capture"> + <activity android:name="SmallCircleActivity" + android:label="Draw/Small Circle" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="SmallCircleActivity" - android:label="Draw/Small Circle"> + + <activity android:name="ClearActivity" + android:label="Window/Clear" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ClearActivity" - android:label="Window/Clear"> + <activity android:name="TextureViewActivity" + android:label="TextureView/Camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TextureViewActivity" - android:label="TextureView/Camera"> + <activity android:name="GlyphCacheActivity" + android:label="Text/Glyph Cache" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GlyphCacheActivity" - android:label="Text/Glyph Cache"> + <activity android:name="CanvasTextureViewActivity" + android:label="TextureView/Canvas" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="CanvasTextureViewActivity" - android:label="TextureView/Canvas"> + <activity android:name="HardwareCanvasTextureViewActivity" + android:label="TextureView/HardwareCanvas" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="HardwareCanvasTextureViewActivity" - android:label="TextureView/HardwareCanvas"> + <activity android:name="SingleFrameTextureViewTestActivity" + android:label="TextureView/SingleFrameTextureViewTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="SingleFrameTextureViewTestActivity" - android:label="TextureView/SingleFrameTextureViewTest"> + <activity android:name="HardwareCanvasSurfaceViewActivity" + android:label="SurfaceView/HardwareCanvas" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="HardwareCanvasSurfaceViewActivity" - android:label="SurfaceView/HardwareCanvas"> + <activity android:name="MovingSurfaceViewActivity" + android:label="SurfaceView/Animated Movement" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MovingSurfaceViewActivity" - android:label="SurfaceView/Animated Movement"> + <activity android:name="GetBitmapSurfaceViewActivity" + android:label="SurfaceView/GetBitmap with Camera source" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GetBitmapSurfaceViewActivity" - android:label="SurfaceView/GetBitmap with Camera source"> + <activity android:name="VideoViewCaptureActivity" + android:label="SurfaceView/GetBitmap with Video source" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="VideoViewCaptureActivity" - android:label="SurfaceView/GetBitmap with Video source"> + <activity android:name="GLTextureViewActivity" + android:label="TextureView/OpenGL" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GLTextureViewActivity" - android:label="TextureView/OpenGL"> + <activity android:name="BitmapMeshActivity" + android:label="Bitmaps/Mesh" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="BitmapMeshActivity" - android:label="Bitmaps/Mesh"> + <activity android:name="BitmapMutateActivity" + android:label="Bitmaps/Mutate" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="BitmapMutateActivity" - android:label="Bitmaps/Mutate"> + <activity android:name="BitmapMeshLayerActivity" + android:label="Bitmaps/Mesh in Layer" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="BitmapMeshLayerActivity" - android:label="Bitmaps/Mesh in Layer"> + <activity android:name="MarqueeActivity" + android:label="Text/Marquee" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="MarqueeActivity" - android:label="Text/Marquee"> + + <activity android:name="ShapesActivity" + android:label="Path/Shapes" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ShapesActivity" - android:label="Path/Shapes"> + <activity android:name="ColoredRectsActivity" + android:label="Draw/Rects" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="ColoredRectsActivity" - android:label="Draw/Rects"> + + <activity android:name="SimplePatchActivity" + android:label="Draw/9-Patch" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="SimplePatchActivity" - android:label="Draw/9-Patch" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + <activity android:name="ViewLayersActivity" + android:label="Layers/Views 1" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ViewLayersActivity" - android:label="Layers/Views 1"> + <activity android:name="ViewLayersActivity2" + android:label="Layers/Views 2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="ViewLayersActivity2" - android:label="Layers/Views 2"> + + <activity android:name="ViewLayersActivity3" + android:label="Layers/Views 3" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="ViewLayersActivity3" - android:label="Layers/Views 3"> + + <activity android:name="ViewLayersActivity4" + android:label="Layers/Views 4" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ViewLayersActivity4" - android:label="Layers/Views 4"> + <activity android:name="ViewLayersActivity5" + android:label="Layers/Views 5" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="ViewLayersActivity5" - android:label="Layers/Views 5"> + + <activity android:name="AlphaLayersActivity" + android:label="Layers/Alpha" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="AlphaLayersActivity" - android:label="Layers/Alpha"> + <activity android:name="AdvancedGradientsActivity" + android:label="Gradients/Advanced" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="AdvancedGradientsActivity" - android:label="Gradients/Advanced"> + + <activity android:name="Bitmaps3dActivity" + android:label="Bitmaps/3D Rotation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="Bitmaps3dActivity" - android:label="Bitmaps/3D Rotation"> + + <activity android:name="LabelsActivity" + android:label="View/TextView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="LabelsActivity" - android:label="View/TextView"> + + <activity android:name="ViewFlipperActivity" + android:label="View/ViewFlipper" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ViewFlipperActivity" - android:label="View/ViewFlipper" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + <activity android:name="ResizeActivity" + android:label="Window/Resize" + android:windowSoftInputMode="adjustResize" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ResizeActivity" - android:label="Window/Resize" - android:windowSoftInputMode="adjustResize"> + <activity android:name="TextGammaActivity" + android:label="Text/Gamma" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="TextGammaActivity" - android:label="Text/Gamma" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + + <activity android:name="TextGammaActivity$SubGammaActivity" + android:label="Text/Sub Gamma" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:hardwareAccelerated="false" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> </intent-filter> </activity> - <activity - android:name="TextGammaActivity$SubGammaActivity" - android:label="Text/Sub Gamma" - android:theme="@android:style/Theme.Translucent.NoTitleBar" - android:hardwareAccelerated="false"> + <activity android:name="LayersActivity" + android:label="Layers/Canvas Layers" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="LayersActivity" - android:label="Layers/Canvas Layers" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + + <activity android:name="NewLayersActivity" + android:label="Layers/Overlapping Layers" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="NewLayersActivity" - android:label="Layers/Overlapping Layers"> + <activity android:name="XfermodeActivity" + android:label="Draw/Xfermodes" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="XfermodeActivity" - android:label="Draw/Xfermodes" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + + <activity android:name="BitmapsActivity" + android:label="Bitmaps/Draw Bitmaps" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="BitmapsActivity" - android:label="Bitmaps/Draw Bitmaps" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + + <activity android:name="BitmapsSkewActivity" + android:label="Bitmaps/Skew" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="BitmapsSkewActivity" - android:label="Bitmaps/Skew"> + + <activity android:name="BitmapsAlphaActivity" + android:label="Bitmaps/Alpha" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="BitmapsAlphaActivity" - android:label="Bitmaps/Alpha" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + <activity android:name="BitmapsRectActivity" + android:label="Bitmaps/Rect" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="BitmapsRectActivity" - android:label="Bitmaps/Rect" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + + <activity android:name="ThinPatchesActivity" + android:label="Draw/9-Patch Thin Drawable" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ThinPatchesActivity" - android:label="Draw/9-Patch Thin Drawable" - android:theme="@android:style/Theme.Translucent.NoTitleBar"> + <activity android:name="NinePatchesActivity" + android:label="Draw/9-Patch Drawable" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="NinePatchesActivity" - android:label="Draw/9-Patch Drawable"> + + <activity android:name="MoreNinePatchesActivity" + android:label="Draw/9-Patch Vertical Drawable" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MoreNinePatchesActivity" - android:label="Draw/9-Patch Vertical Drawable"> + <activity android:name="QuickRejectActivity" + android:label="Clip/QuickReject" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="QuickRejectActivity" - android:label="Clip/QuickReject"> + + <activity android:name="RotationActivity" + android:label="View/Rotation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="RotationActivity" - android:label="View/Rotation"> + + <activity android:name="GradientsActivity" + android:label="Gradients/Gradients" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="GradientsActivity" - android:label="Gradients/Gradients"> + + <activity android:name="ShadersActivity" + android:label="Shaders/Shaders" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ShadersActivity" - android:label="Shaders/Shaders"> + <activity android:name="BlurActivity" + android:label="Shaders/Blur" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="TextActivity" - android:label="Text/Simple Text" - android:theme="@android:style/Theme.NoTitleBar"> + + <activity android:name="TextActivity" + android:label="Text/Simple Text" + android:theme="@android:style/Theme.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PosTextActivity" - android:label="Text/Pos Text" - android:theme="@android:style/Theme.NoTitleBar"> + <activity android:name="PosTextActivity" + android:label="Text/Pos Text" + android:theme="@android:style/Theme.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ListActivity" - android:label="View/List"> + <activity android:name="ListActivity" + android:label="View/List" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TransparentListActivity" - android:label="View/Transparent List"> + <activity android:name="TransparentListActivity" + android:label="View/Transparent List" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - - <activity - android:name="MoreShadersActivity" - android:label="Shaders/Compose Shaders"> + + <activity android:name="MoreShadersActivity" + android:label="Shaders/Compose Shaders" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ColorFiltersActivity" - android:label="ColorFilters/Filters"> + <activity android:name="ColorFiltersActivity" + android:label="ColorFilters/Filters" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ColorFiltersMutateActivity" - android:label="ColorFilters/Mutate Filters"> + <activity android:name="ColorFiltersMutateActivity" + android:label="ColorFilters/Mutate Filters" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="LinesActivity" - android:label="Draw/Lines"> + <activity android:name="LinesActivity" + android:label="Draw/Lines" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="Lines2Activity" - android:label="Draw/Lines 2"> + <activity android:name="Lines2Activity" + android:label="Draw/Lines 2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PathsActivity" - android:label="Path/Paths"> + <activity android:name="PathsActivity" + android:label="Path/Paths" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TextOnPathActivity" - android:label="Text/Text on Path"> + <activity android:name="TextOnPathActivity" + android:label="Text/Text on Path" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PathsCacheActivity" - android:label="Path/Cache"> + <activity android:name="PathsCacheActivity" + android:label="Path/Cache" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" />` - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/>` + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PointsActivity" - android:label="Draw/Points"> + <activity android:name="PointsActivity" + android:label="Draw/Points" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="Transform3dActivity" - android:label="Draw/3D Transform"> + <activity android:name="Transform3dActivity" + android:label="Draw/3D Transform" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="Animated3dActivity" - android:label="Draw/Animated 3D Transform"> + <activity android:name="Animated3dActivity" + android:label="Draw/Animated 3D Transform" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="SimplePathsActivity" - android:label="Path/Simple Paths"> + <activity android:name="SimplePathsActivity" + android:label="Path/Simple Paths" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="AdvancedBlendActivity" - android:label="Draw/Advanced Blend"> + <activity android:name="AdvancedBlendActivity" + android:label="Draw/Advanced Blend" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="FramebufferBlendActivity" - android:label="Draw/Framebuffer Blend"> + <activity android:name="FramebufferBlendActivity" + android:label="Draw/Framebuffer Blend" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="StackActivity" - android:label="View/Stacks"> + <activity android:name="StackActivity" + android:label="View/Stacks" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PathDestructionActivity" - android:label="Path/Path Destruction"> + <activity android:name="PathDestructionActivity" + android:label="Path/Path Destruction" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="TransformsAndAnimationsActivity" - android:label="Draw/Transforms and Animations"> + <activity android:name="TransformsAndAnimationsActivity" + android:label="Draw/Transforms and Animations" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ViewPropertyAlphaActivity" - android:label="View/Alpha Property"> + <activity android:name="ViewPropertyAlphaActivity" + android:label="View/Alpha Property" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ViewLayerInvalidationActivity" - android:label="Layers/Invalidation"> + <activity android:name="ViewLayerInvalidationActivity" + android:label="Layers/Invalidation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="ProjectionActivity" - android:label="Reordering/Projection"> + <activity android:name="ProjectionActivity" + android:label="Reordering/Projection" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name=".ProjectionClippingActivity" - android:label="Reordering/Projection Clipping"> + <activity android:name=".ProjectionClippingActivity" + android:label="Reordering/Projection Clipping" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name=".ZOrderingActivity" - android:label="Reordering/Z Ordering"> + <activity android:name=".ZOrderingActivity" + android:label="Reordering/Z Ordering" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="GLDepthTestActivity" - android:label="Reordering/OpenGL Depth Test"> + <activity android:name="GLDepthTestActivity" + android:label="Reordering/OpenGL Depth Test" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="CirclePropActivity" - android:label="Animation/Circle Props"> + <activity android:name="CirclePropActivity" + android:label="Animation/Circle Props" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="RevealActivity" - android:label="Animation/Reveal Animation"> + <activity android:name="RevealActivity" + android:label="Animation/Reveal Animation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MultiProducerActivity" - android:label="Threads/Multiple Producers"> + <activity android:name="MultiProducerActivity" + android:label="Threads/Multiple Producers" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PixelCopyWindow" - android:label="Readback/Window" - android:screenOrientation="fullSensor"> + <activity android:name="PixelCopyWindow" + android:label="Readback/Window" + android:screenOrientation="fullSensor" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="PositionListenerActivity" - android:label="RenderNode/PositionListener" - android:screenOrientation="fullSensor"> + <activity android:name="PositionListenerActivity" + android:label="RenderNode/PositionListener" + android:screenOrientation="fullSensor" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="CustomRenderer" - android:label="HardwareRenderer/HelloTakeSurface" - android:screenOrientation="fullSensor"> + <activity android:name="CustomRenderer" + android:label="HardwareRenderer/HelloTakeSurface" + android:screenOrientation="fullSensor" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> - <activity - android:name="MyLittleTextureView" - android:label="HardwareRenderer/MyLittleTextureView" - android:screenOrientation="fullSensor"> + <activity android:name="MyLittleTextureView" + android:label="HardwareRenderer/MyLittleTextureView" + android:screenOrientation="fullSensor" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.hwui.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.hwui.TEST"/> </intent-filter> </activity> diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BlurActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BlurActivity.java new file mode 100644 index 000000000000..033fb0ec35d2 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BlurActivity.java @@ -0,0 +1,110 @@ +/* + * 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.test.hwui; + +import android.app.Activity; +import android.content.Context; +import android.graphics.BlurShader; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.LinearGradient; +import android.graphics.Paint; +import android.graphics.Shader; +import android.os.Bundle; +import android.view.Gravity; +import android.view.View; +import android.widget.LinearLayout; + +@SuppressWarnings({"UnusedDeclaration"}) +public class BlurActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + LinearLayout layout = new LinearLayout(this); + layout.setClipChildren(false); + layout.setGravity(Gravity.CENTER); + layout.setOrientation(LinearLayout.VERTICAL); + + + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(500, 500); + params.bottomMargin = 100; + + layout.addView(new BlurGradientView(this), params); + layout.addView(new BlurView(this), params); + + setContentView(layout); + } + + public static class BlurGradientView extends View { + private BlurShader mBlurShader = null; + private Paint mPaint; + + public BlurGradientView(Context c) { + super(c); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + if (changed || mBlurShader == null) { + LinearGradient gradient = new LinearGradient( + 0f, + 0f, + right - left, + bottom - top, + Color.CYAN, + Color.YELLOW, + Shader.TileMode.CLAMP + ); + mBlurShader = new BlurShader(30f, 40f, gradient); + mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + mPaint.setShader(mBlurShader); + } + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint); + } + } + + public static class BlurView extends View { + + private final BlurShader mBlurShader; + private final Paint mPaint; + + public BlurView(Context c) { + super(c); + + mBlurShader = new BlurShader(20f, 20f, null); + mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + mPaint.setShader(mBlurShader); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + mPaint.setColor(Color.BLUE); + canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint); + + mPaint.setColor(Color.RED); + canvas.drawCircle(getWidth() / 2f, getHeight() / 2f, 50f, mPaint); + } + } +} diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java index 51bae3af3e9c..08144c845555 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java @@ -60,7 +60,7 @@ public class ColorFiltersMutateActivity extends Activity { static final String sSkSL = "uniform float param1;\n" - + "void main(float x, float y, inout half4 color) {\n" + + "void main(float2 xy, inout half4 color) {\n" + "color = half4(color.r, half(param1), color.b, 1.0);\n" + "}\n"; diff --git a/tests/Input/Android.bp b/tests/Input/Android.bp new file mode 100644 index 000000000000..9d35cbc3de7f --- /dev/null +++ b/tests/Input/Android.bp @@ -0,0 +1,12 @@ +android_test { + name: "InputTests", + srcs: ["src/**/*.kt"], + platform_apis: true, + certificate: "platform", + static_libs: [ + "androidx.test.ext.junit", + "androidx.test.rules", + "android-support-test", + "ub-uiautomator", + ], +} diff --git a/tests/Input/AndroidManifest.xml b/tests/Input/AndroidManifest.xml new file mode 100644 index 000000000000..4195df72864c --- /dev/null +++ b/tests/Input/AndroidManifest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.test.input"> + <uses-permission android:name="android.permission.MONITOR_INPUT"/> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> + <uses-permission android:name="android.permission.INJECT_EVENTS"/> + + <application android:label="InputTest"> + + <activity android:name=".UnresponsiveGestureMonitorActivity" + android:label="Unresponsive gesture monitor" + android:process=":externalProcess"> + </activity> + + + </application> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.test.input" + android:label="Input Tests"/> +</manifest> diff --git a/tests/Input/AndroidTest.xml b/tests/Input/AndroidTest.xml new file mode 100644 index 000000000000..c62db1ea5ca9 --- /dev/null +++ b/tests/Input/AndroidTest.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright 2020 Google Inc. All Rights Reserved. + --> +<configuration description="Runs Input Tests"> + <option name="test-tag" value="InputTests" /> + <target_preparer class="com.android.tradefed.targetprep.DeviceSetup"> + <!-- keeps the screen on during tests --> + <option name="screen-always-on" value="on" /> + <!-- prevents the phone from restarting --> + <option name="force-skip-system-props" value="true" /> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true"/> + <option name="test-file-name" value="InputTests.apk"/> + + </target_preparer> + <test class="com.android.tradefed.testtype.AndroidJUnitTest"> + <option name="package" value="com.android.test.input"/> + <option name="exclude-annotation" value="androidx.test.filters.FlakyTest" /> + <option name="shell-timeout" value="660s" /> + <option name="test-timeout" value="600s" /> + <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" /> + </test> +</configuration> diff --git a/tests/Input/src/com/android/test/input/AnrTest.kt b/tests/Input/src/com/android/test/input/AnrTest.kt new file mode 100644 index 000000000000..4da3eca25ea0 --- /dev/null +++ b/tests/Input/src/com/android/test/input/AnrTest.kt @@ -0,0 +1,115 @@ +/* + * 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.test.input + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.filters.MediumTest + +import android.graphics.Rect +import android.os.SystemClock +import android.provider.Settings +import android.provider.Settings.Global.HIDE_ERROR_DIALOGS +import android.support.test.uiautomator.By +import android.support.test.uiautomator.UiDevice +import android.support.test.uiautomator.UiObject2 +import android.support.test.uiautomator.Until +import android.view.InputDevice +import android.view.MotionEvent + +import org.junit.After +import org.junit.Assert.fail +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * This test makes sure that an unresponsive gesture monitor gets an ANR. + * + * The gesture monitor must be registered from a different process than the instrumented process. + * Otherwise, when the test runs, you will get: + * Test failed to run to completion. + * Reason: 'Instrumentation run failed due to 'keyDispatchingTimedOut''. + * Check device logcat for details + * RUNNER ERROR: Instrumentation run failed due to 'keyDispatchingTimedOut' + */ +@MediumTest +@RunWith(AndroidJUnit4::class) +class AnrTest { + companion object { + private const val TAG = "AnrTest" + } + + val mInstrumentation = InstrumentationRegistry.getInstrumentation() + var mHideErrorDialogs = 0 + + @Before + fun setUp() { + val contentResolver = mInstrumentation.targetContext.contentResolver + mHideErrorDialogs = Settings.Global.getInt(contentResolver, HIDE_ERROR_DIALOGS, 0) + Settings.Global.putInt(contentResolver, HIDE_ERROR_DIALOGS, 0) + } + + @After + fun tearDown() { + val contentResolver = mInstrumentation.targetContext.contentResolver + Settings.Global.putInt(contentResolver, HIDE_ERROR_DIALOGS, mHideErrorDialogs) + } + + @Test + fun testGestureMonitorAnr() { + startUnresponsiveActivity() + val uiDevice: UiDevice = UiDevice.getInstance(mInstrumentation) + val obj: UiObject2? = uiDevice.wait(Until.findObject( + By.text("Unresponsive gesture monitor")), 10000) + + if (obj == null) { + fail("Could not find unresponsive activity") + return + } + + val rect: Rect = obj.visibleBounds + val downTime = SystemClock.uptimeMillis() + val downEvent = MotionEvent.obtain(downTime, downTime, + MotionEvent.ACTION_DOWN, rect.left.toFloat(), rect.top.toFloat(), 0 /* metaState */) + downEvent.source = InputDevice.SOURCE_TOUCHSCREEN + + mInstrumentation.uiAutomation.injectInputEvent(downEvent, false /* sync*/) + + // Todo: replace using timeout from android.hardware.input.IInputManager + SystemClock.sleep(5000) // default ANR timeout for gesture monitors + + clickCloseAppOnAnrDialog() + } + + private fun clickCloseAppOnAnrDialog() { + // Find anr dialog and kill app + val uiDevice: UiDevice = UiDevice.getInstance(mInstrumentation) + val closeAppButton: UiObject2? = + uiDevice.wait(Until.findObject(By.res("android:id/aerr_close")), 20000) + if (closeAppButton == null) { + fail("Could not find anr dialog") + return + } + closeAppButton.click() + } + + private fun startUnresponsiveActivity() { + val flags = " -W -n " + val startCmd = "am start $flags com.android.test.input/.UnresponsiveGestureMonitorActivity" + mInstrumentation.uiAutomation.executeShellCommand(startCmd) + } +}
\ No newline at end of file diff --git a/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt b/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt new file mode 100644 index 000000000000..d83a4570fedc --- /dev/null +++ b/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt @@ -0,0 +1,52 @@ +/** + * 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.test.input + +import android.app.Activity +import android.hardware.input.InputManager +import android.os.Bundle +import android.os.Looper +import android.util.Log +import android.view.InputChannel +import android.view.InputEvent +import android.view.InputEventReceiver +import android.view.InputMonitor + +class UnresponsiveReceiver(channel: InputChannel, looper: Looper) : + InputEventReceiver(channel, looper) { + companion object { + const val TAG = "UnresponsiveReceiver" + } + override fun onInputEvent(event: InputEvent) { + Log.i(TAG, "Received $event") + // Not calling 'finishInputEvent' in order to trigger the ANR + } +} + +class UnresponsiveGestureMonitorActivity : Activity() { + companion object { + const val MONITOR_NAME = "unresponsive gesture monitor" + } + private lateinit var mInputEventReceiver: InputEventReceiver + private lateinit var mInputMonitor: InputMonitor + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + mInputMonitor = InputManager.getInstance().monitorGestureInput(MONITOR_NAME, displayId) + mInputEventReceiver = UnresponsiveReceiver( + mInputMonitor.getInputChannel(), Looper.myLooper()) + } +} diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp index e233fed7e785..9da17db6a573 100644 --- a/tests/Internal/Android.bp +++ b/tests/Internal/Android.bp @@ -11,6 +11,7 @@ android_test { "androidx.test.rules", "mockito-target-minus-junit4", "truth-prebuilt", + "platform-test-annotations", ], java_resource_dirs: ["res"], certificate: "platform", diff --git a/tests/Internal/AndroidManifest.xml b/tests/Internal/AndroidManifest.xml index c85c3b12504a..dbba24531769 100644 --- a/tests/Internal/AndroidManifest.xml +++ b/tests/Internal/AndroidManifest.xml @@ -16,29 +16,30 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.internal.tests"> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.BIND_WALLPAPER" /> + package="com.android.internal.tests"> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.BIND_WALLPAPER"/> <application> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> <service android:name="stub.DummyWallpaperService" - android:enabled="true" - android:directBootAware="true" - android:label="Dummy wallpaper" - android:permission="android.permission.BIND_WALLPAPER"> + android:enabled="true" + android:directBootAware="true" + android:label="Dummy wallpaper" + android:permission="android.permission.BIND_WALLPAPER" + android:exported="true"> <intent-filter> - <action android:name="android.service.wallpaper.WallpaperService" /> + <action android:name="android.service.wallpaper.WallpaperService"/> </intent-filter> <!-- Link to XML that defines the wallpaper info. --> <meta-data android:name="android.service.wallpaper" - android:resource="@xml/livewallpaper" /> + android:resource="@xml/livewallpaper"/> </service> </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="com.android.internal.tests" - android:label="Internal Tests" /> + android:targetPackage="com.android.internal.tests" + android:label="Internal Tests"/> </manifest> diff --git a/tests/Internal/src/android/app/WallpaperColorsTest.java b/tests/Internal/src/android/app/WallpaperColorsTest.java index e9bac717daa1..45d3dade82b6 100644 --- a/tests/Internal/src/android/app/WallpaperColorsTest.java +++ b/tests/Internal/src/android/app/WallpaperColorsTest.java @@ -47,7 +47,7 @@ public class WallpaperColorsTest { } /** - * Sanity check to guarantee that white supports dark text and black doesn't + * Check that white supports dark text and black doesn't */ @Test public void colorHintsTest() { diff --git a/tests/Internal/src/com/android/internal/protolog/ProtoLogImplTest.java b/tests/Internal/src/com/android/internal/protolog/ProtoLogImplTest.java new file mode 100644 index 000000000000..3db011683a86 --- /dev/null +++ b/tests/Internal/src/com/android/internal/protolog/ProtoLogImplTest.java @@ -0,0 +1,462 @@ +/* + * Copyright (C) 2019 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.internal.protolog; + +import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; + +import static com.android.internal.protolog.ProtoLogImpl.PROTOLOG_VERSION; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.content.Context; +import android.os.SystemClock; +import android.platform.test.annotations.Presubmit; +import android.util.proto.ProtoInputStream; + +import androidx.test.filters.SmallTest; + +import com.android.internal.protolog.common.IProtoLogGroup; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.util.LinkedList; + +/** + * Test class for {@link ProtoLogImpl}. + */ +@SuppressWarnings("ConstantConditions") +@SmallTest +@Presubmit +@RunWith(JUnit4.class) +public class ProtoLogImplTest { + + private static final byte[] MAGIC_HEADER = new byte[]{ + 0x9, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x4c, 0x4f, 0x47 + }; + + private ProtoLogImpl mProtoLog; + private File mFile; + + @Mock + private ProtoLogViewerConfigReader mReader; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + final Context testContext = getInstrumentation().getContext(); + mFile = testContext.getFileStreamPath("tracing_test.dat"); + //noinspection ResultOfMethodCallIgnored + mFile.delete(); + mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader); + } + + @After + public void tearDown() { + if (mFile != null) { + //noinspection ResultOfMethodCallIgnored + mFile.delete(); + } + ProtoLogImpl.setSingleInstance(null); + } + + @Test + public void isEnabled_returnsFalseByDefault() { + assertFalse(mProtoLog.isProtoEnabled()); + } + + @Test + public void isEnabled_returnsTrueAfterStart() { + mProtoLog.startProtoLog(mock(PrintWriter.class)); + assertTrue(mProtoLog.isProtoEnabled()); + } + + @Test + public void isEnabled_returnsFalseAfterStop() { + mProtoLog.startProtoLog(mock(PrintWriter.class)); + mProtoLog.stopProtoLog(mock(PrintWriter.class), true); + assertFalse(mProtoLog.isProtoEnabled()); + } + + @Test + public void logFile_startsWithMagicHeader() throws Exception { + mProtoLog.startProtoLog(mock(PrintWriter.class)); + mProtoLog.stopProtoLog(mock(PrintWriter.class), true); + + assertTrue("Log file should exist", mFile.exists()); + + byte[] header = new byte[MAGIC_HEADER.length]; + try (InputStream is = new FileInputStream(mFile)) { + assertEquals(MAGIC_HEADER.length, is.read(header)); + assertArrayEquals(MAGIC_HEADER, header); + } + } + + @Test + public void getSingleInstance() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + assertSame(mockedProtoLog, ProtoLogImpl.getSingleInstance()); + } + + @Test + public void d_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.d(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.DEBUG), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void v_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.v(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.VERBOSE), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void i_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.i(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.INFO), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void w_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.w(TestProtoLogGroup.TEST_GROUP, 1234, + 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.WARN), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void e_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.e(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.ERROR), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void wtf_logCalled() { + ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class); + ProtoLogImpl.setSingleInstance(mockedProtoLog); + ProtoLogImpl.wtf(TestProtoLogGroup.TEST_GROUP, + 1234, 4321, "test %d"); + verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.WTF), eq( + TestProtoLogGroup.TEST_GROUP), + eq(1234), eq(4321), eq("test %d"), eq(new Object[]{})); + } + + @Test + public void log_logcatEnabledExternalMessage() { + when(mReader.getViewerString(anyInt())).thenReturn("test %b %d %% %o %x %e %g %s %f"); + ProtoLogImpl implSpy = Mockito.spy(mProtoLog); + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + + implSpy.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null, + new Object[]{true, 10000, 20000, 30000, 0.0001, 0.00002, "test", 0.000003}); + + verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( + ProtoLogImpl.LogLevel.INFO), + eq("test true 10000 % 47040 7530 1.000000e-04 2.00000e-05 test 0.000003")); + verify(mReader).getViewerString(eq(1234)); + } + + @Test + public void log_logcatEnabledInvalidMessage() { + when(mReader.getViewerString(anyInt())).thenReturn("test %b %d %% %o %x %e %g %s %f"); + ProtoLogImpl implSpy = Mockito.spy(mProtoLog); + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + + implSpy.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null, + new Object[]{true, 10000, 0.0001, 0.00002, "test"}); + + verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( + ProtoLogImpl.LogLevel.INFO), + eq("UNKNOWN MESSAGE (1234) true 10000 1.0E-4 2.0E-5 test")); + verify(mReader).getViewerString(eq(1234)); + } + + @Test + public void log_logcatEnabledInlineMessage() { + when(mReader.getViewerString(anyInt())).thenReturn("test %d"); + ProtoLogImpl implSpy = Mockito.spy(mProtoLog); + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + + implSpy.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d", + new Object[]{5}); + + verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( + ProtoLogImpl.LogLevel.INFO), eq("test 5")); + verify(mReader, never()).getViewerString(anyInt()); + } + + @Test + public void log_logcatEnabledNoMessage() { + when(mReader.getViewerString(anyInt())).thenReturn(null); + ProtoLogImpl implSpy = Mockito.spy(mProtoLog); + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + + implSpy.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null, + new Object[]{5}); + + verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq( + ProtoLogImpl.LogLevel.INFO), eq("UNKNOWN MESSAGE (1234) 5")); + verify(mReader).getViewerString(eq(1234)); + } + + @Test + public void log_logcatDisabled() { + when(mReader.getViewerString(anyInt())).thenReturn("test %d"); + ProtoLogImpl implSpy = Mockito.spy(mProtoLog); + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + + implSpy.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d", + new Object[]{5}); + + verify(implSpy, never()).passToLogcat(any(), any(), any()); + verify(mReader, never()).getViewerString(anyInt()); + } + + private static class ProtoLogData { + Integer mMessageHash = null; + Long mElapsedTime = null; + LinkedList<String> mStrParams = new LinkedList<>(); + LinkedList<Long> mSint64Params = new LinkedList<>(); + LinkedList<Double> mDoubleParams = new LinkedList<>(); + LinkedList<Boolean> mBooleanParams = new LinkedList<>(); + } + + private ProtoLogData readProtoLogSingle(ProtoInputStream ip) throws IOException { + while (ip.nextField() != ProtoInputStream.NO_MORE_FIELDS) { + if (ip.getFieldNumber() == (int) ProtoLogFileProto.VERSION) { + assertEquals(PROTOLOG_VERSION, ip.readString(ProtoLogFileProto.VERSION)); + continue; + } + if (ip.getFieldNumber() != (int) ProtoLogFileProto.LOG) { + continue; + } + long token = ip.start(ProtoLogFileProto.LOG); + ProtoLogData data = new ProtoLogData(); + while (ip.nextField() != ProtoInputStream.NO_MORE_FIELDS) { + switch (ip.getFieldNumber()) { + case (int) ProtoLogMessage.MESSAGE_HASH: { + data.mMessageHash = ip.readInt(ProtoLogMessage.MESSAGE_HASH); + break; + } + case (int) ProtoLogMessage.ELAPSED_REALTIME_NANOS: { + data.mElapsedTime = ip.readLong(ProtoLogMessage.ELAPSED_REALTIME_NANOS); + break; + } + case (int) ProtoLogMessage.STR_PARAMS: { + data.mStrParams.add(ip.readString(ProtoLogMessage.STR_PARAMS)); + break; + } + case (int) ProtoLogMessage.SINT64_PARAMS: { + data.mSint64Params.add(ip.readLong(ProtoLogMessage.SINT64_PARAMS)); + break; + } + case (int) ProtoLogMessage.DOUBLE_PARAMS: { + data.mDoubleParams.add(ip.readDouble(ProtoLogMessage.DOUBLE_PARAMS)); + break; + } + case (int) ProtoLogMessage.BOOLEAN_PARAMS: { + data.mBooleanParams.add(ip.readBoolean(ProtoLogMessage.BOOLEAN_PARAMS)); + break; + } + } + } + ip.end(token); + return data; + } + return null; + } + + @Test + public void log_protoEnabled() throws Exception { + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false); + TestProtoLogGroup.TEST_GROUP.setLogToProto(true); + mProtoLog.startProtoLog(mock(PrintWriter.class)); + long before = SystemClock.elapsedRealtimeNanos(); + mProtoLog.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, + 0b1110101001010100, null, + new Object[]{"test", 1, 2, 3, 0.4, 0.5, 0.6, true}); + long after = SystemClock.elapsedRealtimeNanos(); + mProtoLog.stopProtoLog(mock(PrintWriter.class), true); + try (InputStream is = new FileInputStream(mFile)) { + ProtoInputStream ip = new ProtoInputStream(is); + ProtoLogData data = readProtoLogSingle(ip); + assertNotNull(data); + assertEquals(1234, data.mMessageHash.longValue()); + assertTrue(before <= data.mElapsedTime && data.mElapsedTime <= after); + assertArrayEquals(new String[]{"test"}, data.mStrParams.toArray()); + assertArrayEquals(new Long[]{1L, 2L, 3L}, data.mSint64Params.toArray()); + assertArrayEquals(new Double[]{0.4, 0.5, 0.6}, data.mDoubleParams.toArray()); + assertArrayEquals(new Boolean[]{true}, data.mBooleanParams.toArray()); + } + } + + @Test + public void log_invalidParamsMask() throws Exception { + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false); + TestProtoLogGroup.TEST_GROUP.setLogToProto(true); + mProtoLog.startProtoLog(mock(PrintWriter.class)); + long before = SystemClock.elapsedRealtimeNanos(); + mProtoLog.log( + ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, + 0b01100100, null, + new Object[]{"test", 1, 0.1, true}); + long after = SystemClock.elapsedRealtimeNanos(); + mProtoLog.stopProtoLog(mock(PrintWriter.class), true); + try (InputStream is = new FileInputStream(mFile)) { + ProtoInputStream ip = new ProtoInputStream(is); + ProtoLogData data = readProtoLogSingle(ip); + assertNotNull(data); + assertEquals(1234, data.mMessageHash.longValue()); + assertTrue(before <= data.mElapsedTime && data.mElapsedTime <= after); + assertArrayEquals(new String[]{"test", "(INVALID PARAMS_MASK) true"}, + data.mStrParams.toArray()); + assertArrayEquals(new Long[]{1L}, data.mSint64Params.toArray()); + assertArrayEquals(new Double[]{0.1}, data.mDoubleParams.toArray()); + assertArrayEquals(new Boolean[]{}, data.mBooleanParams.toArray()); + } + } + + @Test + public void log_protoDisabled() throws Exception { + TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false); + TestProtoLogGroup.TEST_GROUP.setLogToProto(false); + mProtoLog.startProtoLog(mock(PrintWriter.class)); + mProtoLog.log(ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, + 0b11, null, new Object[]{true}); + mProtoLog.stopProtoLog(mock(PrintWriter.class), true); + try (InputStream is = new FileInputStream(mFile)) { + ProtoInputStream ip = new ProtoInputStream(is); + ProtoLogData data = readProtoLogSingle(ip); + assertNull(data); + } + } + + private enum TestProtoLogGroup implements IProtoLogGroup { + TEST_GROUP(true, true, false, "WindowManagetProtoLogTest"); + + private final boolean mEnabled; + private volatile boolean mLogToProto; + private volatile boolean mLogToLogcat; + private final String mTag; + + /** + * @param enabled set to false to exclude all log statements for this group from + * compilation, + * they will not be available in runtime. + * @param logToProto enable binary logging for the group + * @param logToLogcat enable text logging for the group + * @param tag name of the source of the logged message + */ + TestProtoLogGroup(boolean enabled, boolean logToProto, boolean logToLogcat, String tag) { + this.mEnabled = enabled; + this.mLogToProto = logToProto; + this.mLogToLogcat = logToLogcat; + this.mTag = tag; + } + + @Override + public boolean isEnabled() { + return mEnabled; + } + + @Override + public boolean isLogToProto() { + return mLogToProto; + } + + @Override + public boolean isLogToLogcat() { + return mLogToLogcat; + } + + @Override + public boolean isLogToAny() { + return mLogToLogcat || mLogToProto; + } + + @Override + public String getTag() { + return mTag; + } + + @Override + public void setLogToProto(boolean logToProto) { + this.mLogToProto = logToProto; + } + + @Override + public void setLogToLogcat(boolean logToLogcat) { + this.mLogToLogcat = logToLogcat; + } + + } +} diff --git a/tests/Internal/src/com/android/internal/protolog/ProtoLogViewerConfigReaderTest.java b/tests/Internal/src/com/android/internal/protolog/ProtoLogViewerConfigReaderTest.java new file mode 100644 index 000000000000..ae5021638745 --- /dev/null +++ b/tests/Internal/src/com/android/internal/protolog/ProtoLogViewerConfigReaderTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2019 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.internal.protolog; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.zip.GZIPOutputStream; + +@SmallTest +@Presubmit +@RunWith(JUnit4.class) +public class ProtoLogViewerConfigReaderTest { + private static final String TEST_VIEWER_CONFIG = "{\n" + + " \"version\": \"1.0.0\",\n" + + " \"messages\": {\n" + + " \"70933285\": {\n" + + " \"message\": \"Test completed successfully: %b\",\n" + + " \"level\": \"ERROR\",\n" + + " \"group\": \"GENERIC_WM\"\n" + + " },\n" + + " \"1792430067\": {\n" + + " \"message\": \"Attempted to add window to a display that does not exist: %d." + + " Aborting.\",\n" + + " \"level\": \"WARN\",\n" + + " \"group\": \"GENERIC_WM\"\n" + + " },\n" + + " \"1352021864\": {\n" + + " \"message\": \"Test 2\",\n" + + " \"level\": \"WARN\",\n" + + " \"group\": \"GENERIC_WM\"\n" + + " },\n" + + " \"409412266\": {\n" + + " \"message\": \"Window %s is already added\",\n" + + " \"level\": \"WARN\",\n" + + " \"group\": \"GENERIC_WM\"\n" + + " }\n" + + " },\n" + + " \"groups\": {\n" + + " \"GENERIC_WM\": {\n" + + " \"tag\": \"WindowManager\"\n" + + " }\n" + + " }\n" + + "}\n"; + + + private ProtoLogViewerConfigReader + mConfig = new ProtoLogViewerConfigReader(); + private File mTestViewerConfig; + + @Before + public void setUp() throws IOException { + mTestViewerConfig = File.createTempFile("testConfig", ".json.gz"); + OutputStreamWriter writer = new OutputStreamWriter( + new GZIPOutputStream(new FileOutputStream(mTestViewerConfig))); + writer.write(TEST_VIEWER_CONFIG); + writer.close(); + } + + @After + public void tearDown() { + //noinspection ResultOfMethodCallIgnored + mTestViewerConfig.delete(); + } + + @Test + public void getViewerString_notLoaded() { + assertNull(mConfig.getViewerString(1)); + } + + @Test + public void loadViewerConfig() { + mConfig.loadViewerConfig(null, mTestViewerConfig.getAbsolutePath()); + assertEquals("Test completed successfully: %b", mConfig.getViewerString(70933285)); + assertEquals("Test 2", mConfig.getViewerString(1352021864)); + assertEquals("Window %s is already added", mConfig.getViewerString(409412266)); + assertNull(mConfig.getViewerString(1)); + } + + @Test + public void loadViewerConfig_invalidFile() { + mConfig.loadViewerConfig(null, "/tmp/unknown/file/does/not/exist"); + // No exception is thrown. + assertNull(mConfig.getViewerString(1)); + } +} diff --git a/tests/Internal/src/com/android/internal/protolog/common/LogDataTypeTest.java b/tests/Internal/src/com/android/internal/protolog/common/LogDataTypeTest.java new file mode 100644 index 000000000000..e20ca3df57c7 --- /dev/null +++ b/tests/Internal/src/com/android/internal/protolog/common/LogDataTypeTest.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2019 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.internal.protolog.common; + +import static org.junit.Assert.assertEquals; + +import android.platform.test.annotations.Presubmit; + +import androidx.test.filters.SmallTest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@SmallTest +@Presubmit +@RunWith(JUnit4.class) +public class LogDataTypeTest { + @Test + public void parseFormatString() { + String str = "%b %d %o %x %f %e %g %s %%"; + List<Integer> out = LogDataType.parseFormatString(str); + assertEquals(Arrays.asList( + LogDataType.BOOLEAN, + LogDataType.LONG, + LogDataType.LONG, + LogDataType.LONG, + LogDataType.DOUBLE, + LogDataType.DOUBLE, + LogDataType.DOUBLE, + LogDataType.STRING + ), out); + } + + @Test(expected = InvalidFormatStringException.class) + public void parseFormatString_invalid() { + String str = "%q"; + LogDataType.parseFormatString(str); + } + + @Test + public void logDataTypesToBitMask() { + List<Integer> types = Arrays.asList(LogDataType.STRING, LogDataType.DOUBLE, + LogDataType.LONG, LogDataType.BOOLEAN); + int mask = LogDataType.logDataTypesToBitMask(types); + assertEquals(0b11011000, mask); + } + + @Test(expected = BitmaskConversionException.class) + public void logDataTypesToBitMask_toManyParams() { + ArrayList<Integer> types = new ArrayList<>(); + for (int i = 0; i <= 16; i++) { + types.add(LogDataType.STRING); + } + LogDataType.logDataTypesToBitMask(types); + } + + @Test + public void bitmaskToLogDataTypes() { + int bitmask = 0b11011000; + List<Integer> types = Arrays.asList(LogDataType.STRING, LogDataType.DOUBLE, + LogDataType.LONG, LogDataType.BOOLEAN); + for (int i = 0; i < types.size(); i++) { + assertEquals(types.get(i).intValue(), LogDataType.bitmaskToLogDataType(bitmask, i)); + } + } +} diff --git a/tests/JankBench/app/src/main/AndroidManifest.xml b/tests/JankBench/app/src/main/AndroidManifest.xml index 58aa66fcd05d..fe431fda48cd 100644 --- a/tests/JankBench/app/src/main/AndroidManifest.xml +++ b/tests/JankBench/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ -<?xml version="1.0" encoding="utf-8"?><!-- +<?xml version="1.0" encoding="utf-8"?> +<!-- ~ Copyright (C) 2015 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,50 +14,48 @@ ~ License. ~ --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.benchmark"> + package="com.android.benchmark"> - <uses-sdk android:minSdkVersion="24" /> + <uses-sdk android:minSdkVersion="24"/> - <android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <android:uses-permission android:name="android.permission.READ_PHONE_STATE" /> - <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <android:uses-permission android:name="android.permission.READ_PHONE_STATE"/> + <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:supportsRtl="true" - android:theme="@style/AppTheme"> - <activity - android:name=".app.HomeActivity" - android:label="@string/app_name" - android:theme="@style/AppTheme.NoActionBar"> + <application android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity android:name=".app.HomeActivity" + android:label="@string/app_name" + android:theme="@style/AppTheme.NoActionBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity - android:name=".app.RunLocalBenchmarksActivity" - android:exported="true"> + <activity android:name=".app.RunLocalBenchmarksActivity" + android:exported="true"> <intent-filter> - <action android:name="com.android.benchmark.ACTION_BENCHMARK" /> + <action android:name="com.android.benchmark.ACTION_BENCHMARK"/> </intent-filter> - <meta-data - android:name="com.android.benchmark.benchmark_group" - android:resource="@xml/benchmark" /> + <meta-data android:name="com.android.benchmark.benchmark_group" + android:resource="@xml/benchmark"/> </activity> - <activity android:name=".ui.ListViewScrollActivity" /> - <activity android:name=".ui.ImageListViewScrollActivity" /> - <activity android:name=".ui.ShadowGridActivity" /> - <activity android:name=".ui.TextScrollActivity" /> - <activity android:name=".ui.EditTextInputActivity" /> - <activity android:name=".synthetic.MemoryActivity" /> - <activity android:name=".ui.FullScreenOverdrawActivity"></activity> - <activity android:name=".ui.BitmapUploadActivity"></activity> + <activity android:name=".ui.ListViewScrollActivity"/> + <activity android:name=".ui.ImageListViewScrollActivity"/> + <activity android:name=".ui.ShadowGridActivity"/> + <activity android:name=".ui.TextScrollActivity"/> + <activity android:name=".ui.EditTextInputActivity"/> + <activity android:name=".synthetic.MemoryActivity"/> + <activity android:name=".ui.FullScreenOverdrawActivity"/> + <activity android:name=".ui.BitmapUploadActivity"/> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/tests/JobSchedulerTestApp/AndroidManifest.xml b/tests/JobSchedulerTestApp/AndroidManifest.xml index 96541972b9b8..aeeaba469a2a 100644 --- a/tests/JobSchedulerTestApp/AndroidManifest.xml +++ b/tests/JobSchedulerTestApp/AndroidManifest.xml @@ -1,32 +1,30 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.demo.jobSchedulerApp" > + package="com.android.demo.jobSchedulerApp"> - <uses-sdk - android:minSdkVersion="18" - android:targetSdkVersion="18" /> + <uses-sdk android:minSdkVersion="18" + android:targetSdkVersion="18"/> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - <activity - android:name="com.android.demo.jobSchedulerApp.MainActivity" - android:label="@string/app_name" - android:windowSoftInputMode="stateHidden" > + <application android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme"> + <activity android:name="com.android.demo.jobSchedulerApp.MainActivity" + android:label="@string/app_name" + android:windowSoftInputMode="stateHidden" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <service - android:name=".service.TestJobService" - android:permission="android.permission.BIND_JOB_SERVICE" - android:exported="true"/> + <service android:name=".service.TestJobService" + android:permission="android.permission.BIND_JOB_SERVICE" + android:exported="true"/> </application> </manifest> diff --git a/tests/LargeAssetTest/AndroidManifest.xml b/tests/LargeAssetTest/AndroidManifest.xml index c86118e492e5..ac55dcb66be8 100644 --- a/tests/LargeAssetTest/AndroidManifest.xml +++ b/tests/LargeAssetTest/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,15 +13,18 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.largeassettest"> + package="com.android.largeassettest"> <application> - <activity android:name="LargeAssetTest" android:label="Large Asset Test"> + <activity android:name="LargeAssetTest" + android:label="Large Asset Test" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/LegacyAssistant/AndroidManifest.xml b/tests/LegacyAssistant/AndroidManifest.xml index 7ae510379980..942eafa06f35 100644 --- a/tests/LegacyAssistant/AndroidManifest.xml +++ b/tests/LegacyAssistant/AndroidManifest.xml @@ -15,22 +15,23 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.legacyassistant"> + package="com.google.android.test.legacyassistant"> <application android:label="@string/activity_title"> <activity android:name=".AssistActivity" - android:theme="@android:style/Theme.NoTitleBar"> + android:theme="@android:style/Theme.NoTitleBar" + android:exported="true"> <!-- Handle assist intent --> <intent-filter> - <action android:name="android.intent.action.ASSIST" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.intent.action.ASSIST"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <!-- Provide icon for search --> <meta-data android:name="com.android.systemui.action_assist_icon" - android:resource="@drawable/ic_action_assist" /> + android:resource="@drawable/ic_action_assist"/> </activity> diff --git a/tests/LocationTracker/AndroidManifest.xml b/tests/LocationTracker/AndroidManifest.xml index dc7ea99849e0..0940ee31db1f 100644 --- a/tests/LocationTracker/AndroidManifest.xml +++ b/tests/LocationTracker/AndroidManifest.xml @@ -1,30 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.locationtracker"> + package="com.android.locationtracker"> <!-- Permissions for the Location Service --> - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <!-- Permission for wifi --> - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <!-- give the location tracker ability to induce device insomnia --> - <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.WAKE_LOCK"/> <!-- Permission for SD card --> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:label="@string/app_label"> - <activity android:name="TrackerActivity" android:label="Location Tracker"> + <activity android:name="TrackerActivity" + android:label="Location Tracker" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <service android:name=".TrackerService" /> - <activity android:label="@string/settings_menu" android:name="SettingsActivity" /> + <service android:name=".TrackerService"/> + <activity android:label="@string/settings_menu" + android:name="SettingsActivity"/> <provider android:name=".data.TrackerProvider" - android:authorities="com.android.locationtracker" /> + android:authorities="com.android.locationtracker"/> </application> </manifest> diff --git a/tests/LockTaskTests/AndroidManifest.xml b/tests/LockTaskTests/AndroidManifest.xml index e349c9248263..3ffdc4712b0e 100644 --- a/tests/LockTaskTests/AndroidManifest.xml +++ b/tests/LockTaskTests/AndroidManifest.xml @@ -1,56 +1,51 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.example.locktasktests" - android:versionCode="1" - android:versionName="1.0" > + package="com.google.android.example.locktasktests" + android:versionCode="1" + android:versionName="1.0"> - <uses-sdk - android:minSdkVersion="22" - android:targetSdkVersion="22" /> + <uses-sdk android:minSdkVersion="22" + android:targetSdkVersion="22"/> <uses-permission android:name="android.permission.INTERNET"/> - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" - android:allowBackup="true" > - <activity - android:name="com.google.android.example.locktasktests.MainActivity" - android:label="@string/app_name" - android:screenOrientation="portrait" - android:theme="@style/AppTheme" > + <application android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" + android:allowBackup="true"> + <activity android:name="com.google.android.example.locktasktests.MainActivity" + android:label="@string/app_name" + android:screenOrientation="portrait" + android:theme="@style/AppTheme" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity - android:name="com.google.android.example.locktasktests.LockDefaultActivity" - android:label="@string/title_activity_default" - android:taskAffinity="" - android:documentLaunchMode="always" - android:lockTaskMode="normal" > + <activity android:name="com.google.android.example.locktasktests.LockDefaultActivity" + android:label="@string/title_activity_default" + android:taskAffinity="" + android:documentLaunchMode="always" + android:lockTaskMode="normal"> </activity> - <activity - android:name="com.google.android.example.locktasktests.LockTaskNeverActivity" - android:label="@string/title_activity_never" - android:taskAffinity="" - android:documentLaunchMode="always" - android:lockTaskMode="never" > + <activity android:name="com.google.android.example.locktasktests.LockTaskNeverActivity" + android:label="@string/title_activity_never" + android:taskAffinity="" + android:documentLaunchMode="always" + android:lockTaskMode="never"> </activity> - <activity - android:name="com.google.android.example.locktasktests.LockWhitelistedActivity" - android:label="@string/title_activity_whitelist" - android:taskAffinity="" - android:documentLaunchMode="always" - android:lockTaskMode="if_whitelisted" > + <activity android:name="com.google.android.example.locktasktests.LockWhitelistedActivity" + android:label="@string/title_activity_whitelist" + android:taskAffinity="" + android:documentLaunchMode="always" + android:lockTaskMode="if_whitelisted"> </activity> - <activity - android:name="com.google.android.example.locktasktests.LockAtLaunchActivity" - android:label="@string/title_activity_always" - android:taskAffinity="" - android:documentLaunchMode="always" - android:lockTaskMode="always" > + <activity android:name="com.google.android.example.locktasktests.LockAtLaunchActivity" + android:label="@string/title_activity_always" + android:taskAffinity="" + android:documentLaunchMode="always" + android:lockTaskMode="always"> </activity> </application> diff --git a/tests/LotsOfApps/AndroidManifest.xml b/tests/LotsOfApps/AndroidManifest.xml index 585ddccf8450..3aed04391103 100644 --- a/tests/LotsOfApps/AndroidManifest.xml +++ b/tests/LotsOfApps/AndroidManifest.xml @@ -1,710 +1,912 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.lotsofapps"> - <uses-permission android:name="android.permission.DEVICE_POWER" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> - <uses-permission android:name="android.permission.STATUS_BAR" /> - <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> - <uses-permission android:name="android.permission.VIBRATE" /> + package="com.android.lotsofapps"> + <uses-permission android:name="android.permission.DEVICE_POWER"/> + <uses-permission android:name="android.permission.WAKE_LOCK"/> + <uses-permission android:name="android.permission.STATUS_BAR"/> + <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/> + <uses-permission android:name="android.permission.VIBRATE"/> <application> - <activity android:name="com.android.lotsofapps.activity00" android:icon="@drawable/ic_launcher_add_folder"> + <activity android:name="com.android.lotsofapps.activity00" + android:icon="@drawable/ic_launcher_add_folder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity01" android:icon="@drawable/ic_launcher_alarmclock"> + <activity android:name="com.android.lotsofapps.activity01" + android:icon="@drawable/ic_launcher_alarmclock" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity02" android:icon="@drawable/ic_launcher_application"> + <activity android:name="com.android.lotsofapps.activity02" + android:icon="@drawable/ic_launcher_application" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity03" android:icon="@drawable/ic_launcher_browser"> + <activity android:name="com.android.lotsofapps.activity03" + android:icon="@drawable/ic_launcher_browser" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity04" android:icon="@drawable/ic_launcher_camera"> + <activity android:name="com.android.lotsofapps.activity04" + android:icon="@drawable/ic_launcher_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity05" android:icon="@drawable/ic_launcher_camera_record"> + <activity android:name="com.android.lotsofapps.activity05" + android:icon="@drawable/ic_launcher_camera_record" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity06" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity06" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity07" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity07" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity08" android:icon="@drawable/ic_launcher_folder"> + <activity android:name="com.android.lotsofapps.activity08" + android:icon="@drawable/ic_launcher_folder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity09" android:icon="@drawable/ic_launcher_folder_bluetooth"> + <activity android:name="com.android.lotsofapps.activity09" + android:icon="@drawable/ic_launcher_folder_bluetooth" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity10" android:icon="@drawable/ic_launcher_folder_live"> + <activity android:name="com.android.lotsofapps.activity10" + android:icon="@drawable/ic_launcher_folder_live" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity11" android:icon="@drawable/ic_launcher_folder_live_contacts"> + <activity android:name="com.android.lotsofapps.activity11" + android:icon="@drawable/ic_launcher_folder_live_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity12" android:icon="@drawable/ic_launcher_folder_live_contacts_phone"> + <activity android:name="com.android.lotsofapps.activity12" + android:icon="@drawable/ic_launcher_folder_live_contacts_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity13" android:icon="@drawable/ic_launcher_folder_live_contacts_starred"> + <activity android:name="com.android.lotsofapps.activity13" + android:icon="@drawable/ic_launcher_folder_live_contacts_starred" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity14" android:icon="@drawable/ic_launcher_folder_open"> + <activity android:name="com.android.lotsofapps.activity14" + android:icon="@drawable/ic_launcher_folder_open" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity15" android:icon="@drawable/ic_launcher_gallery"> + <activity android:name="com.android.lotsofapps.activity15" + android:icon="@drawable/ic_launcher_gallery" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity16" android:icon="@drawable/ic_launcher_home"> + <activity android:name="com.android.lotsofapps.activity16" + android:icon="@drawable/ic_launcher_home" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity17" android:icon="@drawable/ic_launcher_im"> + <activity android:name="com.android.lotsofapps.activity17" + android:icon="@drawable/ic_launcher_im" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity18" android:icon="@drawable/ic_launcher_musicplayer_2"> + <activity android:name="com.android.lotsofapps.activity18" + android:icon="@drawable/ic_launcher_musicplayer_2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity19" android:icon="@drawable/ic_launcher_phone"> + <activity android:name="com.android.lotsofapps.activity19" + android:icon="@drawable/ic_launcher_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity20" android:icon="@drawable/ic_launcher_record_audio"> + <activity android:name="com.android.lotsofapps.activity20" + android:icon="@drawable/ic_launcher_record_audio" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity21" android:icon="@drawable/ic_launcher_settings"> + <activity android:name="com.android.lotsofapps.activity21" + android:icon="@drawable/ic_launcher_settings" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity22" android:icon="@drawable/ic_launcher_shortcut"> + <activity android:name="com.android.lotsofapps.activity22" + android:icon="@drawable/ic_launcher_shortcut" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity23" android:icon="@drawable/ic_launcher_shortcut_browser_bookmark"> + <activity android:name="com.android.lotsofapps.activity23" + android:icon="@drawable/ic_launcher_shortcut_browser_bookmark" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity24" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity24" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity25" android:icon="@drawable/ic_launcher_shortcut_directdial"> + <activity android:name="com.android.lotsofapps.activity25" + android:icon="@drawable/ic_launcher_shortcut_directdial" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity26" android:icon="@drawable/ic_launcher_shortcut_directmessage"> + <activity android:name="com.android.lotsofapps.activity26" + android:icon="@drawable/ic_launcher_shortcut_directmessage" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity27" android:icon="@drawable/ic_launcher_browser"> + <activity android:name="com.android.lotsofapps.activity27" + android:icon="@drawable/ic_launcher_browser" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity28" android:icon="@drawable/ic_launcher_sim_toolkit"> + <activity android:name="com.android.lotsofapps.activity28" + android:icon="@drawable/ic_launcher_sim_toolkit" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity29" android:icon="@drawable/ic_launcher_slideshow_add_sms"> + <activity android:name="com.android.lotsofapps.activity29" + android:icon="@drawable/ic_launcher_slideshow_add_sms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity20" android:icon="@drawable/ic_launcher_slideshow_default_sms"> + <activity android:name="com.android.lotsofapps.activity20" + android:icon="@drawable/ic_launcher_slideshow_default_sms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity31" android:icon="@drawable/ic_launcher_smsmms"> + <activity android:name="com.android.lotsofapps.activity31" + android:icon="@drawable/ic_launcher_smsmms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity32" android:icon="@drawable/ic_launcher_soundrecorder"> + <activity android:name="com.android.lotsofapps.activity32" + android:icon="@drawable/ic_launcher_soundrecorder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity33" android:icon="@drawable/ic_launcher_video_camera"> + <activity android:name="com.android.lotsofapps.activity33" + android:icon="@drawable/ic_launcher_video_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity34" android:icon="@drawable/ic_launcher_video_player"> + <activity android:name="com.android.lotsofapps.activity34" + android:icon="@drawable/ic_launcher_video_player" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity35" android:icon="@drawable/ic_launcher_wallpaper"> + <activity android:name="com.android.lotsofapps.activity35" + android:icon="@drawable/ic_launcher_wallpaper" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity36" android:icon="@drawable/ic_launcher_im"> + <activity android:name="com.android.lotsofapps.activity36" + android:icon="@drawable/ic_launcher_im" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity37" android:icon="@drawable/ic_launcher_musicplayer_2"> + <activity android:name="com.android.lotsofapps.activity37" + android:icon="@drawable/ic_launcher_musicplayer_2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity38" android:icon="@drawable/ic_launcher_phone"> + <activity android:name="com.android.lotsofapps.activity38" + android:icon="@drawable/ic_launcher_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity39" android:icon="@drawable/ic_launcher_record_audio"> + <activity android:name="com.android.lotsofapps.activity39" + android:icon="@drawable/ic_launcher_record_audio" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity40" android:icon="@drawable/ic_launcher_settings"> + <activity android:name="com.android.lotsofapps.activity40" + android:icon="@drawable/ic_launcher_settings" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity41" android:icon="@drawable/ic_launcher_shortcut"> + <activity android:name="com.android.lotsofapps.activity41" + android:icon="@drawable/ic_launcher_shortcut" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity42" android:icon="@drawable/ic_launcher_sim_toolkit"> + <activity android:name="com.android.lotsofapps.activity42" + android:icon="@drawable/ic_launcher_sim_toolkit" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity43" android:icon="@drawable/ic_launcher_smsmms"> + <activity android:name="com.android.lotsofapps.activity43" + android:icon="@drawable/ic_launcher_smsmms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity44" android:icon="@drawable/ic_launcher_soundrecorder"> + <activity android:name="com.android.lotsofapps.activity44" + android:icon="@drawable/ic_launcher_soundrecorder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity45" android:icon="@drawable/ic_launcher_video_camera"> + <activity android:name="com.android.lotsofapps.activity45" + android:icon="@drawable/ic_launcher_video_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity46" android:icon="@drawable/ic_launcher_wallpaper"> + <activity android:name="com.android.lotsofapps.activity46" + android:icon="@drawable/ic_launcher_wallpaper" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity47" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity47" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity48" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity48" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity49" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity49" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity50" android:icon="@drawable/ic_launcher_add_folder"> + <activity android:name="com.android.lotsofapps.activity50" + android:icon="@drawable/ic_launcher_add_folder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity51" android:icon="@drawable/ic_launcher_alarmclock"> + <activity android:name="com.android.lotsofapps.activity51" + android:icon="@drawable/ic_launcher_alarmclock" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity52" android:icon="@drawable/ic_launcher_application"> + <activity android:name="com.android.lotsofapps.activity52" + android:icon="@drawable/ic_launcher_application" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity53" android:icon="@drawable/ic_launcher_browser"> + <activity android:name="com.android.lotsofapps.activity53" + android:icon="@drawable/ic_launcher_browser" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity54" android:icon="@drawable/ic_launcher_camera"> + <activity android:name="com.android.lotsofapps.activity54" + android:icon="@drawable/ic_launcher_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity55" android:icon="@drawable/ic_launcher_camera_record"> + <activity android:name="com.android.lotsofapps.activity55" + android:icon="@drawable/ic_launcher_camera_record" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity56" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity56" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity57" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity57" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity58" android:icon="@drawable/ic_launcher_folder"> + <activity android:name="com.android.lotsofapps.activity58" + android:icon="@drawable/ic_launcher_folder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity59" android:icon="@drawable/ic_launcher_folder_bluetooth"> + <activity android:name="com.android.lotsofapps.activity59" + android:icon="@drawable/ic_launcher_folder_bluetooth" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity60" android:icon="@drawable/ic_launcher_folder_live"> + <activity android:name="com.android.lotsofapps.activity60" + android:icon="@drawable/ic_launcher_folder_live" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity61" android:icon="@drawable/ic_launcher_folder_live_contacts"> + <activity android:name="com.android.lotsofapps.activity61" + android:icon="@drawable/ic_launcher_folder_live_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity62" android:icon="@drawable/ic_launcher_folder_live_contacts_phone"> + <activity android:name="com.android.lotsofapps.activity62" + android:icon="@drawable/ic_launcher_folder_live_contacts_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity63" android:icon="@drawable/ic_launcher_folder_live_contacts_starred"> + <activity android:name="com.android.lotsofapps.activity63" + android:icon="@drawable/ic_launcher_folder_live_contacts_starred" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity64" android:icon="@drawable/ic_launcher_folder_open"> + <activity android:name="com.android.lotsofapps.activity64" + android:icon="@drawable/ic_launcher_folder_open" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity65" android:icon="@drawable/ic_launcher_gallery"> + <activity android:name="com.android.lotsofapps.activity65" + android:icon="@drawable/ic_launcher_gallery" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity66" android:icon="@drawable/ic_launcher_home"> + <activity android:name="com.android.lotsofapps.activity66" + android:icon="@drawable/ic_launcher_home" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity67" android:icon="@drawable/ic_launcher_im"> + <activity android:name="com.android.lotsofapps.activity67" + android:icon="@drawable/ic_launcher_im" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity68" android:icon="@drawable/ic_launcher_musicplayer_2"> + <activity android:name="com.android.lotsofapps.activity68" + android:icon="@drawable/ic_launcher_musicplayer_2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity69" android:icon="@drawable/ic_launcher_phone"> + <activity android:name="com.android.lotsofapps.activity69" + android:icon="@drawable/ic_launcher_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity70" android:icon="@drawable/ic_launcher_record_audio"> + <activity android:name="com.android.lotsofapps.activity70" + android:icon="@drawable/ic_launcher_record_audio" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity71" android:icon="@drawable/ic_launcher_settings"> + <activity android:name="com.android.lotsofapps.activity71" + android:icon="@drawable/ic_launcher_settings" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity72" android:icon="@drawable/ic_launcher_shortcut"> + <activity android:name="com.android.lotsofapps.activity72" + android:icon="@drawable/ic_launcher_shortcut" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity73" android:icon="@drawable/ic_launcher_shortcut_browser_bookmark"> + <activity android:name="com.android.lotsofapps.activity73" + android:icon="@drawable/ic_launcher_shortcut_browser_bookmark" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity74" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity74" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity75" android:icon="@drawable/ic_launcher_shortcut_directdial"> + <activity android:name="com.android.lotsofapps.activity75" + android:icon="@drawable/ic_launcher_shortcut_directdial" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity76" android:icon="@drawable/ic_launcher_shortcut_directmessage"> + <activity android:name="com.android.lotsofapps.activity76" + android:icon="@drawable/ic_launcher_shortcut_directmessage" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity77" android:icon="@drawable/ic_launcher_browser"> + <activity android:name="com.android.lotsofapps.activity77" + android:icon="@drawable/ic_launcher_browser" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity78" android:icon="@drawable/ic_launcher_sim_toolkit"> + <activity android:name="com.android.lotsofapps.activity78" + android:icon="@drawable/ic_launcher_sim_toolkit" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity79" android:icon="@drawable/ic_launcher_slideshow_add_sms"> + <activity android:name="com.android.lotsofapps.activity79" + android:icon="@drawable/ic_launcher_slideshow_add_sms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity80" android:icon="@drawable/ic_launcher_slideshow_default_sms"> + <activity android:name="com.android.lotsofapps.activity80" + android:icon="@drawable/ic_launcher_slideshow_default_sms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity81" android:icon="@drawable/ic_launcher_smsmms"> + <activity android:name="com.android.lotsofapps.activity81" + android:icon="@drawable/ic_launcher_smsmms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity82" android:icon="@drawable/ic_launcher_soundrecorder"> + <activity android:name="com.android.lotsofapps.activity82" + android:icon="@drawable/ic_launcher_soundrecorder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity83" android:icon="@drawable/ic_launcher_video_camera"> + <activity android:name="com.android.lotsofapps.activity83" + android:icon="@drawable/ic_launcher_video_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity84" android:icon="@drawable/ic_launcher_video_player"> + <activity android:name="com.android.lotsofapps.activity84" + android:icon="@drawable/ic_launcher_video_player" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity85" android:icon="@drawable/ic_launcher_wallpaper"> + <activity android:name="com.android.lotsofapps.activity85" + android:icon="@drawable/ic_launcher_wallpaper" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity86" android:icon="@drawable/ic_launcher_im"> + <activity android:name="com.android.lotsofapps.activity86" + android:icon="@drawable/ic_launcher_im" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity87" android:icon="@drawable/ic_launcher_musicplayer_2"> + <activity android:name="com.android.lotsofapps.activity87" + android:icon="@drawable/ic_launcher_musicplayer_2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity88" android:icon="@drawable/ic_launcher_phone"> + <activity android:name="com.android.lotsofapps.activity88" + android:icon="@drawable/ic_launcher_phone" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity89" android:icon="@drawable/ic_launcher_record_audio"> + <activity android:name="com.android.lotsofapps.activity89" + android:icon="@drawable/ic_launcher_record_audio" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity90" android:icon="@drawable/ic_launcher_settings"> + <activity android:name="com.android.lotsofapps.activity90" + android:icon="@drawable/ic_launcher_settings" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity91" android:icon="@drawable/ic_launcher_shortcut"> + <activity android:name="com.android.lotsofapps.activity91" + android:icon="@drawable/ic_launcher_shortcut" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity92" android:icon="@drawable/ic_launcher_sim_toolkit"> + <activity android:name="com.android.lotsofapps.activity92" + android:icon="@drawable/ic_launcher_sim_toolkit" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity93" android:icon="@drawable/ic_launcher_smsmms"> + <activity android:name="com.android.lotsofapps.activity93" + android:icon="@drawable/ic_launcher_smsmms" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity94" android:icon="@drawable/ic_launcher_soundrecorder"> + <activity android:name="com.android.lotsofapps.activity94" + android:icon="@drawable/ic_launcher_soundrecorder" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity95" android:icon="@drawable/ic_launcher_video_camera"> + <activity android:name="com.android.lotsofapps.activity95" + android:icon="@drawable/ic_launcher_video_camera" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity96" android:icon="@drawable/ic_launcher_wallpaper"> + <activity android:name="com.android.lotsofapps.activity96" + android:icon="@drawable/ic_launcher_wallpaper" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity97" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity97" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity98" android:icon="@drawable/ic_launcher_contacts"> + <activity android:name="com.android.lotsofapps.activity98" + android:icon="@drawable/ic_launcher_contacts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="com.android.lotsofapps.activity99" android:icon="@drawable/ic_launcher_drm_file"> + <activity android:name="com.android.lotsofapps.activity99" + android:icon="@drawable/ic_launcher_drm_file" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/LowStorageTest/AndroidManifest.xml b/tests/LowStorageTest/AndroidManifest.xml index 9d4a63ac330f..5b496562ab27 100644 --- a/tests/LowStorageTest/AndroidManifest.xml +++ b/tests/LowStorageTest/AndroidManifest.xml @@ -1,13 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.lowstoragetest"> + package="com.android.lowstoragetest"> <application android:label="LowStorageTest"> <activity android:name="LowStorageTest" - android:theme="@android:style/Theme.Black.NoTitleBar"> + android:theme="@android:style/Theme.Black.NoTitleBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/tests/ManagedProfileLifecycleStressTest/app/DummyDPC/AndroidManifest.xml b/tests/ManagedProfileLifecycleStressTest/app/DummyDPC/AndroidManifest.xml index 860940d4e025..aefb07661f7e 100644 --- a/tests/ManagedProfileLifecycleStressTest/app/DummyDPC/AndroidManifest.xml +++ b/tests/ManagedProfileLifecycleStressTest/app/DummyDPC/AndroidManifest.xml @@ -15,17 +15,16 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.dummydpc"> + package="com.android.dummydpc"> - <application - android:testOnly="true"> - <receiver - android:name="com.android.dummydpc.DummyDeviceAdminReceiver" - android:permission="android.permission.BIND_DEVICE_ADMIN"> + <application android:testOnly="true"> + <receiver android:name="com.android.dummydpc.DummyDeviceAdminReceiver" + android:permission="android.permission.BIND_DEVICE_ADMIN" + android:exported="true"> <meta-data android:name="android.app.device_admin" - android:resource="@xml/device_admin" /> + android:resource="@xml/device_admin"/> <intent-filter> - <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" /> + <action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/> </intent-filter> </receiver> </application> diff --git a/tests/MirrorSurfaceTest/AndroidManifest.xml b/tests/MirrorSurfaceTest/AndroidManifest.xml index 123cd0f26ff3..6385cc8a9d22 100644 --- a/tests/MirrorSurfaceTest/AndroidManifest.xml +++ b/tests/MirrorSurfaceTest/AndroidManifest.xml @@ -16,14 +16,15 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.mirrorsurface"> + package="com.google.android.test.mirrorsurface"> <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER"/> - <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <application android:label="MirrorSurfaceTest"> <activity android:name=".MirrorSurfaceActivity" - android:label="Mirror Surface" - android:configChanges="orientation|screenSize"> + android:label="Mirror Surface" + android:configChanges="orientation|screenSize" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/tests/OneMedia/AndroidManifest.xml b/tests/OneMedia/AndroidManifest.xml index 8697f1b085bf..7fc352405212 100644 --- a/tests/OneMedia/AndroidManifest.xml +++ b/tests/OneMedia/AndroidManifest.xml @@ -1,33 +1,33 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.onemedia" - android:versionCode="1" - android:versionName="1.0" > + package="com.android.onemedia" + android:versionCode="1" + android:versionName="1.0"> <uses-sdk android:minSdkVersion="19"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > + <application android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme"> - <uses-library android:name="org.apache.http.legacy" android:required="false" /> - <activity - android:name="com.android.onemedia.OnePlayerActivity" - android:label="@string/app_name" > + <uses-library android:name="org.apache.http.legacy" + android:required="false"/> + <activity android:name="com.android.onemedia.OnePlayerActivity" + android:label="@string/app_name" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <service - android:name="com.android.onemedia.OnePlayerService" - android:exported="true" - android:process="com.android.onemedia.service" /> + <service android:name="com.android.onemedia.OnePlayerService" + android:exported="true" + android:process="com.android.onemedia.service"/> </application> </manifest> diff --git a/tests/RenderThreadTest/AndroidManifest.xml b/tests/RenderThreadTest/AndroidManifest.xml index a7f4f6e9c5c8..22a4e43c988c 100644 --- a/tests/RenderThreadTest/AndroidManifest.xml +++ b/tests/RenderThreadTest/AndroidManifest.xml @@ -1,25 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.renderthread" - android:versionCode="1" - android:versionName="1.0" > + package="com.example.renderthread" + android:versionCode="1" + android:versionName="1.0"> - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > + <application android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme"> + <activity android:name=".MainActivity" + android:label="@string/app_name" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".SubActivity" - android:theme="@style/AppTheme.Transparent" /> + android:theme="@style/AppTheme.Transparent"/> </application> </manifest> diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp index 2be4ae6bb214..7dd003eb9755 100644 --- a/tests/RollbackTest/Android.bp +++ b/tests/RollbackTest/Android.bp @@ -15,6 +15,7 @@ android_test { name: "RollbackTest", manifest: "RollbackTest/AndroidManifest.xml", + platform_apis: true, srcs: ["RollbackTest/src/**/*.java"], static_libs: ["androidx.test.rules", "cts-rollback-lib", "cts-install-lib"], test_suites: ["general-tests"], @@ -29,7 +30,12 @@ java_test_host { name: "StagedRollbackTest", srcs: ["StagedRollbackTest/src/**/*.java"], libs: ["tradefed"], - static_libs: ["testng", "compatibility-tradefed", "RollbackTestLib"], + static_libs: [ + "compatibility-tradefed", + "frameworks-base-hostutils", + "RollbackTestLib", + "testng", + ], test_suites: ["general-tests"], test_config: "StagedRollbackTest.xml", data: [":com.android.apex.apkrollback.test_v1"], @@ -39,7 +45,7 @@ java_test_host { name: "NetworkStagedRollbackTest", srcs: ["NetworkStagedRollbackTest/src/**/*.java"], libs: ["tradefed"], - static_libs: ["RollbackTestLib"], + static_libs: ["RollbackTestLib", "frameworks-base-hostutils"], test_suites: ["general-tests"], test_config: "NetworkStagedRollbackTest.xml", } @@ -48,6 +54,9 @@ java_test_host { name: "MultiUserRollbackTest", srcs: ["MultiUserRollbackTest/src/**/*.java"], libs: ["tradefed"], + static_libs: [ + "frameworks-base-hostutils", + ], test_suites: ["general-tests"], test_config: "MultiUserRollbackTest.xml", } diff --git a/tests/RollbackTest/MultiUserRollbackTest/src/com/android/tests/rollback/host/MultiUserRollbackTest.java b/tests/RollbackTest/MultiUserRollbackTest/src/com/android/tests/rollback/host/MultiUserRollbackTest.java index 42b886f0774f..741745560c61 100644 --- a/tests/RollbackTest/MultiUserRollbackTest/src/com/android/tests/rollback/host/MultiUserRollbackTest.java +++ b/tests/RollbackTest/MultiUserRollbackTest/src/com/android/tests/rollback/host/MultiUserRollbackTest.java @@ -24,6 +24,7 @@ import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,6 +41,9 @@ public class MultiUserRollbackTest extends BaseHostJUnit4Test { private static final long SWITCH_USER_COMPLETED_NUMBER_OF_POLLS = 60; private static final long SWITCH_USER_COMPLETED_POLL_INTERVAL_IN_MILLIS = 1000; + @Rule + public AbandonSessionsRule mHostTestRule = new AbandonSessionsRule(this); + @After public void tearDown() throws Exception { removeSecondaryUserIfNecessary(); @@ -59,6 +63,37 @@ public class MultiUserRollbackTest extends BaseHostJUnit4Test { runPhaseForUsers("testBasic", mSecondaryUserId); } + /** + * Tests staged install/rollback works correctly on the 2nd user. + */ + @Test + public void testStagedRollback() throws Exception { + runPhaseForUsers("testStagedRollback_Phase1", mSecondaryUserId); + getDevice().reboot(); + + // Need to unlock the user for device tests to run successfully + getDevice().startUser(mSecondaryUserId); + awaitUserUnlocked(mSecondaryUserId); + runPhaseForUsers("testStagedRollback_Phase2", mSecondaryUserId); + getDevice().reboot(); + + getDevice().startUser(mSecondaryUserId); + awaitUserUnlocked(mSecondaryUserId); + runPhaseForUsers("testStagedRollback_Phase3", mSecondaryUserId); + getDevice().reboot(); + + getDevice().startUser(mSecondaryUserId); + awaitUserUnlocked(mSecondaryUserId); + runPhaseForUsers("testStagedRollback_Phase4", mSecondaryUserId); + } + + @Test + public void testBadUpdateRollback() throws Exception { + // Need to switch user in order to send broadcasts in device tests + assertTrue(getDevice().switchUser(mSecondaryUserId)); + runPhaseForUsers("testBadUpdateRollback", mSecondaryUserId); + } + @Test public void testMultipleUsers() throws Exception { runPhaseForUsers("testMultipleUsersInstallV1", mOriginalUserId, mSecondaryUserId); @@ -83,6 +118,8 @@ public class MultiUserRollbackTest extends BaseHostJUnit4Test { private void removeSecondaryUserIfNecessary() throws Exception { if (mSecondaryUserId != -1) { + // Can't remove the 2nd user without switching out of it + assertTrue(getDevice().switchUser(mOriginalUserId)); getDevice().removeUser(mSecondaryUserId); mSecondaryUserId = -1; } diff --git a/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java b/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java index 61d7c763e8d7..b7d72dbe22ae 100644 --- a/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java +++ b/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java @@ -26,6 +26,8 @@ import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -57,6 +59,9 @@ public class NetworkStagedRollbackTest extends BaseHostJUnit4Test { private WatchdogEventLogger mLogger = new WatchdogEventLogger(); + @Rule + public AbandonSessionsRule mHostTestRule = new AbandonSessionsRule(this); + @Before public void setUp() throws Exception { runPhase("cleanUp"); @@ -72,6 +77,7 @@ public class NetworkStagedRollbackTest extends BaseHostJUnit4Test { /** * Tests failed network health check triggers watchdog staged rollbacks. */ + @Ignore("b/159569441") @Test public void testNetworkFailedRollback() throws Exception { try { diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/MultiUserRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/MultiUserRollbackTest.java index 8641f4d4013a..d37dd7b9ceab 100644 --- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/MultiUserRollbackTest.java +++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/MultiUserRollbackTest.java @@ -70,6 +70,11 @@ public class MultiUserRollbackTest { new RollbackTest().testBasic(); } + @Test + public void testBadUpdateRollback() throws Exception { + new RollbackTest().testBadUpdateRollback(); + } + /** * Install version 1 of the test app. This method is run for both users. */ @@ -115,4 +120,32 @@ public class MultiUserRollbackTest { assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); InstallUtils.processUserData(TestApp.A); } + + @Test + public void testStagedRollback_Phase1() throws Exception { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1); + Install.single(TestApp.A1).setStaged().commit(); + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1); + } + + @Test + public void testStagedRollback_Phase2() throws Exception { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); + Install.single(TestApp.A2).setStaged().setEnableRollback().commit(); + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); + } + + @Test + public void testStagedRollback_Phase3() throws Exception { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(2); + RollbackInfo rollback = RollbackUtils.waitForAvailableRollback(TestApp.A); + assertThat(rollback).packagesContainsExactly(Rollback.from(TestApp.A2).to(TestApp.A1)); + RollbackUtils.rollback(rollback.getRollbackId()); + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(2); + } + + @Test + public void testStagedRollback_Phase4() { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); + } } diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java index dd08771b220d..0db2b2af7260 100644 --- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java +++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java @@ -175,7 +175,7 @@ public class RollbackTest { assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); UserManager um = (UserManager) context.getSystemService(context.USER_SERVICE); - List<Integer> userIds = um.getUsers(true) + List<Integer> userIds = um.getAliveUsers() .stream().map(user -> user.id).collect(Collectors.toList()); assertThat(InstallUtils.isOnlyInstalledForUser(TestApp.A, context.getUserId(), userIds)).isTrue(); @@ -1193,28 +1193,34 @@ public class RollbackTest { Manifest.permission.DELETE_PACKAGES, Manifest.permission.TEST_MANAGE_ROLLBACKS); - Uninstall.packages(TestApp.A, TestApp.B); - Install.multi(TestApp.A1, TestApp.B1).commit(); + Uninstall.packages(TestApp.A, TestApp.B, TestApp.C); + Install.multi(TestApp.A1, TestApp.B1, TestApp.C1).commit(); // Write user data version = 1 InstallUtils.processUserData(TestApp.A); InstallUtils.processUserData(TestApp.B); + InstallUtils.processUserData(TestApp.C); Install a2 = Install.single(TestApp.A2) .setEnableRollback(PackageManager.RollbackDataPolicy.WIPE); Install b2 = Install.single(TestApp.B2) .setEnableRollback(PackageManager.RollbackDataPolicy.RESTORE); - Install.multi(a2, b2).setEnableRollback().commit(); + // The rollback data policy of C2 is specified in the manifest + Install c2 = Install.single(TestApp.C2).setEnableRollback(); + Install.multi(a2, b2, c2).setEnableRollback().commit(); // Write user data version = 2 InstallUtils.processUserData(TestApp.A); InstallUtils.processUserData(TestApp.B); + InstallUtils.processUserData(TestApp.C); RollbackInfo info = RollbackUtils.getAvailableRollback(TestApp.A); RollbackUtils.rollback(info.getRollbackId()); // Read user data version from userdata.txt // A's user data version is -1 for user data is wiped. // B's user data version is 1 as rollback committed. + // C's user data version is -1 for user data is wiped. assertThat(InstallUtils.getUserDataVersion(TestApp.A)).isEqualTo(-1); assertThat(InstallUtils.getUserDataVersion(TestApp.B)).isEqualTo(1); + assertThat(InstallUtils.getUserDataVersion(TestApp.C)).isEqualTo(-1); } finally { InstallUtils.dropShellPermissionIdentity(); } diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java index 00bd4cf388ce..ab2e4923c88e 100644 --- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java @@ -316,17 +316,20 @@ public class StagedRollbackTest { @Test public void testRollbackDataPolicy_Phase1() throws Exception { - Uninstall.packages(TestApp.A, TestApp.B); - Install.multi(TestApp.A1, TestApp.B1).commit(); + Uninstall.packages(TestApp.A, TestApp.B, TestApp.C); + Install.multi(TestApp.A1, TestApp.B1, TestApp.C1).commit(); // Write user data version = 1 InstallUtils.processUserData(TestApp.A); InstallUtils.processUserData(TestApp.B); + InstallUtils.processUserData(TestApp.C); Install a2 = Install.single(TestApp.A2).setStaged() .setEnableRollback(PackageManager.RollbackDataPolicy.WIPE); Install b2 = Install.single(TestApp.B2).setStaged() .setEnableRollback(PackageManager.RollbackDataPolicy.RESTORE); - Install.multi(a2, b2).setEnableRollback().setStaged().commit(); + // The rollback data policy of C2 is specified in the manifest + Install c2 = Install.single(TestApp.C2).setStaged().setEnableRollback(); + Install.multi(a2, b2, c2).setEnableRollback().setStaged().commit(); } @Test @@ -336,6 +339,7 @@ public class StagedRollbackTest { // Write user data version = 2 InstallUtils.processUserData(TestApp.A); InstallUtils.processUserData(TestApp.B); + InstallUtils.processUserData(TestApp.C); RollbackInfo info = RollbackUtils.getAvailableRollback(TestApp.A); RollbackUtils.rollback(info.getRollbackId()); @@ -345,11 +349,14 @@ public class StagedRollbackTest { public void testRollbackDataPolicy_Phase3() throws Exception { assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); assertThat(InstallUtils.getInstalledVersion(TestApp.B)).isEqualTo(1); + assertThat(InstallUtils.getInstalledVersion(TestApp.C)).isEqualTo(1); // Read user data version from userdata.txt // A's user data version is -1 for user data is wiped. // B's user data version is 1 as rollback committed. + // C's user data version is -1 for user data is wiped. assertThat(InstallUtils.getUserDataVersion(TestApp.A)).isEqualTo(-1); assertThat(InstallUtils.getUserDataVersion(TestApp.B)).isEqualTo(1); + assertThat(InstallUtils.getUserDataVersion(TestApp.C)).isEqualTo(-1); } @Test diff --git a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java index 9169ef517bf7..c2fd0c39221e 100644 --- a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +++ b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java @@ -34,6 +34,7 @@ import com.android.tradefed.util.CommandStatus; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -87,6 +88,9 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { private WatchdogEventLogger mLogger = new WatchdogEventLogger(); + @Rule + public AbandonSessionsRule mHostTestRule = new AbandonSessionsRule(this); + @Before public void setUp() throws Exception { deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex", @@ -256,11 +260,19 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { @Test public void testRollbackDataPolicy() throws Exception { + List<String> before = getSnapshotDirectories("/data/misc_ce/0/rollback"); + runPhase("testRollbackDataPolicy_Phase1"); getDevice().reboot(); runPhase("testRollbackDataPolicy_Phase2"); getDevice().reboot(); runPhase("testRollbackDataPolicy_Phase3"); + + // Verify snapshots are deleted after restoration + List<String> after = getSnapshotDirectories("/data/misc_ce/0/rollback"); + // Only check directories newly created during the test + after.removeAll(before); + after.forEach(dir -> assertDirectoryIsEmpty(dir)); } /** @@ -441,6 +453,32 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { after.forEach(dir -> assertDirectoryIsEmpty(dir)); } + @Test + public void testExpireApexRollback() throws Exception { + List<String> before = getSnapshotDirectories("/data/misc_ce/0/apexrollback"); + pushTestApex(); + + // Push files to apex data directory + String oldFilePath1 = apexDataDirCe(APK_IN_APEX_TESTAPEX_NAME, 0) + "/" + TEST_FILENAME_1; + String oldFilePath2 = + apexDataDirCe(APK_IN_APEX_TESTAPEX_NAME, 0) + TEST_SUBDIR + TEST_FILENAME_2; + assertTrue(getDevice().pushString(TEST_STRING_1, oldFilePath1)); + assertTrue(getDevice().pushString(TEST_STRING_2, oldFilePath2)); + + // Install new version of the APEX with rollback enabled + runPhase("testRollbackApexDataDirectories_Phase1"); + getDevice().reboot(); + + List<String> after = getSnapshotDirectories("/data/misc_ce/0/apexrollback"); + // Only check directories newly created during the test + after.removeAll(before); + // Expire all rollbacks and check CE snapshot directories are deleted + runPhase("testCleanUp"); + for (String dir : after) { + assertNull(getDevice().getFileEntry(dir)); + } + } + private void pushTestApex() throws Exception { CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild()); final String fileName = APK_IN_APEX_TESTAPEX_NAME + "_v1.apex"; diff --git a/tests/SerialChat/AndroidManifest.xml b/tests/SerialChat/AndroidManifest.xml index 0efdb58d72cb..7aedb52752c5 100644 --- a/tests/SerialChat/AndroidManifest.xml +++ b/tests/SerialChat/AndroidManifest.xml @@ -15,16 +15,18 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.serialchat"> + package="com.android.serialchat"> <uses-permission android:name="android.permission.SERIAL_PORT"/> <application android:label="Serial Chat"> - <activity android:name="SerialChat" android:label="Serial Chat"> + <activity android:name="SerialChat" + android:label="Serial Chat" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/ServiceCrashTest/AndroidManifest.xml b/tests/ServiceCrashTest/AndroidManifest.xml index 387c8b8ae36b..e906fe2109e1 100644 --- a/tests/ServiceCrashTest/AndroidManifest.xml +++ b/tests/ServiceCrashTest/AndroidManifest.xml @@ -1,23 +1,24 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.servicecrashtest"> + package="com.android.tests.servicecrashtest"> <application android:label="Service Crash Test"> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> <service android:name=".CrashingService" - android:process=":badservice" /> + android:process=":badservice"/> - <activity android:name=".MainActivity" > + <activity android:name=".MainActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> </intent-filter> </activity> </application> <instrumentation android:label="Test bound service crash restart" - android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.tests.servicecrashtest" /> + android:name="android.test.InstrumentationTestRunner" + android:targetPackage="com.android.tests.servicecrashtest"/> </manifest> diff --git a/tests/SharedLibrary/client/AndroidManifest.xml b/tests/SharedLibrary/client/AndroidManifest.xml index d1167fa7322f..9903a98c0ae9 100644 --- a/tests/SharedLibrary/client/AndroidManifest.xml +++ b/tests/SharedLibrary/client/AndroidManifest.xml @@ -15,23 +15,26 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.lib_client"> - <application android:label="@string/app_title" android:theme="@style/Theme"> - <uses-library android:name="android.test.runner" /> - <uses-library android:name="com.google.android.test.shared_library" /> - <activity android:name="ActivityMain"> + package="com.google.android.test.lib_client"> + <application android:label="@string/app_title" + android:theme="@style/Theme"> + <uses-library android:name="android.test.runner"/> + <uses-library android:name="com.google.android.test.shared_library"/> + <activity android:name="ActivityMain" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <receiver android:name="DependentAppwidgetProvider"> + <receiver android:name="DependentAppwidgetProvider" + android:exported="true"> <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> </intent-filter> <meta-data android:name="android.appwidget.provider" - android:resource="@xml/dependent_appwidget_info" /> + android:resource="@xml/dependent_appwidget_info"/> </receiver> </application> </manifest> diff --git a/tests/SharedLibrary/lib/AndroidManifest.xml b/tests/SharedLibrary/lib/AndroidManifest.xml index bb939dd4cb55..df2fdca18f6e 100644 --- a/tests/SharedLibrary/lib/AndroidManifest.xml +++ b/tests/SharedLibrary/lib/AndroidManifest.xml @@ -15,15 +15,16 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.shared_library" - android:versionCode="2"> + package="com.google.android.test.shared_library" + android:versionCode="2"> <application android:label="SharedLibrary"> - <library android:name="com.google.android.test.shared_library" /> + <library android:name="com.google.android.test.shared_library"/> <activity android:name="ActivityMain" - android:icon="@drawable/size_48x48"> + android:icon="@drawable/size_48x48" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/ShowWhenLockedApp/AndroidManifest.xml b/tests/ShowWhenLockedApp/AndroidManifest.xml index a872e061526f..82957b719a48 100644 --- a/tests/ShowWhenLockedApp/AndroidManifest.xml +++ b/tests/ShowWhenLockedApp/AndroidManifest.xml @@ -16,12 +16,13 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.showwhenlocked"> + package="com.android.showwhenlocked"> <application android:label="ShowWhenLocked"> <activity android:name=".ShowWhenLockedActivity" - android:showWhenLocked="true" - android:turnScreenOn="true" - android:launchMode="singleTask"> + android:showWhenLocked="true" + android:turnScreenOn="true" + android:launchMode="singleTask" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/tests/SilkFX/Android.bp b/tests/SilkFX/Android.bp new file mode 100644 index 000000000000..92e3efa7fd55 --- /dev/null +++ b/tests/SilkFX/Android.bp @@ -0,0 +1,28 @@ +// +// Copyright (C) 2010 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. +// + +android_test { + name: "SilkFX", + srcs: ["**/*.java", "**/*.kt"], + platform_apis: true, + certificate: "platform", + static_libs: [ + "androidx.core_core", + "androidx.appcompat_appcompat", + "com.google.android.material_material", + "androidx-constraintlayout_constraintlayout", + ], +} diff --git a/tests/AutoVerify/app1/AndroidManifest.xml b/tests/SilkFX/AndroidManifest.xml index d9caad490d82..050e9c33aeac 100644 --- a/tests/AutoVerify/app1/AndroidManifest.xml +++ b/tests/SilkFX/AndroidManifest.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2020 The Android Open Source Project +<!-- Copyright (C) 2010 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. @@ -16,28 +15,32 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.autoverify" > + package="com.android.test.silkfx"> - <uses-sdk android:targetSdkVersion="26" /> + <uses-sdk android:minSdkVersion="30"/> - <application - android:label="@string/app_name" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> + <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" /> + + <application android:label="SilkFX" + android:theme="@android:style/Theme.Material"> - <intent-filter android:autoVerify="true"> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.BROWSABLE" /> - <data android:scheme="http" /> - <data android:scheme="https" /> - <data android:host="explicit.example.com" /> + <activity android:name=".Main" + android:label="SilkFX Demos" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> + + <activity android:name=".app.CommonDemoActivity" /> + + <activity android:name=".hdr.GlowActivity" + android:label="Glow Examples"/> + + <activity android:name=".materials.GlassActivity" + android:label="Glass Examples"/> + </application> </manifest> diff --git a/tests/SilkFX/res/drawable-hdpi/background1.jpeg b/tests/SilkFX/res/drawable-hdpi/background1.jpeg Binary files differnew file mode 100644 index 000000000000..dcdfa7b850bc --- /dev/null +++ b/tests/SilkFX/res/drawable-hdpi/background1.jpeg diff --git a/tests/SilkFX/res/drawable-hdpi/background2.jpeg b/tests/SilkFX/res/drawable-hdpi/background2.jpeg Binary files differnew file mode 100644 index 000000000000..dc7ce84e6784 --- /dev/null +++ b/tests/SilkFX/res/drawable-hdpi/background2.jpeg diff --git a/tests/SilkFX/res/drawable-hdpi/background3.jpeg b/tests/SilkFX/res/drawable-hdpi/background3.jpeg Binary files differnew file mode 100644 index 000000000000..12b3429e3920 --- /dev/null +++ b/tests/SilkFX/res/drawable-hdpi/background3.jpeg diff --git a/tests/SilkFX/res/drawable-hdpi/noise.png b/tests/SilkFX/res/drawable-hdpi/noise.png Binary files differnew file mode 100644 index 000000000000..053995dad760 --- /dev/null +++ b/tests/SilkFX/res/drawable-hdpi/noise.png diff --git a/tests/SilkFX/res/drawable-nodpi/dark_notification.png b/tests/SilkFX/res/drawable-nodpi/dark_notification.png Binary files differnew file mode 100644 index 000000000000..6de6c2ae785c --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/dark_notification.png diff --git a/tests/SilkFX/res/drawable-nodpi/light_notification.png b/tests/SilkFX/res/drawable-nodpi/light_notification.png Binary files differnew file mode 100644 index 000000000000..81a67cd3d388 --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/light_notification.png diff --git a/tests/SilkFX/res/layout/activity_glass.xml b/tests/SilkFX/res/layout/activity_glass.xml new file mode 100644 index 000000000000..aa09f276d5c8 --- /dev/null +++ b/tests/SilkFX/res/layout/activity_glass.xml @@ -0,0 +1,303 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +** Copyright 2012, 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. +--> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity"> + + <ImageView + android:id="@+id/background" + android:layout_width="0dp" + android:layout_height="0dp" + android:scaleType="matrix" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:srcCompat="@drawable/background1" /> + + <com.android.test.silkfx.materials.GlassView + android:id="@+id/materialView" + android:layout_width="0dp" + android:layout_height="180dp" + android:layout_marginEnd="64dp" + android:layout_marginStart="64dp" + app:layout_constraintBottom_toTopOf="@+id/bottomPanel" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + <TextView + android:id="@+id/textOverlay" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="18dp" + android:layout_gravity="center" + android:textColor="#ffffff" + android:text="Lorem Ipsum dolor sit amet." /> + </com.android.test.silkfx.materials.GlassView> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottomPanel" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:background="?android:attr/colorBackground" + android:paddingTop="24dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintBottom_toBottomOf="parent"> + + <SeekBar + android:id="@+id/materialOpacity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" + android:layout_marginBottom="16dp" + android:max="100" + android:progress="12" + app:layout_constraintBottom_toTopOf="@+id/scrimOpacityTitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" /> + + <SeekBar + android:id="@+id/zoom" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:layout_marginEnd="12dp" + android:layout_marginStart="12dp" + android:min="-100" + android:max="100" + android:progress="-15" + app:layout_constraintBottom_toTopOf="@+id/blurRadiusTitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" /> + + <SeekBar + android:id="@+id/blurRadius" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:layout_marginEnd="12dp" + android:layout_marginStart="12dp" + android:max="150" + android:progress="40" + app:layout_constraintBottom_toTopOf="@+id/materialOpacityTitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" /> + + <SeekBar + android:id="@+id/scrimOpacity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" + android:layout_marginBottom="16dp" + android:max="100" + android:progress="50" + app:layout_constraintBottom_toTopOf="@+id/noiseOpacityTitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" /> + + <SeekBar + android:id="@+id/noiseOpacity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginEnd="12dp" + android:layout_marginBottom="24dp" + android:max="100" + android:progress="15" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/scrimOpacityTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:text="Scrim Opacity" + android:textColor="@android:color/white" + app:layout_constraintBottom_toTopOf="@+id/scrimOpacity" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/materialOpacityTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:text="Soft light Opacity" + android:textColor="@android:color/white" + app:layout_constraintBottom_toTopOf="@+id/materialOpacity" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/zoomTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:text="Zoom" + android:textColor="@android:color/white" + app:layout_constraintBottom_toTopOf="@+id/zoom" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/blurRadiusTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:text="Blur Radius" + android:textColor="@android:color/white" + app:layout_constraintBottom_toTopOf="@+id/blurRadius" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/noiseOpacityTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:textColor="@android:color/white" + android:text="Noise Opacity" + app:layout_constraintBottom_toTopOf="@+id/noiseOpacity" + app:layout_constraintStart_toStartOf="parent" /> + + <ImageView + android:id="@+id/background1" + android:layout_width="64dp" + android:layout_height="64dp" + android:layout_marginStart="24dp" + android:layout_marginBottom="16dp" + android:foreground="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:onClick="onBackgroundClick" + android:scaleType="centerCrop" + app:layout_constraintBottom_toTopOf="@+id/lightMaterialSwitch" + app:layout_constraintStart_toStartOf="parent" + android:src="@drawable/background1" /> + + <ImageView + android:id="@+id/background2" + android:layout_width="64dp" + android:layout_height="64dp" + android:layout_marginStart="8dp" + android:foreground="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:onClick="onBackgroundClick" + android:scaleType="centerCrop" + app:layout_constraintBottom_toBottomOf="@+id/background1" + app:layout_constraintStart_toEndOf="@+id/background1" + android:src="@drawable/background2" /> + + <ImageView + android:id="@+id/background3" + android:layout_width="64dp" + android:layout_height="64dp" + android:layout_marginStart="8dp" + android:scaleType="centerCrop" + android:foreground="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:onClick="onBackgroundClick" + app:layout_constraintBottom_toBottomOf="@+id/background1" + app:layout_constraintStart_toEndOf="@+id/background2" + android:src="@drawable/background3" /> + + <Button + android:id="@+id/pickImage" + android:layout_width="64dp" + android:layout_height="64dp" + android:layout_marginStart="8dp" + android:scaleType="centerCrop" + android:foreground="?android:attr/selectableItemBackgroundBorderless" + android:clickable="true" + android:onClick="onPickImageClick" + app:layout_constraintBottom_toBottomOf="@+id/background1" + app:layout_constraintStart_toEndOf="@+id/background3" + android:text="Pick file" /> + + <Switch + android:id="@+id/lightMaterialSwitch" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginBottom="8dp" + android:text="Light Material" + app:layout_constraintBottom_toTopOf="@+id/zoomTitle" + app:layout_constraintStart_toStartOf="parent" /> + + <TextView + android:id="@+id/blurRadiusValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + android:layout_marginLeft="8dp" + app:layout_constraintBottom_toBottomOf="@+id/blurRadiusTitle" + app:layout_constraintStart_toEndOf="@+id/blurRadiusTitle" /> + + <TextView + android:id="@+id/zoomValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + android:layout_marginLeft="8dp" + app:layout_constraintBottom_toBottomOf="@+id/zoomTitle" + app:layout_constraintStart_toEndOf="@+id/zoomTitle" /> + + <TextView + android:id="@+id/materialOpacityValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + android:layout_marginLeft="8dp" + app:layout_constraintBottom_toBottomOf="@+id/materialOpacityTitle" + app:layout_constraintStart_toEndOf="@+id/materialOpacityTitle" /> + + <TextView + android:id="@+id/noiseOpacityValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + android:layout_marginLeft="8dp" + app:layout_constraintBottom_toBottomOf="@+id/noiseOpacityTitle" + app:layout_constraintStart_toEndOf="@+id/noiseOpacityTitle" /> + + + <TextView + android:id="@+id/scrimOpacityValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + android:layout_marginLeft="8dp" + app:layout_constraintBottom_toBottomOf="@+id/scrimOpacityTitle" + app:layout_constraintStart_toEndOf="@+id/scrimOpacityTitle" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/tests/SilkFX/res/layout/bling_notifications.xml b/tests/SilkFX/res/layout/bling_notifications.xml new file mode 100644 index 000000000000..6d266b701a68 --- /dev/null +++ b/tests/SilkFX/res/layout/bling_notifications.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <com.android.test.silkfx.hdr.BlingyNotification + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="8dp" + android:src="@drawable/dark_notification" /> + + <com.android.test.silkfx.hdr.BlingyNotification + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="8dp" + android:src="@drawable/light_notification" /> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/SilkFX/res/layout/color_mode_controls.xml b/tests/SilkFX/res/layout/color_mode_controls.xml new file mode 100644 index 000000000000..c0c0bab8a605 --- /dev/null +++ b/tests/SilkFX/res/layout/color_mode_controls.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<com.android.test.silkfx.common.ColorModeControls + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/current_mode" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <Button + android:id="@+id/mode_default" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Default (sRGB)" /> + + <Button + android:id="@+id/mode_wide" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="Wide Gamut (P3)" /> + + <Button + android:id="@+id/mode_hdr" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="HDR" /> + + <Button + android:id="@+id/mode_hdr10" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="HDR10" /> + + </LinearLayout> + +</com.android.test.silkfx.common.ColorModeControls>
\ No newline at end of file diff --git a/tests/SilkFX/res/layout/common_base.xml b/tests/SilkFX/res/layout/common_base.xml new file mode 100644 index 000000000000..944c6846fbf7 --- /dev/null +++ b/tests/SilkFX/res/layout/common_base.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <include layout="@layout/color_mode_controls" /> + + <FrameLayout android:id="@+id/demo_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <View + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + <com.android.test.silkfx.common.HDRIndicator + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_margin="8dp" /> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/SilkFX/res/layout/hdr_glows.xml b/tests/SilkFX/res/layout/hdr_glows.xml new file mode 100644 index 000000000000..b6050645866a --- /dev/null +++ b/tests/SilkFX/res/layout/hdr_glows.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <include layout="@layout/color_mode_controls" /> + + <com.android.test.silkfx.hdr.GlowingCard + android:layout_width="match_parent" + android:layout_height="100dp" + android:layout_margin="8dp" /> + + <com.android.test.silkfx.hdr.GlowingCard + android:id="@+id/card2" + android:layout_width="match_parent" + android:layout_height="100dp" + android:layout_margin="8dp"/> + + <com.android.test.silkfx.hdr.RadialGlow + android:layout_width="match_parent" + android:layout_height="200dp" + android:layout_margin="8dp" /> + + <View + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + <com.android.test.silkfx.common.HDRIndicator + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_margin="8dp" /> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/Main.kt b/tests/SilkFX/src/com/android/test/silkfx/Main.kt new file mode 100644 index 000000000000..9ed8d2f5edf7 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/Main.kt @@ -0,0 +1,129 @@ +/* + * 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.test.silkfx + +import android.app.Activity +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.BaseExpandableListAdapter +import android.widget.ExpandableListView +import android.widget.TextView +import com.android.test.silkfx.app.CommonDemoActivity +import com.android.test.silkfx.app.EXTRA_LAYOUT +import com.android.test.silkfx.app.EXTRA_TITLE +import com.android.test.silkfx.hdr.GlowActivity +import com.android.test.silkfx.materials.GlassActivity +import kotlin.reflect.KClass + +class Demo(val name: String, val makeIntent: (Context) -> Intent) { + constructor(name: String, activity: KClass<out Activity>) : this(name, { context -> + Intent(context, activity.java) + }) + constructor(name: String, layout: Int) : this(name, { context -> + Intent(context, CommonDemoActivity::class.java).apply { + putExtra(EXTRA_LAYOUT, layout) + putExtra(EXTRA_TITLE, name) + } + }) +} +data class DemoGroup(val groupName: String, val demos: List<Demo>) + +private val AllDemos = listOf( + DemoGroup("HDR", listOf( + Demo("Glow", GlowActivity::class), + Demo("Blingy Notifications", R.layout.bling_notifications) + )), + DemoGroup("Materials", listOf( + Demo("Glass", GlassActivity::class) + )) +) + +class Main : Activity() { + + public override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val list = ExpandableListView(this) + + setContentView(list) + + val inflater = LayoutInflater.from(this) + list.setAdapter(object : BaseExpandableListAdapter() { + override fun getGroup(groupPosition: Int): DemoGroup { + return AllDemos[groupPosition] + } + + override fun isChildSelectable(groupPosition: Int, childPosition: Int): Boolean = true + + override fun hasStableIds(): Boolean = true + + override fun getGroupView( + groupPosition: Int, + isExpanded: Boolean, + convertView: View?, + parent: ViewGroup? + ): View { + val view = (convertView ?: inflater.inflate( + android.R.layout.simple_expandable_list_item_1, parent, false)) as TextView + view.text = AllDemos[groupPosition].groupName + return view + } + + override fun getChildrenCount(groupPosition: Int): Int { + return AllDemos[groupPosition].demos.size + } + + override fun getChild(groupPosition: Int, childPosition: Int): Demo { + return AllDemos[groupPosition].demos[childPosition] + } + + override fun getGroupId(groupPosition: Int): Long = groupPosition.toLong() + + override fun getChildView( + groupPosition: Int, + childPosition: Int, + isLastChild: Boolean, + convertView: View?, + parent: ViewGroup? + ): View { + val view = (convertView ?: inflater.inflate( + android.R.layout.simple_expandable_list_item_1, parent, false)) as TextView + view.text = AllDemos[groupPosition].demos[childPosition].name + return view + } + + override fun getChildId(groupPosition: Int, childPosition: Int): Long { + return (groupPosition.toLong() shl 32) or childPosition.toLong() + } + + override fun getGroupCount(): Int { + return AllDemos.size + } + }) + + list.setOnChildClickListener { _, _, groupPosition, childPosition, _ -> + val demo = AllDemos[groupPosition].demos[childPosition] + startActivity(demo.makeIntent(this)) + return@setOnChildClickListener true + } + + AllDemos.forEachIndexed { index, _ -> list.expandGroup(index) } + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/app/BaseDemoActivity.kt b/tests/SilkFX/src/com/android/test/silkfx/app/BaseDemoActivity.kt new file mode 100644 index 000000000000..89011b51b8d6 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/app/BaseDemoActivity.kt @@ -0,0 +1,77 @@ +/* + * 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.test.silkfx.app + +import android.app.Activity +import android.content.Context +import android.os.Bundle +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.MenuItem +import android.view.View + +open class BaseDemoActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val inflater = LayoutInflater.from(this) + inflater.factory2 = object : LayoutInflater.Factory2 { + private val sClassPrefixList = arrayOf( + "android.widget.", + "android.webkit.", + "android.app.", + null + ) + override fun onCreateView( + parent: View?, + name: String, + context: Context, + attrs: AttributeSet + ): View? { + return onCreateView(name, context, attrs) + } + + override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? { + for (prefix in sClassPrefixList) { + try { + val view = inflater.createView(name, prefix, attrs) + if (view != null) { + if (view is WindowObserver) { + view.setWindow(window) + } + return view + } + } catch (e: ClassNotFoundException) { } + } + return null + } + } + } + + override fun onStart() { + super.onStart() + actionBar?.setDisplayHomeAsUpEnabled(true) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == android.R.id.home) { + onBackPressed() + return true + } + return super.onOptionsItemSelected(item) + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/app/CommonDemoActivity.kt b/tests/SilkFX/src/com/android/test/silkfx/app/CommonDemoActivity.kt new file mode 100644 index 000000000000..e0a0a20bc0a0 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/app/CommonDemoActivity.kt @@ -0,0 +1,45 @@ +/* + * 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.test.silkfx.app + +import com.android.test.silkfx.R +import android.os.Bundle +import android.view.LayoutInflater + +const val EXTRA_LAYOUT = "layout" +const val EXTRA_TITLE = "title" + +class CommonDemoActivity : BaseDemoActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + val extras = intent.extras ?: return finish() + + val layout = extras.getInt(EXTRA_LAYOUT, -1) + if (layout == -1) { + finish() + return + } + val title = extras.getString(EXTRA_TITLE, "SilkFX") + window.setTitle(title) + + setContentView(R.layout.common_base) + actionBar?.title = title + LayoutInflater.from(this).inflate(layout, findViewById(R.id.demo_container), true) + } +}
\ No newline at end of file diff --git a/tests/AutoVerify/app3/src/com/android/test/autoverify/MainActivity.java b/tests/SilkFX/src/com/android/test/silkfx/app/WindowObserver.kt index 09ef47212622..3d989a54cf27 100644 --- a/tests/AutoVerify/app3/src/com/android/test/autoverify/MainActivity.java +++ b/tests/SilkFX/src/com/android/test/silkfx/app/WindowObserver.kt @@ -13,3 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +package com.android.test.silkfx.app + +import android.view.Window + +interface WindowObserver { + fun setWindow(window: Window) +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/common/BaseDrawingView.kt b/tests/SilkFX/src/com/android/test/silkfx/common/BaseDrawingView.kt new file mode 100644 index 000000000000..4b85953a24b9 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/common/BaseDrawingView.kt @@ -0,0 +1,43 @@ +/* + * 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.test.silkfx.common + +import android.content.Context +import android.graphics.Color +import android.graphics.ColorSpace +import android.util.AttributeSet +import android.view.View + +open class BaseDrawingView : View { + val scRGB = ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB) + val bt2020 = ColorSpace.get(ColorSpace.Named.BT2020) + val lab = ColorSpace.get(ColorSpace.Named.CIE_LAB) + + val density: Float + val dp: Int.() -> Float + + fun color(red: Float, green: Float, blue: Float, alpha: Float = 1f): Long { + return Color.pack(red, green, blue, alpha, scRGB) + } + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + setWillNotDraw(false) + isClickable = true + density = resources.displayMetrics.density + dp = { this * density } + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/common/ColorModeControls.kt b/tests/SilkFX/src/com/android/test/silkfx/common/ColorModeControls.kt new file mode 100644 index 000000000000..9b15b0445642 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/common/ColorModeControls.kt @@ -0,0 +1,122 @@ +/* + * 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.test.silkfx.common + +import android.content.Context +import android.content.pm.ActivityInfo +import android.hardware.display.DisplayManager +import android.util.AttributeSet +import android.view.Window +import android.widget.Button +import android.widget.LinearLayout +import android.widget.TextView +import com.android.test.silkfx.R +import com.android.test.silkfx.app.WindowObserver + +class ColorModeControls : LinearLayout, WindowObserver { + private val COLOR_MODE_HDR10 = 3 + private val SDR_WHITE_POINTS = floatArrayOf(200f, 250f, 300f, 350f, 400f, 100f, 150f) + + constructor(context: Context) : this(context, null) + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + displayManager = context.getSystemService(DisplayManager::class.java)!! + } + + private var window: Window? = null + private var currentModeDisplay: TextView? = null + private val displayManager: DisplayManager + private var targetSdrWhitePointIndex = 0 + + private val whitePoint get() = SDR_WHITE_POINTS[targetSdrWhitePointIndex] + + override fun onFinishInflate() { + super.onFinishInflate() + val window = window ?: throw IllegalStateException("Failed to attach window") + + currentModeDisplay = findViewById(R.id.current_mode)!! + setColorMode(window.colorMode) + + findViewById<Button>(R.id.mode_default)!!.setOnClickListener { + setColorMode(ActivityInfo.COLOR_MODE_DEFAULT) + } + findViewById<Button>(R.id.mode_wide)!!.setOnClickListener { + setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT) + } + findViewById<Button>(R.id.mode_hdr)!!.setOnClickListener { + setColorMode(ActivityInfo.COLOR_MODE_HDR) + } + findViewById<Button>(R.id.mode_hdr10)!!.setOnClickListener { + setColorMode(COLOR_MODE_HDR10) + } + } + + private fun setColorMode(newMode: Int) { + val window = window!! + var sdrWhitepointChanged = false + // Need to do this before setting the colorMode, as setting the colorMode will + // trigger the attribute change listener + if (newMode == ActivityInfo.COLOR_MODE_HDR || + newMode == COLOR_MODE_HDR10) { + if (window.colorMode == newMode) { + targetSdrWhitePointIndex = (targetSdrWhitePointIndex + 1) % SDR_WHITE_POINTS.size + sdrWhitepointChanged = true + } + setBrightness(1.0f) + } else { + setBrightness(.4f) + } + window.colorMode = newMode + if (sdrWhitepointChanged) { + threadedRenderer?.setColorMode(newMode, whitePoint) + } + val whitePoint = whitePoint.toInt() + currentModeDisplay?.run { + text = "Current Mode: " + when (newMode) { + ActivityInfo.COLOR_MODE_DEFAULT -> "Default/SRGB" + ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT -> "Wide Gamut" + ActivityInfo.COLOR_MODE_HDR -> "HDR (sdr white point $whitePoint)" + COLOR_MODE_HDR10 -> "HDR10 (sdr white point $whitePoint)" + else -> "Unknown" + } + } + } + + override fun setWindow(window: Window) { + this.window = window + } + + private fun setBrightness(level: Float) { + // To keep window state in sync + window?.attributes?.screenBrightness = level + invalidate() + // To force an 'immediate' snap to what we want + // Imperfect, but close enough, synchronization by waiting for frame commit to set the value + viewTreeObserver.registerFrameCommitCallback { + try { + displayManager.setTemporaryBrightness(level) + } catch (ex: Exception) { + // Ignore a permission denied rejection - it doesn't meaningfully change much + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + + threadedRenderer?.setColorMode(window!!.colorMode, whitePoint) + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/common/HDRIndicator.kt b/tests/SilkFX/src/com/android/test/silkfx/common/HDRIndicator.kt new file mode 100644 index 000000000000..f42161f63811 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/common/HDRIndicator.kt @@ -0,0 +1,50 @@ +/* + * 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.test.silkfx.common + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.ColorSpace +import android.graphics.Paint +import android.graphics.RectF +import android.util.AttributeSet +import android.view.View + +class HDRIndicator(context: Context) : View(context) { + constructor(context: Context, attrs: AttributeSet?) : this(context) + + val scRGB = ColorSpace.get(ColorSpace.Named.EXTENDED_SRGB) + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + + val paint = Paint() + paint.isAntiAlias = true + val rect = RectF(0f, 0f, width.toFloat(), height.toFloat()) + paint.textSize = height.toFloat() + + canvas.drawColor(Color.pack(1f, 1f, 1f, 1f, scRGB)) + + paint.setColor(Color.pack(1.1f, 1.1f, 1.1f, 1f, scRGB)) + canvas.drawText("H", rect.left, rect.bottom, paint) + paint.setColor(Color.pack(1.2f, 1.2f, 1.2f, 1f, scRGB)) + canvas.drawText("D", rect.left + height.toFloat(), rect.bottom, paint) + paint.setColor(Color.pack(1.3f, 1.3f, 1.3f, 1f, scRGB)) + canvas.drawText("R", rect.left + height.toFloat() * 2, rect.bottom, paint) + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/hdr/BlingyNotification.kt b/tests/SilkFX/src/com/android/test/silkfx/hdr/BlingyNotification.kt new file mode 100644 index 000000000000..4ad21faec9d4 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/hdr/BlingyNotification.kt @@ -0,0 +1,99 @@ +/* + * 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.test.silkfx.hdr + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BlendMode +import android.graphics.Canvas +import android.graphics.LinearGradient +import android.graphics.Paint +import android.graphics.Rect +import android.graphics.Shader +import android.graphics.drawable.BitmapDrawable +import android.util.AttributeSet +import com.android.test.silkfx.common.BaseDrawingView + +class BlingyNotification : BaseDrawingView { + + private val image: Bitmap? + private val bounds = Rect() + private val paint = Paint() + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + val typed = context.obtainStyledAttributes(attrs, intArrayOf(android.R.attr.src)) + val drawable = typed.getDrawable(0) + image = if (drawable is BitmapDrawable) { + drawable.bitmap + } else { + null + } + typed.recycle() + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + val image = image ?: return super.onMeasure(widthMeasureSpec, heightMeasureSpec) + + val widthMode = MeasureSpec.getMode(widthMeasureSpec) + val heightMode = MeasureSpec.getMode(heightMeasureSpec) + + // Currently only used in this mode, so that's all we'll bother to support + if (widthMode == MeasureSpec.EXACTLY && heightMode != MeasureSpec.EXACTLY) { + val width = MeasureSpec.getSize(widthMeasureSpec) + + var height = image.height * width / image.width + if (heightMode == MeasureSpec.AT_MOST) { + height = minOf(MeasureSpec.getSize(heightMeasureSpec), height) + } + setMeasuredDimension(width, height) + } else { + super.onMeasure(widthMeasureSpec, heightMeasureSpec) + } + } + + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + bounds.set(0, 0, w, h) + paint.shader = LinearGradient(0f, 0f, w.toFloat(), 0f, + longArrayOf( + color(1f, 1f, 1f, 0f), + color(1f, 1f, 1f, .1f), + color(2f, 2f, 2f, .3f), + color(1f, 1f, 1f, .2f), + color(1f, 1f, 1f, 0f) + ), + floatArrayOf(.2f, .4f, .5f, .6f, .8f), + Shader.TileMode.CLAMP) + paint.blendMode = BlendMode.PLUS + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + + val image = image ?: return + + canvas.drawBitmap(image, null, bounds, null) + + canvas.save() + val frac = ((drawingTime % 2000) / 300f) - 1f + canvas.translate(width * frac, 0f) + canvas.rotate(-45f) + canvas.drawPaint(paint) + canvas.restore() + invalidate() + } +}
\ No newline at end of file diff --git a/tests/AutoVerify/app4/src/com/android/test/autoverify/MainActivity.java b/tests/SilkFX/src/com/android/test/silkfx/hdr/GlowActivity.kt index 09ef47212622..64dbb22ace43 100644 --- a/tests/AutoVerify/app4/src/com/android/test/autoverify/MainActivity.java +++ b/tests/SilkFX/src/com/android/test/silkfx/hdr/GlowActivity.kt @@ -13,3 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +package com.android.test.silkfx.hdr + +import android.os.Bundle +import com.android.test.silkfx.R +import com.android.test.silkfx.app.BaseDemoActivity + +class GlowActivity : BaseDemoActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.hdr_glows) + findViewById<GlowingCard>(R.id.card2)!!.setGlowIntensity(4f) + } +} diff --git a/tests/SilkFX/src/com/android/test/silkfx/hdr/GlowingCard.kt b/tests/SilkFX/src/com/android/test/silkfx/hdr/GlowingCard.kt new file mode 100644 index 000000000000..b388bb659685 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/hdr/GlowingCard.kt @@ -0,0 +1,85 @@ +/* + * 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.test.silkfx.hdr + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.LinearGradient +import android.graphics.Paint +import android.graphics.RectF +import android.graphics.Shader +import android.util.AttributeSet +import com.android.test.silkfx.common.BaseDrawingView + +class GlowingCard : BaseDrawingView { + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + val radius: Float + var COLOR_MAXIMIZER = 1f + + init { + radius = 10.dp() + } + + fun setGlowIntensity(multiplier: Float) { + COLOR_MAXIMIZER = multiplier + invalidate() + } + + override fun setPressed(pressed: Boolean) { + super.setPressed(pressed) + invalidate() + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + val paint = Paint() + paint.isAntiAlias = true + val rect = RectF(0f, 0f, width.toFloat(), height.toFloat()) + val glowColor = Color.pack(.5f * COLOR_MAXIMIZER, .4f * COLOR_MAXIMIZER, + .75f * COLOR_MAXIMIZER, 1f, scRGB) + + if (isPressed) { + paint.setColor(Color.pack(2f, 2f, 2f, 1f, scRGB)) + paint.strokeWidth = 4.dp() + paint.style = Paint.Style.FILL + paint.shader = LinearGradient(rect.left, rect.bottom, rect.right, rect.top, + glowColor, + Color.pack(0f, 0f, 0f, 0f, scRGB), + Shader.TileMode.CLAMP) + canvas.drawRoundRect(rect, radius, radius, paint) + } + + rect.inset(3.dp(), 3.dp()) + + paint.setColor(Color.pack(.14f, .14f, .14f, .8f, scRGB)) + paint.style = Paint.Style.FILL + paint.shader = null + canvas.drawRoundRect(rect, radius, radius, paint) + + rect.inset(5.dp(), 5.dp()) + paint.textSize = 14.dp() + paint.isFakeBoldText = true + + paint.color = Color.WHITE + canvas.drawText("glow = scRGB{${Color.red(glowColor)}, ${Color.green(glowColor)}, " + + "${Color.blue(glowColor)}}", rect.left, rect.centerY(), paint) + canvas.drawText("(press to activate)", rect.left, rect.bottom, paint) + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/hdr/RadialGlow.kt b/tests/SilkFX/src/com/android/test/silkfx/hdr/RadialGlow.kt new file mode 100644 index 000000000000..599585e9d125 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/hdr/RadialGlow.kt @@ -0,0 +1,91 @@ +/* + * 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.test.silkfx.hdr + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Paint +import android.graphics.RadialGradient +import android.graphics.RectF +import android.graphics.Shader +import android.util.AttributeSet +import com.android.test.silkfx.common.BaseDrawingView +import kotlin.math.min + +class RadialGlow : BaseDrawingView { + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + var glowToggle = false + + val glowColor = color(4f, 3.3f, 2.8f) + val bgColor = color(.15f, .15f, .15f) + val fgColor = color(.51f, .52f, .50f, .4f) + var glow: RadialGradient + + init { + glow = RadialGradient(0f, 0f, 100.dp(), glowColor, bgColor, Shader.TileMode.CLAMP) + isClickable = true + setOnClickListener { + glowToggle = !glowToggle + invalidate() + } + } + + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + glow = RadialGradient(0f, 0f, + min(w, h).toFloat(), glowColor, bgColor, Shader.TileMode.CLAMP) + } + + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + val radius = 10.dp() + + val paint = Paint() + paint.isDither = true + paint.isAntiAlias = true + paint.textSize = 18.dp() + paint.textAlign = Paint.Align.CENTER + + val rect = RectF(0f, 0f, width.toFloat(), height.toFloat()) + + paint.setColor(bgColor) + canvas.drawRoundRect(rect, radius, radius, paint) + + if (glowToggle) { + paint.shader = glow + canvas.save() + val frac = (drawingTime % 5000) / 5000f + canvas.translate(rect.width() * frac, rect.height() - (rect.height() * frac)) + canvas.drawPaint(paint) + canvas.restore() + paint.shader = null + invalidate() + } + + paint.setColor(fgColor) + val innerRect = RectF(rect) + innerRect.inset(rect.width() / 4, rect.height() / 4) + canvas.drawRoundRect(innerRect, radius, radius, paint) + + paint.setColor(color(1f, 1f, 1f)) + canvas.drawText("Tap to toggle animation", rect.centerX(), innerRect.top - 4.dp(), paint) + canvas.drawText("Outside text", rect.centerX(), rect.bottom - 4.dp(), paint) + canvas.drawText("Inside text", innerRect.centerX(), innerRect.bottom - 4.dp(), paint) + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/materials/GlassActivity.kt b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassActivity.kt new file mode 100644 index 000000000000..dde245ff9baf --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassActivity.kt @@ -0,0 +1,162 @@ +/* + * 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.test.silkfx.materials + +import android.app.Activity +import android.content.Intent +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Color +import android.os.Bundle +import android.util.TypedValue +import android.view.View +import android.widget.ImageView +import android.widget.SeekBar +import android.widget.Switch +import android.widget.TextView +import com.android.test.silkfx.R + +class GlassActivity : Activity(), SeekBar.OnSeekBarChangeListener { + + lateinit var backgroundButton1: ImageView + lateinit var backgroundButton2: ImageView + lateinit var backgroundButton3: ImageView + lateinit var backgroundView: ImageView + lateinit var materialView: GlassView + lateinit var lightMaterialSwitch: Switch + lateinit var noiseOpacitySeekBar: SeekBar + lateinit var materialOpacitySeekBar: SeekBar + lateinit var scrimOpacitySeekBar: SeekBar + lateinit var zoomSeekBar: SeekBar + lateinit var blurRadiusSeekBar: SeekBar + lateinit var noiseOpacityValue: TextView + lateinit var materialOpacityValue: TextView + lateinit var scrimOpacityValue: TextView + lateinit var blurRadiusValue: TextView + lateinit var zoomValue: TextView + lateinit var textOverlay: TextView + + var background: Bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) + set(value) { + field = value + backgroundView.setImageBitmap(background) + materialView.backgroundBitmap = background + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_glass) + backgroundButton1 = requireViewById(R.id.background1) + backgroundButton2 = requireViewById(R.id.background2) + backgroundButton3 = requireViewById(R.id.background3) + backgroundView = requireViewById(R.id.background) + lightMaterialSwitch = requireViewById(R.id.lightMaterialSwitch) + materialView = requireViewById(R.id.materialView) + materialOpacitySeekBar = requireViewById(R.id.materialOpacity) + blurRadiusSeekBar = requireViewById(R.id.blurRadius) + zoomSeekBar = requireViewById(R.id.zoom) + noiseOpacitySeekBar = requireViewById(R.id.noiseOpacity) + scrimOpacitySeekBar = requireViewById(R.id.scrimOpacity) + noiseOpacityValue = requireViewById(R.id.noiseOpacityValue) + materialOpacityValue = requireViewById(R.id.materialOpacityValue) + scrimOpacityValue = requireViewById(R.id.scrimOpacityValue) + blurRadiusValue = requireViewById(R.id.blurRadiusValue) + zoomValue = requireViewById(R.id.zoomValue) + textOverlay = requireViewById(R.id.textOverlay) + + background = BitmapFactory.decodeResource(resources, R.drawable.background1) + + blurRadiusSeekBar.setOnSeekBarChangeListener(this) + materialOpacitySeekBar.setOnSeekBarChangeListener(this) + noiseOpacitySeekBar.setOnSeekBarChangeListener(this) + scrimOpacitySeekBar.setOnSeekBarChangeListener(this) + + arrayOf(blurRadiusSeekBar, materialOpacitySeekBar, noiseOpacitySeekBar, + scrimOpacitySeekBar, zoomSeekBar).forEach { + it.setOnSeekBarChangeListener(this) + onProgressChanged(it, it.progress, fromUser = false) + } + + lightMaterialSwitch.setOnCheckedChangeListener { _, isChecked -> + materialView.color = if (isChecked) Color.WHITE else Color.BLACK + textOverlay.setTextColor(if (isChecked) Color.BLACK else Color.WHITE) + } + } + + override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { + when (seekBar) { + blurRadiusSeekBar -> { + materialView.blurRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + progress.toFloat(), resources.displayMetrics) + blurRadiusValue.text = progress.toString() + } + materialOpacitySeekBar -> { + materialView.materialOpacity = progress / seekBar.max.toFloat() + materialOpacityValue.text = progress.toString() + } + noiseOpacitySeekBar -> { + materialView.noiseOpacity = progress / seekBar.max.toFloat() + noiseOpacityValue.text = progress.toString() + } + scrimOpacitySeekBar -> { + materialView.scrimOpacity = progress / seekBar.max.toFloat() + scrimOpacityValue.text = progress.toString() + } + zoomSeekBar -> { + materialView.zoom = progress / seekBar.max.toFloat() + zoomValue.text = progress.toString() + } + else -> throw IllegalArgumentException("Unknown seek bar") + } + } + + override fun onStop() { + super.onStop() + materialView.resetGyroOffsets() + } + + override fun onStartTrackingTouch(seekBar: SeekBar?) {} + override fun onStopTrackingTouch(seekBar: SeekBar?) {} + + fun onBackgroundClick(view: View) { + val resource = when (view) { + backgroundButton1 -> R.drawable.background1 + backgroundButton2 -> R.drawable.background2 + backgroundButton3 -> R.drawable.background3 + else -> throw IllegalArgumentException("Invalid button") + } + + background = BitmapFactory.decodeResource(resources, resource) + } + + fun onPickImageClick(view: View) { + val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { + addCategory(Intent.CATEGORY_OPENABLE) + type = "image/*" + } + startActivityForResult(intent, 0) + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + if (resultCode === RESULT_OK) { + data?.data?.also { + contentResolver.openFileDescriptor(it, "r").let { + background = BitmapFactory.decodeFileDescriptor(it?.fileDescriptor) + } + } + } + } +}
\ No newline at end of file diff --git a/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt new file mode 100644 index 000000000000..711758476a62 --- /dev/null +++ b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt @@ -0,0 +1,208 @@ +/* + * 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.test.silkfx.materials + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.BitmapShader +import android.graphics.BlendMode +import android.graphics.BlurShader +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Outline +import android.graphics.Paint +import android.graphics.RadialGradient +import android.graphics.Rect +import android.graphics.Shader +import android.hardware.Sensor +import android.hardware.SensorEvent +import android.hardware.SensorEventListener +import android.hardware.SensorManager +import android.util.AttributeSet +import android.view.View +import android.view.ViewOutlineProvider +import android.widget.FrameLayout +import com.android.internal.graphics.ColorUtils +import com.android.test.silkfx.R +import kotlin.math.sin +import kotlin.math.sqrt + +class GlassView(context: Context, attributeSet: AttributeSet) : FrameLayout(context, attributeSet) { + + private val textureTranslationMultiplier = 200f + + private var gyroXRotation = 0f + private var gyroYRotation = 0f + + private var noise = BitmapFactory.decodeResource(resources, R.drawable.noise) + private var materialPaint = Paint() + private var scrimPaint = Paint() + private var noisePaint = Paint() + private var blurPaint = Paint() + + private val src = Rect() + private val dst = Rect() + + private val sensorManager = context.getSystemService(SensorManager::class.java) + private val sensorListener = object : SensorEventListener { + + // Constant to convert nanoseconds to seconds. + private val NS2S = 1.0f / 1000000000.0f + private val EPSILON = 0.000001f + private var timestamp: Float = 0f + + override fun onSensorChanged(event: SensorEvent?) { + // This timestep's delta rotation to be multiplied by the current rotation + // after computing it from the gyro sample data. + if (timestamp != 0f && event != null) { + val dT = (event.timestamp - timestamp) * NS2S + // Axis of the rotation sample, not normalized yet. + var axisX: Float = event.values[0] + var axisY: Float = event.values[1] + var axisZ: Float = event.values[2] + + // Calculate the angular speed of the sample + val omegaMagnitude: Float = sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ) + + // Normalize the rotation vector if it's big enough to get the axis + // (that is, EPSILON should represent your maximum allowable margin of error) + if (omegaMagnitude > EPSILON) { + axisX /= omegaMagnitude + axisY /= omegaMagnitude + axisZ /= omegaMagnitude + } + + // Integrate around this axis with the angular speed by the timestep + // in order to get a delta rotation from this sample over the timestep + // We will convert this axis-angle representation of the delta rotation + // into a quaternion before turning it into the rotation matrix. + val thetaOverTwo: Float = omegaMagnitude * dT / 2.0f + val sinThetaOverTwo: Float = sin(thetaOverTwo) + gyroXRotation += sinThetaOverTwo * axisX + gyroYRotation += sinThetaOverTwo * axisY + + invalidate() + } + timestamp = event?.timestamp?.toFloat() ?: 0f + } + + override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) { } + } + + var backgroundBitmap: Bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) + set(value) { + field = value + invalidate() + } + + var noiseOpacity = 0.0f + set(value) { + field = value + noisePaint.alpha = (value * 255).toInt() + invalidate() + } + + var materialOpacity = 0.0f + set(value) { + field = value + materialPaint.alpha = (value * 255).toInt() + invalidate() + } + + var scrimOpacity = 0.5f + set(value) { + field = value + scrimPaint.alpha = (value * 255).toInt() + invalidate() + } + + var zoom = 0.0f + set(value) { + field = value + invalidate() + } + + var color = Color.BLACK + set(value) { + field = value + var alpha = materialPaint.alpha + materialPaint.color = color + materialPaint.alpha = alpha + + alpha = scrimPaint.alpha + scrimPaint.color = color + scrimPaint.alpha = alpha + invalidate() + } + + var blurRadius = 150f + set(value) { + field = value + blurPaint.shader = BlurShader(value, value, null) + invalidate() + } + + init { + setWillNotDraw(false) + materialPaint.blendMode = BlendMode.SOFT_LIGHT + noisePaint.blendMode = BlendMode.SOFT_LIGHT + noisePaint.shader = BitmapShader(noise, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT) + scrimPaint.alpha = (scrimOpacity * 255).toInt() + noisePaint.alpha = (noiseOpacity * 255).toInt() + materialPaint.alpha = (materialOpacity * 255).toInt() + blurPaint.shader = BlurShader(blurRadius, blurRadius, null) + outlineProvider = object : ViewOutlineProvider() { + override fun getOutline(view: View?, outline: Outline?) { + outline?.setRoundRect(Rect(0, 0, width, height), 100f) + } + } + clipToOutline = true + } + + override fun onAttachedToWindow() { + sensorManager?.getSensorList(Sensor.TYPE_GYROSCOPE)?.firstOrNull().let { + sensorManager?.registerListener(sensorListener, it, SensorManager.SENSOR_DELAY_GAME) + } + } + + override fun onDetachedFromWindow() { + sensorManager?.unregisterListener(sensorListener) + } + + override fun onDraw(canvas: Canvas?) { + src.set(-width / 2, -height / 2, width / 2, height / 2) + src.scale(1.0f + zoom) + val centerX = left + width / 2 + val centerY = top + height / 2 + val textureXOffset = (textureTranslationMultiplier * gyroYRotation).toInt() + val textureYOffset = (textureTranslationMultiplier * gyroXRotation).toInt() + src.set(src.left + centerX + textureXOffset, src.top + centerY + textureYOffset, + src.right + centerX + textureXOffset, src.bottom + centerY + textureYOffset) + + dst.set(0, 0, width, height) + canvas?.drawBitmap(backgroundBitmap, src, dst, blurPaint) + canvas?.drawRect(dst, materialPaint) + canvas?.drawRect(dst, noisePaint) + canvas?.drawRect(dst, scrimPaint) + } + + fun resetGyroOffsets() { + gyroXRotation = 0f + gyroYRotation = 0f + invalidate() + } +}
\ No newline at end of file diff --git a/tests/SmokeTest/AndroidManifest.xml b/tests/SmokeTest/AndroidManifest.xml index f141bdcc704f..57f0431ad2e3 100644 --- a/tests/SmokeTest/AndroidManifest.xml +++ b/tests/SmokeTest/AndroidManifest.xml @@ -15,18 +15,19 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.smoketest"> + package="com.android.smoketest"> <application> - <uses-library android:name="android.test.runner" /> - <activity android:name=".SmokeTestActivity" - android:label="Smoke Tests"> + <uses-library android:name="android.test.runner"/> + <activity android:name=".SmokeTestActivity" + android:label="Smoke Tests" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.TEST"/> </intent-filter> </activity> </application> - + </manifest> diff --git a/tests/SmokeTestApps/AndroidManifest.xml b/tests/SmokeTestApps/AndroidManifest.xml index 0f20107f60d1..89e63b1a4198 100644 --- a/tests/SmokeTestApps/AndroidManifest.xml +++ b/tests/SmokeTestApps/AndroidManifest.xml @@ -15,30 +15,33 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.smoketest.triggers"> + package="com.android.smoketest.triggers"> <application android:label="something"> <activity android:name=".CrashyApp" - android:label="Test Crashy App"> + android:label="Test Crashy App" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".CrashyApp2" - android:label="Test Crashy App2"> + android:label="Test Crashy App2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".UnresponsiveApp" - android:label="Test Unresponsive App"> + android:label="Test Unresponsive App" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/SoundTriggerTestApp/AndroidManifest.xml b/tests/SoundTriggerTestApp/AndroidManifest.xml index 87f3e92b3a60..587a25dd71bc 100644 --- a/tests/SoundTriggerTestApp/AndroidManifest.xml +++ b/tests/SoundTriggerTestApp/AndroidManifest.xml @@ -1,27 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.soundtrigger"> - <uses-permission android:name="android.permission.CAPTURE_AUDIO_HOTWORD" /> - <uses-permission android:name="android.permission.MANAGE_SOUND_TRIGGER" /> - <uses-permission android:name="android.permission.RECORD_AUDIO" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> + package="com.android.test.soundtrigger"> + <uses-permission android:name="android.permission.CAPTURE_AUDIO_HOTWORD"/> + <uses-permission android:name="android.permission.MANAGE_SOUND_TRIGGER"/> + <uses-permission android:name="android.permission.RECORD_AUDIO"/> + <uses-permission android:name="android.permission.WAKE_LOCK"/> <application> - <activity - android:name=".SoundTriggerTestActivity" - android:label="SoundTrigger Test Application" - android:screenOrientation="portrait" - android:theme="@android:style/Theme.Material"> + <activity android:name=".SoundTriggerTestActivity" + android:label="SoundTrigger Test Application" + android:screenOrientation="portrait" + android:theme="@android:style/Theme.Material" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <service - android:name=".SoundTriggerTestService" - android:stopWithTask="false" - android:exported="true"> + <service android:name=".SoundTriggerTestService" + android:stopWithTask="false" + android:exported="true"> <intent-filter> - <action android:name="com.android.intent.action.MANAGE_SOUND_TRIGGER" /> + <action android:name="com.android.intent.action.MANAGE_SOUND_TRIGGER"/> </intent-filter> </service> </application> diff --git a/tests/Split/AndroidManifest.xml b/tests/Split/AndroidManifest.xml index 0de8344077f6..e0365273107e 100644 --- a/tests/Split/AndroidManifest.xml +++ b/tests/Split/AndroidManifest.xml @@ -15,13 +15,14 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.example.split"> + package="com.android.example.split"> <application android:label="@string/app_title" - android:icon="@mipmap/ic_app"> - <activity android:name="ActivityMain"> + android:icon="@mipmap/ic_app"> + <activity android:name="ActivityMain" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/StagedInstallTest/Android.bp b/tests/StagedInstallTest/Android.bp index c3fdd695c2b7..f55d4d474bfb 100644 --- a/tests/StagedInstallTest/Android.bp +++ b/tests/StagedInstallTest/Android.bp @@ -18,13 +18,27 @@ android_test_helper_app { srcs: ["app/src/**/*.java"], static_libs: ["androidx.test.rules", "cts-install-lib"], test_suites: ["general-tests"], + java_resources: [ + ":com.android.apex.apkrollback.test_v2", + ], } java_test_host { name: "StagedInstallInternalTest", srcs: ["src/**/*.java"], - libs: ["tradefed"], - static_libs: ["testng", "compatibility-tradefed"], + libs: ["tradefed", "cts-shim-host-lib"], + static_libs: [ + "testng", + "compatibility-tradefed", + "frameworks-base-hostutils", + "module_test_util", + "cts-install-lib-host", + ], + data: [ + ":com.android.apex.apkrollback.test_v1", + ":com.android.apex.cts.shim.v2_prebuilt", + ":TestAppAv1", + ], test_suites: ["general-tests"], test_config: "StagedInstallInternalTest.xml", } diff --git a/tests/StagedInstallTest/app/src/com/android/tests/stagedinstallinternal/StagedInstallInternalTest.java b/tests/StagedInstallTest/app/src/com/android/tests/stagedinstallinternal/StagedInstallInternalTest.java index 02597d548361..e5411dee7805 100644 --- a/tests/StagedInstallTest/app/src/com/android/tests/stagedinstallinternal/StagedInstallInternalTest.java +++ b/tests/StagedInstallTest/app/src/com/android/tests/stagedinstallinternal/StagedInstallInternalTest.java @@ -47,8 +47,9 @@ import java.util.function.Consumer; @RunWith(JUnit4.class) public class StagedInstallInternalTest { - - private static final String TAG = StagedInstallInternalTest.class.getSimpleName(); + private static final String APK_IN_APEX_TESTAPEX_NAME = "com.android.apex.apkrollback.test"; + private static final TestApp TEST_APEX_WITH_APK_V2 = new TestApp("TestApexWithApkV2", + APK_IN_APEX_TESTAPEX_NAME, 2, /*isApex*/true, APK_IN_APEX_TESTAPEX_NAME + "_v2.apex"); private File mTestStateFile = new File( InstrumentationRegistry.getInstrumentation().getContext().getFilesDir(), @@ -82,6 +83,24 @@ public class StagedInstallInternalTest { } @Test + public void testDuplicateApkInApexShouldFail_Commit() throws Exception { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); + // Duplicate packages(TestApp.A) in TEST_APEX_WITH_APK_V2(apk-in-apex) and TestApp.A2(apk) + // should fail to install. + int sessionId = Install.multi(TEST_APEX_WITH_APK_V2, TestApp.A2).setStaged().commit(); + storeSessionId(sessionId); + } + + @Test + public void testDuplicateApkInApexShouldFail_Verify() throws Exception { + assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); + int sessionId = retrieveLastSessionId(); + PackageInstaller.SessionInfo info = + InstallUtils.getPackageInstaller().getSessionInfo(sessionId); + assertThat(info.isStagedSessionFailed()).isTrue(); + } + + @Test public void testSystemServerRestartDoesNotAffectStagedSessions_Commit() throws Exception { int sessionId = Install.single(TestApp.A1).setStaged().commit(); assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(-1); @@ -96,6 +115,18 @@ public class StagedInstallInternalTest { assertSessionReady(sessionId); } + @Test + public void testAbandonStagedSessionShouldCleanUp() throws Exception { + int id1 = Install.single(TestApp.A1).setStaged().createSession(); + InstallUtils.getPackageInstaller().abandonSession(id1); + int id2 = Install.multi(TestApp.A1).setStaged().createSession(); + InstallUtils.getPackageInstaller().abandonSession(id2); + int id3 = Install.single(TestApp.A1).setStaged().commit(); + InstallUtils.getPackageInstaller().abandonSession(id3); + int id4 = Install.multi(TestApp.A1).setStaged().commit(); + InstallUtils.getPackageInstaller().abandonSession(id4); + } + private static void assertSessionReady(int sessionId) { assertSessionState(sessionId, (session) -> assertThat(session.isStagedSessionReady()).isTrue()); diff --git a/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java b/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java index 9b432f7d0ca5..702f8719ff24 100644 --- a/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java +++ b/tests/StagedInstallTest/src/com/android/tests/stagedinstallinternal/host/StagedInstallInternalTest.java @@ -16,26 +16,51 @@ package com.android.tests.stagedinstallinternal.host; +import static com.android.cts.shim.lib.ShimPackage.SHIM_APEX_PACKAGE_NAME; + import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import android.cts.install.lib.host.InstallUtilsHost; +import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper; import com.android.ddmlib.Log; +import com.android.tests.rollback.host.AbandonSessionsRule; +import com.android.tests.util.ModuleTestUtils; import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; +import com.android.tradefed.util.CommandResult; +import com.android.tradefed.util.CommandStatus; import com.android.tradefed.util.ProcessInfo; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import java.io.File; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + @RunWith(DeviceJUnit4ClassRunner.class) public class StagedInstallInternalTest extends BaseHostJUnit4Test { private static final String TAG = StagedInstallInternalTest.class.getSimpleName(); private static final long SYSTEM_SERVER_TIMEOUT_MS = 60 * 1000; - private boolean mWasRoot = false; + + @Rule + public AbandonSessionsRule mHostTestRule = new AbandonSessionsRule(this); + private static final String SHIM_V2 = "com.android.apex.cts.shim.v2.apex"; + private static final String APK_A = "TestAppAv1.apk"; + private static final String APK_IN_APEX_TESTAPEX_NAME = "com.android.apex.apkrollback.test"; + + private final ModuleTestUtils mTestUtils = new ModuleTestUtils(this); + private final InstallUtilsHost mHostUtils = new InstallUtilsHost(this); /** * Runs the given phase of a test by calling into the device. @@ -58,28 +83,70 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test { } catch (AssertionError e) { Log.e(TAG, e); } + deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex", + "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex", + "/data/apex/active/" + SHIM_APEX_PACKAGE_NAME + "*.apex"); } @Before public void setUp() throws Exception { - mWasRoot = getDevice().isAdbRoot(); - if (!mWasRoot) { - getDevice().enableAdbRoot(); - } cleanUp(); - // Abandon all staged sessions - getDevice().executeShellCommand("pm install-abandon $(pm get-stagedsessions --only-ready " - + "--only-parent --only-sessionid)"); } @After public void tearDown() throws Exception { - if (!mWasRoot) { - getDevice().disableAdbRoot(); - } cleanUp(); } + /** + * Deletes files and reboots the device if necessary. + * @param files the paths of files which might contain wildcards + */ + private void deleteFiles(String... files) throws Exception { + boolean found = false; + for (String file : files) { + CommandResult result = getDevice().executeShellV2Command("ls " + file); + if (result.getStatus() == CommandStatus.SUCCESS) { + found = true; + break; + } + } + + if (found) { + if (!getDevice().isAdbRoot()) { + getDevice().enableAdbRoot(); + } + getDevice().remountSystemWritable(); + for (String file : files) { + getDevice().executeShellCommand("rm -rf " + file); + } + getDevice().reboot(); + } + } + + private void pushTestApex() throws Exception { + CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild()); + final String fileName = APK_IN_APEX_TESTAPEX_NAME + "_v1.apex"; + final File apex = buildHelper.getTestFile(fileName); + if (!getDevice().isAdbRoot()) { + getDevice().enableAdbRoot(); + } + getDevice().remountSystemWritable(); + assertTrue(getDevice().pushFile(apex, "/system/apex/" + fileName)); + getDevice().reboot(); + } + + /** + * Tests that duplicate packages in apk-in-apex and apk should fail to install. + */ + @Test + public void testDuplicateApkInApexShouldFail() throws Exception { + pushTestApex(); + runPhase("testDuplicateApkInApexShouldFail_Commit"); + getDevice().reboot(); + runPhase("testDuplicateApkInApexShouldFail_Verify"); + } + @Test public void testSystemServerRestartDoesNotAffectStagedSessions() throws Exception { runPhase("testSystemServerRestartDoesNotAffectStagedSessions_Commit"); @@ -87,25 +154,135 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test { runPhase("testSystemServerRestartDoesNotAffectStagedSessions_Verify"); } + // Test waiting time for staged session to be ready using adb staged install can be altered + @Test + public void testAdbStagdReadyTimeoutFlagWorks() throws Exception { + assumeTrue("Device does not support updating APEX", + mHostUtils.isApexUpdateSupported()); + + final File apexFile = mTestUtils.getTestFile(SHIM_V2); + final String output = getDevice().executeAdbCommand("install", "--staged", + "--staged-ready-timeout", "60000", apexFile.getAbsolutePath()); + assertThat(output).contains("Reboot device to apply staged session"); + final String sessionId = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-parent --only-sessionid").trim(); + assertThat(sessionId).isNotEmpty(); + } + + // Test adb staged installation wait for session to be ready by default + @Test + public void testAdbStagedInstallWaitsTillReadyByDefault() throws Exception { + assumeTrue("Device does not support updating APEX", + mHostUtils.isApexUpdateSupported()); + + final File apexFile = mTestUtils.getTestFile(SHIM_V2); + final String output = getDevice().executeAdbCommand("install", "--staged", + apexFile.getAbsolutePath()); + assertThat(output).contains("Reboot device to apply staged session"); + final String sessionId = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-parent --only-sessionid").trim(); + assertThat(sessionId).isNotEmpty(); + } + + // Test we can skip waiting for staged session to be ready + @Test + public void testAdbStagedReadyWaitCanBeSkipped() throws Exception { + assumeTrue("Device does not support updating APEX", + mHostUtils.isApexUpdateSupported()); + + final File apexFile = mTestUtils.getTestFile(SHIM_V2); + final String output = getDevice().executeAdbCommand("install", "--staged", + "--staged-ready-timeout", "0", apexFile.getAbsolutePath()); + assertThat(output).doesNotContain("Reboot device to apply staged session"); + assertThat(output).contains("Success"); + final String sessionId = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-parent --only-sessionid").trim(); + assertThat(sessionId).isEmpty(); + } + + // Test rollback-app command waits for staged sessions to be ready + @Test + public void testAdbRollbackAppWaitsForStagedReady() throws Exception { + assumeTrue("Device does not support updating APEX", + mHostUtils.isApexUpdateSupported()); + + final File apexFile = mTestUtils.getTestFile(SHIM_V2); + String output = getDevice().executeAdbCommand("install", "--staged", + "--enable-rollback", apexFile.getAbsolutePath()); + assertThat(output).contains("Reboot device to apply staged session"); + getDevice().reboot(); + output = getDevice().executeShellCommand("pm rollback-app " + SHIM_APEX_PACKAGE_NAME); + assertThat(output).contains("Reboot device to apply staged session"); + final String sessionId = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-parent --only-sessionid").trim(); + assertThat(sessionId).isNotEmpty(); + } + + @Test + public void testAdbInstallMultiPackageCommandWorks() throws Exception { + assumeTrue("Device does not support updating APEX", + mHostUtils.isApexUpdateSupported()); + + final File apexFile = mTestUtils.getTestFile(SHIM_V2); + final File apkFile = mTestUtils.getTestFile(APK_A); + final String output = getDevice().executeAdbCommand("install-multi-package", + apexFile.getAbsolutePath(), apkFile.getAbsolutePath()); + assertThat(output).contains("Created parent session"); + assertThat(output).contains("Created child session"); + assertThat(output).contains("Success. Reboot device to apply staged session"); + + // Ensure there is only one parent session + String[] sessionIds = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-parent --only-sessionid").split("\n"); + assertThat(sessionIds.length).isEqualTo(1); + // Ensure there are two children session + sessionIds = getDevice().executeShellCommand( + "pm get-stagedsessions --only-ready --only-sessionid").split("\n"); + assertThat(sessionIds.length).isEqualTo(3); + } + + @Test + public void testAbandonStagedSessionShouldCleanUp() throws Exception { + List<String> before = getStagingDirectories(); + runPhase("testAbandonStagedSessionShouldCleanUp"); + List<String> after = getStagingDirectories(); + // The staging directories generated during the test should be deleted + assertThat(after).isEqualTo(before); + } + + private List<String> getStagingDirectories() { + String baseDir = "/data/app-staging"; + try { + return getDevice().getFileEntry(baseDir).getChildren(false) + .stream().filter(entry -> entry.getName().matches("session_\\d+")) + .map(entry -> entry.getName()) + .collect(Collectors.toList()); + } catch (Exception e) { + // Return an empty list if any error + return Collections.EMPTY_LIST; + } + } + private void restartSystemServer() throws Exception { // Restart the system server - long oldStartTime = getDevice().getProcessByName("system_server").getStartTime(); + final ProcessInfo oldPs = getDevice().getProcessByName("system_server"); + + getDevice().enableAdbRoot(); // Need root to restart system server assertThat(getDevice().executeShellCommand("am restart")).contains("Restart the system"); + getDevice().disableAdbRoot(); // Wait for new system server process to start - long start = System.currentTimeMillis(); - long newStartTime = oldStartTime; + final long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + SYSTEM_SERVER_TIMEOUT_MS) { - ProcessInfo newPs = getDevice().getProcessByName("system_server"); + final ProcessInfo newPs = getDevice().getProcessByName("system_server"); if (newPs != null) { - newStartTime = newPs.getStartTime(); - if (newStartTime != oldStartTime) { - break; + if (newPs.getPid() != oldPs.getPid()) { + getDevice().waitForDeviceAvailable(); + return; } } Thread.sleep(500); } - assertThat(newStartTime).isNotEqualTo(oldStartTime); - getDevice().waitForDeviceAvailable(); + fail("Timed out in restarting system server"); } } diff --git a/tests/StatusBar/AndroidManifest.xml b/tests/StatusBar/AndroidManifest.xml index 6a082e990dab..8744dae1b360 100644 --- a/tests/StatusBar/AndroidManifest.xml +++ b/tests/StatusBar/AndroidManifest.xml @@ -1,56 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.statusbartest"> - <uses-permission android:name="android.permission.DEVICE_POWER" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> - <uses-permission android:name="android.permission.STATUS_BAR" /> - <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> - <uses-permission android:name="android.permission.VIBRATE" /> - <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" /> - <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS" /> + package="com.android.statusbartest"> + <uses-permission android:name="android.permission.DEVICE_POWER"/> + <uses-permission android:name="android.permission.WAKE_LOCK"/> + <uses-permission android:name="android.permission.STATUS_BAR"/> + <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/> + <uses-permission android:name="android.permission.VIBRATE"/> + <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/> + <uses-permission android:name="android.permission.MANAGE_NOTIFICATIONS"/> <application> - <activity android:name="StatusBarTest" android:label="_StatusBar"> + <activity android:name="StatusBarTest" + android:label="_StatusBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="NotificationTestList" android:label="_Notifications"> + <activity android:name="NotificationTestList" + android:label="_Notifications" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="NotificationBuilderTest" - android:label="_Notify Builder" - android:theme="@android:style/Theme.Holo" - android:hardwareAccelerated="true" - > + android:label="_Notify Builder" + android:theme="@android:style/Theme.Holo" + android:hardwareAccelerated="true" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="ToastTest" android:label="_Toasts"> + <activity android:name="ToastTest" + android:label="_Toasts" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="PowerTest" android:label="_Power"> + <activity android:name="PowerTest" + android:label="_Power" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="ConfirmationActivity" android:theme="@android:style/Theme.Dialog"> + <activity android:name="ConfirmationActivity" + android:theme="@android:style/Theme.Dialog"> </activity> - <activity android:name="TestAlertActivity" android:theme="@android:style/Theme.Dialog"> + <activity android:name="TestAlertActivity" + android:theme="@android:style/Theme.Dialog"> </activity> </application> </manifest> diff --git a/tests/SurfaceComposition/AndroidManifest.xml b/tests/SurfaceComposition/AndroidManifest.xml index 4c0a9b61fd8f..46c8f88626c3 100644 --- a/tests/SurfaceComposition/AndroidManifest.xml +++ b/tests/SurfaceComposition/AndroidManifest.xml @@ -16,21 +16,22 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.surfacecomposition"> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + package="android.surfacecomposition"> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <application android:theme="@style/noeffects"> - <uses-library android:name="android.test.runner" /> - <activity android:name="android.surfacecomposition.SurfaceCompositionMeasuringActivity" > + <uses-library android:name="android.test.runner"/> + <activity android:name="android.surfacecomposition.SurfaceCompositionMeasuringActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> </application> <!-- self-instrumenting test package. --> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="android.surfacecomposition"> + android:targetPackage="android.surfacecomposition"> </instrumentation> </manifest> diff --git a/tests/SurfaceControlViewHostTest/AndroidManifest.xml b/tests/SurfaceControlViewHostTest/AndroidManifest.xml index ee95763453f7..7e9a04dfa82c 100644 --- a/tests/SurfaceControlViewHostTest/AndroidManifest.xml +++ b/tests/SurfaceControlViewHostTest/AndroidManifest.xml @@ -13,10 +13,12 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.viewembed"> + package="com.android.test.viewembed"> <application> - <activity android:name="SurfaceControlViewHostTest" android:label="View Embedding Test"> + <activity android:name="SurfaceControlViewHostTest" + android:label="View Embedding Test" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java index 3bc530975580..73e01634709e 100644 --- a/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java +++ b/tests/SurfaceControlViewHostTest/src/com/android/test/viewembed/SurfaceControlViewHostTest.java @@ -22,12 +22,11 @@ import android.graphics.Color; import android.graphics.PixelFormat; import android.os.Bundle; import android.view.Gravity; -import android.view.SurfaceControl; +import android.view.SurfaceControlViewHost; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.WindowManager; -import android.view.SurfaceControlViewHost; import android.widget.Button; import android.widget.FrameLayout; @@ -46,8 +45,6 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde mView.setZOrderOnTop(true); mView.getHolder().addCallback(this); - - addEmbeddedView(); } void addEmbeddedView() { @@ -63,6 +60,8 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde v.setBackgroundColor(Color.RED); } }); + v.getViewTreeObserver().addOnWindowFocusChangeListener(focused -> + v.setBackgroundColor(focused ? Color.MAGENTA : Color.DKGRAY)); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(500, 500, WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.OPAQUE); @@ -71,6 +70,7 @@ public class SurfaceControlViewHostTest extends Activity implements SurfaceHolde @Override public void surfaceCreated(SurfaceHolder holder) { + addEmbeddedView(); } @Override diff --git a/tests/SystemUIDemoModeController/AndroidManifest.xml b/tests/SystemUIDemoModeController/AndroidManifest.xml index 2e97932df525..5feb4acf259d 100644 --- a/tests/SystemUIDemoModeController/AndroidManifest.xml +++ b/tests/SystemUIDemoModeController/AndroidManifest.xml @@ -15,23 +15,21 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.demomodecontroller" - android:versionCode="1" - android:versionName="0.1" > + package="com.example.android.demomodecontroller" + android:versionCode="1" + android:versionName="0.1"> - <uses-sdk - android:minSdkVersion="19" - android:targetSdkVersion="19" /> + <uses-sdk android:minSdkVersion="19" + android:targetSdkVersion="19"/> - <application - android:allowBackup="false" - android:label="@string/app_name" > - <activity - android:name=".DemoModeController" > + <application android:allowBackup="false" + android:label="@string/app_name"> + <activity android:name=".DemoModeController" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/TaskOrganizerTest/AndroidManifest.xml b/tests/TaskOrganizerTest/AndroidManifest.xml index a77d7ee80242..f0ba71a47d7e 100644 --- a/tests/TaskOrganizerTest/AndroidManifest.xml +++ b/tests/TaskOrganizerTest/AndroidManifest.xml @@ -10,16 +10,19 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.taskembed"> - <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" /> - <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> + package="com.android.test.taskembed"> + <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"/> + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/> <application> <service android:name=".TaskOrganizerPipTest" - android:exported="true"> + android:exported="true"> </service> - <activity android:name="TaskOrganizerMultiWindowTest" android:label="TaskOrganizer MW Test"> + <activity android:name="TaskOrganizerMultiWindowTest" + android:label="TaskOrganizer MW Test" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> diff --git a/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java b/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java index 073ae30aaf1a..ca723b881bbd 100644 --- a/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java +++ b/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerMultiWindowTest.java @@ -157,7 +157,7 @@ public class TaskOrganizerMultiWindowTest extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mOrganizer.registerOrganizer(WINDOWING_MODE_MULTI_WINDOW); + mOrganizer.registerOrganizer(); mTaskView1 = new ResizingTaskView(this, makeSettingsIntent()); mTaskView2 = new ResizingTaskView(this, makeContactsIntent()); diff --git a/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerPipTest.java b/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerPipTest.java index 8fc5c5d78b60..5ec949391181 100644 --- a/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerPipTest.java +++ b/tests/TaskOrganizerTest/src/com/android/test/taskembed/TaskOrganizerPipTest.java @@ -57,7 +57,7 @@ public class TaskOrganizerPipTest extends Service { public void onCreate() { super.onCreate(); - mOrganizer.registerOrganizer(WINDOWING_MODE_PINNED); + mOrganizer.registerOrganizer(); final WindowManager.LayoutParams wlp = new WindowManager.LayoutParams(); wlp.setTitle("TaskOrganizerPipTest"); diff --git a/tests/TouchLatency/app/src/main/AndroidManifest.xml b/tests/TouchLatency/app/src/main/AndroidManifest.xml index e4aa4dc6c3f0..98947367bd7b 100644 --- a/tests/TouchLatency/app/src/main/AndroidManifest.xml +++ b/tests/TouchLatency/app/src/main/AndroidManifest.xml @@ -15,20 +15,19 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.prefabulated.touchlatency" > + package="com.prefabulated.touchlatency"> - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - <activity - android:name=".TouchLatencyActivity" - android:label="@string/app_name" > + <application android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme"> + <activity android:name=".TouchLatencyActivity" + android:label="@string/app_name" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/TransformTest/AndroidManifest.xml b/tests/TransformTest/AndroidManifest.xml index 5c9995f25ec6..19854feeabd3 100644 --- a/tests/TransformTest/AndroidManifest.xml +++ b/tests/TransformTest/AndroidManifest.xml @@ -15,13 +15,15 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.google.android.test.transform"> - <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" /> + package="com.google.android.test.transform"> + <uses-sdk android:minSdkVersion="7" + android:targetSdkVersion="7"/> <application android:label="TransformTest"> - <activity android:name="TransformTestActivity"> + <activity android:name="TransformTestActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/TransitionTests/AndroidManifest.xml b/tests/TransitionTests/AndroidManifest.xml index 35e7b6979b7e..482261932003 100644 --- a/tests/TransitionTests/AndroidManifest.xml +++ b/tests/TransitionTests/AndroidManifest.xml @@ -1,250 +1,284 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.transitiontests" - android:versionCode="1" - android:versionName="1.0"> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <application - android:icon="@drawable/icon" - android:label="@string/app_name" - android:hardwareAccelerated="true" - android:theme="@style/AppTheme"> + package="com.android.transitiontests" + android:versionCode="1" + android:versionName="1.0"> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <application android:icon="@drawable/icon" + android:label="@string/app_name" + android:hardwareAccelerated="true" + android:theme="@style/AppTheme"> <activity android:label="@string/states_test1" - android:name="ScenesTestv21"> + android:name="ScenesTestv21" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="@string/states_test_auto_targets" - android:name="ScenesTestAutoTargets"> + android:name="ScenesTestAutoTargets" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="@string/states_test_auto_transition" - android:name="ScenesTestAutoTransition"> + android:name="ScenesTestAutoTransition" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="@string/states_test_auto_transition2" - android:name="ScenesTestAutoTransition2"> + android:name="ScenesTestAutoTransition2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="@string/contacts_expansion" - android:name="ContactsExpansion"> + android:name="ContactsExpansion" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo0" - android:name="Demo0"> + android:name="Demo0" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo1" - android:name="Demo1"> + android:name="Demo1" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo2" - android:name="Demo2"> + android:name="Demo2" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo3" - android:name="Demo3"> + android:name="Demo3" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo4" - android:name="Demo4"> + android:name="Demo4" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Demo5" - android:name="Demo5"> + android:name="Demo5" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="LoginActivity" - android:name="LoginActivity"> + android:name="LoginActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="LoginActivityFromResources" - android:name="LoginActivityFromResources"> + android:name="LoginActivityFromResources" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="OverlayTest" - android:name="OverlayTest"> + android:name="OverlayTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="ResourceLoadingTest" - android:name="ResourceLoadingTest"> + android:name="ResourceLoadingTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="FadingTest" - android:name="FadingTest"> + android:name="FadingTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="UniqueIds" - android:name="UniqueIds"> + android:name="UniqueIds" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="HitRectBug" - android:name="HitRectBug"> + android:name="HitRectBug" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="SequenceTest" - android:name="SequenceTest"> + android:name="SequenceTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="SequenceTestSimple" - android:name="SequenceTestSimple"> + android:name="SequenceTestSimple" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="ChangingText" - android:name="ChangingText"> + android:name="ChangingText" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="ClippingText" - android:name="ClippingText"> + android:name="ClippingText" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="ListViewAddRemove" - android:name="ListViewAddRemove"> + android:name="ListViewAddRemove" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="ListViewAddRemoveNoTransition" - android:name="ListViewAddRemoveNoTransition"> + android:name="ListViewAddRemoveNoTransition" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="CrossFadeDemo" - android:name="CrossFadeDemo"> + android:name="CrossFadeDemo" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="Reparenting" - android:name="Reparenting"> + android:name="Reparenting" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="SurfaceAndTextureViews" - android:name="SurfaceAndTextureViews"> + android:name="SurfaceAndTextureViews" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="InstanceTargets" - android:name="InstanceTargets"> + android:name="InstanceTargets" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="InterruptionTest" - android:name="InterruptionTest"> + android:name="InterruptionTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="DelayedTransition" - android:name="DelayedTransition"> + android:name="DelayedTransition" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="FadingHierachy" - android:name=".FadingHierarchy"> + android:name=".FadingHierarchy" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="HierarchicalMove" - android:name=".HierarchicalMove"> + android:name=".HierarchicalMove" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="CrossfadeImage" - android:name=".CrossfadeImage"> + android:name=".CrossfadeImage" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:label="CrossfadeMultiple" - android:name=".CrossfadeMultiple"> + android:name=".CrossfadeMultiple" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> diff --git a/tests/TtsTests/AndroidManifest.xml b/tests/TtsTests/AndroidManifest.xml index b6d51114e399..cf1c1628951d 100644 --- a/tests/TtsTests/AndroidManifest.xml +++ b/tests/TtsTests/AndroidManifest.xml @@ -15,29 +15,32 @@ See the License for the specific language governing permissions and limitations under the License. --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.speech.tts"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.speech.tts"> <application> - <uses-library android:name="android.test.runner" /> + <uses-library android:name="android.test.runner"/> <service android:name=".MockableTextToSpeechService" - android:label="Mockable Text-to-speech Service"> + android:label="Mockable Text-to-speech Service" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.TTS_SERVICE" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.intent.action.TTS_SERVICE"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </service> <activity android:name=".MockableCheckVoiceData" - android:theme="@android:style/Theme.NoDisplay"> + android:theme="@android:style/Theme.NoDisplay" + android:exported="true"> <intent-filter> - <action android:name="android.speech.tts.engine.CHECK_TTS_DATA" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.speech.tts.engine.CHECK_TTS_DATA"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="com.android.speech.tts" - android:label="Tests for android.speech.tts" /> + android:targetPackage="com.android.speech.tts" + android:label="Tests for android.speech.tts"/> </manifest> diff --git a/tests/UiBench/AndroidManifest.xml b/tests/UiBench/AndroidManifest.xml index dd255ef5233b..4fc6ec71f29c 100644 --- a/tests/UiBench/AndroidManifest.xml +++ b/tests/UiBench/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2015 The Android Open Source Project ~ @@ -13,303 +14,304 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - package="com.android.test.uibench"> + xmlns:tools="http://schemas.android.com/tools" + package="com.android.test.uibench"> - <application - android:allowBackup="false" - android:theme="@style/Theme.AppCompat.Light.DarkActionBar" - tools:ignore="MissingApplicationIcon"> - <uses-library android:name="android.test.runner" /> + <application android:allowBackup="false" + android:theme="@style/Theme.AppCompat.Light.DarkActionBar" + tools:ignore="MissingApplicationIcon"> + <uses-library android:name="android.test.runner"/> <!-- Root navigation activity --> - <activity - android:name=".MainActivity" - android:label="UiBench"> + <activity android:name=".MainActivity" + android:label="UiBench" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <!-- General --> - <activity - android:name=".DialogListActivity" - android:label="General/Dialog List" > + <activity android:name=".DialogListActivity" + android:label="General/Dialog List" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".GlTextureViewActivity" - android:label="General/GL TextureView" > + <activity android:name=".GlTextureViewActivity" + android:label="General/GL TextureView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".FullscreenOverdrawActivity" - android:label="General/Fullscreen Overdraw" > + <activity android:name=".FullscreenOverdrawActivity" + android:label="General/Fullscreen Overdraw" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".InvalidateActivity" - android:label="General/Invalidate" > + <activity android:name=".InvalidateActivity" + android:label="General/Invalidate" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".InvalidateTreeActivity" - android:label="General/Invalidate Tree" > + <activity android:name=".InvalidateTreeActivity" + android:label="General/Invalidate Tree" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".ResizeHWLayerActivity" - android:label="General/Resize HW Layer" > + <activity android:name=".ResizeHWLayerActivity" + android:label="General/Resize HW Layer" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TrivialAnimationActivity" - android:label="General/Trivial Animation" > + <activity android:name=".TrivialAnimationActivity" + android:label="General/Trivial Animation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TrivialAnimationActivityWideGamut" - android:label="General/Trivial Animation (Wide Gamut)" - android:colorMode="wideColorGamut"> + <activity android:name=".TrivialAnimationActivityWideGamut" + android:label="General/Trivial Animation (Wide Gamut)" + android:colorMode="wideColorGamut" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TrivialListActivity" - android:label="General/Trivial ListView" > + <activity android:name=".TrivialListActivity" + android:label="General/Trivial ListView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".FadingEdgeListActivity" - android:label="General/Fading Edge ListView" > + <activity android:name=".FadingEdgeListActivity" + android:label="General/Fading Edge ListView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".SaveLayerInterleaveActivity" - android:label="General/SaveLayer Animation" > + <activity android:name=".SaveLayerInterleaveActivity" + android:label="General/SaveLayer Animation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".ClippedListActivity" - android:label="General/Clipped ListView" - android:theme="@style/NoActionBar"> + <activity android:name=".ClippedListActivity" + android:label="General/Clipped ListView" + android:theme="@style/NoActionBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TrivialRecyclerViewActivity" - android:label="General/Trivial RecyclerView" > + <activity android:name=".TrivialRecyclerViewActivity" + android:label="General/Trivial RecyclerView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".SlowBindRecyclerViewActivity" - android:label="General/Slow Bind RecyclerView" > + <activity android:name=".SlowBindRecyclerViewActivity" + android:label="General/Slow Bind RecyclerView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".SlowNestedRecyclerViewActivity" - android:label="General/Slow Nested RecyclerView" > + <activity android:name=".SlowNestedRecyclerViewActivity" + android:label="General/Slow Nested RecyclerView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".ActivityTransition" - android:label="Transitions/Activity Transition" > + <activity android:name=".ActivityTransition" + android:label="Transitions/Activity Transition" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".ActivityTransitionDetails" - android:label="Transitions/Activity Transition " > + <activity android:name=".ActivityTransitionDetails" + android:label="Transitions/Activity Transition " + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> <!-- Part of ActivityTransition test above, so not in TEST category --> </intent-filter> </activity> <!-- Rendering --> - <activity - android:name=".BitmapUploadActivity" - android:label="Rendering/Bitmap Upload" > + <activity android:name=".BitmapUploadActivity" + android:label="Rendering/Bitmap Upload" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".ShadowGridActivity" - android:label="Rendering/Shadow Grid" > + <activity android:name=".ShadowGridActivity" + android:label="Rendering/Shadow Grid" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".RenderingJitter" - android:label="Rendering/Jitter" > + <activity android:name=".RenderingJitter" + android:label="Rendering/Jitter" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> <!-- Inflation --> - <activity - android:name=".InflatingListActivity" - android:label="Inflation/Inflating ListView" > + <activity android:name=".InflatingListActivity" + android:label="Inflation/Inflating ListView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity-alias - android:name=".InflatingEmojiListActivity" - android:label="Inflation/Inflating ListView with Emoji" - android:targetActivity=".InflatingListActivity"> + <activity-alias android:name=".InflatingEmojiListActivity" + android:label="Inflation/Inflating ListView with Emoji" + android:targetActivity=".InflatingListActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity-alias> - <activity-alias - android:name=".InflatingHanListActivity" - android:label="Inflation/Inflating ListView with Han Characters" - android:targetActivity=".InflatingListActivity"> + <activity-alias android:name=".InflatingHanListActivity" + android:label="Inflation/Inflating ListView with Han Characters" + android:targetActivity=".InflatingListActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity-alias> - <activity-alias - android:name=".InflatingLongStringListActivity" - android:label="Inflation/Inflating ListView with long string" - android:targetActivity=".InflatingListActivity"> + <activity-alias android:name=".InflatingLongStringListActivity" + android:label="Inflation/Inflating ListView with long string" + android:targetActivity=".InflatingListActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity-alias> <!-- Text --> - <activity - android:name=".EditTextTypeActivity" - android:label="Text/EditText Typing" > + <activity android:name=".EditTextTypeActivity" + android:label="Text/EditText Typing" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TextCacheLowHitrateActivity" - android:label="Text/Layout Cache Low Hitrate" > + <activity android:name=".TextCacheLowHitrateActivity" + android:label="Text/Layout Cache Low Hitrate" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".TextCacheHighHitrateActivity" - android:label="Text/Layout Cache High Hitrate" > + <activity android:name=".TextCacheHighHitrateActivity" + android:label="Text/Layout Cache High Hitrate" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> <!-- WebView --> - <activity - android:name=".ScrollableWebViewActivity" - android:label="WebView/Scrollable WebView" > + <activity android:name=".ScrollableWebViewActivity" + android:label="WebView/Scrollable WebView" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> <!-- Navigation Drawer --> - <activity - android:name=".NavigationDrawerActivity" - android:label="Navigation Drawer Activity" - android:theme="@style/NoActionBar"> + <activity android:name=".NavigationDrawerActivity" + android:label="Navigation Drawer Activity" + android:theme="@style/NoActionBar" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> <!-- Notification Shade --> - <activity - android:name=".NotificationShadeActivity" - android:label="Notification Shade"> + <activity android:name=".NotificationShadeActivity" + android:label="Notification Shade" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> - <activity - android:name=".leanback.BrowseActivity" - android:theme="@style/Theme.Leanback.Browse" - android:label="Leanback/Browse Fragment" > + <activity android:name=".leanback.BrowseActivity" + android:theme="@style/Theme.Leanback.Browse" + android:label="Leanback/Browse Fragment" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="com.android.test.uibench.TEST" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="com.android.test.uibench.TEST"/> </intent-filter> </activity> <activity android:name="WindowInsetsControllerActivity" - android:label="WindowInsetsControllerActivity" > + android:label="WindowInsetsControllerActivity" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.test.uibench.TEST" /> diff --git a/tests/UsageReportingTest/AndroidManifest.xml b/tests/UsageReportingTest/AndroidManifest.xml index be0b09e972a5..4a3487f29dc4 100644 --- a/tests/UsageReportingTest/AndroidManifest.xml +++ b/tests/UsageReportingTest/AndroidManifest.xml @@ -1,20 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- Note: Add android:sharedUserId="android.uid.system" to the root element to simulate the system UID caller case. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.usagereporter" - > + package="com.android.tests.usagereporter"> <application android:label="@string/reporter_app"> <activity android:name="UsageReporterActivity" - android:label="UsageReporter"> + android:label="UsageReporter" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> diff --git a/tests/UsageStatsTest/AndroidManifest.xml b/tests/UsageStatsTest/AndroidManifest.xml index fefd99394a87..82e5be1bce3e 100644 --- a/tests/UsageStatsTest/AndroidManifest.xml +++ b/tests/UsageStatsTest/AndroidManifest.xml @@ -1,28 +1,27 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- Note: Add android:sharedUserId="android.uid.system" to the root element to simulate the system UID caller case. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.usagestats" - > + package="com.android.tests.usagestats"> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.OBSERVE_APP_USAGE" /> - <uses-permission android:name="android.permission.SUSPEND_APPS" /> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.OBSERVE_APP_USAGE"/> + <uses-permission android:name="android.permission.SUSPEND_APPS"/> <application android:label="Usage Access Test"> <activity android:name=".UsageStatsActivity" - android:label="Device Usage History"> + android:label="Device Usage History" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name=".UsageLogActivity" /> + <activity android:name=".UsageLogActivity"/> </application> </manifest> diff --git a/tests/UsbHostExternalManagmentTest/AoapTestDevice/AndroidManifest.xml b/tests/UsbHostExternalManagmentTest/AoapTestDevice/AndroidManifest.xml index 99bb520ee902..fadd0ea21996 100644 --- a/tests/UsbHostExternalManagmentTest/AoapTestDevice/AndroidManifest.xml +++ b/tests/UsbHostExternalManagmentTest/AoapTestDevice/AndroidManifest.xml @@ -13,18 +13,19 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" - package="com.android.hardware.usb.aoapdevicetest" > - <application android:label="UsbAoapDeviceTestApp" > + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + package="com.android.hardware.usb.aoapdevicetest"> + <application android:label="UsbAoapDeviceTestApp"> <activity android:name=".UsbAoapDeviceTestActivity" - android:configChanges="keyboard|keyboardHidden" > + android:configChanges="keyboard|keyboardHidden" + android:exported="true"> <intent-filter> - <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" /> + <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/> </intent-filter> - <meta-data - android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" - android:resource="@xml/accessory_filter"/> + <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" + android:resource="@xml/accessory_filter"/> </activity> </application> </manifest> diff --git a/tests/UsbHostExternalManagmentTest/AoapTestHost/AndroidManifest.xml b/tests/UsbHostExternalManagmentTest/AoapTestHost/AndroidManifest.xml index 8cc470eaa85c..9ad17ab64bd0 100644 --- a/tests/UsbHostExternalManagmentTest/AoapTestHost/AndroidManifest.xml +++ b/tests/UsbHostExternalManagmentTest/AoapTestHost/AndroidManifest.xml @@ -13,18 +13,19 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" - package="com.android.hardware.usb.aoaphosttest" > - <application android:label="UsbAoapHostTestApp" > + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + package="com.android.hardware.usb.aoaphosttest"> + <application android:label="UsbAoapHostTestApp"> <activity android:name=".UsbAoapHostTestActivity" - android:configChanges="keyboard|keyboardHidden" > + android:configChanges="keyboard|keyboardHidden" + android:exported="true"> <intent-filter> - <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> + <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> </intent-filter> - <meta-data - android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" - android:resource="@xml/usb_device_filter"/> + <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" + android:resource="@xml/usb_device_filter"/> </activity> </application> </manifest> diff --git a/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/AndroidManifest.xml b/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/AndroidManifest.xml index 97bbefb5c4af..627e46b6304d 100644 --- a/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/AndroidManifest.xml +++ b/tests/UsbHostExternalManagmentTest/UsbHostExternalManagmentTestApp/AndroidManifest.xml @@ -13,19 +13,21 @@ See the License for the specific language governing permissions and limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" - package="com.android.hardware.usb.externalmanagementtest" > + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" + package="com.android.hardware.usb.externalmanagementtest"> - <uses-permission android:name="android.permission.MANAGE_USB" /> - <application android:label="UsbHostExternalManagementTestApp" > + <uses-permission android:name="android.permission.MANAGE_USB"/> + <application android:label="UsbHostExternalManagementTestApp"> <activity android:name=".UsbHostManagementActivity" - android:configChanges="keyboard|keyboardHidden" > + android:configChanges="keyboard|keyboardHidden" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> </intent-filter> <intent-filter> - <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> + <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> </intent-filter> </activity> </application> diff --git a/tests/VectorDrawableTest/AndroidManifest.xml b/tests/VectorDrawableTest/AndroidManifest.xml index 7b3beb27e0cc..5334dac57ca2 100644 --- a/tests/VectorDrawableTest/AndroidManifest.xml +++ b/tests/VectorDrawableTest/AndroidManifest.xml @@ -16,147 +16,146 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.dynamic" > - - <application - android:hardwareAccelerated="true" - android:label="vector" - android:supportsRtl="true" > - <activity - android:name="VectorDrawablePerformance" - android:label="Vector Performance" > + package="com.android.test.dynamic"> + + <application android:hardwareAccelerated="true" + android:label="vector" + android:supportsRtl="true"> + <activity android:name="VectorDrawablePerformance" + android:label="Vector Performance" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="BitmapDrawableDupe" - android:label="Bitmap Performance of clones" > + <activity android:name="BitmapDrawableDupe" + android:label="Bitmap Performance of clones" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorDrawableAnimation" - android:label="VectorTestAnimation" > + <activity android:name="VectorDrawableAnimation" + android:label="VectorTestAnimation" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorDrawableTest" - android:label="Vector Icon" > + <activity android:name="VectorDrawableTest" + android:label="Vector Icon" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity - android:name="AnimatedVectorDrawableTest" - android:label="AnimatedVectorDrawableTest" > + <activity android:name="AnimatedVectorDrawableTest" + android:label="AnimatedVectorDrawableTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="AnimatedStateVectorDrawableTest" - android:label="AnimatedStateList and AnimatedVectorDrawable" > + <activity android:name="AnimatedStateVectorDrawableTest" + android:label="AnimatedStateList and AnimatedVectorDrawable" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorDrawable01" - android:label="VectorTest1" > + <activity android:name="VectorDrawable01" + android:label="VectorTest1" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorDrawableDupPerf" - android:label="Vector Performance of clones" > + <activity android:name="VectorDrawableDupPerf" + android:label="Vector Performance of clones" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="AnimatedVectorDrawableDupPerf" - android:label="Animated Vector Performance of clones" > + <activity android:name="AnimatedVectorDrawableDupPerf" + android:label="Animated Vector Performance of clones" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorDrawableStaticPerf" - android:label="System icons" > + <activity android:name="VectorDrawableStaticPerf" + android:label="System icons" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorCheckbox" - android:label="Basic static vector drawables" > + <activity android:name="VectorCheckbox" + android:label="Basic static vector drawables" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="VectorPathChecking" - android:label="Path Checking graphics" > + <activity android:name="VectorPathChecking" + android:label="Path Checking graphics" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="ScaleDrawableTests" - android:label="Scale Type Test" > + <activity android:name="ScaleDrawableTests" + android:label="Scale Type Test" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="AnimatedVectorDrawableAttr" - android:label="AnimatedVectorDrawable Attr Test" > + <activity android:name="AnimatedVectorDrawableAttr" + android:label="AnimatedVectorDrawable Attr Test" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> - <activity - android:name="BoundsCheckTest" - android:label="SetBound check" > + <activity android:name="BoundsCheckTest" + android:label="SetBound check" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MAIN"/> - <category android:name="com.android.test.dynamic.TEST" /> + <category android:name="com.android.test.dynamic.TEST"/> </intent-filter> </activity> </application> diff --git a/tests/VoiceEnrollment/AndroidManifest.xml b/tests/VoiceEnrollment/AndroidManifest.xml index 46f6ff541b4d..d30f21c1cd57 100644 --- a/tests/VoiceEnrollment/AndroidManifest.xml +++ b/tests/VoiceEnrollment/AndroidManifest.xml @@ -1,20 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.voiceenrollment"> + package="com.android.test.voiceenrollment"> - <uses-permission android:name="android.permission.MANAGE_VOICE_KEYPHRASES" /> - <application - android:permission="android.permission.MANAGE_VOICE_KEYPHRASES"> - <activity - android:name="TestEnrollmentActivity" - android:label="Voice Enrollment Application" - android:theme="@android:style/Theme.Material.Light.Voice"> + <uses-permission android:name="android.permission.MANAGE_VOICE_KEYPHRASES"/> + <application android:permission="android.permission.MANAGE_VOICE_KEYPHRASES"> + <activity android:name="TestEnrollmentActivity" + android:label="Voice Enrollment Application" + android:theme="@android:style/Theme.Material.Light.Voice" + android:exported="true"> <intent-filter> - <action android:name="com.android.intent.action.MANAGE_VOICE_KEYPHRASES" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="com.android.intent.action.MANAGE_VOICE_KEYPHRASES"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> - <meta-data - android:name="android.voice_enrollment" - android:resource="@xml/enrollment_application"/> + <meta-data android:name="android.voice_enrollment" + android:resource="@xml/enrollment_application"/> </application> </manifest> diff --git a/tests/VoiceInteraction/AndroidManifest.xml b/tests/VoiceInteraction/AndroidManifest.xml index 5fdf0dd3992c..5d8cea783dd7 100644 --- a/tests/VoiceInteraction/AndroidManifest.xml +++ b/tests/VoiceInteraction/AndroidManifest.xml @@ -1,74 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.test.voiceinteraction"> + package="com.android.test.voiceinteraction"> - <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="25" /> + <uses-sdk android:minSdkVersion="23" + android:targetSdkVersion="25"/> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.READ_LOGS" /> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> + <uses-permission android:name="android.permission.READ_LOGS"/> <application> - <activity android:name="VoiceInteractionMain" android:label="Voice Interaction" - android:theme="@android:style/Theme.Material"> + <activity android:name="VoiceInteractionMain" + android:label="Voice Interaction" + android:theme="@android:style/Theme.Material" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="AssistProxyActivity" - android:label="Test Assist Proxy" - android:theme="@android:style/Theme.NoDisplay" - android:excludeFromRecents="true" - android:noHistory="true" - android:taskAffinity=""> + android:label="Test Assist Proxy" + android:theme="@android:style/Theme.NoDisplay" + android:excludeFromRecents="true" + android:noHistory="true" + android:taskAffinity="" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.ASSIST" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.intent.action.ASSIST"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <activity android:name="SettingsActivity" - android:label="Voice Interaction Settings"> + android:label="Voice Interaction Settings" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> <service android:name="MainInteractionService" - android:label="Test Voice Interaction Service" - android:permission="android.permission.BIND_VOICE_INTERACTION" - android:process=":interactor"> + android:label="Test Voice Interaction Service" + android:permission="android.permission.BIND_VOICE_INTERACTION" + android:process=":interactor" + android:exported="true"> <meta-data android:name="android.voice_interaction" - android:resource="@xml/interaction_service" /> + android:resource="@xml/interaction_service"/> <intent-filter> - <action android:name="android.service.voice.VoiceInteractionService" /> + <action android:name="android.service.voice.VoiceInteractionService"/> </intent-filter> </service> <service android:name="MainInteractionSessionService" - android:permission="android.permission.BIND_VOICE_INTERACTION" - android:process=":session"> + android:permission="android.permission.BIND_VOICE_INTERACTION" + android:process=":session"> </service> <service android:name="MainRecognitionService" - android:label="Test Voice Interaction Service"> + android:label="Test Voice Interaction Service" + android:exported="true"> <intent-filter> - <action android:name="android.speech.RecognitionService" /> - <category android:name="android.intent.category.DEFAULT" /> + <action android:name="android.speech.RecognitionService"/> + <category android:name="android.intent.category.DEFAULT"/> </intent-filter> - <meta-data android:name="android.speech" android:resource="@xml/recognition_service" /> + <meta-data android:name="android.speech" + android:resource="@xml/recognition_service"/> </service> - <activity android:name="TestInteractionActivity" android:label="Voice Interaction Target" - android:theme="@android:style/Theme.Material.Light"> + <activity android:name="TestInteractionActivity" + android:label="Voice Interaction Target" + android:theme="@android:style/Theme.Material.Light" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.VOICE" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.VOICE"/> </intent-filter> </activity> - <activity android:name="StartVoiceInteractionActivity" android:label="In-Activity Voice" - android:theme="@android:style/Theme.Material.Light"> + <activity android:name="StartVoiceInteractionActivity" + android:label="In-Activity Voice" + android:theme="@android:style/Theme.Material.Light" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/WallpaperTest/AndroidManifest.xml b/tests/WallpaperTest/AndroidManifest.xml index 4c914dd5498d..8d7ccb9476ca 100644 --- a/tests/WallpaperTest/AndroidManifest.xml +++ b/tests/WallpaperTest/AndroidManifest.xml @@ -1,31 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.wallpapertest" > + package="com.example.wallpapertest"> - <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> + <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/> - <application - android:label="@string/app_name" - android:theme="@style/AppTheme" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > + <application android:label="@string/app_name" + android:theme="@style/AppTheme"> + <activity android:name=".MainActivity" + android:label="@string/app_name" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <service - android:label="@string/test_wallpaper" - android:name=".TestWallpaper" - android:permission="android.permission.BIND_WALLPAPER" - android:enabled="true"> + <service android:label="@string/test_wallpaper" + android:name=".TestWallpaper" + android:permission="android.permission.BIND_WALLPAPER" + android:enabled="true" + android:exported="true"> <intent-filter> - <action android:name="android.service.wallpaper.WallpaperService" /> + <action android:name="android.service.wallpaper.WallpaperService"/> </intent-filter> <meta-data android:name="android.service.wallpaper" - android:resource="@xml/test_wallpaper" /> + android:resource="@xml/test_wallpaper"/> </service> </application> </manifest> diff --git a/tests/WindowAnimationJank/AndroidManifest.xml b/tests/WindowAnimationJank/AndroidManifest.xml index d7aef3348af3..34d24408be1f 100644 --- a/tests/WindowAnimationJank/AndroidManifest.xml +++ b/tests/WindowAnimationJank/AndroidManifest.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- * Copyright (C) 2015 The Android Open Source Project * @@ -15,26 +14,28 @@ * See the License for the specific language governing permissions and * limitations under the License. --> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.windowanimationjank"> + package="android.windowanimationjank"> - <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> + <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/> <application> <uses-library android:name="android.test.runner"/> <activity android:name="ElementLayoutActivity" - android:label="ElementLayoutActivity" - android:taskAffinity="android.windowanimationjank.ElementLayoutActivity" > + android:label="ElementLayoutActivity" + android:taskAffinity="android.windowanimationjank.ElementLayoutActivity" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <!-- self-instrumenting test package. --> <instrumentation android:name="android.test.InstrumentationTestRunner" - android:targetPackage="android.windowanimationjank"> + android:targetPackage="android.windowanimationjank"> </instrumentation> </manifest> diff --git a/tests/WindowInsetsTests/AndroidManifest.xml b/tests/WindowInsetsTests/AndroidManifest.xml index 0f6282e20b41..61dd9d4cd021 100644 --- a/tests/WindowInsetsTests/AndroidManifest.xml +++ b/tests/WindowInsetsTests/AndroidManifest.xml @@ -18,15 +18,22 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.test.windowinsetstests"> - <application android:label="@string/activity_title"> - <activity android:name=".WindowInsetsActivity" - android:theme="@style/appTheme" - android:windowSoftInputMode="adjustResize"> - + <application android:label="@string/application_title"> + <activity android:name=".WindowInsetsTestsMainActivity" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + + <activity android:name=".ChatActivity" + android:label="@string/chat_activity_title" + android:theme="@style/chat" + android:windowSoftInputMode="adjustResize" /> + + <activity android:name=".ControllerActivity" + android:label="@string/controller_activity_title" + android:theme="@style/controller" /> </application> </manifest> diff --git a/tests/WindowInsetsTests/res/layout/window_inset_activity.xml b/tests/WindowInsetsTests/res/layout/chat_activity.xml index 1b51c4f83fe0..1b51c4f83fe0 100644 --- a/tests/WindowInsetsTests/res/layout/window_inset_activity.xml +++ b/tests/WindowInsetsTests/res/layout/chat_activity.xml diff --git a/tests/WindowInsetsTests/res/layout/controller_activity.xml b/tests/WindowInsetsTests/res/layout/controller_activity.xml new file mode 100644 index 000000000000..d51a4ddd43e8 --- /dev/null +++ b/tests/WindowInsetsTests/res/layout/controller_activity.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2019 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. +--> + + +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:id="@+id/content" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <Spinner + android:id="@+id/spinnerBehavior" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" /> + + <ToggleButton + android:id="@+id/toggleButtonStatus" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:checked="true" + android:text="Status Bars Toggle Button" + android:textOff="Status Bars Invisible" + android:textOn="Status Bars Visible" /> + + <SeekBar + android:id="@+id/seekBarStatus" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" + android:max="10000" + android:progress="10000" /> + + <ToggleButton + android:id="@+id/toggleButtonNavigation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:checked="true" + android:text="Navigation Bars Toggle Button" + android:textOff="Navigation Bars Invisible" + android:textOn="Navigation Bars Visible" /> + + <SeekBar + android:id="@+id/seekBarNavigation" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" + android:max="10000" + android:progress="10000" /> + + <ToggleButton + android:id="@+id/toggleButtonIme" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:checked="true" + android:text="IME Toggle Button" + android:textOff="IME Invisible" + android:textOn="IME Visible" /> + + <SeekBar + android:id="@+id/seekBarIme" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginBottom="20dp" + android:max="10000" + android:progress="0" /> + + <TextView + android:id="@+id/textViewControllableInsets" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="5dp" /> + + <EditText + android:id="@+id/editText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ems="10" + android:hint="For testing IME..." + android:inputType="text" + android:text="" /> + + </LinearLayout> + +</ScrollView>
\ No newline at end of file diff --git a/tests/WindowInsetsTests/res/layout/main_activity.xml b/tests/WindowInsetsTests/res/layout/main_activity.xml new file mode 100644 index 000000000000..621ed89204d1 --- /dev/null +++ b/tests/WindowInsetsTests/res/layout/main_activity.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <Button + android:id="@+id/chat_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/chat_activity_title" + android:textAllCaps="false"/> + + <Button + android:id="@+id/controller_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/controller_activity_title" + android:textAllCaps="false"/> + +</LinearLayout> diff --git a/tests/WindowInsetsTests/res/values/strings.xml b/tests/WindowInsetsTests/res/values/strings.xml index 2b8e5f3da362..1a236c6f751d 100644 --- a/tests/WindowInsetsTests/res/values/strings.xml +++ b/tests/WindowInsetsTests/res/values/strings.xml @@ -16,5 +16,14 @@ --> <resources> - <string name="activity_title">New Insets Chat</string> + <string name="application_title">Window Insets Tests</string> + <string name="chat_activity_title">New Insets Chat</string> + <string name="controller_activity_title">Window Insets Controller</string> + + <!-- The item positions should match the flag values respectively. --> + <string-array name="behaviors"> + <item>BEHAVIOR_SHOW_BARS_BY_TOUCH</item> + <item>BEHAVIOR_SHOW_BARS_BY_SWIPE</item> + <item>BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE</item> + </string-array> </resources> diff --git a/tests/WindowInsetsTests/res/values/styles.xml b/tests/WindowInsetsTests/res/values/styles.xml index 220671fb8e71..a84ffbed600d 100644 --- a/tests/WindowInsetsTests/res/values/styles.xml +++ b/tests/WindowInsetsTests/res/values/styles.xml @@ -17,7 +17,7 @@ <resources> - <style name="appTheme" parent="@style/Theme.MaterialComponents.Light"> + <style name="chat" parent="@style/Theme.MaterialComponents.Light"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> @@ -63,5 +63,11 @@ <dimen name="bubble_padding">8dp</dimen> <dimen name="bubble_padding_side">16dp</dimen> + <style name="controller" parent="android:Theme.Material"> + <item name="android:colorPrimaryDark">#111111</item> + <item name="android:navigationBarColor">#111111</item> + <item name="android:colorPrimary">#222222</item> + <item name="android:colorAccent">#33ccff</item> + </style> </resources>
\ No newline at end of file diff --git a/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/WindowInsetsActivity.java b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/ChatActivity.java index 498cb7c1c710..ba12acb2c877 100644 --- a/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/WindowInsetsActivity.java +++ b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/ChatActivity.java @@ -30,7 +30,6 @@ import android.content.Context; import android.graphics.Insets; import android.os.Bundle; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; @@ -39,8 +38,6 @@ import android.view.WindowInsetsAnimation; import android.view.WindowInsetsAnimation.Callback; import android.view.WindowInsetsAnimationControlListener; import android.view.WindowInsetsAnimationController; -import android.view.WindowInsetsController; -import android.view.WindowInsetsController.OnControllableInsetsChangedListener; import android.view.animation.LinearInterpolator; import android.widget.LinearLayout; @@ -49,7 +46,7 @@ import java.util.List; import androidx.appcompat.app.AppCompatActivity; -public class WindowInsetsActivity extends AppCompatActivity { +public class ChatActivity extends AppCompatActivity { private View mRoot; @@ -58,7 +55,7 @@ public class WindowInsetsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.window_inset_activity); + setContentView(R.layout.chat_activity); setSupportActionBar(findViewById(R.id.toolbar)); @@ -71,7 +68,7 @@ public class WindowInsetsActivity extends AppCompatActivity { mRoot.setOnTouchListener(new View.OnTouchListener() { private final ViewConfiguration mViewConfiguration = - ViewConfiguration.get(WindowInsetsActivity.this); + ViewConfiguration.get(ChatActivity.this); WindowInsetsAnimationController mAnimationController; WindowInsetsAnimationControlListener mCurrentRequest; boolean mRequestedController = false; diff --git a/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/ControllerActivity.java b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/ControllerActivity.java new file mode 100644 index 000000000000..beb4049cb230 --- /dev/null +++ b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/ControllerActivity.java @@ -0,0 +1,202 @@ +/* + * 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.google.android.test.windowinsetstests; + +import android.app.Activity; +import android.graphics.Insets; +import android.os.Bundle; +import android.view.View; +import android.view.WindowInsets; +import android.view.WindowInsets.Type; +import android.view.WindowInsetsAnimationControlListener; +import android.view.WindowInsetsAnimationController; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.CompoundButton; +import android.widget.SeekBar; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.ToggleButton; + +public class ControllerActivity extends Activity implements View.OnApplyWindowInsetsListener { + + private ToggleButton mToggleStatus; + private SeekBar mSeekStatus; + private ToggleButton mToggleNavigation; + private SeekBar mSeekNavigation; + private ToggleButton mToggleIme; + private SeekBar mSeekIme; + private TextView mTextControllableInsets; + private boolean[] mNotFromUser = {false}; + private WindowInsets mLastInsets; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.controller_activity); + final Spinner spinnerBehavior = findViewById(R.id.spinnerBehavior); + ArrayAdapter<CharSequence> adapterBehavior = ArrayAdapter.createFromResource(this, + R.array.behaviors, android.R.layout.simple_spinner_item); + adapterBehavior.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + spinnerBehavior.setAdapter(adapterBehavior); + spinnerBehavior.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + parent.getWindowInsetsController().setSystemBarsBehavior(position); + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { } + }); + mToggleStatus = findViewById(R.id.toggleButtonStatus); + mToggleStatus.setTag(mNotFromUser); + mToggleStatus.setOnCheckedChangeListener(new ToggleListener(Type.statusBars())); + mSeekStatus = findViewById(R.id.seekBarStatus); + mSeekStatus.setOnSeekBarChangeListener(new SeekBarListener(Type.statusBars())); + mToggleNavigation = findViewById(R.id.toggleButtonNavigation); + mToggleNavigation.setTag(mNotFromUser); + mToggleNavigation.setOnCheckedChangeListener(new ToggleListener(Type.navigationBars())); + mSeekNavigation = findViewById(R.id.seekBarNavigation); + mSeekNavigation.setOnSeekBarChangeListener(new SeekBarListener(Type.navigationBars())); + mToggleIme = findViewById(R.id.toggleButtonIme); + mToggleIme.setTag(mNotFromUser); + mToggleIme.setOnCheckedChangeListener(new ToggleListener(Type.ime())); + mSeekIme = findViewById(R.id.seekBarIme); + mSeekIme.setOnSeekBarChangeListener(new SeekBarListener(Type.ime())); + mTextControllableInsets = findViewById(R.id.textViewControllableInsets); + final View contentView = findViewById(R.id.content); + contentView.setOnApplyWindowInsetsListener(this); + contentView.getWindowInsetsController().addOnControllableInsetsChangedListener( + (c, types) -> mTextControllableInsets.setText("ControllableInsetsTypes=" + types)); + } + + @Override + public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { + mNotFromUser[0] = true; + updateWidgets(insets, Type.statusBars(), mToggleStatus, mSeekStatus); + updateWidgets(insets, Type.navigationBars(), mToggleNavigation, mSeekNavigation); + updateWidgets(insets, Type.ime(), mToggleIme, mSeekIme); + mLastInsets = insets; + mNotFromUser[0] = false; + + // Prevent triggering system gestures while controlling seek bars. + final Insets gestureInsets = insets.getInsets(Type.systemGestures()); + v.setPadding(gestureInsets.left, 0, gestureInsets.right, 0); + + return v.onApplyWindowInsets(insets); + } + + private void updateWidgets(WindowInsets insets, int types, ToggleButton toggle, SeekBar seek) { + final boolean isVisible = insets.isVisible(types); + final boolean wasVisible = mLastInsets != null ? mLastInsets.isVisible(types) : !isVisible; + if (isVisible != wasVisible) { + toggle.setChecked(isVisible); + if (!seek.isPressed()) { + seek.setProgress(isVisible ? seek.getMax() : seek.getMin(), true /* animate*/); + } + } + + } + + private static class ToggleListener implements CompoundButton.OnCheckedChangeListener { + + private final @Type.InsetsType int mTypes; + + ToggleListener(int types) { + mTypes = types; + } + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (((boolean[]) buttonView.getTag())[0]) { + // not from user + return; + } + if (isChecked) { + buttonView.getWindowInsetsController().show(mTypes); + } else { + buttonView.getWindowInsetsController().hide(mTypes); + } + } + } + + private static class SeekBarListener implements SeekBar.OnSeekBarChangeListener { + + private final @Type.InsetsType int mTypes; + + private WindowInsetsAnimationController mController; + + SeekBarListener(int types) { + mTypes = types; + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (mController != null && fromUser) { + final int min = seekBar.getMin(); + final float fraction = (progress - min) / (float) (seekBar.getMax() - min); + final Insets shownInsets = mController.getShownStateInsets(); + final Insets hiddenInsets = mController.getHiddenStateInsets(); + final Insets currentInsets = Insets.of( + (int) (0.5f + fraction * (shownInsets.left - hiddenInsets.left)), + (int) (0.5f + fraction * (shownInsets.top - hiddenInsets.top)), + (int) (0.5f + fraction * (shownInsets.right - hiddenInsets.right)), + (int) (0.5f + fraction * (shownInsets.bottom - hiddenInsets.bottom))); + mController.setInsetsAndAlpha(currentInsets, 1f /* alpha */, fraction); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + if (mController != null) { + return; + } + seekBar.getWindowInsetsController().controlWindowInsetsAnimation(mTypes, + -1 /* durationMs */, null /* interpolator */, null /* cancellationSignal */, + new WindowInsetsAnimationControlListener() { + @Override + public void onReady(WindowInsetsAnimationController controller, int types) { + mController = controller; + if (!seekBar.isPressed()) { + onStopTrackingTouch(seekBar); + } + } + + @Override + public void onFinished(WindowInsetsAnimationController controller) { + mController = null; + } + + @Override + public void onCancelled(WindowInsetsAnimationController controller) { + mController = null; + } + }); + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + final int min = seekBar.getMin(); + final int max = seekBar.getMax(); + final boolean shown = (seekBar.getProgress() - min) * 2 > max - min; + seekBar.setProgress(shown ? max : min); + if (mController != null) { + mController.finish(shown); + } + } + } +} diff --git a/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/WindowInsetsTestsMainActivity.java b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/WindowInsetsTestsMainActivity.java new file mode 100644 index 000000000000..8b77a78ff51e --- /dev/null +++ b/tests/WindowInsetsTests/src/com/google/android/test/windowinsetstests/WindowInsetsTestsMainActivity.java @@ -0,0 +1,36 @@ +/* + * 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.google.android.test.windowinsetstests; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +public class WindowInsetsTestsMainActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main_activity); + + findViewById(R.id.chat_button).setOnClickListener( + v -> startActivity(new Intent(this, ChatActivity.class))); + + findViewById(R.id.controller_button).setOnClickListener( + v -> startActivity(new Intent(this, ControllerActivity.class))); + } +} diff --git a/tests/appwidgets/AppWidgetHostTest/AndroidManifest.xml b/tests/appwidgets/AppWidgetHostTest/AndroidManifest.xml index bf6a7cbfacef..3601992d13cc 100644 --- a/tests/appwidgets/AppWidgetHostTest/AndroidManifest.xml +++ b/tests/appwidgets/AppWidgetHostTest/AndroidManifest.xml @@ -1,36 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.appwidgethost"> - <uses-permission android:name="android.permission.VIBRATE" /> + package="com.android.tests.appwidgethost"> + <uses-permission android:name="android.permission.VIBRATE"/> <application> - <activity android:name="AppWidgetHostActivity" android:label="_AppWidgetHost"> + <activity android:name="AppWidgetHostActivity" + android:label="_AppWidgetHost" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - <activity android:name="TestAppWidgetConfigure" android:label="Configure TestAppWidgetProvider"> + <activity android:name="TestAppWidgetConfigure" + android:label="Configure TestAppWidgetProvider" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <!-- BEGIN_INCLUDE(AppWidgetProvider) --> <receiver android:name="TestAppWidgetProvider" - android:label="@string/oh_hai" - android:icon="@drawable/oh_hai_icon" - > + android:label="@string/oh_hai" + android:icon="@drawable/oh_hai_icon" + android:exported="true"> <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> </intent-filter> <meta-data android:name="android.appwidget.provider" - android:resource="@xml/appwidget_info" - /> + android:resource="@xml/appwidget_info"/> </receiver> <!-- END_INCLUDE(AppWidgetProvider) --> - + </application> </manifest> diff --git a/tests/appwidgets/AppWidgetProviderTest/AndroidManifest.xml b/tests/appwidgets/AppWidgetProviderTest/AndroidManifest.xml index ec4d583ddccb..4f6a81fadd52 100644 --- a/tests/appwidgets/AppWidgetProviderTest/AndroidManifest.xml +++ b/tests/appwidgets/AppWidgetProviderTest/AndroidManifest.xml @@ -1,13 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.appwidgetprovider"> - <uses-permission android:name="android.permission.VIBRATE" /> + package="com.android.tests.appwidgetprovider"> + <uses-permission android:name="android.permission.VIBRATE"/> <application> - <receiver android:name="TestAppWidgetProvider"> + <receiver android:name="TestAppWidgetProvider" + android:exported="true"> <intent-filter> - <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> </intent-filter> - <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_info" /> + <meta-data android:name="android.appwidget.provider" + android:resource="@xml/appwidget_info"/> </receiver> </application> </manifest> diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml index 3778742e105e..f0a3eb2da8ea 100644 --- a/tests/backup/AndroidManifest.xml +++ b/tests/backup/AndroidManifest.xml @@ -1,11 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.backuptest"> + package="com.android.backuptest"> <application android:backupAgent="BackupTestAgent"> - <activity android:name="BackupTestActivity" android:label="_BackupTest"> + <activity android:name="BackupTestActivity" + android:label="_BackupTest" + android:exported="true"> <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.DEFAULT"/> + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> diff --git a/tests/benchmarks/internal/Android.bp b/tests/benchmarks/internal/Android.bp new file mode 100644 index 000000000000..9c34eaf2af01 --- /dev/null +++ b/tests/benchmarks/internal/Android.bp @@ -0,0 +1,26 @@ +// 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. + +android_test { + name: "InternalBenchTests", + srcs: ["src/**/*.java"], + static_libs: [ + "androidx.test.rules", + "androidx.annotation_annotation", + ], + test_suites: ["device-tests"], + platform_apis: true, + certificate: "platform" +} + diff --git a/tests/benchmarks/internal/AndroidManifest.xml b/tests/benchmarks/internal/AndroidManifest.xml new file mode 100644 index 000000000000..16023c6f3617 --- /dev/null +++ b/tests/benchmarks/internal/AndroidManifest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.internal.bench"> + + <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.internal.bench"/> +</manifest> + diff --git a/tests/benchmarks/internal/AndroidTest.xml b/tests/benchmarks/internal/AndroidTest.xml new file mode 100644 index 000000000000..d776ee681c04 --- /dev/null +++ b/tests/benchmarks/internal/AndroidTest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Benchmark for internal classes/utilities."> + <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller"> + <option name="cleanup-apks" value="true" /> + <option name="test-file-name" value="InternalBenchTests.apk" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.AndroidJUnitTest" > + <option name="package" value="com.android.internal.bench" /> + <option name="hidden-api-checks" value="false"/> + </test> + +</configuration> + diff --git a/tests/benchmarks/internal/src/com/android/internal/LambdaPerfTest.java b/tests/benchmarks/internal/src/com/android/internal/LambdaPerfTest.java new file mode 100644 index 000000000000..388548691b77 --- /dev/null +++ b/tests/benchmarks/internal/src/com/android/internal/LambdaPerfTest.java @@ -0,0 +1,454 @@ +/*
+ * 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.internal;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import android.app.Activity;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.os.Message;
+import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.os.SystemClock;
+import android.util.Log;
+
+import androidx.test.filters.LargeTest;
+
+import com.android.internal.util.function.pooled.PooledConsumer;
+import com.android.internal.util.function.pooled.PooledLambda;
+import com.android.internal.util.function.pooled.PooledPredicate;
+
+import org.junit.Assume;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runners.model.Statement;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/** Compares the performance of regular lambda and pooled lambda. */
+@LargeTest
+public class LambdaPerfTest {
+ private static final boolean DEBUG = false;
+ private static final String TAG = LambdaPerfTest.class.getSimpleName();
+
+ private static final String LAMBDA_FORM_REGULAR = "regular";
+ private static final String LAMBDA_FORM_POOLED = "pooled";
+
+ private static final int WARMUP_ITERATIONS = 1000;
+ private static final int TEST_ITERATIONS = 3000000;
+ private static final int TASK_COUNT = 10;
+ private static final long DELAY_AFTER_BENCH_MS = 1000;
+
+ private String mMethodName;
+
+ private final Bundle mTestResults = new Bundle();
+ private final ArrayList<Task> mTasks = new ArrayList<>();
+
+ // The member fields are used to ensure lambda capturing. They don't have the actual meaning.
+ private final Task mTask = new Task();
+ private final Rect mBounds = new Rect();
+ private int mTaskId;
+ private long mTime;
+ private boolean mTop;
+
+ @Rule
+ public final TestRule mRule = (base, description) -> new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ mMethodName = description.getMethodName();
+ mTasks.clear();
+ for (int i = 0; i < TASK_COUNT; i++) {
+ final Task t = new Task();
+ mTasks.add(t);
+ }
+ base.evaluate();
+
+ getInstrumentation().sendStatus(Activity.RESULT_OK, mTestResults);
+ }
+ };
+
+ @Test
+ public void test1ParamConsumer() {
+ evaluate(LAMBDA_FORM_REGULAR, () -> forAllTask(t -> t.doSomething(mTask)));
+ evaluate(LAMBDA_FORM_POOLED, () -> {
+ final PooledConsumer c = PooledLambda.obtainConsumer(Task::doSomething,
+ PooledLambda.__(Task.class), mTask);
+ forAllTask(c);
+ c.recycle();
+ });
+ }
+
+ @Test
+ public void test2PrimitiveParamsConsumer() {
+ // Not in Integer#IntegerCache (-128~127) for autoboxing, that will create new object.
+ mTaskId = 12345;
+ mTime = 54321;
+
+ evaluate(LAMBDA_FORM_REGULAR, () -> forAllTask(t -> t.doSomething(mTaskId, mTime)));
+ evaluate(LAMBDA_FORM_POOLED, () -> {
+ final PooledConsumer c = PooledLambda.obtainConsumer(Task::doSomething,
+ PooledLambda.__(Task.class), mTaskId, mTime);
+ forAllTask(c);
+ c.recycle();
+ });
+ }
+
+ @Test
+ public void test3ParamsPredicate() {
+ mTop = true;
+ // In Integer#IntegerCache.
+ mTaskId = 10;
+
+ evaluate(LAMBDA_FORM_REGULAR, () -> handleTask(t -> t.doSomething(mBounds, mTop, mTaskId)));
+ evaluate(LAMBDA_FORM_POOLED, () -> {
+ final PooledPredicate c = PooledLambda.obtainPredicate(Task::doSomething,
+ PooledLambda.__(Task.class), mBounds, mTop, mTaskId);
+ handleTask(c);
+ c.recycle();
+ });
+ }
+
+ @Test
+ public void testMessage() {
+ evaluate(LAMBDA_FORM_REGULAR, () -> {
+ final Message m = Message.obtain().setCallback(() -> mTask.doSomething(mTaskId, mTime));
+ m.getCallback().run();
+ m.recycle();
+ });
+ evaluate(LAMBDA_FORM_POOLED, () -> {
+ final Message m = PooledLambda.obtainMessage(Task::doSomething, mTask, mTaskId, mTime);
+ m.getCallback().run();
+ m.recycle();
+ });
+ }
+
+ @Test
+ public void testRunnable() {
+ evaluate(LAMBDA_FORM_REGULAR, () -> {
+ final Runnable r = mTask::doSomething;
+ r.run();
+ });
+ evaluate(LAMBDA_FORM_POOLED, () -> {
+ final Runnable r = PooledLambda.obtainRunnable(Task::doSomething, mTask).recycleOnUse();
+ r.run();
+ });
+ }
+
+ @Test
+ public void testMultiThread() {
+ final int numThread = 3;
+
+ final Runnable regularAction = () -> forAllTask(t -> t.doSomething(mTask));
+ final Runnable[] regularActions = new Runnable[numThread];
+ Arrays.fill(regularActions, regularAction);
+ evaluateMultiThread(LAMBDA_FORM_REGULAR, regularActions);
+
+ final Runnable pooledAction = () -> {
+ final PooledConsumer c = PooledLambda.obtainConsumer(Task::doSomething,
+ PooledLambda.__(Task.class), mTask);
+ forAllTask(c);
+ c.recycle();
+ };
+ final Runnable[] pooledActions = new Runnable[numThread];
+ Arrays.fill(pooledActions, pooledAction);
+ evaluateMultiThread(LAMBDA_FORM_POOLED, pooledActions);
+ }
+
+ private void forAllTask(Consumer<Task> callback) {
+ for (int i = mTasks.size() - 1; i >= 0; i--) {
+ callback.accept(mTasks.get(i));
+ }
+ }
+
+ private void handleTask(Predicate<Task> callback) {
+ for (int i = mTasks.size() - 1; i >= 0; i--) {
+ final Task task = mTasks.get(i);
+ if (callback.test(task)) {
+ return;
+ }
+ }
+ }
+
+ private void evaluate(String title, Runnable action) {
+ for (int i = 0; i < WARMUP_ITERATIONS; i++) {
+ action.run();
+ }
+ performGc();
+
+ final GcStatus startGcStatus = getGcStatus();
+ final long startTime = SystemClock.elapsedRealtime();
+ for (int i = 0; i < TEST_ITERATIONS; i++) {
+ action.run();
+ }
+ evaluateResult(title, startGcStatus, startTime);
+ }
+
+ private void evaluateMultiThread(String title, Runnable[] actions) {
+ performGc();
+
+ final CountDownLatch latch = new CountDownLatch(actions.length);
+ final GcStatus startGcStatus = getGcStatus();
+ final long startTime = SystemClock.elapsedRealtime();
+ for (Runnable action : actions) {
+ new Thread() {
+ @Override
+ public void run() {
+ for (int i = 0; i < TEST_ITERATIONS; i++) {
+ action.run();
+ }
+ latch.countDown();
+ };
+ }.start();
+ }
+ try {
+ latch.await();
+ } catch (InterruptedException ignored) {
+ }
+ evaluateResult(title, startGcStatus, startTime);
+ }
+
+ private void evaluateResult(String title, GcStatus startStatus, long startTime) {
+ final float elapsed = SystemClock.elapsedRealtime() - startTime;
+ // Sleep a while to see if GC may happen.
+ SystemClock.sleep(DELAY_AFTER_BENCH_MS);
+ final GcStatus endStatus = getGcStatus();
+ final GcInfo info = startStatus.calculateGcTime(endStatus, title, mTestResults);
+ Log.i(TAG, mMethodName + "_" + title + " execution time: "
+ + elapsed + "ms (avg=" + String.format("%.5f", elapsed / TEST_ITERATIONS) + "ms)"
+ + " GC time: " + String.format("%.3f", info.mTotalGcTime) + "ms"
+ + " GC paused time: " + String.format("%.3f", info.mTotalGcPausedTime) + "ms");
+ }
+
+ /** Cleans the test environment. */
+ private static void performGc() {
+ System.gc();
+ System.runFinalization();
+ System.gc();
+ }
+
+ private static GcStatus getGcStatus() {
+ if (DEBUG) {
+ Log.i(TAG, "===== Read GC dump =====");
+ }
+ final GcStatus status = new GcStatus();
+ final List<String> vmDump = getVmDump();
+ Assume.assumeFalse("VM dump is empty", vmDump.isEmpty());
+ for (String line : vmDump) {
+ status.visit(line);
+ if (line.startsWith("DALVIK THREADS")) {
+ break;
+ }
+ }
+ return status;
+ }
+
+ private static List<String> getVmDump() {
+ final int myPid = Process.myPid();
+ // Another approach Debug#dumpJavaBacktraceToFileTimeout requires setenforce 0.
+ Process.sendSignal(myPid, Process.SIGNAL_QUIT);
+ // Give a chance to handle the signal.
+ SystemClock.sleep(100);
+
+ String dump = null;
+ final String pattern = myPid + " written to: ";
+ final List<String> logs = shell("logcat -v brief -d tombstoned:I *:S");
+ for (int i = logs.size() - 1; i >= 0; i--) {
+ final String log = logs.get(i);
+ // Log pattern: Traces for pid 9717 written to: /data/anr/trace_07
+ final int pos = log.indexOf(pattern);
+ if (pos > 0) {
+ dump = log.substring(pattern.length() + pos);
+ break;
+ }
+ }
+
+ Assume.assumeNotNull("Unable to find VM dump", dump);
+ // It requires system or root uid to read the trace.
+ return shell("cat " + dump);
+ }
+
+ private static List<String> shell(String command) {
+ final ParcelFileDescriptor.AutoCloseInputStream stream =
+ new ParcelFileDescriptor.AutoCloseInputStream(
+ getInstrumentation().getUiAutomation().executeShellCommand(command));
+ final ArrayList<String> lines = new ArrayList<>();
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ lines.add(line);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return lines;
+ }
+
+ /** An empty class which provides some methods with different type arguments. */
+ static class Task {
+ void doSomething() {
+ }
+
+ void doSomething(Task t) {
+ }
+
+ void doSomething(int taskId, long time) {
+ }
+
+ boolean doSomething(Rect bounds, boolean top, int taskId) {
+ return false;
+ }
+ }
+
+ static class ValPattern {
+ static final int TYPE_COUNT = 0;
+ static final int TYPE_TIME = 1;
+ static final String PATTERN_COUNT = "(\\d+)";
+ static final String PATTERN_TIME = "(\\d+\\.?\\d+)(\\w+)";
+ final String mRawPattern;
+ final Pattern mPattern;
+ final int mType;
+
+ int mIntValue;
+ float mFloatValue;
+
+ ValPattern(String p, int type) {
+ mRawPattern = p;
+ mPattern = Pattern.compile(
+ p + (type == TYPE_TIME ? PATTERN_TIME : PATTERN_COUNT) + ".*");
+ mType = type;
+ }
+
+ boolean visit(String line) {
+ final Matcher matcher = mPattern.matcher(line);
+ if (!matcher.matches()) {
+ return false;
+ }
+ final String value = matcher.group(1);
+ if (value == null) {
+ return false;
+ }
+ if (mType == TYPE_COUNT) {
+ mIntValue = Integer.parseInt(value);
+ return true;
+ }
+ final float time = Float.parseFloat(value);
+ final String unit = matcher.group(2);
+ if (unit == null) {
+ return false;
+ }
+ // Refer to art/libartbase/base/time_utils.cc
+ switch (unit) {
+ case "s":
+ mFloatValue = time * 1000;
+ break;
+ case "ms":
+ mFloatValue = time;
+ break;
+ case "us":
+ mFloatValue = time / 1000;
+ break;
+ case "ns":
+ mFloatValue = time / 1000 / 1000;
+ break;
+ default:
+ throw new IllegalArgumentException();
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return mRawPattern + (mType == TYPE_TIME ? (mFloatValue + "ms") : mIntValue);
+ }
+ }
+
+ /** Parses the dump pattern of Heap::DumpGcPerformanceInfo. */
+ private static class GcStatus {
+ private static final int TOTAL_GC_TIME_INDEX = 1;
+ private static final int TOTAL_GC_PAUSED_TIME_INDEX = 5;
+
+ // Refer to art/runtime/gc/heap.cc
+ final ValPattern[] mPatterns = {
+ new ValPattern("Total GC count: ", ValPattern.TYPE_COUNT),
+ new ValPattern("Total GC time: ", ValPattern.TYPE_TIME),
+ new ValPattern("Total time waiting for GC to complete: ", ValPattern.TYPE_TIME),
+ new ValPattern("Total blocking GC count: ", ValPattern.TYPE_COUNT),
+ new ValPattern("Total blocking GC time: ", ValPattern.TYPE_TIME),
+ new ValPattern("Total mutator paused time: ", ValPattern.TYPE_TIME),
+ new ValPattern("Total number of allocations ", ValPattern.TYPE_COUNT),
+ new ValPattern("concurrent copying paused: Sum: ", ValPattern.TYPE_TIME),
+ new ValPattern("concurrent copying total time: ", ValPattern.TYPE_TIME),
+ new ValPattern("concurrent copying freed: ", ValPattern.TYPE_COUNT),
+ new ValPattern("Peak regions allocated ", ValPattern.TYPE_COUNT),
+ };
+
+ void visit(String dumpLine) {
+ for (ValPattern p : mPatterns) {
+ if (p.visit(dumpLine)) {
+ if (DEBUG) {
+ Log.i(TAG, " " + p);
+ }
+ }
+ }
+ }
+
+ GcInfo calculateGcTime(GcStatus newStatus, String title, Bundle result) {
+ Log.i(TAG, "===== GC status of " + title + " =====");
+ final GcInfo info = new GcInfo();
+ for (int i = 0; i < mPatterns.length; i++) {
+ final ValPattern p = mPatterns[i];
+ if (p.mType == ValPattern.TYPE_COUNT) {
+ final int diff = newStatus.mPatterns[i].mIntValue - p.mIntValue;
+ Log.i(TAG, " " + p.mRawPattern + diff);
+ if (diff > 0) {
+ result.putInt("[" + title + "] " + p.mRawPattern, diff);
+ }
+ continue;
+ }
+ final float diff = newStatus.mPatterns[i].mFloatValue - p.mFloatValue;
+ Log.i(TAG, " " + p.mRawPattern + diff + "ms");
+ if (diff > 0) {
+ result.putFloat("[" + title + "] " + p.mRawPattern + "(ms)", diff);
+ }
+ if (i == TOTAL_GC_TIME_INDEX) {
+ info.mTotalGcTime = diff;
+ } else if (i == TOTAL_GC_PAUSED_TIME_INDEX) {
+ info.mTotalGcPausedTime = diff;
+ }
+ }
+ return info;
+ }
+ }
+
+ private static class GcInfo {
+ float mTotalGcTime;
+ float mTotalGcPausedTime;
+ }
+}
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index 57c356dae9f8..1f23bf38c2f2 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -1198,7 +1198,7 @@ public class ConnectivityServiceTest { MockitoAnnotations.initMocks(this); when(mMetricsService.defaultNetworkMetrics()).thenReturn(mDefaultNetworkMetrics); - when(mUserManager.getUsers(eq(true))).thenReturn( + when(mUserManager.getAliveUsers()).thenReturn( Arrays.asList(new UserInfo[] { new UserInfo(VPN_USER, "", 0), })); @@ -3057,7 +3057,7 @@ public class ConnectivityServiceTest { * @return the context's attribution tag */ private String getAttributionTag() { - return null; + return mContext.getAttributionTag(); } @Test diff --git a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java index 5a29c2c96ba7..de35f910d53a 100644 --- a/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java +++ b/tests/net/java/com/android/server/connectivity/PermissionMonitorTest.java @@ -123,7 +123,7 @@ public class PermissionMonitorTest { MockitoAnnotations.initMocks(this); when(mContext.getPackageManager()).thenReturn(mPackageManager); when(mContext.getSystemService(eq(Context.USER_SERVICE))).thenReturn(mUserManager); - when(mUserManager.getUsers(eq(true))).thenReturn( + when(mUserManager.getAliveUsers()).thenReturn( Arrays.asList(new UserInfo[] { new UserInfo(MOCK_USER1, "", 0), new UserInfo(MOCK_USER2, "", 0), diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java index e8c4ee9c628d..c76b4cd501e7 100644 --- a/tests/net/java/com/android/server/connectivity/VpnTest.java +++ b/tests/net/java/com/android/server/connectivity/VpnTest.java @@ -1238,15 +1238,14 @@ public class VpnTest { * @see UserManagerService#getUsers(boolean) */ doAnswer(invocation -> { - final boolean excludeDying = (boolean) invocation.getArguments()[0]; final ArrayList<UserInfo> result = new ArrayList<>(users.length); for (UserInfo ui : users) { - if (!excludeDying || (ui.isEnabled() && !ui.partial)) { + if (ui.isEnabled() && !ui.partial) { result.add(ui); } } return result; - }).when(mUserManager).getUsers(anyBoolean()); + }).when(mUserManager).getAliveUsers(); doAnswer(invocation -> { final int id = (int) invocation.getArguments()[0]; diff --git a/tests/utils/StubIME/AndroidManifest.xml b/tests/utils/StubIME/AndroidManifest.xml index 04502d331d6a..bc64c671d9be 100644 --- a/tests/utils/StubIME/AndroidManifest.xml +++ b/tests/utils/StubIME/AndroidManifest.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- /* * Copyright 2006, The Android Open Source Project @@ -17,16 +18,20 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.testing.stubime"> - <application android:label="Stub IME"> - <service android:name="StubIme" - android:permission="android.permission.BIND_INPUT_METHOD"> + package="com.android.testing.stubime"> + <application android:label="Dummy IME"> + <service android:name="DummyIme" + android:permission="android.permission.BIND_INPUT_METHOD" + android:exported="true"> <intent-filter> - <action android:name="android.view.InputMethod" /> + <action android:name="android.view.InputMethod"/> </intent-filter> - <meta-data android:name="android.view.im" android:resource="@xml/method" /> + <meta-data android:name="android.view.im" + android:resource="@xml/method"/> </service> - <activity android:name=".ImePreferences" android:label="Stub IME Settings"> + <activity android:name=".ImePreferences" + android:label="Stub IME Settings" + android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> </intent-filter> diff --git a/tests/utils/hostutils/src/com/android/internal/util/test/SystemPreparer.java b/tests/utils/hostutils/src/com/android/internal/util/test/SystemPreparer.java index f30c35aca8da..f80af034fa2b 100644 --- a/tests/utils/hostutils/src/com/android/internal/util/test/SystemPreparer.java +++ b/tests/utils/hostutils/src/com/android/internal/util/test/SystemPreparer.java @@ -34,6 +34,8 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import javax.annotation.Nullable; @@ -49,7 +51,7 @@ import javax.annotation.Nullable; public class SystemPreparer extends ExternalResource { private static final long OVERLAY_ENABLE_TIMEOUT_MS = 30000; - // The paths of the files pushed onto the device through this rule. + // The paths of the files pushed onto the device through this rule to be removed after. private ArrayList<String> mPushedFiles = new ArrayList<>(); // The package names of packages installed through this rule. @@ -60,12 +62,22 @@ public class SystemPreparer extends ExternalResource { private final RebootStrategy mRebootStrategy; private final TearDownRule mTearDownRule; + // When debugging, it may be useful to run a test case without rebooting the device afterwards, + // to manually verify the device state. + private boolean mDebugSkipAfterReboot; + public SystemPreparer(TemporaryFolder hostTempFolder, DeviceProvider deviceProvider) { this(hostTempFolder, RebootStrategy.FULL, null, deviceProvider); } public SystemPreparer(TemporaryFolder hostTempFolder, RebootStrategy rebootStrategy, @Nullable TestRuleDelegate testRuleDelegate, DeviceProvider deviceProvider) { + this(hostTempFolder, rebootStrategy, testRuleDelegate, false, deviceProvider); + } + + public SystemPreparer(TemporaryFolder hostTempFolder, RebootStrategy rebootStrategy, + @Nullable TestRuleDelegate testRuleDelegate, boolean debugSkipAfterReboot, + DeviceProvider deviceProvider) { mHostTempFolder = hostTempFolder; mDeviceProvider = deviceProvider; mRebootStrategy = rebootStrategy; @@ -73,6 +85,7 @@ public class SystemPreparer extends ExternalResource { if (testRuleDelegate != null) { testRuleDelegate.setDelegate(mTearDownRule); } + mDebugSkipAfterReboot = debugSkipAfterReboot; } /** Copies a file within the host test jar to a path on device. */ @@ -81,7 +94,7 @@ public class SystemPreparer extends ExternalResource { final ITestDevice device = mDeviceProvider.getDevice(); remount(); assertTrue(device.pushFile(copyResourceToTemp(filePath), outputPath)); - mPushedFiles.add(outputPath); + addPushedFile(device, outputPath); return this; } @@ -91,10 +104,23 @@ public class SystemPreparer extends ExternalResource { final ITestDevice device = mDeviceProvider.getDevice(); remount(); assertTrue(device.pushFile(file, outputPath)); - mPushedFiles.add(outputPath); + addPushedFile(device, outputPath); return this; } + private void addPushedFile(ITestDevice device, String outputPath) + throws DeviceNotAvailableException { + Path pathCreated = Paths.get(outputPath); + + // Find the top most parent that is new to the device + while (pathCreated.getParent() != null + && !device.doesFileExist(pathCreated.getParent().toString())) { + pathCreated = pathCreated.getParent(); + } + + mPushedFiles.add(pathCreated.toString()); + } + /** Deletes the given path from the device */ public SystemPreparer deleteFile(String file) throws DeviceNotAvailableException { final ITestDevice device = mDeviceProvider.getDevice(); @@ -157,7 +183,9 @@ public class SystemPreparer extends ExternalResource { case USERSPACE_UNTIL_ONLINE: device.rebootUserspaceUntilOnline(); break; - case START_STOP: + // TODO(b/159540015): Make this START_STOP instead of default once it's fixed. Can't + // currently be done because START_STOP is commented out. + default: device.executeShellCommand("stop"); device.executeShellCommand("start"); ITestDevice.RecoveryMode cachedRecoveryMode = device.getRecoveryMode(); @@ -203,7 +231,7 @@ public class SystemPreparer extends ExternalResource { /** Removes installed packages and files that were pushed to the device. */ @Override - protected void after() { + public void after() { final ITestDevice device = mDeviceProvider.getDevice(); try { remount(); @@ -213,7 +241,9 @@ public class SystemPreparer extends ExternalResource { for (final String packageName : mInstalledPackages) { device.uninstallPackage(packageName); } - reboot(); + if (!mDebugSkipAfterReboot) { + reboot(); + } } catch (DeviceNotAvailableException e) { Assert.fail(e.toString()); } @@ -340,6 +370,7 @@ public class SystemPreparer extends ExternalResource { /** * How to reboot the device. Ordered from slowest to fastest. */ + @SuppressWarnings("DanglingJavadoc") public enum RebootStrategy { /** @see ITestDevice#reboot() */ FULL, @@ -359,7 +390,15 @@ public class SystemPreparer extends ExternalResource { * * TODO(b/159540015): There's a bug with this causing unnecessary disk space usage, which * can eventually lead to an insufficient storage space error. + * + * This can be uncommented for local development, but should be left out when merging. + * It is done this way to hopefully be caught by code review, since merging this will + * break all of postsubmit. But the nearly 50% reduction in test runtime is worth having + * this option exist. + * + * @deprecated do not use this in merged code until bug is resolved */ - START_STOP +// @Deprecated +// START_STOP } } diff --git a/tests/utils/hostutils/src/com/android/tests/rollback/host/AbandonSessionsRule.java b/tests/utils/hostutils/src/com/android/tests/rollback/host/AbandonSessionsRule.java new file mode 100644 index 000000000000..b08621314ee0 --- /dev/null +++ b/tests/utils/hostutils/src/com/android/tests/rollback/host/AbandonSessionsRule.java @@ -0,0 +1,62 @@ +/* + * 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.tests.rollback.host; + +import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; + +import org.junit.rules.ExternalResource; + +public class AbandonSessionsRule extends ExternalResource { + private final BaseHostJUnit4Test mHost; + + public AbandonSessionsRule(BaseHostJUnit4Test host) { + mHost = host; + } + + @Override + protected void before() throws Throwable { + abandonSessions(mHost.getDevice()); + } + + @Override + protected void after() { + try { + abandonSessions(mHost.getDevice()); + } catch (Exception ignore) { + } + } + + /** + * Abandons all sessions to prevent interference in our tests. + */ + private static void abandonSessions(ITestDevice device) throws Exception { + // No point in abandoning applied or failed sessions. We care about ready sessions only. + String cmdListReadySessions = + "pm list staged-sessions --only-sessionid --only-parent --only-ready"; + String output = device.executeShellCommand(cmdListReadySessions); + if (output.trim().isEmpty()) { + // No sessions to abandon + return; + } + // Ensure we have sufficient privilege to abandon sessions from other apps + device.enableAdbRoot(); + device.executeShellCommand("for i in $(" + cmdListReadySessions + + "); do pm install-abandon $i; done"); + device.disableAdbRoot(); + } +} |
