summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author wilsonshih <wilsonshih@google.com> 2024-01-11 17:55:45 +0800
committer wilsonshih <wilsonshih@google.com> 2024-01-15 03:10:36 +0000
commitd12f56e7725837ffe22bf02cc221a89d43b9920e (patch)
tree86d75c960688832846f11270e86419697c348a79
parent583bc7179d830789c474583233001ff430b0d4ff (diff)
Make the icon of SplashScreenView non-focusable
To make the embedded window of SplashScreenView non-focusable, needs to add the window flag separately from SurfaceControlViewHost#setView Bug: 319369153 Test: verify the embedded window of splash screen won't grant focus Change-Id: Ic9b48dcc4de25e681405b3dd78468597a8a7c627
-rw-r--r--core/java/android/window/SplashScreenView.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/window/SplashScreenView.java b/core/java/android/window/SplashScreenView.java
index bdaad2b68fc2..473b814fc4a7 100644
--- a/core/java/android/window/SplashScreenView.java
+++ b/core/java/android/window/SplashScreenView.java
@@ -47,6 +47,7 @@ import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
+import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -337,7 +338,14 @@ public final class SplashScreenView extends FrameLayout {
"SplashScreenView");
ImageView imageView = new ImageView(viewContext);
imageView.setBackground(mIconDrawable);
- viewHost.setView(imageView, mIconSize, mIconSize);
+ final int windowFlag = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
+ | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+ final WindowManager.LayoutParams lp =
+ new WindowManager.LayoutParams(mIconSize, mIconSize,
+ WindowManager.LayoutParams.TYPE_APPLICATION, windowFlag,
+ PixelFormat.TRANSPARENT);
+ viewHost.setView(imageView, lp);
SurfaceControlViewHost.SurfacePackage surfacePackage = viewHost.getSurfacePackage();
surfaceView.setChildSurfacePackage(surfacePackage);
view.mSurfacePackage = surfacePackage;