Fix the search result "Google Account" doesn't work.

- The "Google Account" item will launch the
  AccountDetailDashboardFragment.
  To launch the account detail page, we need the intent extras, account,
  account label and account type.
- Currently, SI doesn't support to index the intent extras, so we launch
  AccountDashboardFragment instead of AccountDetailDashboardFragment.

Fixes: 153626405
Test: manual test the search result and run Settings robotest
Change-Id: I081bd447c3f8422fb8859146b1ed4d7fcbc06810
This commit is contained in:
Stanley Wang
2020-05-18 20:17:19 +08:00
parent 1b240b646d
commit 732514cd5f
2 changed files with 15 additions and 0 deletions

View File

@@ -125,5 +125,9 @@ public class DashboardFragmentRegistry {
for (Map.Entry<String, String> parentToKey : PARENT_TO_CATEGORY_KEY_MAP.entrySet()) {
CATEGORY_KEY_TO_PARENT_MAP.put(parentToKey.getValue(), parentToKey.getKey());
}
// For injection index, redirect CATEGORY_ACCOUNT_DETAIL to AccountDashboardFragment.
CATEGORY_KEY_TO_PARENT_MAP.put(CategoryKey.CATEGORY_ACCOUNT_DETAIL,
AccountDashboardFragment.class.getName());
}
}

View File

@@ -18,6 +18,9 @@ package com.android.settings.dashboard;
import static com.google.common.truth.Truth.assertThat;
import com.android.settings.accounts.AccountDashboardFragment;
import com.android.settingslib.drawer.CategoryKey;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -29,4 +32,12 @@ public class DashboardFragmentRegistryTest {
assertThat(DashboardFragmentRegistry.CATEGORY_KEY_TO_PARENT_MAP.size())
.isEqualTo(DashboardFragmentRegistry.PARENT_TO_CATEGORY_KEY_MAP.size());
}
@Test
public void accountDetailCategoryShouldRedirectToAccountDashboardFragment() {
final String fragment = DashboardFragmentRegistry.CATEGORY_KEY_TO_PARENT_MAP.get(
CategoryKey.CATEGORY_ACCOUNT_DETAIL);
assertThat(fragment).isEqualTo(AccountDashboardFragment.class.getName());
}
}