Fix Settings search result 'add an account' does nothing.

Tap 'add an account' from search results will launch ChooseAccountFragment,
this way doesn't invoke AddAccountSettings and the add account service of gms
won't be triggered, so the items on the fragment will do nothing.

Move the key word to the search synonym of AccountDashboardFragment
and remove it from ChooseAccountFragment, the search result will invoke
AccountDashboardFragment.

Fixes: 133511289
Test: maunal
Change-Id: I67fa004c4965da37c59cada6ca27752e9fe7202b
This commit is contained in:
Stanley Wang
2019-06-28 11:45:27 +08:00
parent 5d00bdbdc5
commit 1903470bfb
3 changed files with 2 additions and 31 deletions

View File

@@ -7332,7 +7332,7 @@
<string name="keywords_sounds_and_notifications_interruptions">dont don\u2019t disturb, interrupt, interruption, break</string>
<string name="keywords_app">RAM</string>
<string name="keywords_location">nearby, location, history, reporting, GPS</string>
<string name="keywords_accounts">account</string>
<string name="keywords_accounts">account, add an account, work profile</string>
<string name="keywords_users">restriction, restrict, restricted</string>
<string name="keywords_keyboard_and_ime">text correction, correct, sound, vibrate, auto, language, gesture, suggest, suggestion, theme, offensive, word, type, emoji, international</string>
<string name="keywords_reset_apps">reset, preferences, default</string>
@@ -7428,9 +7428,6 @@
<!-- Battery Saver: Search terms for battery saver schedule preference. Feel free to add additional terms when translating if appropriate [CHAR_LIMIT=NONE] -->
<string name="keywords_battery_saver_schedule">routine, schedule, battery saver, power saver, battery, automatic, percent</string>
<!-- List of synonyms for the Add an account setting [CHAR_LIMIT=NONE] -->
<string name="keywords_add_an_account">work profile</string>
<!-- Option title for the default sound, context based on screen -->
<string name="default_sound">Default sound</string>

View File

@@ -19,5 +19,4 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="add_account_screen"
android:title="@string/header_add_an_account"
settings:controller="com.android.settings.accounts.ChooseAccountPreferenceController"
settings:keywords="@string/keywords_add_an_account"/>
settings:controller="com.android.settings.accounts.ChooseAccountPreferenceController"/>

View File

@@ -20,15 +20,11 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
import java.util.List;
@@ -36,7 +32,6 @@ import java.util.List;
/**
* Activity asking a user to select an account to be set up.
*/
@SearchIndexable
public class ChooseAccountFragment extends DashboardFragment {
private static final String TAG = "ChooseAccountFragment";
@@ -84,24 +79,4 @@ public class ChooseAccountFragment extends DashboardFragment {
controllers.add(new EnterpriseDisclosurePreferenceController(context));
return controllers;
}
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
boolean enabled) {
final ArrayList<SearchIndexableResource> result = new ArrayList<>();
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.add_account_settings;
result.add(sir);
return result;
}
@Override
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {
return buildControllers(context);
}
};
}