summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorShu Chen <shuchen@google.com>2020-01-21 05:51:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-21 05:51:27 +0000
commit0964a57e857b87888dc49637889289e13f0fd2ae (patch)
tree1de7212f0a38e889ac427617912768b7a1483200 /core/java
parent08a23eb7cdddb023052e161ea7a49b3816b249c6 (diff)
parent36ae40e39fef8e9384c3eacffaee31c375030511 (diff)
Merge "Reads "enable_cursor_control" device config flag in Editor."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/Editor.java12
-rw-r--r--core/java/android/widget/WidgetFlags.java40
2 files changed, 52 insertions, 0 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index b891af52a887..513e72f27901 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -21,6 +21,7 @@ import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.app.AppGlobals;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.app.RemoteAction;
@@ -384,6 +385,10 @@ public class Editor {
private final SuggestionHelper mSuggestionHelper = new SuggestionHelper();
+ // Specifies whether the cursor control feature set is enabled.
+ // This can only be true if the text view is editable.
+ private final boolean mCursorControlEnabled;
+
Editor(TextView textView) {
mTextView = textView;
// Synchronize the filter list, which places the undo input filter at the end.
@@ -397,6 +402,13 @@ public class Editor {
Magnifier.createBuilderWithOldMagnifierDefaults(mTextView).build();
mMagnifierAnimator = new MagnifierMotionAnimator(magnifier);
}
+
+ mCursorControlEnabled = AppGlobals.getIntCoreSetting(
+ WidgetFlags.KEY_ENABLE_CURSOR_CONTROL , 0) != 0;
+ if (TextView.DEBUG_CURSOR) {
+ logCursor("Editor", "Cursor control is %s.",
+ mCursorControlEnabled ? "enabled" : "disabled");
+ }
}
ParcelableParcel saveInstanceState() {
diff --git a/core/java/android/widget/WidgetFlags.java b/core/java/android/widget/WidgetFlags.java
new file mode 100644
index 000000000000..fa1e498d55b6
--- /dev/null
+++ b/core/java/android/widget/WidgetFlags.java
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+package android.widget;
+
+/**
+ * Keeps the flags related to the Widget namespace in {@link DeviceConfig}.
+ *
+ * @hide
+ */
+public final class WidgetFlags {
+
+ /**
+ * Whether the cursor control feature set is enabled.
+ * TODO: Makes this flag key visible to webview/chrome.
+ */
+ public static final String ENABLE_CURSOR_CONTROL =
+ "CursorControlFeature__enable_cursor_control";
+
+ /**
+ * The key name used in app core settings for enable cursor control.
+ */
+ public static final String KEY_ENABLE_CURSOR_CONTROL = "widget__enable_cursor_control";
+
+ private WidgetFlags() {
+ }
+}