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
This commit is contained in:
Dipen Pradhan
2023-06-26 15:51:50 -07:00
parent d0b8361ec1
commit c49de81cdf
3 changed files with 8 additions and 1 deletions

View File

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

View File

@@ -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. -->
<bool name="config_repairModeSupported">false</bool>
<!-- Enables or disables the "Share" action item shown in the context menu that appears upon
long-pressing on selected text. Enabled by default. -->
<bool name="config_textShareSupported">true</bool>
</resources>

View File

@@ -3038,6 +3038,7 @@
<java-symbol type="id" name="addToDictionaryButton" />
<java-symbol type="id" name="deleteButton" />
<!-- TextView -->
<java-symbol type="bool" name="config_textShareSupported" />
<java-symbol type="string" name="failed_to_copy_to_clipboard" />
<java-symbol type="id" name="notification_material_reply_container" />