Merge "Add search index into WallpaperSuggestionActivity"
This commit is contained in:
committed by
Android (Google) Code Review
commit
0ba7a5fd2f
@@ -795,7 +795,8 @@
|
|||||||
|
|
||||||
<activity android:name="Settings$WallpaperSettingsActivity"
|
<activity android:name="Settings$WallpaperSettingsActivity"
|
||||||
android:label="@string/wallpaper_settings_fragment_title"
|
android:label="@string/wallpaper_settings_fragment_title"
|
||||||
android:icon="@drawable/ic_wallpaper">
|
android:icon="@drawable/ic_wallpaper"
|
||||||
|
android:exported="true">
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
android:value="com.android.settings.wallpaper.WallpaperTypeSettings" />
|
android:value="com.android.settings.wallpaper.WallpaperTypeSettings" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -28,10 +28,18 @@ import androidx.annotation.VisibleForTesting;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
import com.android.settings.search.Indexable;
|
||||||
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
public class WallpaperSuggestionActivity extends Activity {
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SearchIndexable
|
||||||
|
public class WallpaperSuggestionActivity extends Activity implements Indexable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -79,4 +87,30 @@ public class WallpaperSuggestionActivity extends Activity {
|
|||||||
return context.getResources().getBoolean(
|
return context.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_enableWallpaperService);
|
com.android.internal.R.bool.config_enableWallpaperService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
new BaseSearchIndexProvider() {
|
||||||
|
private static final String SUPPORT_SEARCH_INDEX_KEY = "wallpaper_type";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableRaw> getRawDataToIndex(Context context,
|
||||||
|
boolean enabled) {
|
||||||
|
|
||||||
|
final List<SearchIndexableRaw> result = new ArrayList<>();
|
||||||
|
|
||||||
|
SearchIndexableRaw data = new SearchIndexableRaw(context);
|
||||||
|
data.title = context.getString(R.string.wallpaper_settings_fragment_title);
|
||||||
|
data.screenTitle = context.getString(
|
||||||
|
R.string.wallpaper_settings_fragment_title);
|
||||||
|
data.intentTargetPackage = context.getString(
|
||||||
|
R.string.config_wallpaper_picker_package);
|
||||||
|
data.intentTargetClass = context.getString(
|
||||||
|
R.string.config_wallpaper_picker_class);
|
||||||
|
data.intentAction = Intent.ACTION_MAIN;
|
||||||
|
data.key = SUPPORT_SEARCH_INDEX_KEY;
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,21 +17,11 @@
|
|||||||
package com.android.settings.wallpaper;
|
package com.android.settings.wallpaper;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
|
||||||
import com.android.settings.search.SearchIndexableRaw;
|
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
|
||||||
public class WallpaperTypeSettings extends DashboardFragment {
|
public class WallpaperTypeSettings extends DashboardFragment {
|
||||||
private static final String TAG = "WallpaperTypeSettings";
|
private static final String TAG = "WallpaperTypeSettings";
|
||||||
|
|
||||||
@@ -54,42 +44,4 @@ public class WallpaperTypeSettings extends DashboardFragment {
|
|||||||
protected int getPreferenceScreenResId() {
|
protected int getPreferenceScreenResId() {
|
||||||
return R.xml.wallpaper_settings;
|
return R.xml.wallpaper_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
|
||||||
new BaseSearchIndexProvider() {
|
|
||||||
@Override
|
|
||||||
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
|
|
||||||
final List<SearchIndexableRaw> result = new ArrayList<>();
|
|
||||||
|
|
||||||
final Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
|
|
||||||
final PackageManager pm = context.getPackageManager();
|
|
||||||
final List<ResolveInfo> rList = pm.queryIntentActivities(intent,
|
|
||||||
PackageManager.MATCH_DEFAULT_ONLY);
|
|
||||||
|
|
||||||
// Add indexable data for package that is in config_wallpaper_picker_package
|
|
||||||
final String wallpaperPickerPackage =
|
|
||||||
context.getString(R.string.config_wallpaper_picker_package);
|
|
||||||
for (ResolveInfo info : rList) {
|
|
||||||
if (!wallpaperPickerPackage.equals(info.activityInfo.packageName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
CharSequence label = info.loadLabel(pm);
|
|
||||||
if (label == null) {
|
|
||||||
label = info.activityInfo.packageName;
|
|
||||||
}
|
|
||||||
final SearchIndexableRaw data = new SearchIndexableRaw(context);
|
|
||||||
data.title = label.toString();
|
|
||||||
data.key = "wallpaper_type_settings";
|
|
||||||
data.screenTitle = context.getResources().getString(
|
|
||||||
R.string.wallpaper_settings_fragment_title);
|
|
||||||
data.intentAction = Intent.ACTION_SET_WALLPAPER;
|
|
||||||
data.intentTargetPackage = info.activityInfo.packageName;
|
|
||||||
data.intentTargetClass = info.activityInfo.name;
|
|
||||||
data.keywords = context.getString(R.string.keywords_wallpaper);
|
|
||||||
result.add(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ com.android.settings.users.RestrictedProfileSettings
|
|||||||
com.android.settings.users.UserDetailsSettings
|
com.android.settings.users.UserDetailsSettings
|
||||||
com.android.settings.vpn2.AppManagementFragment
|
com.android.settings.vpn2.AppManagementFragment
|
||||||
com.android.settings.vpn2.VpnSettings
|
com.android.settings.vpn2.VpnSettings
|
||||||
|
com.android.settings.wallpaper.WallpaperTypeSettings
|
||||||
com.android.settings.wifi.calling.WifiCallingSettingsForSub
|
com.android.settings.wifi.calling.WifiCallingSettingsForSub
|
||||||
com.android.settings.wifi.ChangeWifiStateDetails
|
com.android.settings.wifi.ChangeWifiStateDetails
|
||||||
com.android.settings.wifi.details.WifiNetworkDetailsFragment
|
com.android.settings.wifi.details.WifiNetworkDetailsFragment
|
||||||
|
|||||||
Reference in New Issue
Block a user