Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1332,6 +1332,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 supportsInlineSuggestions = 16844302; // 0x101060e field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1 field public static final int supportsLocalInteraction = 16844047; // 0x101050f field public static final int supportsMultipleDisplays = 16844182; // 0x1010596 core/java/android/inputmethodservice/InputMethodService.java +3 −21 Original line number Diff line number Diff line Loading @@ -721,15 +721,6 @@ public class InputMethodService extends AbstractInputMethodService { return false; } /** * Returns whether inline suggestions are enabled on this service. * * TODO(b/137800469): check XML for value. */ private boolean isInlineSuggestionsEnabled() { return true; } /** * Sends an {@link InlineSuggestionsRequest} obtained from * {@link #onCreateInlineSuggestionsRequest()} to the current Autofill Session through Loading Loading @@ -763,23 +754,14 @@ public class InputMethodService extends AbstractInputMethodService { private void handleOnCreateInlineSuggestionsRequest(@NonNull ComponentName componentName, @NonNull AutofillId autofillId, @NonNull IInlineSuggestionsRequestCallback callback) { mInlineSuggestionsRequestInfo = new InlineSuggestionsRequestInfo(componentName, autofillId, callback); if (!isInlineSuggestionsEnabled()) { try { callback.onInlineSuggestionsUnsupported(); } catch (RemoteException e) { Log.w(TAG, "handleMakeInlineSuggestionsRequest() RemoteException:" + e); } return; } if (!mInputStarted) { Log.w(TAG, "onStartInput() not called yet"); return; } mInlineSuggestionsRequestInfo = new InlineSuggestionsRequestInfo(componentName, autofillId, callback); makeInlineSuggestionsRequest(); } Loading core/java/android/service/autofill/AutofillServiceInfo.java +14 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,8 @@ public final class AutofillServiceInfo { @Nullable private final ArrayMap<String, Long> mCompatibilityPackages; private final boolean mInlineSuggestionsEnabled; public AutofillServiceInfo(Context context, ComponentName comp, int userHandle) throws PackageManager.NameNotFoundException { this(context, getServiceInfoOrThrow(comp, userHandle)); Loading Loading @@ -112,11 +114,13 @@ public final class AutofillServiceInfo { if (parser == null) { mSettingsActivity = null; mCompatibilityPackages = null; mInlineSuggestionsEnabled = false; return; } String settingsActivity = null; ArrayMap<String, Long> compatibilityPackages = null; boolean inlineSuggestionsEnabled = false; // false by default. try { final Resources resources = context.getPackageManager().getResourcesForApplication( Loading @@ -135,6 +139,8 @@ public final class AutofillServiceInfo { com.android.internal.R.styleable.AutofillService); settingsActivity = afsAttributes.getString( R.styleable.AutofillService_settingsActivity); inlineSuggestionsEnabled = afsAttributes.getBoolean( R.styleable.AutofillService_supportsInlineSuggestions, false); } finally { if (afsAttributes != null) { afsAttributes.recycle(); Loading @@ -150,6 +156,7 @@ public final class AutofillServiceInfo { mSettingsActivity = settingsActivity; mCompatibilityPackages = compatibilityPackages; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; } private ArrayMap<String, Long> parseCompatibilityPackages(XmlPullParser parser, Loading Loading @@ -227,6 +234,10 @@ public final class AutofillServiceInfo { return mCompatibilityPackages; } public boolean isInlineSuggestionsEnabled() { return mInlineSuggestionsEnabled; } @Override public String toString() { final StringBuilder builder = new StringBuilder(); Loading @@ -235,6 +246,7 @@ public final class AutofillServiceInfo { builder.append(", settings:").append(mSettingsActivity); builder.append(", hasCompatPckgs:").append(mCompatibilityPackages != null && !mCompatibilityPackages.isEmpty()).append("]"); builder.append(", inline suggestions enabled:").append(mInlineSuggestionsEnabled); return builder.toString(); } Loading @@ -245,5 +257,7 @@ public final class AutofillServiceInfo { pw.print(prefix); pw.print("Component: "); pw.println(getServiceInfo().getComponentName()); pw.print(prefix); pw.print("Settings: "); pw.println(mSettingsActivity); pw.print(prefix); pw.print("Compat packages: "); pw.println(mCompatibilityPackages); pw.print(prefix); pw.print("Inline Suggestions Enabled: "); pw.println(mInlineSuggestionsEnabled); } } core/java/android/view/inputmethod/InputMethodInfo.java +38 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import java.util.List; * @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_supportsInlineSuggestions */ public final class InputMethodInfo implements Parcelable { static final String TAG = "InputMethodInfo"; Loading Loading @@ -110,6 +111,11 @@ public final class InputMethodInfo implements Parcelable { */ private final boolean mSupportsSwitchingToNextInputMethod; /** * The flag whether this IME supports inline suggestions. */ private final boolean mInlineSuggestionsEnabled; /** * @param service the {@link ResolveInfo} corresponds in which the IME is implemented. * @return a unique ID to be returned by {@link #getId()}. We have used Loading Loading @@ -152,6 +158,7 @@ public final class InputMethodInfo implements Parcelable { mId = computeId(service); boolean isAuxIme = true; boolean supportsSwitchingToNextInputMethod = false; // false as default boolean inlineSuggestionsEnabled = false; // false as default mForceDefault = false; PackageManager pm = context.getPackageManager(); Loading Loading @@ -193,6 +200,8 @@ public final class InputMethodInfo implements Parcelable { supportsSwitchingToNextInputMethod = sa.getBoolean( com.android.internal.R.styleable.InputMethod_supportsSwitchingToNextInputMethod, false); inlineSuggestionsEnabled = sa.getBoolean( com.android.internal.R.styleable.InputMethod_supportsInlineSuggestions, false); sa.recycle(); final int depth = parser.getDepth(); Loading Loading @@ -263,6 +272,7 @@ public final class InputMethodInfo implements Parcelable { mIsDefaultResId = isDefaultResId; mIsAuxIme = isAuxIme; mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; mIsVrOnly = isVrOnly; } Loading @@ -272,6 +282,7 @@ public final class InputMethodInfo implements Parcelable { mIsDefaultResId = source.readInt(); mIsAuxIme = source.readInt() == 1; mSupportsSwitchingToNextInputMethod = source.readInt() == 1; mInlineSuggestionsEnabled = source.readInt() == 1; mIsVrOnly = source.readBoolean(); mService = ResolveInfo.CREATOR.createFromParcel(source); mSubtypes = new InputMethodSubtypeArray(source); Loading @@ -286,7 +297,7 @@ public final class InputMethodInfo implements Parcelable { this(buildDummyResolveInfo(packageName, className, label), false /* isAuxIme */, settingsActivity, null /* subtypes */, 0 /* isDefaultResId */, false /* forceDefault */, true /* supportsSwitchingToNextInputMethod */, false /* isVrOnly */); false /* inlineSuggestionsEnabled */, false /* isVrOnly */); } /** Loading @@ -297,7 +308,8 @@ public final class InputMethodInfo implements Parcelable { String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId, boolean forceDefault) { this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId, forceDefault, true /* supportsSwitchingToNextInputMethod */, false /* isVrOnly */); true /* supportsSwitchingToNextInputMethod */, false /* inlineSuggestionsEnabled */, false /* isVrOnly */); } /** Loading @@ -307,6 +319,18 @@ public final class InputMethodInfo implements Parcelable { public InputMethodInfo(ResolveInfo ri, boolean isAuxIme, String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId, boolean forceDefault, boolean supportsSwitchingToNextInputMethod, boolean isVrOnly) { this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId, forceDefault, supportsSwitchingToNextInputMethod, false /* inlineSuggestionsEnabled */, isVrOnly); } /** * 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, boolean inlineSuggestionsEnabled, boolean isVrOnly) { final ServiceInfo si = ri.serviceInfo; mService = ri; mId = new ComponentName(si.packageName, si.name).flattenToShortString(); Loading @@ -316,6 +340,7 @@ public final class InputMethodInfo implements Parcelable { mSubtypes = new InputMethodSubtypeArray(subtypes); mForceDefault = forceDefault; mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; mIsVrOnly = isVrOnly; } Loading Loading @@ -467,7 +492,8 @@ public final class InputMethodInfo implements Parcelable { pw.println(prefix + "mId=" + mId + " mSettingsActivityName=" + mSettingsActivityName + " mIsVrOnly=" + mIsVrOnly + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod); + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod + " mInlineSuggestionsEnabled=" + mInlineSuggestionsEnabled); pw.println(prefix + "mIsDefaultResId=0x" + Integer.toHexString(mIsDefaultResId)); pw.println(prefix + "Service:"); Loading Loading @@ -527,6 +553,14 @@ public final class InputMethodInfo implements Parcelable { return mSupportsSwitchingToNextInputMethod; } /** * @return true if this input method supports inline suggestions. * @hide */ public boolean isInlineSuggestionsEnabled() { return mInlineSuggestionsEnabled; } /** * Used to package this object into a {@link Parcel}. * Loading @@ -540,6 +574,7 @@ public final class InputMethodInfo implements Parcelable { dest.writeInt(mIsDefaultResId); dest.writeInt(mIsAuxIme ? 1 : 0); dest.writeInt(mSupportsSwitchingToNextInputMethod ? 1 : 0); dest.writeInt(mInlineSuggestionsEnabled ? 1 : 0); dest.writeBoolean(mIsVrOnly); mService.writeToParcel(dest, flags); mSubtypes.writeToParcel(dest); Loading core/res/res/values/attrs.xml +5 −0 Original line number Diff line number Diff line Loading @@ -3469,6 +3469,8 @@ device --> <attr name="isVrOnly" format="boolean"/> <attr name="__removed2" format="boolean" /> <!-- Specifies whether the IME supports showing inline suggestions. --> <attr name="supportsInlineSuggestions" format="boolean" /> </declare-styleable> <!-- This is the subtype of InputMethod. Subtype can describe locales (for example, en_US and Loading Loading @@ -8177,6 +8179,9 @@ <!-- Fully qualified class name of an activity that allows the user to modify the settings for this service. --> <attr name="settingsActivity" /> <!-- Specifies whether the AutofillService supports inline suggestions--> <attr name="supportsInlineSuggestions" format="boolean" /> </declare-styleable> <!-- Use <code>compatibility-package</code> as a child tag of <code>autofill-service</code> Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1332,6 +1332,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 supportsInlineSuggestions = 16844302; // 0x101060e field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1 field public static final int supportsLocalInteraction = 16844047; // 0x101050f field public static final int supportsMultipleDisplays = 16844182; // 0x1010596
core/java/android/inputmethodservice/InputMethodService.java +3 −21 Original line number Diff line number Diff line Loading @@ -721,15 +721,6 @@ public class InputMethodService extends AbstractInputMethodService { return false; } /** * Returns whether inline suggestions are enabled on this service. * * TODO(b/137800469): check XML for value. */ private boolean isInlineSuggestionsEnabled() { return true; } /** * Sends an {@link InlineSuggestionsRequest} obtained from * {@link #onCreateInlineSuggestionsRequest()} to the current Autofill Session through Loading Loading @@ -763,23 +754,14 @@ public class InputMethodService extends AbstractInputMethodService { private void handleOnCreateInlineSuggestionsRequest(@NonNull ComponentName componentName, @NonNull AutofillId autofillId, @NonNull IInlineSuggestionsRequestCallback callback) { mInlineSuggestionsRequestInfo = new InlineSuggestionsRequestInfo(componentName, autofillId, callback); if (!isInlineSuggestionsEnabled()) { try { callback.onInlineSuggestionsUnsupported(); } catch (RemoteException e) { Log.w(TAG, "handleMakeInlineSuggestionsRequest() RemoteException:" + e); } return; } if (!mInputStarted) { Log.w(TAG, "onStartInput() not called yet"); return; } mInlineSuggestionsRequestInfo = new InlineSuggestionsRequestInfo(componentName, autofillId, callback); makeInlineSuggestionsRequest(); } Loading
core/java/android/service/autofill/AutofillServiceInfo.java +14 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,8 @@ public final class AutofillServiceInfo { @Nullable private final ArrayMap<String, Long> mCompatibilityPackages; private final boolean mInlineSuggestionsEnabled; public AutofillServiceInfo(Context context, ComponentName comp, int userHandle) throws PackageManager.NameNotFoundException { this(context, getServiceInfoOrThrow(comp, userHandle)); Loading Loading @@ -112,11 +114,13 @@ public final class AutofillServiceInfo { if (parser == null) { mSettingsActivity = null; mCompatibilityPackages = null; mInlineSuggestionsEnabled = false; return; } String settingsActivity = null; ArrayMap<String, Long> compatibilityPackages = null; boolean inlineSuggestionsEnabled = false; // false by default. try { final Resources resources = context.getPackageManager().getResourcesForApplication( Loading @@ -135,6 +139,8 @@ public final class AutofillServiceInfo { com.android.internal.R.styleable.AutofillService); settingsActivity = afsAttributes.getString( R.styleable.AutofillService_settingsActivity); inlineSuggestionsEnabled = afsAttributes.getBoolean( R.styleable.AutofillService_supportsInlineSuggestions, false); } finally { if (afsAttributes != null) { afsAttributes.recycle(); Loading @@ -150,6 +156,7 @@ public final class AutofillServiceInfo { mSettingsActivity = settingsActivity; mCompatibilityPackages = compatibilityPackages; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; } private ArrayMap<String, Long> parseCompatibilityPackages(XmlPullParser parser, Loading Loading @@ -227,6 +234,10 @@ public final class AutofillServiceInfo { return mCompatibilityPackages; } public boolean isInlineSuggestionsEnabled() { return mInlineSuggestionsEnabled; } @Override public String toString() { final StringBuilder builder = new StringBuilder(); Loading @@ -235,6 +246,7 @@ public final class AutofillServiceInfo { builder.append(", settings:").append(mSettingsActivity); builder.append(", hasCompatPckgs:").append(mCompatibilityPackages != null && !mCompatibilityPackages.isEmpty()).append("]"); builder.append(", inline suggestions enabled:").append(mInlineSuggestionsEnabled); return builder.toString(); } Loading @@ -245,5 +257,7 @@ public final class AutofillServiceInfo { pw.print(prefix); pw.print("Component: "); pw.println(getServiceInfo().getComponentName()); pw.print(prefix); pw.print("Settings: "); pw.println(mSettingsActivity); pw.print(prefix); pw.print("Compat packages: "); pw.println(mCompatibilityPackages); pw.print(prefix); pw.print("Inline Suggestions Enabled: "); pw.println(mInlineSuggestionsEnabled); } }
core/java/android/view/inputmethod/InputMethodInfo.java +38 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import java.util.List; * @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_supportsInlineSuggestions */ public final class InputMethodInfo implements Parcelable { static final String TAG = "InputMethodInfo"; Loading Loading @@ -110,6 +111,11 @@ public final class InputMethodInfo implements Parcelable { */ private final boolean mSupportsSwitchingToNextInputMethod; /** * The flag whether this IME supports inline suggestions. */ private final boolean mInlineSuggestionsEnabled; /** * @param service the {@link ResolveInfo} corresponds in which the IME is implemented. * @return a unique ID to be returned by {@link #getId()}. We have used Loading Loading @@ -152,6 +158,7 @@ public final class InputMethodInfo implements Parcelable { mId = computeId(service); boolean isAuxIme = true; boolean supportsSwitchingToNextInputMethod = false; // false as default boolean inlineSuggestionsEnabled = false; // false as default mForceDefault = false; PackageManager pm = context.getPackageManager(); Loading Loading @@ -193,6 +200,8 @@ public final class InputMethodInfo implements Parcelable { supportsSwitchingToNextInputMethod = sa.getBoolean( com.android.internal.R.styleable.InputMethod_supportsSwitchingToNextInputMethod, false); inlineSuggestionsEnabled = sa.getBoolean( com.android.internal.R.styleable.InputMethod_supportsInlineSuggestions, false); sa.recycle(); final int depth = parser.getDepth(); Loading Loading @@ -263,6 +272,7 @@ public final class InputMethodInfo implements Parcelable { mIsDefaultResId = isDefaultResId; mIsAuxIme = isAuxIme; mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; mIsVrOnly = isVrOnly; } Loading @@ -272,6 +282,7 @@ public final class InputMethodInfo implements Parcelable { mIsDefaultResId = source.readInt(); mIsAuxIme = source.readInt() == 1; mSupportsSwitchingToNextInputMethod = source.readInt() == 1; mInlineSuggestionsEnabled = source.readInt() == 1; mIsVrOnly = source.readBoolean(); mService = ResolveInfo.CREATOR.createFromParcel(source); mSubtypes = new InputMethodSubtypeArray(source); Loading @@ -286,7 +297,7 @@ public final class InputMethodInfo implements Parcelable { this(buildDummyResolveInfo(packageName, className, label), false /* isAuxIme */, settingsActivity, null /* subtypes */, 0 /* isDefaultResId */, false /* forceDefault */, true /* supportsSwitchingToNextInputMethod */, false /* isVrOnly */); false /* inlineSuggestionsEnabled */, false /* isVrOnly */); } /** Loading @@ -297,7 +308,8 @@ public final class InputMethodInfo implements Parcelable { String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId, boolean forceDefault) { this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId, forceDefault, true /* supportsSwitchingToNextInputMethod */, false /* isVrOnly */); true /* supportsSwitchingToNextInputMethod */, false /* inlineSuggestionsEnabled */, false /* isVrOnly */); } /** Loading @@ -307,6 +319,18 @@ public final class InputMethodInfo implements Parcelable { public InputMethodInfo(ResolveInfo ri, boolean isAuxIme, String settingsActivity, List<InputMethodSubtype> subtypes, int isDefaultResId, boolean forceDefault, boolean supportsSwitchingToNextInputMethod, boolean isVrOnly) { this(ri, isAuxIme, settingsActivity, subtypes, isDefaultResId, forceDefault, supportsSwitchingToNextInputMethod, false /* inlineSuggestionsEnabled */, isVrOnly); } /** * 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, boolean inlineSuggestionsEnabled, boolean isVrOnly) { final ServiceInfo si = ri.serviceInfo; mService = ri; mId = new ComponentName(si.packageName, si.name).flattenToShortString(); Loading @@ -316,6 +340,7 @@ public final class InputMethodInfo implements Parcelable { mSubtypes = new InputMethodSubtypeArray(subtypes); mForceDefault = forceDefault; mSupportsSwitchingToNextInputMethod = supportsSwitchingToNextInputMethod; mInlineSuggestionsEnabled = inlineSuggestionsEnabled; mIsVrOnly = isVrOnly; } Loading Loading @@ -467,7 +492,8 @@ public final class InputMethodInfo implements Parcelable { pw.println(prefix + "mId=" + mId + " mSettingsActivityName=" + mSettingsActivityName + " mIsVrOnly=" + mIsVrOnly + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod); + " mSupportsSwitchingToNextInputMethod=" + mSupportsSwitchingToNextInputMethod + " mInlineSuggestionsEnabled=" + mInlineSuggestionsEnabled); pw.println(prefix + "mIsDefaultResId=0x" + Integer.toHexString(mIsDefaultResId)); pw.println(prefix + "Service:"); Loading Loading @@ -527,6 +553,14 @@ public final class InputMethodInfo implements Parcelable { return mSupportsSwitchingToNextInputMethod; } /** * @return true if this input method supports inline suggestions. * @hide */ public boolean isInlineSuggestionsEnabled() { return mInlineSuggestionsEnabled; } /** * Used to package this object into a {@link Parcel}. * Loading @@ -540,6 +574,7 @@ public final class InputMethodInfo implements Parcelable { dest.writeInt(mIsDefaultResId); dest.writeInt(mIsAuxIme ? 1 : 0); dest.writeInt(mSupportsSwitchingToNextInputMethod ? 1 : 0); dest.writeInt(mInlineSuggestionsEnabled ? 1 : 0); dest.writeBoolean(mIsVrOnly); mService.writeToParcel(dest, flags); mSubtypes.writeToParcel(dest); Loading
core/res/res/values/attrs.xml +5 −0 Original line number Diff line number Diff line Loading @@ -3469,6 +3469,8 @@ device --> <attr name="isVrOnly" format="boolean"/> <attr name="__removed2" format="boolean" /> <!-- Specifies whether the IME supports showing inline suggestions. --> <attr name="supportsInlineSuggestions" format="boolean" /> </declare-styleable> <!-- This is the subtype of InputMethod. Subtype can describe locales (for example, en_US and Loading Loading @@ -8177,6 +8179,9 @@ <!-- Fully qualified class name of an activity that allows the user to modify the settings for this service. --> <attr name="settingsActivity" /> <!-- Specifies whether the AutofillService supports inline suggestions--> <attr name="supportsInlineSuggestions" format="boolean" /> </declare-styleable> <!-- Use <code>compatibility-package</code> as a child tag of <code>autofill-service</code> Loading