[Physical Keyboard] Clean up old ui and flag

Change-Id: I9423d0e9debcef37338e5733aab56b98920621e3

Test: n/a
Bug: 330517633
Change-Id: I485848f67e0eb3ab207413a6ed8f7de809f80c5c
This commit is contained in:
shaoweishen
2024-03-26 09:31:55 +00:00
committed by Shaowei Shen
parent 3a1252ebcc
commit 90e70b15d7
14 changed files with 18 additions and 600 deletions

View File

@@ -18,7 +18,6 @@ package com.android.settings.inputmethod;
import android.content.Context;
import android.hardware.input.InputManager;
import android.util.FeatureFlagUtils;
import androidx.preference.Preference;
@@ -78,9 +77,7 @@ public class KeyboardPreferenceController extends BasePreferenceController
@Override
public int getAvailabilityStatus() {
return FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_UI)
? AVAILABLE
: CONDITIONALLY_UNAVAILABLE;
return AVAILABLE;
}
private void updateSummary() {

View File

@@ -23,7 +23,6 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.Bundle;
import android.util.FeatureFlagUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -111,11 +110,5 @@ public class KeyboardSettings extends DashboardFragment {
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.keyboard_settings) {
@Override
protected boolean isPageSearchEnabled(Context context) {
return FeatureFlagUtils
.isEnabled(context, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_UI);
}
};
new BaseSearchIndexProvider(R.xml.keyboard_settings);
}

View File

@@ -20,7 +20,6 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.util.FeatureFlagUtils;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
@@ -69,8 +68,7 @@ public class KeyboardSettingsPreferenceController extends BasePreferenceControll
@Override
public int getAvailabilityStatus() {
List<HardKeyboardDeviceInfo> newHardKeyboards = getHardKeyboardList();
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_UI)
&& !newHardKeyboards.isEmpty()) {
if (!newHardKeyboards.isEmpty()) {
for (HardKeyboardDeviceInfo hardKeyboardDeviceInfo : newHardKeyboards) {
if (mCachedDevice.getAddress() != null
&& hardKeyboardDeviceInfo.mBluetoothAddress != null

View File

@@ -110,7 +110,6 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
private Intent mIntentWaitingForResult;
private boolean mIsNewKeyboardSettings;
private boolean mSupportsFirmwareUpdate;
static final String EXTRA_BT_ADDRESS = "extra_bt_address";
@@ -152,8 +151,6 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
if (mSupportsFirmwareUpdate) {
mFeatureProvider.addFirmwareUpdateCategory(getContext(), getPreferenceScreen());
}
mIsNewKeyboardSettings = FeatureFlagUtils.isEnabled(
getContext(), FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_UI);
boolean isModifierKeySettingsEnabled = FeatureFlagUtils
.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_MODIFIER_KEY);
if (!isModifierKeySettingsEnabled) {
@@ -287,27 +284,19 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
// TODO(yukawa): Consider using com.android.settings.widget.GearPreference
final Preference pref = new Preference(getPrefContext());
pref.setTitle(hardKeyboardDeviceInfo.mDeviceName);
if (mIsNewKeyboardSettings) {
String currentLayout =
NewKeyboardSettingsUtils.getSelectedKeyboardLayoutLabelForUser(getContext(),
UserHandle.myUserId(), hardKeyboardDeviceInfo.mDeviceIdentifier);
if (currentLayout != null) {
pref.setSummary(currentLayout);
}
pref.setOnPreferenceClickListener(
preference -> {
showEnabledLocalesKeyboardLayoutList(
hardKeyboardDeviceInfo.mDeviceIdentifier);
return true;
});
} else {
pref.setSummary(hardKeyboardDeviceInfo.mLayoutLabel);
pref.setOnPreferenceClickListener(
preference -> {
showKeyboardLayoutDialog(hardKeyboardDeviceInfo.mDeviceIdentifier);
return true;
});
String currentLayout =
NewKeyboardSettingsUtils.getSelectedKeyboardLayoutLabelForUser(getContext(),
UserHandle.myUserId(), hardKeyboardDeviceInfo.mDeviceIdentifier);
if (currentLayout != null) {
pref.setSummary(currentLayout);
}
pref.setOnPreferenceClickListener(
preference -> {
showEnabledLocalesKeyboardLayoutList(
hardKeyboardDeviceInfo.mDeviceIdentifier);
return true;
});
category.addPreference(pref);
StringBuilder vendorAndProductId = new StringBuilder();
String vendorId = String.valueOf(hardKeyboardDeviceInfo.mVendorId);