Only create shortcut preference when no existing shortcut found

Update onCreateView in AccessibilityShortcutPreferenceFragmen
so it only create a new shortcutPreference when no existing
shortcut preference is found.

Bug: 397719419
Test: Manually verified on test devices
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: Ic4747240cfd3d48fd97c61fd0b15d44f6ba5cf0a
This commit is contained in:
Yuhan Yang
2025-02-20 18:21:07 +00:00
parent 29b9665128
commit 4d52d72337
4 changed files with 30 additions and 35 deletions

View File

@@ -24,6 +24,8 @@ import android.view.View;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
@@ -60,7 +62,7 @@ public class ShortcutPreference extends TwoTargetPreference {
private boolean mChecked = false;
private boolean mSettingsEditable = true;
ShortcutPreference(Context context, AttributeSet attrs) {
public ShortcutPreference(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setIconSpaceReserved(false);
// Treat onSettingsClicked as this preference's click.