[PhysicalKeyboard] Update Setting Feature Provider for follow up usage

rename method in provider and usage, the provider is not activated now,
this change will not have impact on current feature.

Bug: 369937888
Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/inputmethod/
Flag: NONE, rename method, no effect on current feature.

Change-Id: I1bb66b106c338a8a8730bbd9163d6a921c17b9c0
This commit is contained in:
shaoweishen
2024-10-18 02:42:08 +00:00
parent 37ae076618
commit dba15f821f
4 changed files with 19 additions and 27 deletions

View File

@@ -35,20 +35,21 @@ public interface KeyboardSettingsFeatureProvider {
boolean supportsFirmwareUpdate();
/**
* Add firmware update preference category .
* Register firmware information preferences update on preference screen.
*
* @param context The context to initialize the application with.
* @param screen The {@link PreferenceScreen} to add the firmware update preference category.
*
* @return true if the category is added successfully.
* @param screen The {@link PreferenceScreen} to add the firmware information preferences.
*/
boolean addFirmwareUpdateCategory(Context context, PreferenceScreen screen);
void registerKeyboardInformationCategory(@Nullable PreferenceScreen screen);
/**
* Unregister firmware information preferences update on preference screen.
*/
void unregisterKeyboardInformationCategory();
/**
* Get custom action key icon.
*
* @param context Context for accessing resources.
*
* @return Returns the image of the icon, or null if there is no any custom icon.
*/
@Nullable

View File

@@ -19,6 +19,7 @@ package com.android.settings.inputmethod;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceScreen;
/**
@@ -32,12 +33,13 @@ public class KeyboardSettingsFeatureProviderImpl implements KeyboardSettingsFeat
}
@Override
public boolean addFirmwareUpdateCategory(Context context, PreferenceScreen screen) {
return false;
}
public void registerKeyboardInformationCategory(@Nullable PreferenceScreen screen) {}
@Override
public void unregisterKeyboardInformationCategory() {}
@Override
public Drawable getActionKeyIcon(Context context) {
return null;
};
}
}

View File

@@ -164,7 +164,7 @@ public final class PhysicalKeyboardFragment extends DashboardFragment
mFeatureProvider = featureFactory.getKeyboardSettingsFeatureProvider();
mSupportsFirmwareUpdate = mFeatureProvider.supportsFirmwareUpdate();
if (mSupportsFirmwareUpdate) {
mFeatureProvider.addFirmwareUpdateCategory(getContext(), getPreferenceScreen());
mFeatureProvider.registerKeyboardInformationCategory(getPreferenceScreen());
}
boolean isModifierKeySettingsEnabled = FeatureFlagUtils
.isEnabled(getContext(), FeatureFlagUtils.SETTINGS_NEW_KEYBOARD_MODIFIER_KEY);
@@ -344,7 +344,7 @@ public final class PhysicalKeyboardFragment extends DashboardFragment
mKeyboardAssistanceCategory.setOrder(1);
preferenceScreen.addPreference(mKeyboardAssistanceCategory);
if (mSupportsFirmwareUpdate) {
mFeatureProvider.addFirmwareUpdateCategory(getPrefContext(), preferenceScreen);
mFeatureProvider.registerKeyboardInformationCategory(preferenceScreen);
}
if (InputSettings.isAccessibilityBounceKeysFeatureEnabled()
@@ -423,6 +423,9 @@ public final class PhysicalKeyboardFragment extends DashboardFragment
private void unregisterSettingsObserver() {
getActivity().getContentResolver().unregisterContentObserver(mContentObserver);
if (mSupportsFirmwareUpdate) {
mFeatureProvider.unregisterKeyboardInformationCategory();
}
}
private void updateAccessibilityBounceKeysSwitch(@NonNull Context context) {