am d866f500
: Merge "Add new API shouldOfferSwitchingToNextInputMethod" into klp-dev
* commit 'd866f5002aef29de5cde0e3b5e84ed3992214916': Add new API shouldOfferSwitchingToNextInputMethod
This commit is contained in:
@ -29299,6 +29299,7 @@ package android.view.inputmethod {
|
||||
method public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
|
||||
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 boolean shouldOfferSwitchingToNextInputMethod(android.os.IBinder);
|
||||
method public void showInputMethodAndSubtypeEnabler(java.lang.String);
|
||||
method public void showInputMethodPicker();
|
||||
method public boolean showSoftInput(android.view.View, int);
|
||||
|
@ -1875,6 +1875,24 @@ public final class InputMethodManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current IME needs to offer the users a way to switch to a next input
|
||||
* method. When the user triggers it, the IME has to call {@link #switchToNextInputMethod} to
|
||||
* switch to a next input method which is selected by the system.
|
||||
* @param imeToken Supplies the identifying token given to an input method when it was started,
|
||||
* which allows it to perform this operation on itself.
|
||||
*/
|
||||
public boolean shouldOfferSwitchingToNextInputMethod(IBinder imeToken) {
|
||||
synchronized (mH) {
|
||||
try {
|
||||
return mService.shouldOfferSwitchingToNextInputMethod(imeToken);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "IME died: " + mCurId, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set additional input method subtypes. Only a process which shares the same uid with the IME
|
||||
* can add additional input method subtypes to the IME.
|
||||
|
@ -56,7 +56,7 @@ interface IInputMethodManager {
|
||||
InputBindResult windowGainedFocus(in IInputMethodClient client, in IBinder windowToken,
|
||||
int controlFlags, int softInputMode, int windowFlags,
|
||||
in EditorInfo attribute, IInputContext inputContext);
|
||||
|
||||
|
||||
void showInputMethodPickerFromClient(in IInputMethodClient client);
|
||||
void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
|
||||
void setInputMethod(in IBinder token, String id);
|
||||
@ -71,6 +71,7 @@ interface IInputMethodManager {
|
||||
boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype);
|
||||
boolean switchToLastInputMethod(in IBinder token);
|
||||
boolean switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme);
|
||||
boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
|
||||
boolean setInputMethodEnabled(String id, boolean enabled);
|
||||
oneway void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
|
||||
}
|
||||
|
@ -2158,6 +2158,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOfferSwitchingToNextInputMethod(IBinder token) {
|
||||
if (!calledFromValidUser()) {
|
||||
return false;
|
||||
}
|
||||
synchronized (mMethodMap) {
|
||||
final ImeSubtypeListItem nextSubtype = mImListManager.getNextInputMethod(
|
||||
false /* onlyCurrentIme */, mMethodMap.get(mCurMethodId), mCurrentSubtype);
|
||||
if (nextSubtype == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputMethodSubtype getLastInputMethodSubtype() {
|
||||
if (!calledFromValidUser()) {
|
||||
|
Reference in New Issue
Block a user