Loading api/current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -37911,7 +37911,6 @@ package android.service.autofill { } public static final class FieldClassification.Match { method public java.lang.String getAlgorithm(); method public java.lang.String getRemoteId(); method public float getScore(); } api/system-current.txt +3 −11 Original line number Diff line number Diff line Loading @@ -3875,18 +3875,10 @@ package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service { method public android.os.IBinder onBind(android.content.Intent); method public android.service.autofill.AutofillFieldClassificationService.Scores onGetScores(java.lang.String, android.os.Bundle, java.util.List<android.view.autofill.AutofillValue>, java.util.List<java.lang.String>); method public float[][] onGetScores(java.lang.String, android.os.Bundle, java.util.List<android.view.autofill.AutofillValue>, java.util.List<java.lang.String>); field public static final java.lang.String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService"; } public static final class AutofillFieldClassificationService.Scores implements android.os.Parcelable { ctor public AutofillFieldClassificationService.Scores(java.lang.String, int, int); ctor public AutofillFieldClassificationService.Scores(android.os.Parcel); method public int describeContents(); method public java.lang.String getAlgorithm(); method public float[][] getScores(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.service.autofill.AutofillFieldClassificationService.Scores> CREATOR; field public static final java.lang.String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms"; field public static final java.lang.String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm"; } } Loading core/java/android/service/autofill/AutofillFieldClassificationService.java +29 −42 Original line number Diff line number Diff line Loading @@ -64,6 +64,20 @@ public abstract class AutofillFieldClassificationService extends Service { public static final String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService"; /** * Manifest metadata key for the resource string containing the name of the default field * classification algorithm. */ public static final String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm"; /** * Manifest metadata key for the resource string array containing the names of all field * classification algorithms provided by the service. */ public static final String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms"; /** {@hide} **/ public static final String EXTRA_SCORES = "scores"; Loading @@ -83,9 +97,9 @@ public abstract class AutofillFieldClassificationService extends Service { final List<AutofillValue> actualValues = ((List<AutofillValue>) args.arg4); @SuppressWarnings("unchecked") final String[] userDataValues = (String[]) args.arg5; final Scores scores = onGetScores(algorithmName, algorithmArgs, actualValues, final float[][] scores = onGetScores(algorithmName, algorithmArgs, actualValues, Arrays.asList(userDataValues)); data.putParcelable(EXTRA_SCORES, scores); data.putParcelable(EXTRA_SCORES, new Scores(scores)); break; default: Log.w(TAG, "Handling unknown message: " + action); Loading Loading @@ -124,13 +138,14 @@ public abstract class AutofillFieldClassificationService extends Service { * @param args optional arguments to be passed to the algorithm. * @param actualValues values entered by the user. * @param userDataValues values predicted from the user data. * @return the calculated scores and the algorithm used. * @return the calculated scores, with the first dimension representing actual values and the * second dimension values from {@link UserData}. * * {@hide} */ @Nullable @SystemApi public Scores onGetScores(@Nullable String algorithm, public float[][] onGetScores(@Nullable String algorithm, @Nullable Bundle args, @NonNull List<AutofillValue> actualValues, @NonNull List<String> userDataValues) { throw new UnsupportedOperationException("Must be implemented by external service"); Loading @@ -148,52 +163,27 @@ public abstract class AutofillFieldClassificationService extends Service { } } // TODO(b/70939974): it might be simpler to remove this class and return the float[][] directly, // ignoring the request if the algorithm name is invalid. /** * Represents field classification scores used in a batch calculation. * Helper class used to encapsulate a float[][] in a Parcelable. * * {@hide} */ @SystemApi public static final class Scores implements Parcelable { private final String mAlgorithmName; private final float[][] mScores; /* @hide */ public Scores(String algorithmName, int size1, int size2) { mAlgorithmName = algorithmName; mScores = new float[size1][size2]; } public final float[][] scores; public Scores(Parcel parcel) { mAlgorithmName = parcel.readString(); private Scores(Parcel parcel) { final int size1 = parcel.readInt(); final int size2 = parcel.readInt(); mScores = new float[size1][size2]; scores = new float[size1][size2]; for (int i = 0; i < size1; i++) { for (int j = 0; j < size2; j++) { mScores[i][j] = parcel.readFloat(); scores[i][j] = parcel.readFloat(); } } } /** * Gets the name of algorithm used to calculate the score. */ @NonNull public String getAlgorithm() { return mAlgorithmName; } /** * Gets the resulting scores, with the 1st dimension representing actual values and the 2nd * dimension values from {@link UserData}. */ @NonNull public float[][] getScores() { return mScores; private Scores(float[][] scores) { this.scores = scores; } @Override Loading @@ -203,20 +193,18 @@ public abstract class AutofillFieldClassificationService extends Service { @Override public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(mAlgorithmName); int size1 = mScores.length; int size2 = mScores[0].length; int size1 = scores.length; int size2 = scores[0].length; parcel.writeInt(size1); parcel.writeInt(size2); for (int i = 0; i < size1; i++) { for (int j = 0; j < size2; j++) { parcel.writeFloat(mScores[i][j]); parcel.writeFloat(scores[i][j]); } } } public static final Creator<Scores> CREATOR = new Creator<Scores>() { @Override public Scores createFromParcel(Parcel parcel) { return new Scores(parcel); Loading @@ -226,7 +214,6 @@ public abstract class AutofillFieldClassificationService extends Service { public Scores[] newArray(int size) { return new Scores[size]; } }; } } core/java/android/service/autofill/FieldClassification.java +3 −24 Original line number Diff line number Diff line Loading @@ -105,21 +105,16 @@ public final class FieldClassification { /** * Represents the score of a {@link UserData} entry for the field. * * <p>The score is calculated by the given {@link #getAlgorithm() algorithm} and * the entry is identified by {@link #getRemoteId()}. */ public static final class Match { private final String mRemoteId; private final float mScore; private final String mAlgorithm; /** @hide */ public Match(String remoteId, float score, String algorithm) { public Match(String remoteId, float score) { mRemoteId = Preconditions.checkNotNull(remoteId); mScore = score; mAlgorithm = algorithm; } /** Loading Loading @@ -150,38 +145,22 @@ public final class FieldClassification { return mScore; } /** * Gets the algorithm used to calculate this score. * * <p>Typically, this is either the algorithm set by * {@link UserData.Builder#setFieldClassificationAlgorithm(String, android.os.Bundle)}, * or the * {@link android.view.autofill.AutofillManager#getDefaultFieldClassificationAlgorithm()}. */ @NonNull public String getAlgorithm() { return mAlgorithm; } @Override public String toString() { if (!sDebug) return super.toString(); final StringBuilder string = new StringBuilder("Match: remoteId="); Helper.appendRedacted(string, mRemoteId); return string.append(", score=").append(mScore) .append(", algorithm=").append(mAlgorithm) .toString(); return string.append(", score=").append(mScore).toString(); } private void writeToParcel(@NonNull Parcel parcel) { parcel.writeString(mRemoteId); parcel.writeFloat(mScore); parcel.writeString(mAlgorithm); } private static Match readFromParcel(@NonNull Parcel parcel) { return new Match(parcel.readString(), parcel.readFloat(), parcel.readString()); return new Match(parcel.readString(), parcel.readFloat()); } } } core/java/android/service/autofill/UserData.java +3 −6 Original line number Diff line number Diff line Loading @@ -155,12 +155,9 @@ public final class UserData implements Parcelable { * <p>The currently available algorithms can be retrieve through * {@link AutofillManager#getAvailableFieldClassificationAlgorithms()}. * * <p><b>Note: </b>The available algorithms in the Android System can change dinamically, * so it's not guaranteed that the algorithm set here is the one that will be effectually * used. If the algorithm set here is not available at runtime, the * {@link AutofillManager#getDefaultFieldClassificationAlgorithm()} is used instead. * You can verify which algorithm was used by calling * {@link FieldClassification.Match#getAlgorithm()}. * <p>If not set, the * {@link AutofillManager#getDefaultFieldClassificationAlgorithm() default algorithm} is * used instead. * * @param name name of the algorithm or {@code null} to used default. * @param args optional arguments to the algorithm. Loading Loading
api/current.txt +0 −1 Original line number Diff line number Diff line Loading @@ -37911,7 +37911,6 @@ package android.service.autofill { } public static final class FieldClassification.Match { method public java.lang.String getAlgorithm(); method public java.lang.String getRemoteId(); method public float getScore(); }
api/system-current.txt +3 −11 Original line number Diff line number Diff line Loading @@ -3875,18 +3875,10 @@ package android.service.autofill { public abstract class AutofillFieldClassificationService extends android.app.Service { method public android.os.IBinder onBind(android.content.Intent); method public android.service.autofill.AutofillFieldClassificationService.Scores onGetScores(java.lang.String, android.os.Bundle, java.util.List<android.view.autofill.AutofillValue>, java.util.List<java.lang.String>); method public float[][] onGetScores(java.lang.String, android.os.Bundle, java.util.List<android.view.autofill.AutofillValue>, java.util.List<java.lang.String>); field public static final java.lang.String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService"; } public static final class AutofillFieldClassificationService.Scores implements android.os.Parcelable { ctor public AutofillFieldClassificationService.Scores(java.lang.String, int, int); ctor public AutofillFieldClassificationService.Scores(android.os.Parcel); method public int describeContents(); method public java.lang.String getAlgorithm(); method public float[][] getScores(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.service.autofill.AutofillFieldClassificationService.Scores> CREATOR; field public static final java.lang.String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms"; field public static final java.lang.String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm"; } } Loading
core/java/android/service/autofill/AutofillFieldClassificationService.java +29 −42 Original line number Diff line number Diff line Loading @@ -64,6 +64,20 @@ public abstract class AutofillFieldClassificationService extends Service { public static final String SERVICE_INTERFACE = "android.service.autofill.AutofillFieldClassificationService"; /** * Manifest metadata key for the resource string containing the name of the default field * classification algorithm. */ public static final String SERVICE_META_DATA_KEY_DEFAULT_ALGORITHM = "android.autofill.field_classification.default_algorithm"; /** * Manifest metadata key for the resource string array containing the names of all field * classification algorithms provided by the service. */ public static final String SERVICE_META_DATA_KEY_AVAILABLE_ALGORITHMS = "android.autofill.field_classification.available_algorithms"; /** {@hide} **/ public static final String EXTRA_SCORES = "scores"; Loading @@ -83,9 +97,9 @@ public abstract class AutofillFieldClassificationService extends Service { final List<AutofillValue> actualValues = ((List<AutofillValue>) args.arg4); @SuppressWarnings("unchecked") final String[] userDataValues = (String[]) args.arg5; final Scores scores = onGetScores(algorithmName, algorithmArgs, actualValues, final float[][] scores = onGetScores(algorithmName, algorithmArgs, actualValues, Arrays.asList(userDataValues)); data.putParcelable(EXTRA_SCORES, scores); data.putParcelable(EXTRA_SCORES, new Scores(scores)); break; default: Log.w(TAG, "Handling unknown message: " + action); Loading Loading @@ -124,13 +138,14 @@ public abstract class AutofillFieldClassificationService extends Service { * @param args optional arguments to be passed to the algorithm. * @param actualValues values entered by the user. * @param userDataValues values predicted from the user data. * @return the calculated scores and the algorithm used. * @return the calculated scores, with the first dimension representing actual values and the * second dimension values from {@link UserData}. * * {@hide} */ @Nullable @SystemApi public Scores onGetScores(@Nullable String algorithm, public float[][] onGetScores(@Nullable String algorithm, @Nullable Bundle args, @NonNull List<AutofillValue> actualValues, @NonNull List<String> userDataValues) { throw new UnsupportedOperationException("Must be implemented by external service"); Loading @@ -148,52 +163,27 @@ public abstract class AutofillFieldClassificationService extends Service { } } // TODO(b/70939974): it might be simpler to remove this class and return the float[][] directly, // ignoring the request if the algorithm name is invalid. /** * Represents field classification scores used in a batch calculation. * Helper class used to encapsulate a float[][] in a Parcelable. * * {@hide} */ @SystemApi public static final class Scores implements Parcelable { private final String mAlgorithmName; private final float[][] mScores; /* @hide */ public Scores(String algorithmName, int size1, int size2) { mAlgorithmName = algorithmName; mScores = new float[size1][size2]; } public final float[][] scores; public Scores(Parcel parcel) { mAlgorithmName = parcel.readString(); private Scores(Parcel parcel) { final int size1 = parcel.readInt(); final int size2 = parcel.readInt(); mScores = new float[size1][size2]; scores = new float[size1][size2]; for (int i = 0; i < size1; i++) { for (int j = 0; j < size2; j++) { mScores[i][j] = parcel.readFloat(); scores[i][j] = parcel.readFloat(); } } } /** * Gets the name of algorithm used to calculate the score. */ @NonNull public String getAlgorithm() { return mAlgorithmName; } /** * Gets the resulting scores, with the 1st dimension representing actual values and the 2nd * dimension values from {@link UserData}. */ @NonNull public float[][] getScores() { return mScores; private Scores(float[][] scores) { this.scores = scores; } @Override Loading @@ -203,20 +193,18 @@ public abstract class AutofillFieldClassificationService extends Service { @Override public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(mAlgorithmName); int size1 = mScores.length; int size2 = mScores[0].length; int size1 = scores.length; int size2 = scores[0].length; parcel.writeInt(size1); parcel.writeInt(size2); for (int i = 0; i < size1; i++) { for (int j = 0; j < size2; j++) { parcel.writeFloat(mScores[i][j]); parcel.writeFloat(scores[i][j]); } } } public static final Creator<Scores> CREATOR = new Creator<Scores>() { @Override public Scores createFromParcel(Parcel parcel) { return new Scores(parcel); Loading @@ -226,7 +214,6 @@ public abstract class AutofillFieldClassificationService extends Service { public Scores[] newArray(int size) { return new Scores[size]; } }; } }
core/java/android/service/autofill/FieldClassification.java +3 −24 Original line number Diff line number Diff line Loading @@ -105,21 +105,16 @@ public final class FieldClassification { /** * Represents the score of a {@link UserData} entry for the field. * * <p>The score is calculated by the given {@link #getAlgorithm() algorithm} and * the entry is identified by {@link #getRemoteId()}. */ public static final class Match { private final String mRemoteId; private final float mScore; private final String mAlgorithm; /** @hide */ public Match(String remoteId, float score, String algorithm) { public Match(String remoteId, float score) { mRemoteId = Preconditions.checkNotNull(remoteId); mScore = score; mAlgorithm = algorithm; } /** Loading Loading @@ -150,38 +145,22 @@ public final class FieldClassification { return mScore; } /** * Gets the algorithm used to calculate this score. * * <p>Typically, this is either the algorithm set by * {@link UserData.Builder#setFieldClassificationAlgorithm(String, android.os.Bundle)}, * or the * {@link android.view.autofill.AutofillManager#getDefaultFieldClassificationAlgorithm()}. */ @NonNull public String getAlgorithm() { return mAlgorithm; } @Override public String toString() { if (!sDebug) return super.toString(); final StringBuilder string = new StringBuilder("Match: remoteId="); Helper.appendRedacted(string, mRemoteId); return string.append(", score=").append(mScore) .append(", algorithm=").append(mAlgorithm) .toString(); return string.append(", score=").append(mScore).toString(); } private void writeToParcel(@NonNull Parcel parcel) { parcel.writeString(mRemoteId); parcel.writeFloat(mScore); parcel.writeString(mAlgorithm); } private static Match readFromParcel(@NonNull Parcel parcel) { return new Match(parcel.readString(), parcel.readFloat(), parcel.readString()); return new Match(parcel.readString(), parcel.readFloat()); } } }
core/java/android/service/autofill/UserData.java +3 −6 Original line number Diff line number Diff line Loading @@ -155,12 +155,9 @@ public final class UserData implements Parcelable { * <p>The currently available algorithms can be retrieve through * {@link AutofillManager#getAvailableFieldClassificationAlgorithms()}. * * <p><b>Note: </b>The available algorithms in the Android System can change dinamically, * so it's not guaranteed that the algorithm set here is the one that will be effectually * used. If the algorithm set here is not available at runtime, the * {@link AutofillManager#getDefaultFieldClassificationAlgorithm()} is used instead. * You can verify which algorithm was used by calling * {@link FieldClassification.Match#getAlgorithm()}. * <p>If not set, the * {@link AutofillManager#getDefaultFieldClassificationAlgorithm() default algorithm} is * used instead. * * @param name name of the algorithm or {@code null} to used default. * @param args optional arguments to the algorithm. Loading