diff --git a/res/drawable/ic_settings_trackpad.xml b/res/drawable/ic_settings_trackpad.xml
new file mode 100644
index 00000000000..9580e022829
--- /dev/null
+++ b/res/drawable/ic_settings_trackpad.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_gesture_back.xml b/res/drawable/ic_trackpad_gesture_back.xml
new file mode 100644
index 00000000000..b6a80cfd9d8
--- /dev/null
+++ b/res/drawable/ic_trackpad_gesture_back.xml
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/res/drawable/ic_trackpad_gesture_home.xml b/res/drawable/ic_trackpad_gesture_home.xml
new file mode 100644
index 00000000000..f0e7232abed
--- /dev/null
+++ b/res/drawable/ic_trackpad_gesture_home.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_gesture_notifications.xml b/res/drawable/ic_trackpad_gesture_notifications.xml
new file mode 100644
index 00000000000..37d77d87671
--- /dev/null
+++ b/res/drawable/ic_trackpad_gesture_notifications.xml
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/res/drawable/ic_trackpad_gesture_recent_apps.xml b/res/drawable/ic_trackpad_gesture_recent_apps.xml
new file mode 100644
index 00000000000..76ba829f5db
--- /dev/null
+++ b/res/drawable/ic_trackpad_gesture_recent_apps.xml
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/res/drawable/ic_trackpad_gesture_switch_apps.xml b/res/drawable/ic_trackpad_gesture_switch_apps.xml
new file mode 100644
index 00000000000..3d18d1cc729
--- /dev/null
+++ b/res/drawable/ic_trackpad_gesture_switch_apps.xml
@@ -0,0 +1,26 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_pointer_speed.xml b/res/drawable/ic_trackpad_pointer_speed.xml
new file mode 100644
index 00000000000..4e9abeb6c5d
--- /dev/null
+++ b/res/drawable/ic_trackpad_pointer_speed.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_reverse_scrolling.xml b/res/drawable/ic_trackpad_reverse_scrolling.xml
new file mode 100644
index 00000000000..a62f904300b
--- /dev/null
+++ b/res/drawable/ic_trackpad_reverse_scrolling.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_tap_to_click.xml b/res/drawable/ic_trackpad_tap_to_click.xml
new file mode 100644
index 00000000000..7db0454935e
--- /dev/null
+++ b/res/drawable/ic_trackpad_tap_to_click.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_trackpad_touch_gestures_inverse.xml b/res/drawable/ic_trackpad_touch_gestures_inverse.xml
new file mode 100644
index 00000000000..d66357268ec
--- /dev/null
+++ b/res/drawable/ic_trackpad_touch_gestures_inverse.xml
@@ -0,0 +1,25 @@
+
+
+
+
diff --git a/res/drawable/ic_trackpad_touch_gestures_normal.xml b/res/drawable/ic_trackpad_touch_gestures_normal.xml
new file mode 100644
index 00000000000..34619c80432
--- /dev/null
+++ b/res/drawable/ic_trackpad_touch_gestures_normal.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 63640b581ef..5f92ce4a36c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3660,6 +3660,53 @@
On-screen keyboard for work
+
+ Touchpad
+
+ Touchpad & mouse
+
+ Pointer speed, gestures
+
+
+ Tap to click
+
+ Touchpad gestures
+
+ Customize individual touchpad navigation gestures
+
+ Reverse scrolling
+
+ Content moves up when you scroll down
+
+ Bottom-right tap
+
+ Tap the bottom right corner of the touchpad for more options
+
+ Pointer speed
+
+ Learn touchpad gestures
+
+
+ Go back
+
+ Swipe left or right with three fingers
+
+ Go home
+
+ Swipe up with three fingers
+
+ Recent apps
+
+ Swipe up with three fingers, then hold
+
+ Notifications
+
+ Swipe down with three fingers
+
+ Switch apps
+
+ Swipe left or right with four fingers
+
Default
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index 3b242035844..1f5559f0927 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -45,6 +45,15 @@
android:fragment="com.android.settings.inputmethod.KeyboardSettings"
settings:controller="com.android.settings.inputmethod.KeyboardPreferenceController"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/xml/trackpad_settings.xml b/res/xml/trackpad_settings.xml
new file mode 100644
index 00000000000..6401fb87c49
--- /dev/null
+++ b/res/xml/trackpad_settings.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index da81f6eb6f5..fa72fba2c05 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -123,6 +123,7 @@ import com.android.settings.inputmethod.KeyboardSettings;
import com.android.settings.inputmethod.NewKeyboardLayoutEnabledLocalesFragment;
import com.android.settings.inputmethod.PhysicalKeyboardFragment;
import com.android.settings.inputmethod.SpellCheckersSettings;
+import com.android.settings.inputmethod.TrackpadSettings;
import com.android.settings.inputmethod.UserDictionaryList;
import com.android.settings.inputmethod.UserDictionarySettings;
import com.android.settings.language.LanguageAndInputSettings;
@@ -216,6 +217,7 @@ public class SettingsGateway {
LanguageSettings.class.getName(),
KeyboardSettings.class.getName(),
NewKeyboardLayoutEnabledLocalesFragment.class.getName(),
+ TrackpadSettings.class.getName(),
SpellCheckersSettings.class.getName(),
UserDictionaryList.class.getName(),
UserDictionarySettings.class.getName(),
diff --git a/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java b/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java
new file mode 100644
index 00000000000..6e54689423c
--- /dev/null
+++ b/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2022 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 com.android.settings.inputmethod;
+
+import android.content.Context;
+import android.util.FeatureFlagUtils;
+
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.widget.ButtonPreference;
+
+public class TouchGesturesButtonPreferenceController extends BasePreferenceController {
+
+ private static final int ORDER_TOP = 0;
+ private static final int ORDER_BOTTOM = 100;
+ private static final String PREFERENCE_KEY = "trackpad_touch_gesture";
+
+ public TouchGesturesButtonPreferenceController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ ButtonPreference buttonPreference =
+ (ButtonPreference) screen.findPreference(getPreferenceKey());
+ boolean touchGestureDeveloperMode = FeatureFlagUtils
+ .isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE);
+ if (getPreferenceKey().equals(PREFERENCE_KEY)) {
+ if (touchGestureDeveloperMode) {
+ buttonPreference.setOrder(ORDER_TOP);
+ } else {
+ buttonPreference.setOrder(ORDER_BOTTOM);
+ }
+ }
+ buttonPreference.setOnClickListener(v -> {
+ showTouchpadGestureEducation();
+ });
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ private void showTouchpadGestureEducation() {
+ // TODO: Waiting for the education UX design.
+ /* For example:
+ FragmentManager fragmentManager = mParent.getActivity().getSupportFragmentManager();
+ FragmentTransaction transaction = fragmentManager.beginTransaction();
+ TrackpadGestureDialogFragment fragment = new TrackpadGestureDialogFragment();
+ fragment.show(transaction, GESTURE_DIALOG_TAG);
+ */
+ }
+}
diff --git a/src/com/android/settings/inputmethod/TrackpadSettings.java b/src/com/android/settings/inputmethod/TrackpadSettings.java
new file mode 100644
index 00000000000..436e3e6040b
--- /dev/null
+++ b/src/com/android/settings/inputmethod/TrackpadSettings.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2022 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 com.android.settings.inputmethod;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.util.FeatureFlagUtils;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+
+public class TrackpadSettings extends DashboardFragment {
+
+ private static final String TAG = "TrackpadSettings";
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return SettingsEnums.SETTINGS_KEYBOARDS_TOUCHPAD;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.trackpad_settings;
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.trackpad_settings) {
+ @Override
+ protected boolean isPageSearchEnabled(Context context) {
+ return FeatureFlagUtils
+ .isEnabled(context, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD);
+ }
+ };
+}
diff --git a/src/com/android/settings/inputmethod/TrackpadSettingsController.java b/src/com/android/settings/inputmethod/TrackpadSettingsController.java
new file mode 100644
index 00000000000..41be395d0e8
--- /dev/null
+++ b/src/com/android/settings/inputmethod/TrackpadSettingsController.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 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 com.android.settings.inputmethod;
+
+import android.content.Context;
+import android.util.FeatureFlagUtils;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class TrackpadSettingsController extends BasePreferenceController {
+
+ public TrackpadSettingsController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ // TODO: Need to detect if trackpad is connected with device.
+ boolean isFeatureOn = FeatureFlagUtils
+ .isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD);
+ return isFeatureOn ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+ }
+}
diff --git a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java
new file mode 100644
index 00000000000..9884862b672
--- /dev/null
+++ b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 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 com.android.settings.inputmethod;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.util.FeatureFlagUtils;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+
+public class TrackpadTouchGestureSettings extends DashboardFragment {
+
+ private static final String TAG = "TrackpadTouchGestureSettings";
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return SettingsEnums.SETTINGS_KEYBOARDS_TOUCHPAD_GESTURE;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.trackpad_gesture_settings;
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.trackpad_settings) {
+ @Override
+ protected boolean isPageSearchEnabled(Context context) {
+ return FeatureFlagUtils
+ .isEnabled(
+ context,
+ FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE);
+ }
+ };
+}
diff --git a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java
new file mode 100644
index 00000000000..8f04aee1404
--- /dev/null
+++ b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 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 com.android.settings.inputmethod;
+
+import android.content.Context;
+import android.util.FeatureFlagUtils;
+
+import com.android.settings.core.BasePreferenceController;
+
+public class TrackpadTouchGestureSettingsController extends BasePreferenceController {
+
+ public TrackpadTouchGestureSettingsController(Context context, String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ boolean isFeatureOn = FeatureFlagUtils
+ .isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE);
+ return isFeatureOn ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+ }
+}