diff options
| author | Felipe Leme <felipeal@google.com> | 2017-04-04 15:07:13 -0700 |
|---|---|---|
| committer | Felipe Leme <felipeal@google.com> | 2017-04-04 18:28:09 -0700 |
| commit | f78e952d8df7074aa7380c5998826a4dffe335e7 (patch) | |
| tree | b49f2150298806681817cdaa91fff84affed3266 /core/java/android | |
| parent | 5effb5f6452b8185d139020704a781bcb2509e78 (diff) | |
Removed deprecated auto(F)ill classes.
Bug: 35956626
Test: manual verification
Test: CtsAutoFillServiceTestCases pass
Change-Id: Icb622589c41e6a286d51e3f85bd5a813e483b5ea
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/assist/AssistStructure.java | 41 | ||||
| -rw-r--r-- | core/java/android/service/autofill/AutoFillService.java | 24 | ||||
| -rw-r--r-- | core/java/android/service/autofill/AutofillService.java | 2 | ||||
| -rw-r--r-- | core/java/android/service/autofill/AutofillServiceInfo.java | 22 | ||||
| -rw-r--r-- | core/java/android/service/autofill/Dataset.java | 11 | ||||
| -rw-r--r-- | core/java/android/service/autofill/SaveInfo.java | 21 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutoFillId.aidl | 20 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutoFillId.java | 85 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutoFillType.java | 188 | ||||
| -rw-r--r-- | core/java/android/view/autofill/AutoFillValue.java | 181 |
10 files changed, 5 insertions, 590 deletions
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index 7d2db5c9f384..fe51633b50eb 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -27,9 +27,6 @@ import android.view.ViewStructure.HtmlInfo; import android.view.ViewStructure.HtmlInfo.Builder; import android.view.WindowManager; import android.view.WindowManagerGlobal; -import android.view.autofill.AutoFillId; -import android.view.autofill.AutoFillType; -import android.view.autofill.AutoFillValue; import android.view.autofill.AutofillId; import android.view.autofill.AutofillValue; @@ -920,15 +917,6 @@ public class AssistStructure implements Parcelable { } /** - * @hide - * @deprecated TODO(b/35956626): remove once clients use getAutoFilltype - */ - @Deprecated - public AutoFillId getAutoFillId() { - return AutoFillId.forDaRealId(mAutofillId); - } - - /** * Gets the id that can be used to autofill the view contents. * * <p>It's only set when the {@link AssistStructure} is used for autofilling purposes, not @@ -939,26 +927,6 @@ public class AssistStructure implements Parcelable { } /** - * @hide - * @deprecated TODO(b/35956626): remove once clients use getAutoFilltype() - */ - @Deprecated - public AutoFillType getAutoFillType() { - switch (getAutofillType()) { - case View.AUTOFILL_TYPE_TEXT: - return AutoFillType.forText(); - case View.AUTOFILL_TYPE_TOGGLE: - return AutoFillType.forToggle(); - case View.AUTOFILL_TYPE_LIST: - return AutoFillType.forList(); - case View.AUTOFILL_TYPE_DATE: - return AutoFillType.forDate(); - default: - return null; - } - } - - /** * Gets the the type of value that can be used to autofill the view contents. * * <p>It's only set when the {@link AssistStructure} is used for autofilling purposes, not @@ -982,15 +950,6 @@ public class AssistStructure implements Parcelable { } /** - * @hide - * @deprecated TODO(b/35956626): remove once clients use getAutoFilltype - */ - @Deprecated - public AutoFillValue getAutoFillValue() { - return AutoFillValue.forDaRealValue(mAutofillValue); - } - - /** * Gets the the value of this view. * * <p>It's only set when the {@link AssistStructure} is used for autofilling purposes, not diff --git a/core/java/android/service/autofill/AutoFillService.java b/core/java/android/service/autofill/AutoFillService.java deleted file mode 100644 index c26f679cbda8..000000000000 --- a/core/java/android/service/autofill/AutoFillService.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package android.service.autofill; - -/** - * @hide - * @deprecated TODO(b/35956626): remove once clients use AutofillService - */ -@Deprecated -public abstract class AutoFillService extends AutofillService { -} diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java index 6f17d0e5ec77..9f8a6217c5f4 100644 --- a/core/java/android/service/autofill/AutofillService.java +++ b/core/java/android/service/autofill/AutofillService.java @@ -71,7 +71,7 @@ public abstract class AutofillService extends Service { * Name under which a AutoFillService component publishes information about itself. * This meta-data should reference an XML resource containing a * <code><{@link - * android.R.styleable#AutoFillService autofill-service}></code> tag. + * android.R.styleable#AutofillService autofill-service}></code> tag. * This is a a sample XML file configuring an AutoFillService: * <pre> <autofill-service * android:settingsActivity="foo.bar.SettingsActivity" diff --git a/core/java/android/service/autofill/AutofillServiceInfo.java b/core/java/android/service/autofill/AutofillServiceInfo.java index f6d40dbf3414..0f4824e47fa9 100644 --- a/core/java/android/service/autofill/AutofillServiceInfo.java +++ b/core/java/android/service/autofill/AutofillServiceInfo.java @@ -36,7 +36,6 @@ import com.android.internal.R; import java.io.IOException; -// TODO(b/33197203 , b/33802548): add CTS tests /** * {@link ServiceInfo} and meta-data about an {@link AutofillService}. * @@ -75,15 +74,8 @@ public final class AutofillServiceInfo { mServiceInfo = si; final TypedArray metaDataArray = getMetaDataArray(pm, si); if (metaDataArray != null) { - // TODO(b/35956626): inline newSettingsActivity once clients migrate - final String newSettingsActivity = - metaDataArray.getString(R.styleable.AutofillService_settingsActivity); - if (newSettingsActivity != null) { - mSettingsActivity = newSettingsActivity; - } else { - mSettingsActivity = - metaDataArray.getString(R.styleable.AutoFillService_settingsActivity); - } + mSettingsActivity = metaDataArray + .getString(R.styleable.AutofillService_settingsActivity); metaDataArray.recycle(); } else { mSettingsActivity = null; @@ -96,16 +88,11 @@ public final class AutofillServiceInfo { @Nullable private static TypedArray getMetaDataArray(PackageManager pm, ServiceInfo si) { // Check for permissions. - // TODO(b/35956626): remove check for BIND_AUTO_FILL once clients migrate - if (!Manifest.permission.BIND_AUTOFILL.equals(si.permission) - && !Manifest.permission.BIND_AUTO_FILL.equals(si.permission)) { + if (!Manifest.permission.BIND_AUTOFILL.equals(si.permission)) { Log.e(TAG, "Service does not require permission " + Manifest.permission.BIND_AUTOFILL); return null; } - // TODO(b/35956626): remove once clients migrate - final boolean oldStyle = !Manifest.permission.BIND_AUTOFILL.equals(si.permission); - // Get the AutoFill metadata, if declared. XmlResourceParser parser = si.loadXmlMetaData(pm, AutofillService.SERVICE_META_DATA); if (parser == null) { @@ -141,8 +128,7 @@ public final class AutofillServiceInfo { return null; } - return oldStyle ? res.obtainAttributes(attrs, R.styleable.AutoFillService) - : res.obtainAttributes(attrs, R.styleable.AutofillService); + return res.obtainAttributes(attrs, R.styleable.AutofillService); } finally { parser.close(); } diff --git a/core/java/android/service/autofill/Dataset.java b/core/java/android/service/autofill/Dataset.java index b7a04206a4c6..e77bd0d753ac 100644 --- a/core/java/android/service/autofill/Dataset.java +++ b/core/java/android/service/autofill/Dataset.java @@ -23,8 +23,6 @@ import android.annotation.Nullable; import android.content.IntentSender; import android.os.Parcel; import android.os.Parcelable; -import android.view.autofill.AutoFillId; -import android.view.autofill.AutoFillValue; import android.view.autofill.AutofillId; import android.view.autofill.AutofillValue; import android.widget.RemoteViews; @@ -175,15 +173,6 @@ public final class Dataset implements Parcelable { } /** - * @hide - * @deprecated TODO(b/35956626): remove once clients use other setValue() - */ - @Deprecated - public @NonNull Builder setValue(@NonNull AutoFillId id, @NonNull AutoFillValue value) { - return setValue(id.getDaRealId(), value.getDaRealValue()); - } - - /** * Sets the value of a field. * * @param id id returned by {@link diff --git a/core/java/android/service/autofill/SaveInfo.java b/core/java/android/service/autofill/SaveInfo.java index 6213d27bfc70..95608a54a72c 100644 --- a/core/java/android/service/autofill/SaveInfo.java +++ b/core/java/android/service/autofill/SaveInfo.java @@ -25,7 +25,6 @@ import android.content.IntentSender; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import android.view.autofill.AutoFillId; import android.view.autofill.AutofillId; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; @@ -269,26 +268,6 @@ public final class SaveInfo implements Parcelable { return this; } - - /** - * @hide - */ - // TODO(b/33197203): temporary fix to runtime crash - public @NonNull Builder addSavableIds(@Nullable AutoFillId... ids) { - throwIfDestroyed(); - - if (ids == null || ids.length == 0) { - return this; - } - if (mRequiredIds == null) { - mRequiredIds = new AutofillId[ids.length]; - } - for (int i = 0; i < ids.length; i++) { - mRequiredIds[i] = ids[i].getDaRealId(); - } - return this; - } - /** * Sets an optional description to be shown in the UI when the user is asked to save. * diff --git a/core/java/android/view/autofill/AutoFillId.aidl b/core/java/android/view/autofill/AutoFillId.aidl deleted file mode 100644 index fc57ce7acfc1..000000000000 --- a/core/java/android/view/autofill/AutoFillId.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2017, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.view.autofill; - -// @deprecated TODO(b/35956626): remove once clients use AutofillId -parcelable AutoFillId;
\ No newline at end of file diff --git a/core/java/android/view/autofill/AutoFillId.java b/core/java/android/view/autofill/AutoFillId.java deleted file mode 100644 index 081fb0289d76..000000000000 --- a/core/java/android/view/autofill/AutoFillId.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package android.view.autofill; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * @hide - * @deprecated TODO(b/35956626): remove once clients use getAutoFilltype - */ -@Deprecated -public final class AutoFillId implements Parcelable { - - private final AutofillId mRealId; - - /** @hide */ - public AutoFillId(AutofillId daRealId) { - this.mRealId = daRealId; - } - - @Override - public int hashCode() { - return mRealId.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - final AutoFillId other = (AutoFillId) obj; - return mRealId.equals(other.mRealId); - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeParcelable(mRealId, 0); - } - - private AutoFillId(Parcel parcel) { - mRealId = parcel.readParcelable(null); - } - - /** @hide */ - public AutofillId getDaRealId() { - return mRealId; - } - - /** @hide */ - public static AutoFillId forDaRealId(AutofillId id) { - return id == null ? null : new AutoFillId(id); - } - - public static final Parcelable.Creator<AutoFillId> CREATOR = - new Parcelable.Creator<AutoFillId>() { - @Override - public AutoFillId createFromParcel(Parcel source) { - return new AutoFillId(source); - } - - @Override - public AutoFillId[] newArray(int size) { - return new AutoFillId[size]; - } - }; -} diff --git a/core/java/android/view/autofill/AutoFillType.java b/core/java/android/view/autofill/AutoFillType.java deleted file mode 100644 index c508ba4eb892..000000000000 --- a/core/java/android/view/autofill/AutoFillType.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.view.autofill; - -import static android.view.autofill.Helper.DEBUG; - -import android.os.Parcel; -import android.os.Parcelable; -import android.view.View; - -/** - * Defines the type of a object that can be used to autofill a {@link View} so the - * {@link android.service.autofill.AutofillService} can use the proper {@link AutofillValue} to - * fill it. - * - * @hide - * @deprecated TODO(b/35956626): remove once clients use getAutoFilltype - */ -@Deprecated -public final class AutoFillType implements Parcelable { - - // Cached instance for types that don't have subtype; it uses the "lazy initialization holder - // class idiom" (Effective Java, Item 71) to avoid memory utilization when autofill is not - // enabled. - private static class DefaultTypesHolder { - static final AutoFillType TEXT = new AutoFillType(TYPE_TEXT); - static final AutoFillType TOGGLE = new AutoFillType(TYPE_TOGGLE); - static final AutoFillType LIST = new AutoFillType(TYPE_LIST); - static final AutoFillType DATE = new AutoFillType(TYPE_DATE); - } - - private static final int TYPE_TEXT = 1; - private static final int TYPE_TOGGLE = 2; - private static final int TYPE_LIST = 3; - private static final int TYPE_DATE = 4; - - private final int mType; - - private AutoFillType(int type) { - mType = type; - } - - /** - * Checks if this is a type for a text field, which is filled by a {@link CharSequence}. - */ - public boolean isText() { - return mType == TYPE_TEXT; - } - - /** - * Checks if this is a a type for a togglable field, which is filled by a {@code boolean}. - */ - public boolean isToggle() { - return mType == TYPE_TOGGLE; - } - - /** - * Checks if this is a type for a selection list field, which is filled by a {@code integer} - * representing the element index inside the list (starting at {@code 0}. - */ - public boolean isList() { - return mType == TYPE_LIST; - } - - /** - * Checks if this is a type for a date and time, which is represented by a long representing - * the number of milliseconds since the standard base time known as "the epoch", namely - * January 1, 1970, 00:00:00 GMT (see {@link java.util.Date#getTime()}. - */ - public boolean isDate() { - return mType == TYPE_DATE; - } - - ///////////////////////////////////// - // Object "contract" methods. // - ///////////////////////////////////// - - @Override - public String toString() { - if (!DEBUG) return super.toString(); - - return "AutoFillType [type=" + mType + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + mType; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - final AutoFillType other = (AutoFillType) obj; - if (mType != other.mType) return false; - return true; - } - - ///////////////////////////////////// - // Parcelable "contract" methods. // - ///////////////////////////////////// - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeInt(mType); - } - - private AutoFillType(Parcel parcel) { - mType = parcel.readInt(); - } - - public static final Parcelable.Creator<AutoFillType> CREATOR = - new Parcelable.Creator<AutoFillType>() { - @Override - public AutoFillType createFromParcel(Parcel source) { - return new AutoFillType(source); - } - - @Override - public AutoFillType[] newArray(int size) { - return new AutoFillType[size]; - } - }; - - //////////////////// - // Factory methods // - //////////////////// - - /** - * Creates a text field type, which is filled by a {@link CharSequence}. - * - * <p>See {@link #isText()} for more info. - */ - public static AutoFillType forText() { - return DefaultTypesHolder.TEXT; - } - - /** - * Creates a type that can be toggled which is filled by a {@code boolean}. - * - * <p>See {@link #isToggle()} for more info. - */ - public static AutoFillType forToggle() { - return DefaultTypesHolder.TOGGLE; - } - - /** - * Creates a selection list, which is filled by a {@code integer} representing the element index - * inside the list (starting at {@code 0}. - * - * <p>See {@link #isList()} for more info. - */ - public static AutoFillType forList() { - return DefaultTypesHolder.LIST; - } - - /** - * Creates a type that represents a date. - * - * <p>See {@link #isDate()} for more info. - */ - public static AutoFillType forDate() { - return DefaultTypesHolder.DATE; - } -} diff --git a/core/java/android/view/autofill/AutoFillValue.java b/core/java/android/view/autofill/AutoFillValue.java deleted file mode 100644 index 4774d8f0a71a..000000000000 --- a/core/java/android/view/autofill/AutoFillValue.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.view.autofill; - -import static android.view.autofill.Helper.DEBUG; - -import android.annotation.Nullable; -import android.os.Parcel; -import android.os.Parcelable; -import android.view.View; - -/** - * @hide - * @deprecated TODO(b/35956626): remove once clients use AutofillValue - */ -@Deprecated -public final class AutoFillValue implements Parcelable { - private final AutofillValue mRealValue; - - private AutoFillValue(AutofillValue daRealValue) { - this.mRealValue = daRealValue; - } - - /** - * Gets the value to autofill a text field. - * - * <p>See {@link View#AUTOFILL_TYPE_TEXT} for more info. - */ - public CharSequence getTextValue() { - return mRealValue.getTextValue(); - } - - /** - * Gets the value to autofill a toggable field. - * - * <p>See {@link View#AUTOFILL_TYPE_TOGGLE} for more info. - */ - public boolean getToggleValue() { - return mRealValue.getToggleValue(); - } - - /** - * Gets the value to autofill a selection list field. - * - * <p>See {@link View#AUTOFILL_TYPE_LIST} for more info. - */ - public int getListValue() { - return mRealValue.getListValue(); - } - - /** - * Gets the value to autofill a date field. - * - * <p>See {@link View#AUTOFILL_TYPE_DATE} for more info. - */ - public long getDateValue() { - return mRealValue.getDateValue(); - } - - ///////////////////////////////////// - // Object "contract" methods. // - ///////////////////////////////////// - - @Override - public int hashCode() { - return mRealValue.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - final AutoFillValue other = (AutoFillValue) obj; - return mRealValue.equals(other.mRealValue); - } - - @Override - public String toString() { - if (!DEBUG) return super.toString(); - - return mRealValue.toString(); - } - - ///////////////////////////////////// - // Parcelable "contract" methods. // - ///////////////////////////////////// - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeParcelable(mRealValue, 0); - } - - private AutoFillValue(Parcel parcel) { - mRealValue = parcel.readParcelable(null); - } - - public static final Parcelable.Creator<AutoFillValue> CREATOR = - new Parcelable.Creator<AutoFillValue>() { - @Override - public AutoFillValue createFromParcel(Parcel source) { - return new AutoFillValue(source); - } - - @Override - public AutoFillValue[] newArray(int size) { - return new AutoFillValue[size]; - } - }; - - //////////////////// - // Factory methods // - //////////////////// - /** - * Creates a new {@link AutoFillValue} to autofill a {@link View} representing a text field. - * - * <p>See {@link View#AUTOFILL_TYPE_TEXT} for more info. - */ - @Nullable - public static AutoFillValue forText(@Nullable CharSequence value) { - return value == null ? null : new AutoFillValue(AutofillValue.forText(value)); - } - - /** - * Creates a new {@link AutoFillValue} to autofill a {@link View} representing a toggable - * field. - * - * <p>See {@link View#AUTOFILL_TYPE_TOGGLE} for more info. - */ - public static AutoFillValue forToggle(boolean value) { - return new AutoFillValue(AutofillValue.forToggle(value)); - } - - /** - * Creates a new {@link AutoFillValue} to autofill a {@link View} representing a selection - * list. - * - * <p>See {@link View#AUTOFILL_TYPE_LIST} for more info. - */ - public static AutoFillValue forList(int value) { - return new AutoFillValue(AutofillValue.forList(value)); - } - - /** - * Creates a new {@link AutoFillValue} to autofill a {@link View} representing a date. - * - * <p>See {@link View#AUTOFILL_TYPE_DATE} for more info. - */ - public static AutoFillValue forDate(long date) { - return new AutoFillValue(AutofillValue.forDate(date)); - } - - /** @hide */ - public static AutoFillValue forDaRealValue(AutofillValue daRealValue) { - return new AutoFillValue(daRealValue); - } - - /** @hide */ - public AutofillValue getDaRealValue() { - return mRealValue; - } -} |
