input method (OSK) not being hidden if app killed

Bug #1267550 reported by Bill Filler on 2014-01-09
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
unity-mir
High
Gerry Boland
ubuntu-keyboard (Ubuntu)
High
Unassigned
unity-mir (Ubuntu)
High
Gerry Boland

Bug Description

The osk is not always being hidden when an application is quit/terminated/crashes, most notably when another app is running.

Steps to reproduce:
1) launch dialer
2) launch notes app
3) click in a note to make osk appear
4) shell into phone, do ps auwx | grep qmlscene to find the pid of the notes-app
5) kill -9 <notes-app-pid>

Expected result:
- dialer app is shown, osk disappears

Actual result:
- dialer-app is shown, osk still visible

6) when in this state, if notes-app is relaunched from command line, the keyboard remains visible but typing on it does not cause input to go into notes-app. It only starts working after closing the keyboard by swiping down and reopening it.

This is causing problems with the following autopilot tests:
https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1259476

Related branches

Gerry Boland (gerboland) on 2014-01-09
Changed in unity-mir:
status: New → Triaged
importance: Undecided → High
Changed in unity-mir (Ubuntu):
importance: Undecided → High
status: New → Triaged
Gerry Boland (gerboland) wrote :

Trying with this patch to unity-mir:

src/modules/Unity/Application/OSKController.qml
    Connections {
        target: ApplicationManager
        onFocusedApplicationIdChanged: {
            if (__oskSurface != null) {
                print("Focused app closed with OSK open, close OSK")
                Qt.inputMethod.hide();
            }
        }
    }

it prints at the correct time, but the OSK fails to close. Qt.inputMethod.hide() does not appear to function in shell. No idea why, but I do recall shell always had problems controlling OSK.

A better solution to this bug would be for when the focused app dies, the shell returns to the dash, not to the next focused app.

Ricardo Mendoza (ricmm) wrote :

Qt.inputMethod can only be used in the context of the owner application since 5.1.

maliit needs to be smart enough to realize that the relevant dbus session died, and use that to invalidate the active input context.

Bill Filler (bfiller) wrote :

tried this suggestion from greyback in OSKController.qml:
Connections {
    target: ApplicationManager
    onFocusRequested: {
        if (__oskSurface) {
            // application in focus changed while OSK visible
            if (appId == "") // appId parameter of focusRequested signal. This hopefully means all focused app closed.
                Qt.inputMethod.hide(); //close OSK
        }
    }
}

Unfortunately the Qt.inputMethod.hide() method does not close the OSK. According to ricmm, only the owner of the input context (i.e. the app that has just been killed) can call hide on it.

The proper fix according to ricmm would be maliit-server should detect when a peer is closed and invalidate the active input context or explicitly make the OSK surface invisible. I have no idea where the code would be in maliit-server to do this, and all of our maliit experts are gone (:

So one potential workaround to try as quick fixes:
- instead of focusing the next app in the stack as we do now when the currently focused app is killed, focus the shell. This will cause the OSK to hide properly - as it does now if you just have one app running and you kill it from under the covers.
Was unclear where in application_manager.cpp to make this change or I would have tried.

@greyback - can you give this a try?

Changed in unity-mir:
status: Triaged → Confirmed
Changed in unity-mir (Ubuntu):
status: Triaged → Confirmed
assignee: nobody → Gerry Boland (gerboland)
Changed in unity-mir:
assignee: nobody → Gerry Boland (gerboland)
Gerry Boland (gerboland) wrote :

@bfiller agreed this is a good idea, will give it a go

Gerry Boland (gerboland) on 2014-01-15
Changed in unity-mir (Ubuntu):
status: Confirmed → In Progress
Changed in unity-mir:
status: Confirmed → In Progress
Bill Filler (bfiller) on 2014-01-16
Changed in ubuntu-keyboard (Ubuntu):
status: New → Fix Committed
Changed in unity-mir (Ubuntu):
status: In Progress → Invalid
Changed in unity-mir:
status: In Progress → Invalid
Changed in ubuntu-keyboard (Ubuntu):
importance: Undecided → High
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-keyboard - 0.99.trunk.phablet2+14.04.20140121-0ubuntu1

---------------
ubuntu-keyboard (0.99.trunk.phablet2+14.04.20140121-0ubuntu1) trusty; urgency=low

  [ Bill Filler ]
  * turn off spell-checking and auto-complete by default.
  * changes to load/set the active keyboard based on gsettings key.
  * change Architecture of plugins to any as they are platform specific.

  [ Gerry Boland ]
  * Implement handleClientChanged method to react correctly to client
    connect/disconnect. (LP: #1267550)

  [ Thomas Moenicke ]
  * build fixes. (LP: #1258061)
  * language features + backends go into plugins .
  * new click sound for keys.
  * changes to load/set the active keyboard based on gsettings key.

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 126
 -- Ubuntu daily release <email address hidden> Tue, 21 Jan 2014 17:12:09 +0000

Changed in ubuntu-keyboard (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers