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

Commit c70e5815 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add supportsDismissingSelfWindow attribute of IME"

parents 0bf67a29 e12a6fff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1234,6 +1234,7 @@ package android {
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsDismissingWindow = 16844104; // 0x1010548
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
+1 −0
Original line number Diff line number Diff line
@@ -1347,6 +1347,7 @@ package android {
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsDismissingWindow = 16844104; // 0x1010548
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
+1 −0
Original line number Diff line number Diff line
@@ -1234,6 +1234,7 @@ package android {
    field public static final int summaryOff = 16843248; // 0x10101f0
    field public static final int summaryOn = 16843247; // 0x10101ef
    field public static final int supportsAssist = 16844016; // 0x10104f0
    field public static final int supportsDismissingWindow = 16844104; // 0x1010548
    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
+33 −8
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import java.util.Map;
 * @attr ref android.R.styleable#InputMethod_settingsActivity
 * @attr ref android.R.styleable#InputMethod_isDefault
 * @attr ref android.R.styleable#InputMethod_supportsSwitchingToNextInputMethod
 * @attr ref android.R.styleable#InputMethod_supportsDismissingWindow
 */
public final class InputMethodInfo implements Parcelable {
    static final String TAG = "InputMethodInfo";
@@ -103,6 +104,11 @@ public final class InputMethodInfo implements Parcelable {
     */
    private final boolean mSupportsSwitchingToNextInputMethod;

    /**
     * The flag whether this IME supports ways to dismiss its window (e.g. dismiss button.)
     */
    private final boolean mSupportsDismissingWindow;

    /**
     * Constructor.
     *
@@ -132,6 +138,7 @@ public final class InputMethodInfo implements Parcelable {
        mId = new ComponentName(si.packageName, si.name).flattenToShortString();
        boolean isAuxIme = true;
        boolean supportsSwitchingToNextInputMethod = false; // false as default
        boolean supportsDismissingWindow = false; // false as default
        mForceDefault = false;

        PackageManager pm = context.getPackageManager();
@@ -171,6 +178,8 @@ public final class InputMethodInfo implements Parcelable {
            supportsSwitchingToNextInputMethod = sa.getBoolean(
                    com.android.internal.R.styleable.InputMethod_supportsSwitchingToNextInputMethod,
                    false);
            supportsDismissingWindow = sa.getBoolean(
                    com.android.internal.R.styleable.InputMethod_supportsDismissingWindow, false);
            sa.recycle();

            final int depth = parser.getDepth();
@@ -242,6 +251,7 @@ public final class InputMethodInfo implements Parcelable {
        mIsDefaultResId = isDefaultResId;
        mIsAuxIme = isAuxIme;
        mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod;
        mSupportsDismissingWindow = supportsDismissingWindow;
    }

    InputMethodInfo(Parcel source) {
@@ -250,6 +260,7 @@ public final class InputMethodInfo implements Parcelable {
        mIsDefaultResId = source.readInt();
        mIsAuxIme = source.readInt() == 1;
        mSupportsSwitchingToNextInputMethod = source.readInt() == 1;
        mSupportsDismissingWindow = source.readInt() == 1;
        mService = ResolveInfo.CREATOR.createFromParcel(source);
        mSubtypes = new InputMethodSubtypeArray(source);
        mForceDefault = false;
@@ -260,8 +271,10 @@ public final class InputMethodInfo implements Parcelable {
     */
    public InputMethodInfo(String packageName, String className,
            CharSequence label, String settingsActivity) {
        this(buildDummyResolveInfo(packageName, className, label), false, settingsActivity, null,
                0, false /* forceDefault */, true /* supportsSwitchingToNextInputMethod */);
        this(buildDummyResolveInfo(packageName, className, label), false /* isAuxIme */,
                settingsActivity, null /* subtypes */, 0 /* isDefaultResId */,
                false /* forceDefault */, true /* supportsSwitchingToNextInputMethod */,
                true /* supportsDismissingWindow */);
    }

    /**
@@ -271,17 +284,18 @@ public final class InputMethodInfo implements Parcelable {
    public InputMethodInfo(ResolveInfo ri, boolean isAuxIme,
            String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId,
            boolean forceDefault) {
        this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId,
                forceDefault, true /* supportsSwitchingToNextInputMethod */);
        this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId, forceDefault,
                 true /* supportsSwitchingToNextInputMethod */,
                 true /* supportsDismissingWindow */);
    }

    /**
     * Temporary API for creating a built-in input method for test.
     * @hide
     */
    public InputMethodInfo(ResolveInfo ri, boolean isAuxIme,
            String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId,
            boolean forceDefault, boolean supportsSwitchingToNextInputMethod) {
    public InputMethodInfo(ResolveInfo ri, boolean isAuxIme, String settingsActivity,
            List<InputMethodSubtype> subtypes, int isDefaultResId, boolean forceDefault,
            boolean supportsSwitchingToNextInputMethod, boolean supportsDismissingWindow) {
        final ServiceInfo si = ri.serviceInfo;
        mService = ri;
        mId = new ComponentName(si.packageName, si.name).flattenToShortString();
@@ -291,6 +305,7 @@ public final class InputMethodInfo implements Parcelable {
        mSubtypes = new InputMethodSubtypeArray(subtypes);
        mForceDefault = forceDefault;
        mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod;
        mSupportsDismissingWindow = supportsDismissingWindow;
    }

    private static ResolveInfo buildDummyResolveInfo(String packageName, String className,
@@ -431,7 +446,8 @@ public final class InputMethodInfo implements Parcelable {
    public void dump(Printer pw, String prefix) {
        pw.println(prefix + "mId=" + mId
                + " mSettingsActivityName=" + mSettingsActivityName
                + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod);
                + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod
                + " mSupportsDismissingWindow=" + mSupportsDismissingWindow);
        pw.println(prefix + "mIsDefaultResId=0x"
                + Integer.toHexString(mIsDefaultResId));
        pw.println(prefix + "Service:");
@@ -483,6 +499,14 @@ public final class InputMethodInfo implements Parcelable {
        return mSupportsSwitchingToNextInputMethod;
    }

    /**
     * @return true if this input method supports ways to dismiss its window.
     * @hide
     */
    public boolean supportsDismissingWindow() {
        return mSupportsDismissingWindow;
    }

    /**
     * Used to package this object into a {@link Parcel}.
     *
@@ -496,6 +520,7 @@ public final class InputMethodInfo implements Parcelable {
        dest.writeInt(mIsDefaultResId);
        dest.writeInt(mIsAuxIme ? 1 : 0);
        dest.writeInt(mSupportsSwitchingToNextInputMethod ? 1 : 0);
        dest.writeInt(mSupportsDismissingWindow ? 1 : 0);
        mService.writeToParcel(dest, flags);
        mSubtypes.writeToParcel(dest);
    }
+12 −0
Original line number Diff line number Diff line
@@ -3178,6 +3178,18 @@
             and subtype in order to provide the consistent user experience in switching
             between IMEs and subtypes. -->
        <attr name="supportsSwitchingToNextInputMethod" format="boolean" />
        <!-- Set to true if this input method supports ways to dismiss the windows assigned to
             the input method (e.g. a dismiss button rendered by the input method itself).  The
             System UI may optimize the UI by not showing system-level dismiss button if this
             value is true.
             <p> Must be a boolean value, either "true" or "false". The default value is "false".
             <p> This may also be a reference to a resource (in the form "@[package:]type:name")
             or theme attribute (in the form "?[package:]type:name") containing a value of this
             type.
             <p> A UI element that dismisses the input method window should report
             {@link android.view.accessibility.AccessibilityNodeInfo#ACTION_DISMISS} action, so
             that accessibility services can handle it accordingly. -->
        <attr name="supportsDismissingWindow" format="boolean" />
    </declare-styleable>

    <!-- This is the subtype of InputMethod. Subtype can describe locales (e.g. en_US, fr_FR...)
Loading