Add test cases for highlight Preference click behavior

On large screen Activity embedding devices, Settings homepage
shows a highlighted Preference which is mapped to current
right pane.

For better UX, when users click again on a highlighted Preference,
it should not launch SubSettings.

Fix: 236275503
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard.DashboardFeatureProviderImplTest
Change-Id: I222c9b015fb090f359c3c9f4187823477920715b
This commit is contained in:
Arc Wang
2022-06-22 16:36:16 +08:00
parent 21d6249393
commit 69974d0c4f
4 changed files with 131 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@@ -72,6 +73,13 @@ public class TopLevelSettings extends DashboardFragment implements SplitLayoutLi
setArguments(args);
}
/** Dependency injection ctor only for testing. */
@VisibleForTesting
public TopLevelSettings(TopLevelHighlightMixin highlightMixin) {
this();
mHighlightMixin = highlightMixin;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.top_level_settings;