Make setAdditionalInputMethodSubtypes async

Bug: 5120261
Change-Id: Ic7869cfaa5361531e08d58d7dfa5ba0feab0613e
This commit is contained in:
satok
2011-09-02 18:50:15 +09:00
parent 117999d1f4
commit ee5e77cafe
5 changed files with 10 additions and 20 deletions

View File

@@ -24486,7 +24486,7 @@ package android.view.inputmethod {
method public boolean isWatchingCursor(android.view.View); method public boolean isWatchingCursor(android.view.View);
method public void restartInput(android.view.View); method public void restartInput(android.view.View);
method public void sendAppPrivateCommand(android.view.View, java.lang.String, android.os.Bundle); method public void sendAppPrivateCommand(android.view.View, java.lang.String, android.os.Bundle);
method public boolean setAdditionalInputMethodSubtypes(java.lang.String, android.view.inputmethod.InputMethodSubtype[]); method public void setAdditionalInputMethodSubtypes(java.lang.String, android.view.inputmethod.InputMethodSubtype[]);
method public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype); method public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
method public void setInputMethod(android.os.IBinder, java.lang.String); method public void setInputMethod(android.os.IBinder, java.lang.String);
method public void setInputMethodAndSubtype(android.os.IBinder, java.lang.String, android.view.inputmethod.InputMethodSubtype); method public void setInputMethodAndSubtype(android.os.IBinder, java.lang.String, android.view.inputmethod.InputMethodSubtype);

View File

@@ -1593,15 +1593,13 @@ public final class InputMethodManager {
* to the current implementation.) * to the current implementation.)
* @param imiId Id of InputMethodInfo which additional input method subtypes will be added to. * @param imiId Id of InputMethodInfo which additional input method subtypes will be added to.
* @param subtypes subtypes will be added as additional subtypes of the current input method. * @param subtypes subtypes will be added as additional subtypes of the current input method.
* @return true if the additional input method subtypes are successfully added.
*/ */
public boolean setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) { public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
synchronized (mH) { synchronized (mH) {
try { try {
return mService.setAdditionalInputMethodSubtypes(imiId, subtypes); mService.setAdditionalInputMethodSubtypes(imiId, subtypes);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "IME died: " + mCurId, e); Log.w(TAG, "IME died: " + mCurId, e);
return false;
} }
} }
} }

View File

@@ -68,5 +68,5 @@ interface IInputMethodManager {
boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype); boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype);
boolean switchToLastInputMethod(in IBinder token); boolean switchToLastInputMethod(in IBinder token);
boolean setInputMethodEnabled(String id, boolean enabled); boolean setInputMethodEnabled(String id, boolean enabled);
boolean setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); oneway void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
} }

View File

@@ -1668,13 +1668,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} }
@Override @Override
public boolean setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) { public void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes) {
// By this IPC call, only a process which shares the same uid with the IME can add // By this IPC call, only a process which shares the same uid with the IME can add
// additional input method subtypes to the IME. // additional input method subtypes to the IME.
if (TextUtils.isEmpty(imiId) || subtypes == null || subtypes.length == 0) return false; if (TextUtils.isEmpty(imiId) || subtypes == null || subtypes.length == 0) return;
synchronized (mMethodMap) { synchronized (mMethodMap) {
final InputMethodInfo imi = mMethodMap.get(imiId); final InputMethodInfo imi = mMethodMap.get(imiId);
if (imi == null) return false; if (imi == null) return;
final PackageManager pm = mContext.getPackageManager(); final PackageManager pm = mContext.getPackageManager();
final String[] packageInfos = pm.getPackagesForUid(Binder.getCallingUid()); final String[] packageInfos = pm.getPackagesForUid(Binder.getCallingUid());
if (packageInfos != null) { if (packageInfos != null) {
@@ -1688,12 +1688,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} finally { } finally {
Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident);
} }
return true; return;
} }
} }
} }
} }
return false; return;
} }
private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) { private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) {

View File

@@ -107,10 +107,9 @@ public class BridgeIInputMethodManager implements IInputMethodManager {
} }
public boolean setAdditionalInputMethodSubtypes(String arg0, InputMethodSubtype[] arg1) public void setAdditionalInputMethodSubtypes(String arg0, InputMethodSubtype[] arg1)
throws RemoteException { throws RemoteException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false;
} }
public boolean setCurrentInputMethodSubtype(InputMethodSubtype arg0) throws RemoteException { public boolean setCurrentInputMethodSubtype(InputMethodSubtype arg0) throws RemoteException {
@@ -187,11 +186,4 @@ public class BridgeIInputMethodManager implements IInputMethodManager {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
public boolean setAdditionalInputMethodSubtypes(IBinder arg0, InputMethodSubtype[] arg1)
throws RemoteException {
// TODO Auto-generated method stub
return false;
}
} }