From 911dd88ca6306519f4fbdba10c388aa70a2ee20e Mon Sep 17 00:00:00 2001
From: Priyank Singh
Date: Fri, 27 Mar 2020 15:09:16 -0700
Subject: [PATCH] Add attr allowClickWhenDisabled for the new API
View#setAllowClickWhenDisabled
Fix: 152628656
Test: Manual
Change-Id: I10d149b618dfc0f06d5e395e8d053dce2f5df452
---
api/current.txt | 1 +
core/java/android/view/View.java | 6 ++++++
core/res/res/values/attrs.xml | 3 +++
core/res/res/values/public.xml | 22 ++++++++++++++++++++++
4 files changed, 32 insertions(+)
diff --git a/api/current.txt b/api/current.txt
index e92c8dbd146fa..248f6a808344c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -289,6 +289,7 @@ package android {
field public static final int allowAudioPlaybackCapture = 16844289; // 0x1010601
field public static final int allowBackup = 16843392; // 0x1010280
field public static final int allowClearUserData = 16842757; // 0x1010005
+ field public static final int allowClickWhenDisabled = 16844325; // 0x1010625
field public static final int allowEmbedded = 16843765; // 0x10103f5
field public static final int allowNativeHeapPointerTagging = 16844307; // 0x1010613
field public static final int allowParallelSyncs = 16843570; // 0x1010332
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 7c7e76a4cb427..1beb4c8067c06 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -728,6 +728,7 @@ import java.util.function.Predicate;
*
*
* @attr ref android.R.styleable#View_accessibilityHeading
+ * @attr ref android.R.styleable#View_allowClickWhenDisabled
* @attr ref android.R.styleable#View_alpha
* @attr ref android.R.styleable#View_background
* @attr ref android.R.styleable#View_clickable
@@ -5586,6 +5587,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
viewFlagMasks |= CLICKABLE;
}
break;
+ case com.android.internal.R.styleable.View_allowClickWhenDisabled:
+ setAllowClickWhenDisabled(a.getBoolean(attr, false));
+ break;
case com.android.internal.R.styleable.View_longClickable:
if (a.getBoolean(attr, false)) {
viewFlagValues |= LONG_CLICKABLE;
@@ -12140,6 +12144,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* Enables or disables click events for this view when disabled.
*
* @param clickableWhenDisabled true to make the view clickable, false otherwise
+ *
+ * @attr ref android.R.styleable#View_allowClickWhenDisabled
*/
public void setAllowClickWhenDisabled(boolean clickableWhenDisabled) {
if (clickableWhenDisabled) {
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index ecf46962f352f..dab8436e6bcd3 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3182,6 +3182,9 @@
+
+
+
+
+
+
+
+
+
+
+