Merge lp://staging/~nick-dedekind/unity8/sidestage-restoreOnRotation into lp://staging/unity8

Proposed by Nick Dedekind
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2398
Merged at revision: 2513
Proposed branch: lp://staging/~nick-dedekind/unity8/sidestage-restoreOnRotation
Merge into: lp://staging/unity8
Prerequisite: lp://staging/~nick-dedekind/unity8/fix-dash-in-sidestage
Diff against target: 264 lines (+123/-51)
2 files modified
qml/Stages/TabletStage.qml (+7/-5)
tests/qmltests/Stages/tst_TabletStage.qml (+116/-46)
To merge this branch: bzr merge lp://staging/~nick-dedekind/unity8/sidestage-restoreOnRotation
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Daniel d'Andrada (community) Abstain
Lukáš Tinkl Pending
Review via email: mp+297909@code.staging.launchpad.net

This proposal supersedes a proposal from 2016-05-23.

Commit message

Save the last surface stage on stage drop.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
N/A

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

Nice refactoring in tst_TabletStage.

-----------

This sure is the easiest way to fix that bug, but I think it's wasteful to keep updating a database on disk (IO) about information you already keep in a variable in RAM. You only need to write that info to disk once the application goes away, as you are no longer keeping tabs on it in RAM.

Why does it lose that information when you rotate the shell?

What will happen if an application has two surfaces (one in main and one in side stage) and you rotate to portrait and then back to landscape (tst_OrientedShell doesn't have yet those app list controls so I could easily reproduce this use case)?

review: Needs Information
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal

Text conflict in qml/Stages/SurfaceContainer.qml

review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> Nice refactoring in tst_TabletStage.
>
> -----------
>
> This sure is the easiest way to fix that bug, but I think it's wasteful to
> keep updating a database on disk (IO) about information you already keep in a
> variable in RAM. You only need to write that info to disk once the application
> goes away, as you are no longer keeping tabs on it in RAM.

This is really a performance problem with the WindowStateStorage component.
We could make it batch state changes, or only save to disk out on exit; but that's for a different MP.

>
> Why does it lose that information when you rotate the shell?

When we rotate to and from portrait, the sidestage enables/disables (because sidestage not available in portrait). This triggers a refresh of the last saved stage (ie the last one due to user interaction [ie. dragging or closing]).

1) First open app.
   - MainStage loaded as default.
2) Drag app to SideStage.
   - state saved to SideStage.
3) Rotate device to portrait
   - App switches to MainStage because that's all that is available
4) Rotate device back to landscape
   - Reload saved stage = SideStage.

So if we drop on SideStage, then flip to portrait it will load in MainStage because SideStage is not available, but flip back to landscape and it will reload the last dropped stage (SideStage)

>
> What will happen if an application has two surfaces (one in main and one in
> side stage) and you rotate to portrait and then back to landscape
> (tst_OrientedShell doesn't have yet those app list controls so I could easily
> reproduce this use case)?

We'll have to have stage saved/loaded per surface. For another MP.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> Text conflict in qml/Stages/SurfaceContainer.qml

From prereq. fixed.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> > Nice refactoring in tst_TabletStage.
> >
> > -----------
> >
> > This sure is the easiest way to fix that bug, but I think it's wasteful to
> > keep updating a database on disk (IO) about information you already keep in
> a
> > variable in RAM. You only need to write that info to disk once the
> application
> > goes away, as you are no longer keeping tabs on it in RAM.
>
> This is really a performance problem with the WindowStateStorage component.
> We could make it batch state changes, or only save to disk out on exit; but
> that's for a different MP.
>
> >
> > Why does it lose that information when you rotate the shell?
>
> When we rotate to and from portrait, the sidestage enables/disables (because
> sidestage not available in portrait). This triggers a refresh of the last
> saved stage (ie the last one due to user interaction [ie. dragging or
> closing]).

Actually, it probably shouldn't save out on close. Will have to look into that...

>
> 1) First open app.
> - MainStage loaded as default.
> 2) Drag app to SideStage.
> - state saved to SideStage.
> 3) Rotate device to portrait
> - App switches to MainStage because that's all that is available
> 4) Rotate device back to landscape
> - Reload saved stage = SideStage.
>
> So if we drop on SideStage, then flip to portrait it will load in MainStage
> because SideStage is not available, but flip back to landscape and it will
> reload the last dropped stage (SideStage)
>
> >
> > What will happen if an application has two surfaces (one in main and one in
> > side stage) and you rotate to portrait and then back to landscape
> > (tst_OrientedShell doesn't have yet those app list controls so I could
> easily
> > reproduce this use case)?
>
> We'll have to have stage saved/loaded per surface. For another MP.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2394
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1499/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1998/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2026
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1943
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1943
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1943
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1934/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1934
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1934/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1499/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2396
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1502/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2002
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1016
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1016
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1016
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2030
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1947
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1947
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1947
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1938/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1938
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1938/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1502/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

So spreadDelegate.stage means stage where the surface currently is in, whereas you use WindowStateStorage for holding the stage where the *user* wants the surface to be in (preferred/selected stage).

That's misuse of WindowStateStorage.

It's like you saving the surface geometry into WindowStateStorage on every single window resize.

The purpose of WindowStateStorage is to store the last window state right before it's gone. So that when this application is launched again (seconds, minutes, months or years later), its window starts with the same state that it had when it was last used.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> So spreadDelegate.stage means stage where the surface currently is in, whereas
> you use WindowStateStorage for holding the stage where the *user* wants the
> surface to be in (preferred/selected stage).
>
> That's misuse of WindowStateStorage.
>
> It's like you saving the surface geometry into WindowStateStorage on every
> single window resize.
>
> The purpose of WindowStateStorage is to store the last window state right
> before it's gone. So that when this application is launched again (seconds,
> minutes, months or years later), its window starts with the same state that it
> had when it was last used.

No, it's called "window state storage". It's storing whatever state you want it to store(last/preferred).
The fact that we use it to store the last position/geometry is a implementation decision of that use case.

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

And this is preserving the last "valid" state anyway.
If we save it on exit when in portrait and load it again in landscape we will end up in a state different to when we exited the app.

Revision history for this message
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal

I'm with nick on this one. It's ok to use WindowStateStorage as a storage during runtime too. If the syncing to disk is the issue here (which I'm not really sure if it is, because it's not that we're hitting the flash really often) then yes, the WindowStateStorage component should be changed to only sync later or something. I however would probably vote to sync all the time because this way it saves the user's preferences even when something crashes.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Ok, I'm outvoted here so I will just abstain.

review: Abstain
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2398
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1564/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2077
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1081
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1081
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1081
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2105
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2016
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2016
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2016
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2007/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2007
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2007/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1564/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

* code looks ok to me

* tested on M10

* no related test failures

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches