Loading core/java/android/view/textservice/TextServicesManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -162,10 +162,13 @@ public final class TextServicesManager { */ public void setSpellCheckerSubtype(SpellCheckerSubtype subtype) { try { final int hashCode; if (subtype == null) { throw new NullPointerException("SpellCheckerSubtype is null."); hashCode = 0; } else { hashCode = subtype.hashCode(); } sService.setCurrentSpellCheckerSubtype(null, subtype.hashCode()); sService.setCurrentSpellCheckerSubtype(null, hashCode); } catch (RemoteException e) { Log.e(TAG, "Error in setSpellCheckerSubtype:" + e); } Loading services/java/com/android/server/TextServicesManagerService.java +7 −8 Original line number Diff line number Diff line Loading @@ -217,6 +217,9 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { return null; } final int hashCode = Integer.valueOf(subtypeHashCodeStr); if (hashCode == 0) { return null; } for (int i = 0; i < sci.getSubtypeCount(); ++i) { final SpellCheckerSubtype scs = sci.getSubtypeAt(i); if (scs.hashCode() == hashCode) { Loading Loading @@ -416,21 +419,17 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { Slog.w(TAG, "setCurrentSpellCheckerSubtype: " + hashCode); } final SpellCheckerInfo sci = getCurrentSpellChecker(null); if (sci == null) return; boolean found = false; for (int i = 0; i < sci.getSubtypeCount(); ++i) { int tempHashCode = 0; for (int i = 0; sci != null && i < sci.getSubtypeCount(); ++i) { if(sci.getSubtypeAt(i).hashCode() == hashCode) { found = true; tempHashCode = hashCode; break; } } if (!found) { return; } final long ident = Binder.clearCallingIdentity(); try { Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE, String.valueOf(hashCode)); Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE, String.valueOf(tempHashCode)); } finally { Binder.restoreCallingIdentity(ident); } Loading Loading
core/java/android/view/textservice/TextServicesManager.java +5 −2 Original line number Diff line number Diff line Loading @@ -162,10 +162,13 @@ public final class TextServicesManager { */ public void setSpellCheckerSubtype(SpellCheckerSubtype subtype) { try { final int hashCode; if (subtype == null) { throw new NullPointerException("SpellCheckerSubtype is null."); hashCode = 0; } else { hashCode = subtype.hashCode(); } sService.setCurrentSpellCheckerSubtype(null, subtype.hashCode()); sService.setCurrentSpellCheckerSubtype(null, hashCode); } catch (RemoteException e) { Log.e(TAG, "Error in setSpellCheckerSubtype:" + e); } Loading
services/java/com/android/server/TextServicesManagerService.java +7 −8 Original line number Diff line number Diff line Loading @@ -217,6 +217,9 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { return null; } final int hashCode = Integer.valueOf(subtypeHashCodeStr); if (hashCode == 0) { return null; } for (int i = 0; i < sci.getSubtypeCount(); ++i) { final SpellCheckerSubtype scs = sci.getSubtypeAt(i); if (scs.hashCode() == hashCode) { Loading Loading @@ -416,21 +419,17 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { Slog.w(TAG, "setCurrentSpellCheckerSubtype: " + hashCode); } final SpellCheckerInfo sci = getCurrentSpellChecker(null); if (sci == null) return; boolean found = false; for (int i = 0; i < sci.getSubtypeCount(); ++i) { int tempHashCode = 0; for (int i = 0; sci != null && i < sci.getSubtypeCount(); ++i) { if(sci.getSubtypeAt(i).hashCode() == hashCode) { found = true; tempHashCode = hashCode; break; } } if (!found) { return; } final long ident = Binder.clearCallingIdentity(); try { Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE, String.valueOf(hashCode)); Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE, String.valueOf(tempHashCode)); } finally { Binder.restoreCallingIdentity(ident); } Loading