[Keyboard Setting] Rename KeyboardSettingUtils
rename KeyboardSettingUtils to match more about usage. Bug: 379594195 Test: atest SettingsRoboTests Flag: NONE, rename file. Change-Id: If978e7b56ecbdb0b571db5ff34553bbb20f976ee
This commit is contained in:
@@ -44,9 +44,9 @@ import java.util.Arrays;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities of keyboard settings
|
* Utilities of input peripherals settings
|
||||||
*/
|
*/
|
||||||
public class NewKeyboardSettingsUtils {
|
public class InputPeripheralsSettingsUtils {
|
||||||
|
|
||||||
static final String EXTRA_TITLE = "keyboard_layout_picker_title";
|
static final String EXTRA_TITLE = "keyboard_layout_picker_title";
|
||||||
static final String EXTRA_USER_ID = "user_id";
|
static final String EXTRA_USER_ID = "user_id";
|
@@ -308,7 +308,7 @@ public class KeyboardLayoutDialogFragment extends InstrumentedDialogFragment
|
|||||||
public Keyboards loadInBackground() {
|
public Keyboards loadInBackground() {
|
||||||
Keyboards keyboards = new Keyboards();
|
Keyboards keyboards = new Keyboards();
|
||||||
InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE);
|
InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE);
|
||||||
if (mInputDeviceIdentifier == null || NewKeyboardSettingsUtils.getInputDevice(
|
if (mInputDeviceIdentifier == null || InputPeripheralsSettingsUtils.getInputDevice(
|
||||||
im, mInputDeviceIdentifier) == null) {
|
im, mInputDeviceIdentifier) == null) {
|
||||||
keyboards.keyboardLayouts.add(null); // default layout
|
keyboards.keyboardLayouts.add(null); // default layout
|
||||||
keyboards.current = 0;
|
keyboards.current = 0;
|
||||||
|
@@ -68,11 +68,13 @@ public class KeyboardLayoutPickerController extends BasePreferenceController imp
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
mIm.registerInputDeviceListener(this, null);
|
mIm.registerInputDeviceListener(this, null);
|
||||||
if (mInputDeviceIdentifier == null
|
if (mInputDeviceIdentifier == null
|
||||||
|| NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier) == null) {
|
|| InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier)
|
||||||
|
== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mInputDeviceId =
|
mInputDeviceId =
|
||||||
NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier).getId();
|
InputPeripheralsSettingsUtils.getInputDevice(mIm,
|
||||||
|
mInputDeviceIdentifier).getId();
|
||||||
updateCheckedState();
|
updateCheckedState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ public class KeyboardLayoutPickerFragment extends DashboardFragment {
|
|||||||
final InputDeviceIdentifier inputDeviceIdentifier = getActivity().getIntent().
|
final InputDeviceIdentifier inputDeviceIdentifier = getActivity().getIntent().
|
||||||
getParcelableExtra(EXTRA_INPUT_DEVICE_IDENTIFIER);
|
getParcelableExtra(EXTRA_INPUT_DEVICE_IDENTIFIER);
|
||||||
final InputManager im = context.getSystemService(InputManager.class);
|
final InputManager im = context.getSystemService(InputManager.class);
|
||||||
if (NewKeyboardSettingsUtils.getInputDevice(im, inputDeviceIdentifier) == null) {
|
if (InputPeripheralsSettingsUtils.getInputDevice(im, inputDeviceIdentifier) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
use(KeyboardLayoutPickerController.class).initialize(this /*parent*/,
|
use(KeyboardLayoutPickerController.class).initialize(this /*parent*/,
|
||||||
|
@@ -40,7 +40,7 @@ import com.android.settings.Utils;
|
|||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
|
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
|
||||||
import com.android.settings.inputmethod.NewKeyboardSettingsUtils.KeyboardInfo;
|
import com.android.settings.inputmethod.InputPeripheralsSettingsUtils.KeyboardInfo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -117,14 +117,15 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mInputDeviceIdentifier =
|
mInputDeviceIdentifier =
|
||||||
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
|
arguments.getParcelable(
|
||||||
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
|
||||||
InputDeviceIdentifier.class);
|
InputDeviceIdentifier.class);
|
||||||
if (mInputDeviceIdentifier == null) {
|
if (mInputDeviceIdentifier == null) {
|
||||||
Log.e(TAG, "The inputDeviceIdentifier should not be null");
|
Log.e(TAG, "The inputDeviceIdentifier should not be null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InputDevice inputDevice =
|
InputDevice inputDevice =
|
||||||
NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier);
|
InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier);
|
||||||
if (inputDevice == null) {
|
if (inputDevice == null) {
|
||||||
Log.e(TAG, "inputDevice is null");
|
Log.e(TAG, "inputDevice is null");
|
||||||
return;
|
return;
|
||||||
@@ -138,7 +139,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
mIm.registerInputDeviceListener(this, null);
|
mIm.registerInputDeviceListener(this, null);
|
||||||
InputDevice inputDevice =
|
InputDevice inputDevice =
|
||||||
NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier);
|
InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier);
|
||||||
if (inputDevice == null) {
|
if (inputDevice == null) {
|
||||||
Log.e(TAG, "Unable to start: input device is null");
|
Log.e(TAG, "Unable to start: input device is null");
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
@@ -161,7 +162,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateCheckedState() {
|
private void updateCheckedState() {
|
||||||
if (NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier) == null) {
|
if (InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,9 +208,9 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
|||||||
private void mapLanguageWithLayout(InputMethodInfo info, InputMethodSubtype subtype) {
|
private void mapLanguageWithLayout(InputMethodInfo info, InputMethodSubtype subtype) {
|
||||||
CharSequence subtypeLabel = getSubtypeLabel(mContext, info, subtype);
|
CharSequence subtypeLabel = getSubtypeLabel(mContext, info, subtype);
|
||||||
KeyboardLayout[] keyboardLayouts =
|
KeyboardLayout[] keyboardLayouts =
|
||||||
NewKeyboardSettingsUtils.getKeyboardLayouts(
|
InputPeripheralsSettingsUtils.getKeyboardLayouts(
|
||||||
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
|
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
|
||||||
KeyboardLayoutSelectionResult result = NewKeyboardSettingsUtils.getKeyboardLayout(
|
KeyboardLayoutSelectionResult result = InputPeripheralsSettingsUtils.getKeyboardLayout(
|
||||||
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
|
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
|
||||||
if (result.getLayoutDescriptor() != null) {
|
if (result.getLayoutDescriptor() != null) {
|
||||||
for (int i = 0; i < keyboardLayouts.length; i++) {
|
for (int i = 0; i < keyboardLayouts.length; i++) {
|
||||||
@@ -316,13 +317,14 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
|
|||||||
InputMethodSubtype inputMethodSubtype) {
|
InputMethodSubtype inputMethodSubtype) {
|
||||||
Bundle arguments = new Bundle();
|
Bundle arguments = new Bundle();
|
||||||
arguments.putParcelable(
|
arguments.putParcelable(
|
||||||
NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER, inputDeviceIdentifier);
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
|
||||||
|
inputDeviceIdentifier);
|
||||||
arguments.putParcelable(
|
arguments.putParcelable(
|
||||||
NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_INFO, inputMethodInfo);
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_METHOD_INFO, inputMethodInfo);
|
||||||
arguments.putParcelable(
|
arguments.putParcelable(
|
||||||
NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE, inputMethodSubtype);
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE, inputMethodSubtype);
|
||||||
arguments.putInt(NewKeyboardSettingsUtils.EXTRA_USER_ID, userId);
|
arguments.putInt(InputPeripheralsSettingsUtils.EXTRA_USER_ID, userId);
|
||||||
arguments.putCharSequence(NewKeyboardSettingsUtils.EXTRA_TITLE, subtypeLabel);
|
arguments.putCharSequence(InputPeripheralsSettingsUtils.EXTRA_TITLE, subtypeLabel);
|
||||||
new SubSettingLauncher(mContext)
|
new SubSettingLauncher(mContext)
|
||||||
.setSourceMetricsCategory(getMetricsCategory())
|
.setSourceMetricsCategory(getMetricsCategory())
|
||||||
.setDestination(NewKeyboardLayoutPickerFragment.class.getName())
|
.setDestination(NewKeyboardLayoutPickerFragment.class.getName())
|
||||||
|
@@ -48,9 +48,9 @@ public class NewKeyboardLayoutPickerContent extends DashboardFragment {
|
|||||||
InputManager im = getContext().getSystemService(InputManager.class);
|
InputManager im = getContext().getSystemService(InputManager.class);
|
||||||
InputDeviceIdentifier identifier =
|
InputDeviceIdentifier identifier =
|
||||||
getArguments().getParcelable(
|
getArguments().getParcelable(
|
||||||
NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
|
||||||
if (identifier == null
|
if (identifier == null
|
||||||
|| NewKeyboardSettingsUtils.getInputDevice(im, identifier) == null) {
|
|| InputPeripheralsSettingsUtils.getInputDevice(im, identifier) == null) {
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -73,19 +73,21 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
|
|||||||
public void initialize(Fragment parent) {
|
public void initialize(Fragment parent) {
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
Bundle arguments = parent.getArguments();
|
Bundle arguments = parent.getArguments();
|
||||||
mTitle = arguments.getCharSequence(NewKeyboardSettingsUtils.EXTRA_TITLE);
|
mTitle = arguments.getCharSequence(InputPeripheralsSettingsUtils.EXTRA_TITLE);
|
||||||
mUserId = arguments.getInt(NewKeyboardSettingsUtils.EXTRA_USER_ID);
|
mUserId = arguments.getInt(InputPeripheralsSettingsUtils.EXTRA_USER_ID);
|
||||||
mInputDeviceIdentifier =
|
mInputDeviceIdentifier =
|
||||||
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
|
arguments.getParcelable(
|
||||||
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER);
|
||||||
mInputMethodInfo =
|
mInputMethodInfo =
|
||||||
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_INFO);
|
arguments.getParcelable(InputPeripheralsSettingsUtils.EXTRA_INPUT_METHOD_INFO);
|
||||||
mInputMethodSubtype =
|
mInputMethodSubtype =
|
||||||
arguments.getParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE);
|
arguments.getParcelable(
|
||||||
|
InputPeripheralsSettingsUtils.EXTRA_INPUT_METHOD_SUBTYPE);
|
||||||
mLayout = getSelectedLayoutLabel();
|
mLayout = getSelectedLayoutLabel();
|
||||||
mFinalSelectedLayout = mLayout;
|
mFinalSelectedLayout = mLayout;
|
||||||
mKeyboardLayouts = mIm.getKeyboardLayoutListForInputDevice(
|
mKeyboardLayouts = mIm.getKeyboardLayoutListForInputDevice(
|
||||||
mInputDeviceIdentifier, mUserId, mInputMethodInfo, mInputMethodSubtype);
|
mInputDeviceIdentifier, mUserId, mInputMethodInfo, mInputMethodSubtype);
|
||||||
NewKeyboardSettingsUtils.sortKeyboardLayoutsByLabel(mKeyboardLayouts);
|
InputPeripheralsSettingsUtils.sortKeyboardLayoutsByLabel(mKeyboardLayouts);
|
||||||
parent.getActivity().setTitle(mTitle);
|
parent.getActivity().setTitle(mTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +95,13 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
mIm.registerInputDeviceListener(this, null);
|
mIm.registerInputDeviceListener(this, null);
|
||||||
if (mInputDeviceIdentifier == null
|
if (mInputDeviceIdentifier == null
|
||||||
|| NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier) == null) {
|
|| InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier)
|
||||||
|
== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mInputDeviceId =
|
mInputDeviceId =
|
||||||
NewKeyboardSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier).getId();
|
InputPeripheralsSettingsUtils.getInputDevice(mIm,
|
||||||
|
mInputDeviceIdentifier).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -202,9 +206,9 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
|
|||||||
|
|
||||||
private String getSelectedLayoutLabel() {
|
private String getSelectedLayoutLabel() {
|
||||||
String label = mContext.getString(R.string.keyboard_default_layout);
|
String label = mContext.getString(R.string.keyboard_default_layout);
|
||||||
KeyboardLayoutSelectionResult result = NewKeyboardSettingsUtils.getKeyboardLayout(
|
KeyboardLayoutSelectionResult result = InputPeripheralsSettingsUtils.getKeyboardLayout(
|
||||||
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
|
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
|
||||||
KeyboardLayout[] keyboardLayouts = NewKeyboardSettingsUtils.getKeyboardLayouts(
|
KeyboardLayout[] keyboardLayouts = InputPeripheralsSettingsUtils.getKeyboardLayouts(
|
||||||
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
|
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
|
||||||
if (result.getLayoutDescriptor() != null) {
|
if (result.getLayoutDescriptor() != null) {
|
||||||
for (KeyboardLayout keyboardLayout : keyboardLayouts) {
|
for (KeyboardLayout keyboardLayout : keyboardLayouts) {
|
||||||
|
@@ -317,7 +317,7 @@ public final class PhysicalKeyboardFragment extends DashboardFragment
|
|||||||
final Preference pref = new Preference(getPrefContext());
|
final Preference pref = new Preference(getPrefContext());
|
||||||
pref.setTitle(hardKeyboardDeviceInfo.mDeviceName);
|
pref.setTitle(hardKeyboardDeviceInfo.mDeviceName);
|
||||||
String currentLayout =
|
String currentLayout =
|
||||||
NewKeyboardSettingsUtils.getSelectedKeyboardLayoutLabelForUser(context,
|
InputPeripheralsSettingsUtils.getSelectedKeyboardLayoutLabelForUser(context,
|
||||||
UserHandle.myUserId(), hardKeyboardDeviceInfo.mDeviceIdentifier);
|
UserHandle.myUserId(), hardKeyboardDeviceInfo.mDeviceIdentifier);
|
||||||
if (currentLayout != null) {
|
if (currentLayout != null) {
|
||||||
pref.setSummary(currentLayout);
|
pref.setSummary(currentLayout);
|
||||||
@@ -369,7 +369,7 @@ public final class PhysicalKeyboardFragment extends DashboardFragment
|
|||||||
|
|
||||||
private void showEnabledLocalesKeyboardLayoutList(InputDeviceIdentifier inputDeviceIdentifier) {
|
private void showEnabledLocalesKeyboardLayoutList(InputDeviceIdentifier inputDeviceIdentifier) {
|
||||||
Bundle arguments = new Bundle();
|
Bundle arguments = new Bundle();
|
||||||
arguments.putParcelable(NewKeyboardSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
|
arguments.putParcelable(InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
|
||||||
inputDeviceIdentifier);
|
inputDeviceIdentifier);
|
||||||
new SubSettingLauncher(getContext())
|
new SubSettingLauncher(getContext())
|
||||||
.setSourceMetricsCategory(getMetricsCategory())
|
.setSourceMetricsCategory(getMetricsCategory())
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.inputmethod;
|
package com.android.settings.inputmethod;
|
||||||
|
|
||||||
import static com.android.settings.inputmethod.NewKeyboardSettingsUtils.isMouse;
|
import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isMouse;
|
||||||
import static com.android.settings.inputmethod.NewKeyboardSettingsUtils.isTouchpad;
|
import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isTouchpad;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.inputmethod;
|
package com.android.settings.inputmethod;
|
||||||
|
|
||||||
import static com.android.settings.inputmethod.NewKeyboardSettingsUtils.isMouse;
|
import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isMouse;
|
||||||
import static com.android.settings.inputmethod.NewKeyboardSettingsUtils.isTouchpad;
|
import static com.android.settings.inputmethod.InputPeripheralsSettingsUtils.isTouchpad;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@@ -32,8 +32,8 @@ public class PointerTouchpadPreferenceController extends BasePreferenceControlle
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
boolean isMouse = NewKeyboardSettingsUtils.isMouse();
|
boolean isMouse = InputPeripheralsSettingsUtils.isMouse();
|
||||||
return (isTouchpad || isMouse) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return (isTouchpad || isMouse) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ public class TouchGesturesButtonPreferenceController extends BasePreferenceContr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public class TrackpadBottomPreferenceController extends TogglePreferenceControll
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public class TrackpadReverseScrollingPreferenceController extends TogglePreferen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ public class TrackpadSettings extends DashboardFragment {
|
|||||||
public void onCreate(@NonNull Bundle icicle) {
|
public void onCreate(@NonNull Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
getPreferenceScreen().setTitle(
|
getPreferenceScreen().setTitle(
|
||||||
NewKeyboardSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
InputPeripheralsSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,7 +67,7 @@ public class TrackpadSettings extends DashboardFragment {
|
|||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return FeatureFlagUtils
|
return FeatureFlagUtils
|
||||||
.isEnabled(context, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD)
|
.isEnabled(context, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD)
|
||||||
&& NewKeyboardSettingsUtils.isTouchpad();
|
&& InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -77,17 +77,17 @@ public class TrackpadSettingsController extends BasePreferenceController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mPreference.setVisible(isAvailable());
|
mPreference.setVisible(isAvailable());
|
||||||
mPreference.setTitle(NewKeyboardSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
mPreference.setTitle(InputPeripheralsSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isFeatureOn = FeatureFlagUtils
|
boolean isFeatureOn = FeatureFlagUtils
|
||||||
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD);
|
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD);
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
boolean isPointerCustomizationEnabled =
|
boolean isPointerCustomizationEnabled =
|
||||||
android.view.flags.Flags.enableVectorCursorA11ySettings();
|
android.view.flags.Flags.enableVectorCursorA11ySettings();
|
||||||
boolean isMouse = NewKeyboardSettingsUtils.isMouse();
|
boolean isMouse = InputPeripheralsSettingsUtils.isMouse();
|
||||||
return (isFeatureOn && isTouchpad) || (isPointerCustomizationEnabled && isMouse) ? AVAILABLE
|
return (isFeatureOn && isTouchpad) || (isPointerCustomizationEnabled && isMouse) ? AVAILABLE
|
||||||
: CONDITIONALLY_UNAVAILABLE;
|
: CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public class TrackpadTapDraggingPreferenceController extends TogglePreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return (InputSettings.isTouchpadTapDraggingFeatureFlagEnabled() && isTouchpad)
|
return (InputSettings.isTouchpadTapDraggingFeatureFlagEnabled() && isTouchpad)
|
||||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public class TrackpadTapToClickPreferenceController extends TogglePreferenceCont
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return isTouchpad ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ public class TrackpadTouchGestureSettings extends DashboardFragment {
|
|||||||
.isEnabled(
|
.isEnabled(
|
||||||
context,
|
context,
|
||||||
FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE)
|
FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE)
|
||||||
&& NewKeyboardSettingsUtils.isTouchpad();
|
&& InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class TrackpadTouchGestureSettingsController extends BasePreferenceContro
|
|||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
boolean isFeatureOn = FeatureFlagUtils
|
boolean isFeatureOn = FeatureFlagUtils
|
||||||
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE);
|
.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_TRACKPAD_GESTURE);
|
||||||
boolean isTouchpad = NewKeyboardSettingsUtils.isTouchpad();
|
boolean isTouchpad = InputPeripheralsSettingsUtils.isTouchpad();
|
||||||
return (isFeatureOn && isTouchpad) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
return (isFeatureOn && isTouchpad) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ public class TrackpadSettingsControllerTest {
|
|||||||
InputDevice.SOURCE_TOUCHPAD);
|
InputDevice.SOURCE_TOUCHPAD);
|
||||||
ShadowInputDevice.addDevice(deviceId, device);
|
ShadowInputDevice.addDevice(deviceId, device);
|
||||||
String expectedTitle = mContext.getString(
|
String expectedTitle = mContext.getString(
|
||||||
NewKeyboardSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
InputPeripheralsSettingsUtils.getTouchpadAndMouseTitleTitleResId());
|
||||||
|
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user