mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
fix: the launcher does not offer its own display as a second screen (#889)
* fix: the launcher does not offer its own display as a second screen MainActivity asked for the second-screen candidates with the default display as the primary one. When the launcher is itself shown on another display (DeX, an external monitor), that display was listed as a second screen. Pass the Activity's own display id, as SessionActivity already does. * fix: read the Activity display only on API 30 and newer minSdk is 26 and Activity.getDisplay needs API 30. Use windowManager.defaultDisplay below that. --------- Co-authored-by: ovurrsl <ovurrsl@users.noreply.github.com>
This commit is contained in:
1 parent
0d2e268dd5
commit
d573b60e4c
1 file changed
+3
-1
@@ -1050,7 +1050,9 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
private fun refreshSecondScreenDisplays() {
|
private fun refreshSecondScreenDisplays() {
|
||||||
if (!::displayManager.isInitialized) return
|
if (!::displayManager.isInitialized) return
|
||||||
secondScreenDisplays = SecondScreenDisplays.available(displayManager)
|
// The launcher can itself be shown on a non-default display (DeX, an external monitor); that one is not a "second screen".
|
||||||
|
val ownDisplayId = if (android.os.Build.VERSION.SDK_INT >= 30) display?.displayId ?: android.view.Display.DEFAULT_DISPLAY else @Suppress("DEPRECATION") windowManager.defaultDisplay.displayId
|
||||||
|
secondScreenDisplays = SecondScreenDisplays.available(displayManager, ownDisplayId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun launchAndroidApp(app: HomeApp.LaunchableApp, displayId: Int?) {
|
private fun launchAndroidApp(app: HomeApp.LaunchableApp, displayId: Int?) {
|
||||||
|
|||||||
Reference in new issue
Block a user