summaryrefslogtreecommitdiff
path: root/core/java/android/widget/CompoundButton.java
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2017-03-09 13:19:55 -0800
committerPhilip P. Moltmann <moltmann@google.com>2017-03-14 09:11:47 -0700
commit9668903731c272e51ce610598c052ef411c9d89f (patch)
tree3251415a2fe04367f2c50e94373c8b6ae2340274 /core/java/android/widget/CompoundButton.java
parentb94427d2855c4fc5b62890fdb99ceca140b5034d (diff)
Make it clear which type of AutoFillValue is set
throw and handle errors if the wrong value is set for a view Test: android.autofillservice.cts.AutofillValueTest Change-Id: Ida80da7913a210bede6c47d6b7a6f215a012a84c
Diffstat (limited to 'core/java/android/widget/CompoundButton.java')
-rw-r--r--core/java/android/widget/CompoundButton.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index d2464052e68f..ae58e2ae50e5 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.Gravity;
import android.view.SoundEffectConstants;
import android.view.ViewDebug;
@@ -55,6 +56,7 @@ import com.android.internal.R;
* </p>
*/
public abstract class CompoundButton extends Button implements Checkable {
+ private static final String LOG_TAG = CompoundButton.class.getSimpleName();
private boolean mChecked;
private boolean mBroadcasting;
@@ -585,7 +587,11 @@ public abstract class CompoundButton extends Button implements Checkable {
public void autofill(AutofillValue value) {
if (!isEnabled()) return;
- setChecked(value.getToggleValue());
+ if (value.isToggle()) {
+ setChecked(value.getToggleValue());
+ } else {
+ Log.w(LOG_TAG, value + " could not be autofilled into " + this);
+ }
}
@Override