Fix a reference leak in SpellCheckerSessionListenerImpl.
The primary goal of this CL is to address a reference leak
in SpellCheckerSession.SpellCheckerSessionListenerImpl if
the SpellCheckerSession is closed too early. Here is the
minimum repro code.
TextServicesManager tsm = (TextServicesManager)
getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
SpellCheckerSession session = tsm.newSpellCheckerSession(,
Locale.ENGLISH, listener, false);
session.close();
In order to make the state management reliable and easier to
debug, this CL replaces SpellCheckerSessionListenerImpl#mOpened
with an explicit state number so that we can tell three different
"not open" cases: 1) not connected yet and not closed yet, 2)
closed before establishing connection, and 3) closed after
establishing connection.
Bug: 21319642
Change-Id: Ifd05565ac0c057c46ec88a3fb9094c04934041d7
1 file changed