Merge "Removed deprecated auto(F)ill classes." into oc-dev

am: b44feb154b

Change-Id: I95768d5e62af9f9fd6469b8a8e36c6e6a196091a
This commit is contained in:
Felipe Leme
2017-04-05 20:32:10 +00:00
committed by android-build-merger
11 changed files with 5 additions and 597 deletions

View File

@@ -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;
@@ -919,15 +916,6 @@ public class AssistStructure implements Parcelable {
return mIdEntry;
}
/**
* @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.
*
@@ -938,26 +926,6 @@ public class AssistStructure implements Parcelable {
return mAutofillId;
}
/**
* @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.
*
@@ -981,15 +949,6 @@ public class AssistStructure implements Parcelable {
return mAutofillHints;
}
/**
* @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.
*

View File

@@ -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 {
}

View File

@@ -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>&lt;{@link
* android.R.styleable#AutoFillService autofill-service}&gt;</code> tag.
* android.R.styleable#AutofillService autofill-service}&gt;</code> tag.
* This is a a sample XML file configuring an AutoFillService:
* <pre> &lt;autofill-service
* android:settingsActivity="foo.bar.SettingsActivity"

View File

@@ -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();
}

View File

@@ -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;
@@ -174,15 +172,6 @@ public final class Dataset implements Parcelable {
return this;
}
/**
* @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.
*

View File

@@ -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.
*

View File

@@ -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;

View File

@@ -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];
}
};
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -7739,13 +7739,6 @@
<attr name="settingsActivity" />
</declare-styleable>
<!-- TODO(b/35956626): temporary until clients change to AutofillService -->
<declare-styleable name="AutoFillService">
<!-- Fully qualified class name of an activity that allows the user to modify
the settings for this service. -->
<attr name="settingsActivity" />
</declare-styleable>
<!-- =============================== -->
<!-- Contacts meta-data attributes -->
<!-- =============================== -->