diff --git a/res/drawable/ic_mode_edit.xml b/res/drawable/ic_mode_edit.xml
new file mode 100644
index 00000000000..60a0dd1ca15
--- /dev/null
+++ b/res/drawable/ic_mode_edit.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/res/layout/accessibility_shortcut_secondary_action.xml b/res/layout/accessibility_shortcut_secondary_action.xml
new file mode 100644
index 00000000000..81d7bd52d22
--- /dev/null
+++ b/res/layout/accessibility_shortcut_secondary_action.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 66948541c37..f87048c62c4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4856,6 +4856,14 @@
Use captions
Not all apps support this setting.
+
+ Accessibility button
+
+ 2-finger swipe up from bottom
+
+ Hold volume keys
+
+ Triple tap screen
Continue
diff --git a/src/com/android/settings/accessibility/ShortcutPreference.java b/src/com/android/settings/accessibility/ShortcutPreference.java
new file mode 100644
index 00000000000..cc91b84fa1a
--- /dev/null
+++ b/src/com/android/settings/accessibility/ShortcutPreference.java
@@ -0,0 +1,108 @@
+/*
+ * 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 com.android.settings.accessibility;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.CheckBox;
+
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
+
+import com.android.settings.R;
+
+/**
+ * Preference that can enable accessibility shortcut and let users choose which shortcut type they
+ * prefer to use.
+ */
+public class ShortcutPreference extends Preference {
+
+ private View.OnClickListener mCheckBoxListener;
+ private View.OnClickListener mSettingButtonListener;
+
+ private boolean mChecked = false;
+
+ ShortcutPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ setLayoutResource(R.layout.accessibility_shortcut_secondary_action);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ holder.itemView.setClickable(false);
+
+ final CheckBox checkBox = holder.itemView.findViewById(R.id.checkbox);
+ checkBox.setOnClickListener(mCheckBoxListener);
+ checkBox.setChecked(mChecked);
+ final View settingButton = holder.itemView.findViewById(R.id.settings_button);
+ settingButton.setOnClickListener(mSettingButtonListener);
+ }
+
+ /**
+ * Set the shortcut checkbox according to checked value.
+ *
+ * @param checked the state value of shortcut checkbox.
+ */
+ public void setChecked(boolean checked) {
+ if (checked != mChecked) {
+ mChecked = checked;
+ notifyChanged();
+ }
+ }
+
+ /**
+ * Set the given onClickListener to the SettingButtonListener.
+ *
+ * @param listener the given onClickListener.
+ */
+ public void setSettingButtonListener(@Nullable View.OnClickListener listener) {
+ mSettingButtonListener = listener;
+ notifyChanged();
+ }
+
+ /**
+ * Returns the callback to be invoked when the setting button is clicked.
+ *
+ * @return The callback to be invoked
+ */
+ public View.OnClickListener getSettingButtonListener() {
+ return mSettingButtonListener;
+ }
+
+ /**
+ * Set the given onClickListener to the CheckBoxListener.
+ *
+ * @param listener the given onClickListener.
+ */
+ public void setCheckBoxListener(@Nullable View.OnClickListener listener) {
+ mCheckBoxListener = listener;
+ notifyChanged();
+ }
+
+ /**
+ * Returns the callback to be invoked when the checkbox is clicked.
+ *
+ * @return The callback to be invoked
+ */
+ public View.OnClickListener getCheckBoxListener() {
+ return mCheckBoxListener;
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/ShortcutPreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/ShortcutPreferenceTest.java
new file mode 100644
index 00000000000..3c86f4c12b9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ShortcutPreferenceTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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 com.android.settings.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.view.View;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+/** Tests for {@link ShortcutPreference} */
+@RunWith(RobolectricTestRunner.class)
+public class ShortcutPreferenceTest {
+
+ private ShortcutPreference mShortcutPreference;
+ private View.OnClickListener mSettingButtonListener;
+ private View.OnClickListener mCheckBoxListener;
+
+ @Before
+ public void setUp() {
+ final Context mContext = RuntimeEnvironment.application;
+ mShortcutPreference = new ShortcutPreference(mContext, null);
+ }
+
+ @Test
+ public void setOnClickListeners_shouldSetListeners() {
+ mShortcutPreference.setSettingButtonListener(mSettingButtonListener);
+ mShortcutPreference.setCheckBoxListener(mCheckBoxListener);
+
+ assertThat(mShortcutPreference.getCheckBoxListener()).isEqualTo(mCheckBoxListener);
+ assertThat(mShortcutPreference.getSettingButtonListener()).isEqualTo(
+ mSettingButtonListener);
+ }
+}