From c49de81cdf65be05b5fb41e64ae7d949907c2b4d Mon Sep 17 00:00:00 2001 From: Dipen Pradhan Date: Mon, 26 Jun 2023 15:51:50 -0700 Subject: [PATCH] Add config for "Share" action in TextView context menu "Share" text action is not applicable to all platforms, this config allows disabling the action item. Example - Automotive (AAOS) does not support it Bug: 162463255 Test: atest TextViewTest EditTextTest, manual check Merged-In: I825a85bdf566c0a319bd91b523284757af6be68e Change-Id: I825a85bdf566c0a319bd91b523284757af6be68e --- core/java/android/widget/TextView.java | 4 +++- core/res/res/values/config.xml | 4 ++++ core/res/res/values/symbols.xml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b74c8795ffb1e..142df2102999d 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -14994,7 +14994,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } boolean canShare() { - if (!getContext().canStartActivityForResult() || !isDeviceProvisioned()) { + if (!getContext().canStartActivityForResult() || !isDeviceProvisioned() + || !getContext().getResources().getBoolean( + com.android.internal.R.bool.config_textShareSupported)) { return false; } return canCopy(); diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 130648c74bb1c..87d0bf27aad6f 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -6543,4 +6543,8 @@ environment to protect the user's privacy when the device is being repaired. Off by default, since OEMs may have had a similar feature on their devices. --> false + + + true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 08c404b40ccc4..4cd3260a018d7 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3038,6 +3038,7 @@ +