Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7b60f72 authored by satok's avatar satok
Browse files

Fix DeadObjectException of the spell checker

Bug: 5119646
Change-Id: I2938a2206b79645c13a54cc7200f64c2c0aa3836
parent 4596eba7
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
                    Settings.Secure.getString(mContext.getContentResolver(),
                            Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE);
            if (DBG) {
                Slog.w(TAG, "getCurrentSpellChecker: " + subtypeHashCodeStr);
                Slog.w(TAG, "getCurrentSpellCheckerSubtype: " + subtypeHashCodeStr);
            }
            final SpellCheckerInfo sci = getCurrentSpellChecker(null);
            if (sci == null || sci.getSubtypeCount() == 0) {
@@ -509,7 +509,8 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
                                listener.mScLocale, listener.mScListener, listener.mBundle);
                        listener.mTsListener.onServiceConnected(session);
                    } catch (RemoteException e) {
                        Slog.e(TAG, "Exception in getting the spell checker session: " + e);
                        Slog.e(TAG, "Exception in getting the spell checker session."
                                + "Reconnect to the spellchecker. ", e);
                        removeAll();
                        return;
                    }
@@ -579,8 +580,12 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
                Slog.d(TAG, "cleanLocked");
            }
            if (mListeners.isEmpty()) {
                if (mSpellCheckerBindGroups.containsKey(this)) {
                    mSpellCheckerBindGroups.remove(this);
                final String sciId = mInternalConnection.mSciId;
                if (mSpellCheckerBindGroups.containsKey(sciId)) {
                    if (DBG) {
                        Slog.d(TAG, "Remove bind group.");
                    }
                    mSpellCheckerBindGroups.remove(sciId);
                }
                // Unbind service when there is no active clients.
                mContext.unbindService(mInternalConnection);