Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopWallpaperActivity.kt +21 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.app.Activity import android.app.TaskInfo import android.content.ComponentName import android.os.Bundle import android.util.Log import android.view.WindowManager import android.window.DesktopExperienceFlags /** * A transparent activity used in the desktop mode to show the wallpaper under the freeform windows. Loading @@ -35,11 +37,29 @@ class DesktopWallpaperActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) updateFocusableFlag(focusable = true) } override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) { if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) return Log.d(TAG, "onTopResumedActivityChanged: $isTopResumedActivity") // Let the activity be focusable when it is top-resumed (e.g. empty desk), otherwise input // events will result in an ANR because the focused app would have no focusable window. updateFocusableFlag(focusable = isTopResumedActivity) } private fun updateFocusableFlag(focusable: Boolean) { if (focusable) { window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } else { window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } } companion object { private const val TAG = "DesktopWallpaperActivity" private const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui" @JvmStatic val wallpaperActivityComponent = ComponentName(SYSTEM_UI_PACKAGE_NAME, DesktopWallpaperActivity::class.java.name) Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopWallpaperActivity.kt +21 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ import android.app.Activity import android.app.TaskInfo import android.content.ComponentName import android.os.Bundle import android.util.Log import android.view.WindowManager import android.window.DesktopExperienceFlags /** * A transparent activity used in the desktop mode to show the wallpaper under the freeform windows. Loading @@ -35,11 +37,29 @@ class DesktopWallpaperActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) updateFocusableFlag(focusable = true) } override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) { if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) return Log.d(TAG, "onTopResumedActivityChanged: $isTopResumedActivity") // Let the activity be focusable when it is top-resumed (e.g. empty desk), otherwise input // events will result in an ANR because the focused app would have no focusable window. updateFocusableFlag(focusable = isTopResumedActivity) } private fun updateFocusableFlag(focusable: Boolean) { if (focusable) { window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } else { window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) } } companion object { private const val TAG = "DesktopWallpaperActivity" private const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui" @JvmStatic val wallpaperActivityComponent = ComponentName(SYSTEM_UI_PACKAGE_NAME, DesktopWallpaperActivity::class.java.name) Loading