Loading tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImmersiveAppHelper.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.tools.device.apphelpers.StandardAppHelper import android.tools.traces.component.ComponentNameMatcher import android.tools.traces.parsers.toFlickerComponent import com.android.server.wm.flicker.testapp.ActivityOptions class ImmersiveAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.ImmersiveActivity.LABEL, component: ComponentNameMatcher = ActivityOptions.ImmersiveActivity.COMPONENT.toFlickerComponent() ) : StandardAppHelper(instr, launcherName, component) tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,17 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".ImmersiveActivity" android:taskAffinity="com.android.server.wm.flicker.testapp.ImmersiveActivity" android:immersive="true" android:configChanges="screenSize" android:label="ImmersiveActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <service android:name=".AssistantInteractionSessionService" android:exported="true" Loading tests/FlickerTests/test-apps/flickerapp/res/layout/activity_immersive.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:background="@android:color/holo_blue_light"> <SurfaceView android:id="@+id/surface_view" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout> tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ActivityOptions.java +6 −0 Original line number Diff line number Diff line Loading @@ -318,4 +318,10 @@ public class ActivityOptions { public static final ComponentName ASSISTANT_SERVICE_COMPONENT_NAME = new ComponentName( FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".AssistantInteractionService"); public static class ImmersiveActivity { public static final String LABEL = "ImmersiveActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".ImmersiveActivity"); } } tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ImmersiveActivity.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.testapp; import android.app.Activity; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.PixelFormat; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; public class ImmersiveActivity extends Activity implements SurfaceHolder.Callback { private SurfaceHolder mSurfaceHolder; private SurfaceView mSurfaceView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_immersive); mSurfaceView = findViewById(R.id.surface_view); mSurfaceView.setZOrderOnTop(true); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder.addCallback(this); } @Override public void surfaceCreated(SurfaceHolder holder) { hideSystemBars(); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Canvas canvas = holder.lockCanvas(); canvas.drawColor(Color.argb(128, 0, 180, 255)); holder.unlockCanvasAndPost(canvas); } @Override public void surfaceDestroyed(SurfaceHolder holder) { } private void hideSystemBars() { WindowInsetsControllerCompat windowInsetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView()); if (windowInsetsController == null) { return; } // Configure the behavior of the hidden system bars. windowInsetsController.setSystemBarsBehavior( WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE ); // Hide both status bar and navigation bar. windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); } } Loading
tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/ImmersiveAppHelper.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.tools.device.apphelpers.StandardAppHelper import android.tools.traces.component.ComponentNameMatcher import android.tools.traces.parsers.toFlickerComponent import com.android.server.wm.flicker.testapp.ActivityOptions class ImmersiveAppHelper @JvmOverloads constructor( instr: Instrumentation, launcherName: String = ActivityOptions.ImmersiveActivity.LABEL, component: ComponentNameMatcher = ActivityOptions.ImmersiveActivity.COMPONENT.toFlickerComponent() ) : StandardAppHelper(instr, launcherName, component)
tests/FlickerTests/test-apps/flickerapp/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -431,6 +431,17 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".ImmersiveActivity" android:taskAffinity="com.android.server.wm.flicker.testapp.ImmersiveActivity" android:immersive="true" android:configChanges="screenSize" android:label="ImmersiveActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <service android:name=".AssistantInteractionSessionService" android:exported="true" Loading
tests/FlickerTests/test-apps/flickerapp/res/layout/activity_immersive.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:background="@android:color/holo_blue_light"> <SurfaceView android:id="@+id/surface_view" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout>
tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ActivityOptions.java +6 −0 Original line number Diff line number Diff line Loading @@ -318,4 +318,10 @@ public class ActivityOptions { public static final ComponentName ASSISTANT_SERVICE_COMPONENT_NAME = new ComponentName( FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".AssistantInteractionService"); public static class ImmersiveActivity { public static final String LABEL = "ImmersiveActivity"; public static final ComponentName COMPONENT = new ComponentName(FLICKER_APP_PACKAGE, FLICKER_APP_PACKAGE + ".ImmersiveActivity"); } }
tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/ImmersiveActivity.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.testapp; import android.app.Activity; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.PixelFormat; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; public class ImmersiveActivity extends Activity implements SurfaceHolder.Callback { private SurfaceHolder mSurfaceHolder; private SurfaceView mSurfaceView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_immersive); mSurfaceView = findViewById(R.id.surface_view); mSurfaceView.setZOrderOnTop(true); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder.addCallback(this); } @Override public void surfaceCreated(SurfaceHolder holder) { hideSystemBars(); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Canvas canvas = holder.lockCanvas(); canvas.drawColor(Color.argb(128, 0, 180, 255)); holder.unlockCanvasAndPost(canvas); } @Override public void surfaceDestroyed(SurfaceHolder holder) { } private void hideSystemBars() { WindowInsetsControllerCompat windowInsetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView()); if (windowInsetsController == null) { return; } // Configure the behavior of the hidden system bars. windowInsetsController.setSystemBarsBehavior( WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE ); // Hide both status bar and navigation bar. windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); } }