Introduce config_show_wallpaper_attribution.
This introduces a boolean flag in which when set to true, Wallpaper Attribution will be shown in the Legal page. When set to false, it will be hidden. Wallpaper has always been removed from search results, so that has not changed. Bug: 62378616 Test: make RunSettingsRoboTests ROBOTEST_FILTER=LegalSettings passes. Change-Id: Ia6f3e7d1ef471eecf79f1b46616fa4ba27d35748
This commit is contained in:
@@ -24,13 +24,14 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.Indexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
||||
private static final String KEY_LICENSE = "license";
|
||||
private static final String KEY_COPYRIGHT = "copyright";
|
||||
private static final String KEY_WEBVIEW_LICENSE = "webview_license";
|
||||
private static final String KEY_WALLPAPER_ATTRIBUTIONS = "wallpaper_attributions";
|
||||
@VisibleForTesting static final String KEY_WALLPAPER_ATTRIBUTIONS = "wallpaper_attributions";
|
||||
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@@ -57,6 +58,8 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
||||
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
|
||||
Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_WEBVIEW_LICENSE,
|
||||
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
|
||||
|
||||
checkWallpaperAttributionAvailability(act);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,6 +67,14 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
||||
return MetricsEvent.ABOUT_LEGAL_SETTINGS;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void checkWallpaperAttributionAvailability(Context context) {
|
||||
if (!context.getResources().getBoolean(
|
||||
R.bool.config_show_wallpaper_attribution)) {
|
||||
removePreference(KEY_WALLPAPER_ATTRIBUTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
|
Reference in New Issue
Block a user