diff --git a/res/drawable/ic_trackpad_gesture_back.xml b/res/drawable/ic_trackpad_gesture_back.xml deleted file mode 100644 index b6a80cfd9d8..00000000000 --- a/res/drawable/ic_trackpad_gesture_back.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/res/drawable/ic_trackpad_gesture_home.xml b/res/drawable/ic_trackpad_gesture_home.xml deleted file mode 100644 index f0e7232abed..00000000000 --- a/res/drawable/ic_trackpad_gesture_home.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - \ No newline at end of file diff --git a/res/drawable/ic_trackpad_gesture_notifications.xml b/res/drawable/ic_trackpad_gesture_notifications.xml deleted file mode 100644 index 37d77d87671..00000000000 --- a/res/drawable/ic_trackpad_gesture_notifications.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/res/drawable/ic_trackpad_gesture_recent_apps.xml b/res/drawable/ic_trackpad_gesture_recent_apps.xml deleted file mode 100644 index 76ba829f5db..00000000000 --- a/res/drawable/ic_trackpad_gesture_recent_apps.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/res/drawable/ic_trackpad_gesture_switch_apps.xml b/res/drawable/ic_trackpad_gesture_switch_apps.xml deleted file mode 100644 index 3d18d1cc729..00000000000 --- a/res/drawable/ic_trackpad_gesture_switch_apps.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - \ 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 deleted file mode 100644 index d66357268ec..00000000000 --- a/res/drawable/ic_trackpad_touch_gestures_inverse.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/res/values/strings.xml b/res/values/strings.xml index 4d843fb85cf..762288cc6f3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4726,10 +4726,6 @@ Tap dragging Tap and drag your finger on the touchpad to move objects - - Touchpad gestures - - Customize individual touchpad navigation gestures Reverse scrolling @@ -4814,27 +4810,6 @@ Done - - 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 - Modifier keys diff --git a/res/xml/touchpad_and_mouse_settings.xml b/res/xml/touchpad_and_mouse_settings.xml index b82b3a62ea3..c470a729ccb 100644 --- a/res/xml/touchpad_and_mouse_settings.xml +++ b/res/xml/touchpad_and_mouse_settings.xml @@ -19,14 +19,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:title="@string/trackpad_mouse_settings"> - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java b/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java index 8b0ae4cbd26..babee95abc3 100644 --- a/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java +++ b/src/com/android/settings/inputmethod/TouchGesturesButtonPreferenceController.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.Intent; import android.hardware.input.InputSettings; import android.os.UserHandle; -import android.util.FeatureFlagUtils; import androidx.fragment.app.Fragment; import androidx.preference.PreferenceScreen; @@ -36,7 +35,6 @@ 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"; private static final String GESTURE_DIALOG_TAG = "GESTURE_DIALOG_TAG"; @@ -59,14 +57,8 @@ public class TouchGesturesButtonPreferenceController extends BasePreferenceContr 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.setOrder(ORDER_BOTTOM); } buttonPreference.setOnClickListener(v -> { showTouchpadGestureEducation(); diff --git a/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceController.java b/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceController.java deleted file mode 100644 index 36fb0c07c8f..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2023 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.provider.Settings; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; - -public class TrackpadGoBackPreferenceController extends TogglePreferenceController { - - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_BACK_ENABLED; - - private MetricsFeatureProvider mMetricsFeatureProvider; - - public TrackpadGoBackPreferenceController(Context context, String key) { - super(context, key); - mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); - } - - @Override - public boolean isChecked() { - return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0; - } - - @Override - public boolean setChecked(boolean isChecked) { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, isChecked ? 1 : 0); - mMetricsFeatureProvider.action( - mContext, SettingsEnums.ACTION_GESTURE_GO_BACK_CHANGED, isChecked); - return true; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_system; - } -} diff --git a/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceController.java b/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceController.java deleted file mode 100644 index dbc706ee2f3..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2023 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.provider.Settings; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; - -public class TrackpadGoHomePreferenceController extends TogglePreferenceController { - - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_HOME_ENABLED; - - private MetricsFeatureProvider mMetricsFeatureProvider; - - public TrackpadGoHomePreferenceController(Context context, String key) { - super(context, key); - mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); - } - - @Override - public boolean isChecked() { - return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0; - } - - @Override - public boolean setChecked(boolean isChecked) { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, isChecked ? 1 : 0); - mMetricsFeatureProvider.action( - mContext, SettingsEnums.ACTION_GESTURE_GO_HOME_CHANGED, isChecked); - return true; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_system; - } -} diff --git a/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceController.java b/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceController.java deleted file mode 100644 index d430e4d4c76..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2023 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.provider.Settings; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; - -public class TrackpadNotificationsPreferenceController extends TogglePreferenceController { - - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_NOTIFICATION_ENABLED; - - private MetricsFeatureProvider mMetricsFeatureProvider; - - public TrackpadNotificationsPreferenceController(Context context, String key) { - super(context, key); - mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); - } - - @Override - public boolean isChecked() { - return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0; - } - - @Override - public boolean setChecked(boolean isChecked) { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, isChecked ? 1 : 0); - mMetricsFeatureProvider.action( - mContext, SettingsEnums.ACTION_GESTURE_NOTIFICATION_CHANGED, isChecked); - return true; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_system; - } -} diff --git a/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceController.java b/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceController.java deleted file mode 100644 index 44a56e72ab1..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2023 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.provider.Settings; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; - -public class TrackpadRecentAppsPreferenceController extends TogglePreferenceController { - - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_OVERVIEW_ENABLED; - - private MetricsFeatureProvider mMetricsFeatureProvider; - - public TrackpadRecentAppsPreferenceController(Context context, String key) { - super(context, key); - mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); - } - - @Override - public boolean isChecked() { - return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0; - } - - @Override - public boolean setChecked(boolean isChecked) { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, isChecked ? 1 : 0); - mMetricsFeatureProvider.action( - mContext, SettingsEnums.ACTION_GESTURE_RECENT_APPS_CHANGED, isChecked); - return true; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_system; - } -} diff --git a/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceController.java b/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceController.java deleted file mode 100644 index 2b11411c186..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2023 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.provider.Settings; - -import com.android.settings.R; -import com.android.settings.core.TogglePreferenceController; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; - -public class TrackpadSwitchAppsPreferenceController extends TogglePreferenceController { - - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_QUICK_SWITCH_ENABLED; - - private MetricsFeatureProvider mMetricsFeatureProvider; - - public TrackpadSwitchAppsPreferenceController(Context context, String key) { - super(context, key); - mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); - } - - @Override - public boolean isChecked() { - return Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1) != 0; - } - - @Override - public boolean setChecked(boolean isChecked) { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, isChecked ? 1 : 0); - mMetricsFeatureProvider.action( - mContext, SettingsEnums.ACTION_GESTURE_SWITCH_APPS_CHANGED, isChecked); - return true; - } - - @Override - public int getAvailabilityStatus() { - return AVAILABLE; - } - - @Override - public int getSliceHighlightMenuRes() { - return R.string.menu_key_system; - } -} diff --git a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java deleted file mode 100644 index 14bb484d470..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettings.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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; -import com.android.settingslib.search.SearchIndexable; - -@SearchIndexable -public class TrackpadTouchGestureSettings extends DashboardFragment { - - private static final String TAG = "TrackpadTouchGestureSettings"; - - @Override - public void onAttach(Context context) { - super.onAttach(context); - use(TouchGesturesButtonPreferenceController.class).setFragment(this /*parent*/); - } - - @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_gesture_settings) { - @Override - protected boolean isPageSearchEnabled(Context context) { - return FeatureFlagUtils - .isEnabled( - context, - FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE) - && InputPeripheralsSettingsUtils.isTouchpad(); - } - }; -} diff --git a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java b/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java deleted file mode 100644 index ff6899049c0..00000000000 --- a/src/com/android/settings/inputmethod/TrackpadTouchGestureSettingsController.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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); - boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad(); - return (isFeatureOn && isTouchpad) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; - } -} diff --git a/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceControllerTest.java deleted file mode 100644 index 85d56ef834b..00000000000 --- a/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoBackPreferenceControllerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.Settings; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.testutils.FakeFeatureFactory; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; - -/** Tests for {@link TrackpadGoBackPreferenceController} */ -@RunWith(RobolectricTestRunner.class) -public class TrackpadGoBackPreferenceControllerTest { - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private static final String PREFERENCE_KEY = "gesture_go_back"; - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_BACK_ENABLED; - - private Context mContext; - private TrackpadGoBackPreferenceController mController; - private FakeFeatureFactory mFeatureFactory; - - @Before - public void setUp() { - mContext = ApplicationProvider.getApplicationContext(); - mFeatureFactory = FakeFeatureFactory.setupForTest(); - mController = new TrackpadGoBackPreferenceController(mContext, PREFERENCE_KEY); - } - - @Test - public void getAvailabilityStatus_expected() { - assertThat(mController.getAvailabilityStatus()) - .isEqualTo(BasePreferenceController.AVAILABLE); - } - - @Test - public void getSliceHighlightMenuRes_expected() { - assertThat(mController.getSliceHighlightMenuRes()).isEqualTo(R.string.menu_key_system); - } - - @Test - public void setChecked_true_shouldReturn1() { - mController.setChecked(true); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(1); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_GO_BACK_CHANGED), - eq(true)); - } - - @Test - public void setChecked_false_shouldReturn0() { - mController.setChecked(false); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(0); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_GO_BACK_CHANGED), - eq(false)); - } - - @Test - public void isChecked_providerPutInt1_returnTrue() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 1); - - boolean result = mController.isChecked(); - - assertThat(result).isTrue(); - } - - @Test - public void isChecked_providerPutInt0_returnFalse() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 0); - - boolean result = mController.isChecked(); - - assertThat(result).isFalse(); - } -} diff --git a/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceControllerTest.java deleted file mode 100644 index 6b3b3f5a86d..00000000000 --- a/tests/robotests/src/com/android/settings/inputmethod/TrackpadGoHomePreferenceControllerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.Settings; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.testutils.FakeFeatureFactory; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; - -/** Tests for {@link TrackpadGoHomePreferenceController} */ -@RunWith(RobolectricTestRunner.class) -public class TrackpadGoHomePreferenceControllerTest { - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private static final String PREFERENCE_KEY = "gesture_go_home"; - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_HOME_ENABLED; - - private Context mContext; - private TrackpadGoHomePreferenceController mController; - private FakeFeatureFactory mFeatureFactory; - - @Before - public void setUp() { - mContext = ApplicationProvider.getApplicationContext(); - mFeatureFactory = FakeFeatureFactory.setupForTest(); - mController = new TrackpadGoHomePreferenceController(mContext, PREFERENCE_KEY); - } - - @Test - public void getAvailabilityStatus_expected() { - assertThat(mController.getAvailabilityStatus()) - .isEqualTo(BasePreferenceController.AVAILABLE); - } - - @Test - public void getSliceHighlightMenuRes_expected() { - assertThat(mController.getSliceHighlightMenuRes()).isEqualTo(R.string.menu_key_system); - } - - @Test - public void setChecked_true_shouldReturn1() { - mController.setChecked(true); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(1); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_GO_HOME_CHANGED), - eq(true)); - } - - @Test - public void setChecked_false_shouldReturn0() { - mController.setChecked(false); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(0); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_GO_HOME_CHANGED), - eq(false)); - } - - @Test - public void isChecked_providerPutInt1_returnTrue() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 1); - - boolean result = mController.isChecked(); - - assertThat(result).isTrue(); - } - - @Test - public void isChecked_providerPutInt0_returnFalse() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 0); - - boolean result = mController.isChecked(); - - assertThat(result).isFalse(); - } -} diff --git a/tests/robotests/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceControllerTest.java deleted file mode 100644 index 005bc9fcf23..00000000000 --- a/tests/robotests/src/com/android/settings/inputmethod/TrackpadNotificationsPreferenceControllerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.Settings; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.testutils.FakeFeatureFactory; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; - -/** Tests for {@link TrackpadNotificationsPreferenceController} */ -@RunWith(RobolectricTestRunner.class) -public class TrackpadNotificationsPreferenceControllerTest { - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private static final String PREFERENCE_KEY = "gesture_notifications"; - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_NOTIFICATION_ENABLED; - - private Context mContext; - private TrackpadNotificationsPreferenceController mController; - private FakeFeatureFactory mFeatureFactory; - - @Before - public void setUp() { - mContext = ApplicationProvider.getApplicationContext(); - mFeatureFactory = FakeFeatureFactory.setupForTest(); - mController = new TrackpadNotificationsPreferenceController(mContext, PREFERENCE_KEY); - } - - @Test - public void getAvailabilityStatus_expected() { - assertThat(mController.getAvailabilityStatus()) - .isEqualTo(BasePreferenceController.AVAILABLE); - } - - @Test - public void getSliceHighlightMenuRes_expected() { - assertThat(mController.getSliceHighlightMenuRes()).isEqualTo(R.string.menu_key_system); - } - - @Test - public void setChecked_true_shouldReturn1() { - mController.setChecked(true); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(1); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_NOTIFICATION_CHANGED), - eq(true)); - } - - @Test - public void setChecked_false_shouldReturn0() { - mController.setChecked(false); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(0); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_NOTIFICATION_CHANGED), - eq(false)); - } - - @Test - public void isChecked_providerPutInt1_returnTrue() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 1); - - boolean result = mController.isChecked(); - - assertThat(result).isTrue(); - } - - @Test - public void isChecked_providerPutInt0_returnFalse() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 0); - - boolean result = mController.isChecked(); - - assertThat(result).isFalse(); - } -} diff --git a/tests/robotests/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceControllerTest.java deleted file mode 100644 index 2ef53a67aeb..00000000000 --- a/tests/robotests/src/com/android/settings/inputmethod/TrackpadRecentAppsPreferenceControllerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.Settings; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.testutils.FakeFeatureFactory; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; - -/** Tests for {@link TrackpadRecentAppsPreferenceController} */ -@RunWith(RobolectricTestRunner.class) -public class TrackpadRecentAppsPreferenceControllerTest { - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private static final String PREFERENCE_KEY = "gesture_recent_apps"; - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_OVERVIEW_ENABLED; - - private Context mContext; - private TrackpadRecentAppsPreferenceController mController; - private FakeFeatureFactory mFeatureFactory; - - @Before - public void setUp() { - mContext = ApplicationProvider.getApplicationContext(); - mFeatureFactory = FakeFeatureFactory.setupForTest(); - mController = new TrackpadRecentAppsPreferenceController(mContext, PREFERENCE_KEY); - } - - @Test - public void getAvailabilityStatus_expected() { - assertThat(mController.getAvailabilityStatus()) - .isEqualTo(BasePreferenceController.AVAILABLE); - } - - @Test - public void getSliceHighlightMenuRes_expected() { - assertThat(mController.getSliceHighlightMenuRes()).isEqualTo(R.string.menu_key_system); - } - - @Test - public void setChecked_true_shouldReturn1() { - mController.setChecked(true); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(1); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_RECENT_APPS_CHANGED), - eq(true)); - } - - @Test - public void setChecked_false_shouldReturn0() { - mController.setChecked(false); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(0); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_RECENT_APPS_CHANGED), - eq(false)); - } - - @Test - public void isChecked_providerPutInt1_returnTrue() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 1); - - boolean result = mController.isChecked(); - - assertThat(result).isTrue(); - } - - @Test - public void isChecked_providerPutInt0_returnFalse() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 0); - - boolean result = mController.isChecked(); - - assertThat(result).isFalse(); - } -} diff --git a/tests/robotests/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceControllerTest.java deleted file mode 100644 index 5e354d2ca18..00000000000 --- a/tests/robotests/src/com/android/settings/inputmethod/TrackpadSwitchAppsPreferenceControllerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2023 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 static com.google.common.truth.Truth.assertThat; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; - -import android.app.settings.SettingsEnums; -import android.content.Context; -import android.provider.Settings; - -import androidx.test.core.app.ApplicationProvider; - -import com.android.settings.R; -import com.android.settings.core.BasePreferenceController; -import com.android.settings.testutils.FakeFeatureFactory; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.RobolectricTestRunner; - -/** Tests for {@link TrackpadSwitchAppsPreferenceController} */ -@RunWith(RobolectricTestRunner.class) -public class TrackpadSwitchAppsPreferenceControllerTest { - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private static final String PREFERENCE_KEY = "gesture_switch_apps"; - private static final String SETTING_KEY = Settings.Secure.TRACKPAD_GESTURE_QUICK_SWITCH_ENABLED; - - private Context mContext; - private TrackpadSwitchAppsPreferenceController mController; - private FakeFeatureFactory mFeatureFactory; - - @Before - public void setUp() { - mContext = ApplicationProvider.getApplicationContext(); - mFeatureFactory = FakeFeatureFactory.setupForTest(); - mController = new TrackpadSwitchAppsPreferenceController(mContext, PREFERENCE_KEY); - } - - @Test - public void getAvailabilityStatus_expected() { - assertThat(mController.getAvailabilityStatus()) - .isEqualTo(BasePreferenceController.AVAILABLE); - } - - @Test - public void getSliceHighlightMenuRes_expected() { - assertThat(mController.getSliceHighlightMenuRes()).isEqualTo(R.string.menu_key_system); - } - - @Test - public void setChecked_true_shouldReturn1() { - mController.setChecked(true); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(1); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_SWITCH_APPS_CHANGED), - eq(true)); - } - - @Test - public void setChecked_false_shouldReturn0() { - mController.setChecked(false); - - int result = Settings.Secure.getInt(mContext.getContentResolver(), SETTING_KEY, 1); - - assertThat(result).isEqualTo(0); - verify(mFeatureFactory.metricsFeatureProvider).action( - any(), - eq(SettingsEnums.ACTION_GESTURE_SWITCH_APPS_CHANGED), - eq(false)); - } - - @Test - public void isChecked_providerPutInt1_returnTrue() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 1); - - boolean result = mController.isChecked(); - - assertThat(result).isTrue(); - } - - @Test - public void isChecked_providerPutInt0_returnFalse() { - Settings.Secure.putInt(mContext.getContentResolver(), SETTING_KEY, 0); - - boolean result = mController.isChecked(); - - assertThat(result).isFalse(); - } -}