FLAG_LAYOUT_NO_LIMITS it is not respected on one screen mode

%3CLINGO-SUB%20id%3D%22lingo-sub-2776044%22%20slang%3D%22en-US%22%3EFLAG_LAYOUT_NO_LIMITS%20it%20is%20not%20respected%20on%20one%20screen%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2776044%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Fview%2FWindowManager.LayoutParams%23FLAG_LAYOUT_NO_LIMITS%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EFLAG_LAYOUT_NO_LIMITS%3C%2FA%3E%20is%20not%20respected%20on%20one%20screen%20mode%20on%20real%20device%20and%20emulator.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222021-09-22_23-08-14.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312231i542EEFC5F68363B4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222021-09-22_23-08-14.png%22%20alt%3D%222021-09-22_23-08-14.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222021-09-22_23-08-34.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312232iA86B1B18A76AE733%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222021-09-22_23-08-34.png%22%20alt%3D%222021-09-22_23-08-34.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20was%20reported%20by%20one%20of%20my%20app%20user%20and%20can%20be%20replicated%20really%20easy%20on%20emulator.%20Placing%20a%20View%20with%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Fview%2FWindowManager.LayoutParams%23FLAG_LAYOUT_NO_LIMITS%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EFLAG_LAYOUT_NO_LIMITS%3C%2FA%3E%26nbsp%3Boutside%20the%20screen%20boundaries%20does%20not%20work%20on%20single%20screen%20mode%2C%20as%20you%20can%20see%20in%20the%20screenshots%20above.%20When%20both%20screens%20are%20visible%2C%20the%20blue%20rectangle%20(a%20view)%20it%20is%20correctly%20placed%20outside%20the%20screen%2C%20when%20the%20screen%20is%20closed%20it%20is%20restricted%20inside%20the%20screen.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EVideo%20demo%20with%20the%20problem%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fstreamable.com%2F2tgevf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fstreamable.com%2F2tgevf%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2776044%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBUG%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2790112%22%20slang%3D%22en-US%22%3ERe%3A%20FLAG_LAYOUT_NO_LIMITS%20it%20is%20not%20respected%20on%20one%20screen%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2790112%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1162630%22%20target%3D%22_blank%22%3E%40micku7zu%3C%2FA%3E%26nbsp%3Bthanks%20for%20the%20additional%20info%20-%20from%20what%20I%20understand%20this%20is%20the%20same%20issue%20we%20%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fmicku7zu%2Fstatus%2F1440296206157053962%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ediscussed%20on%20Twitter%3C%2FA%3E%20but%20with%20a%20different%20repro%3F%20Adding%20the%20GitHub%20link%20so%20that%20all%20the%20relevant%20info%20is%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicku7zu%2FSurfaceDuoDispathGestureBug%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicku7zu%2FSurfaceDuoDispathGestureBug%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20downloaded%20%3CSTRONG%3EQuick%20Cursor%3C%2FSTRONG%3E%26nbsp%3Bapp%20(great%20idea%20BTW)%20and%20noticed%20that%20in%201.11.3%20you've%20listed%20a%20Surface%20Duo%20bug%20as%20fixed%20(Sep%2021%2C%202021).%20Since%20this%20post%20is%20from%20Sep%2022%2C%20it%20seems%20like%20there%20are%20still%20issues%20with%20FLAG_LAYOUT_NO_LIMITS%20though%3F%20To%20confirm%3A%20the%20%3CEM%3Ecursor%20tracking%3C%2FEM%3E%20part%20seems%20to%20work%20on%20both%20dual-screen%20and%20both%20single-screens%2C%20however%20the%20%3CEM%3Eclick%20target%3C%2FEM%3E%20is%20wrong%20when%20it's%20only%20the%20%3CU%3Eright%20screen%3C%2FU%3E%20that's%20active%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2790153%22%20slang%3D%22en-US%22%3ERe%3A%20FLAG_LAYOUT_NO_LIMITS%20it%20is%20not%20respected%20on%20one%20screen%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2790153%22%20slang%3D%22en-US%22%3EThe%20changelog%20from%20Quick%20Cursor%20refers%20to%20some%20other%20bug%20(my%20resizing%20algorithm)%2C%20not%20related%20to%20any%20of%20the%20discussions%20I%20opened%20here.%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20bug%20with%20FLAG_LAYOUT_NO_LIMITS%20was%20not%20discussed%20on%20Twitter%2C%20it%20is%20something%20new%20that%20some%20user%20reported%20after%20I've%20talked%20with%20you%20about%20the%20other%20bug%3A%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsurface-duo-sdk%2Fdisplay-screen-fold-info-from-accessibility-service%2Ftd-p%2F2771829%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsurface-duo-sdk%2Fdisplay-screen-fold-info-from-accessibility-service%2Ftd-p%2F2771829%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENone%20of%20this%20bugs%20can%20be%20fixed%20in%20the%20app%2C%20from%20my%20current%20Android%20knowledge.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20FLAG_LAYOUT_NO_LIMITS%20issue%20can%20be%20reproduced%20easily%20in%20Quick%20Cursor%3A%3CBR%20%2F%3E%3CBR%20%2F%3E1.%20Enable%20Quick%20Cursor%20-%26gt%3B%20Settings%20-%26gt%3B%20Debug%20-%26gt%3B%20Visual%20Debug%3CBR%20%2F%3E2.%20Move%20the%20tracker%20outside%20the%20screen%20with%20the%20screens%20open%3CBR%20%2F%3E3.%20Move%20the%20tracker%20outside%20the%20screen%20with%20only%20one%20screen%20active%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20see%20that%20the%20blue%20rectangle%20under%20the%20tracker%20(a%20view%20attached%20directly%20to%20Window%20Manager%20with%20FLAG_LAYOUT_NO_LIMITS)%20is%20restricted%20inside%20window%20limits%20when%20one%20screen%20is%20active.%20This%20should%20not%20happen%20according%20to%20the%20Android%20Documentation.%3CBR%20%2F%3E%3CBR%20%2F%3EOr%20just%20do%20a%20sample%20app%20and%20attach%20a%20view%20to%20Window%20Manager%20outside%20the%20screen%20coordinates%2C%20it%20should%20work%20with%20the%20flag%20but%20it%20doesn't.%3C%2FLINGO-BODY%3E
Occasional Contributor

The FLAG_LAYOUT_NO_LIMITS is not respected on one screen mode on real device and emulator. 

 

2021-09-22_23-08-14.png2021-09-22_23-08-34.png

 

This was reported by one of my app user and can be replicated really easy on emulator. Placing a View with FLAG_LAYOUT_NO_LIMITS outside the screen boundaries does not work on single screen mode, as you can see in the screenshots above. When both screens are visible, the blue rectangle (a view) it is correctly placed outside the screen, when the screen is closed it is restricted inside the screen. 

 

Video demo with the problem: https://streamable.com/2tgevf

5 Replies

@micku7zu thanks for the additional info - from what I understand this is the same issue we discussed on Twitter but with a different repro? Adding the GitHub link so that all the relevant info is here:

https://github.com/micku7zu/SurfaceDuoDispathGestureBug

 

I downloaded Quick Cursor app (great idea BTW) and noticed that in 1.11.3 you've listed a Surface Duo bug as fixed (Sep 21, 2021). Since this post is from Sep 22, it seems like there are still issues with FLAG_LAYOUT_NO_LIMITS though? To confirm: the cursor tracking part seems to work on both dual-screen and both single-screens, however the click target is wrong when it's only the right screen that's active?

The changelog from Quick Cursor refers to some other bug (my resizing algorithm), not related to any of the discussions I opened here.

This bug with FLAG_LAYOUT_NO_LIMITS was not discussed on Twitter, it is something new that some user reported after I've talked with you about the other bug: https://techcommunity.microsoft.com/t5/surface-duo-sdk/display-screen-fold-info-from-accessibility-s...

None of this bugs can be fixed in the app, from my current Android knowledge.

The FLAG_LAYOUT_NO_LIMITS issue can be reproduced easily in Quick Cursor:

1. Enable Quick Cursor -> Settings -> Debug -> Visual Debug
2. Move the tracker outside the screen with the screens open
3. Move the tracker outside the screen with only one screen active

You will see that the blue rectangle under the tracker (a view attached directly to Window Manager with FLAG_LAYOUT_NO_LIMITS) is restricted inside window limits when one screen is active. This should not happen according to the Android Documentation.

Or just do a sample app and attach a view to Window Manager outside the screen coordinates, it should work with the flag but it doesn't.

@Craig_Dunn 

To summarize, there are two bugs reported by the same user of my app in different days:

 

1. AccessibilityService.dispatchGesture coordinates x,y are not adjusted correctly when the user is using only the right screen (the left one is off). This can be an intended way of working but then there should be a way to detect that only the right screen is on, to adjust the coordinates from the app: https://techcommunity.microsoft.com/t5/surface-duo-sdk/display-screen-fold-info-from-accessibility-s...

 

2. FLAG_LAYOUT_NO_LIMITS is not working when one screen is open(this discussion):  https://techcommunity.microsoft.com/t5/surface-duo-sdk/flag-layout-no-limits-it-is-not-respected-on-...

 

I've created two separate discussions because they are completely different. 


@Craig_Dunn wrote:

I downloaded Quick Cursor app (great idea BTW) 


Thanks! I consider the app extremely useful considering the screen sizes trends and also a necessity for certain people with disabilities. 

 

I don't own a Surface Duo device, I just test it on the emulator, so I don't know exactly how easy is to use the app on it, but I have some users that use the app and reported those bugs. 

 

I want to adapt/fix the app for Surface Duo and for the recently released Surface Duo 2. I've currently made some nasty hacks for Duo for the app to be usable, but the opened discussions can't be fixed because Surface Duo Android implementation doesn't respect the official documentation (or needs to complicated hackish solution). 

Gotcha, thanks for the clarification.