8000 Keep frame always landscape · Issue #34 · openstf/minicap · GitHub
[go: up one dir, main page]

Skip to content

Keep frame always landscape #34

Closed
Closed

Description

@haihaoshen

Hi,

Previously, I asked a question on frame for different rotation. You suggested restart the minicap server when rotation is changed.

I am wondering whether there is a way to keep frame always align for one rotation, like landscape, even for portrait app or landscape app. What I saw is the frame is just half for portrait app when the desired rotation of starting minicap server is 90 degree; however, it shows correctly for landscape apps.

Thanks,
Harry

Activity

  1. sorccu commented on Aug 22, 2016

    @sorccu
    Member

    First of all, if you're only getting half-sized frames, you're probably giving the parameters incorrectly. Both portrait and landscape images should be full size, although obviously they're landscape and portrait, so you'll actually get something like 720x1280 for portrait mode, and 1280x720 for landscape mode (as long as you restart minicap with the correct parameters).

    For locking the orientation, please look at the STF codebase, most of the things you have asked so far have been solved there. If you want to lock rotation, you can use public Android APIs to do that, but have to run the app as the shell user because of permission issues. See here for an example.

    Alternatively you should be able to lock the rotation by operating the device manually. Might be OK if you're willing to do that once?

    Also, not all views support multiple orientations.

    Anyway minicap by itself cannot do it.

  2. haihaoshen commented on Aug 22, 2016

    @haihaoshen
    Author

    Thanks for your answers. Let me explain the question more clearly. I hope to start minicap server only once, keep landscape mode, frame width 1280 and height 720. For landscape app, it is ok and the frame is normal; while for portrait app, it is half-sized (the 90 degree rotated frame is also accepted). I don't want to lock the orientation since some apps may require it.

  3. sorccu commented on Aug 22, 2016

    @sorccu
    Member

    I really don't think that's possible with the APIs minicap has access to. SurfaceFlinger unfortunately auto-rotates the frame so that it's always upright. When I made minicap I tried to work around that but was not able to find a way. There are some rotation-related flags that you can use when retrieving a frame, however they appear not to work. Restarting minicap is the only way that works reliably on all devices. Please let me know if you find a way, though.

  4. harrycrossincode commented on Aug 25, 2016

    @harrycrossincode

    I found Android screenrecord can always make the image upright. (no need to restart it several times).

  5. sorccu commented on Aug 25, 2016

    @sorccu
    Member

    Yeah? The image being upright is the issue.

  6. haihaoshen commented on Aug 26, 2016

    @haihaoshen
    Author

    I also tried screenrecord. The difference is screencap can show the full image, for portrait at beginning and landscape after rotation; however, minicap does not show the full image when starting orientation is changed.

  7. sorccu commented on Aug 26, 2016

    @sorccu
    Member

    minicap can show you the full image after you restart it. Is it really such a big issue that you have to restart it?

  8. haihaoshen commented on Aug 26, 2016

    @haihaoshen
    Author

    from my understanding, you have to monitor the orientation change and do minicap restart. It seems a heavy operation due to monitoring overhead. In practice, on-demand orientation can decide whether to rotate the image and minicap always show the image at start orientation (no matter orientation change), which is better solution. What do you think?

  9. sorccu commented on Aug 26, 2016

    @sorccu
    Member

    It's not possible to do it without breaking devices. On at least 4.4 and 5.0, calling the only API that's able to return the current size and orientation to you segfaults on practically every Samsung device because they've customized the DisplayInfo struct. You can test with the -i flag to see what happens on your device.

    Also, watching the rotation is not a heavy operation. There's another semi-private API on the Java side called RotationWatcher that simply gets notified when the rotation changes. It's not like it's doing polling.

    Screenrecord can access every API more reliably since it's the manufacturer building it with the full modified source code. I think you'll find that if you copy the screenrecord binary from a Nexus to a Galaxy device running the same version of Android, it simply won't work.

  10. haihaoshen commented on Aug 26, 2016

    @haihaoshen
    Author

    Could you please pinpoint the code to RotationWatcher ?

  11. sorccu commented on Aug 26, 2016

    @sorccu
    Member

    There's a link in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assign 3EBC ees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0