Fix can't start injected item problem

Should set highlight Preference key after
isDuplicateClick to ensure clicked Preference
key & highlight Preference are different and
then isDuplicateClick returns a correct value.

Bug: 233553587
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard
      manual
      1. Click all left pane items and see if there is any launch problem.
      2. Check if duplicate click check works.

Change-Id: Ic6394b96896fd3a0fb926707565f63beff74a27b
This commit is contained in:
Arc Wang
2022-05-24 14:28:06 +08:00
parent d9174aa3cc
commit 03d8d11914

View File

@@ -185,9 +185,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
&& ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) {
// Highlight the preference whenever it's clicked
final TopLevelSettings topLevelSettings = (TopLevelSettings) fragment;
topLevelSettings.setHighlightPreferenceKey(key);
highlightMixin = topLevelSettings.getHighlightMixin();
isDuplicateClick = topLevelSettings.isDuplicateClick(preference);
topLevelSettings.setHighlightPreferenceKey(key);
}
launchIntentOrSelectProfile(activity, tile, intent, sourceMetricsCategory,
highlightMixin, isDuplicateClick);