Merge "Eliminate duplicate keys in pref xmls."
This commit is contained in:
committed by
Android (Google) Code Review
commit
11151f5052
@@ -26,7 +26,6 @@ import android.util.FeatureFlagUtils;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
|
||||
import com.android.settings.deviceinfo.BasebandVersionPreferenceController;
|
||||
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
|
||||
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
|
||||
@@ -153,7 +152,6 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(
|
||||
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
|
||||
controllers.add(new AdditionalSystemUpdatePreferenceController(context));
|
||||
controllers.add(new ManualPreferenceController(context));
|
||||
controllers.add(new FeedbackPreferenceController(fragment, context));
|
||||
controllers.add(new KernelVersionPreferenceController(context));
|
||||
|
@@ -50,7 +50,7 @@ public class DisplaySettings extends DashboardFragment {
|
||||
private static final String TAG = "DisplaySettings";
|
||||
|
||||
public static final String KEY_AUTO_BRIGHTNESS = "auto_brightness";
|
||||
public static final String KEY_DISPLAY_SIZE = "screen_zoom";
|
||||
public static final String KEY_DISPLAY_SIZE = "display_settings_screen_zoom";
|
||||
|
||||
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
|
||||
private static final String KEY_AMBIENT_DISPLAY = "ambient_display";
|
||||
|
@@ -46,7 +46,6 @@ import com.android.internal.content.PackageMonitor;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.view.RotationPolicy;
|
||||
import com.android.internal.view.RotationPolicy.RotationPolicyListener;
|
||||
import com.android.settings.DisplaySettings;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.Utils;
|
||||
@@ -81,8 +80,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
|
||||
|
||||
private static final String[] CATEGORIES = new String[] {
|
||||
CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
|
||||
CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
|
||||
CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
|
||||
CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
|
||||
};
|
||||
|
||||
// Preferences
|
||||
@@ -219,7 +218,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
* on non-accelerated platforms due to the performance implications.
|
||||
*
|
||||
* @param context The current context
|
||||
* @return
|
||||
*/
|
||||
public static boolean isColorTransformAccelerated(Context context) {
|
||||
return context.getResources()
|
||||
@@ -734,27 +732,29 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
List<SearchIndexableResource> indexables = new ArrayList<>();
|
||||
SearchIndexableResource indexable = new SearchIndexableResource(context);
|
||||
indexable.xmlResId = R.xml.accessibility_settings;
|
||||
indexables.add(indexable);
|
||||
return indexables;
|
||||
}
|
||||
public static final String KEY_DISPLAY_SIZE = "accessibility_settings_screen_zoom";
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in Display
|
||||
keys.add(FONT_SIZE_PREFERENCE_SCREEN);
|
||||
keys.add(DisplaySettings.KEY_DISPLAY_SIZE);
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
List<SearchIndexableResource> indexables = new ArrayList<>();
|
||||
SearchIndexableResource indexable = new SearchIndexableResource(context);
|
||||
indexable.xmlResId = R.xml.accessibility_settings;
|
||||
indexables.add(indexable);
|
||||
return indexables;
|
||||
}
|
||||
|
||||
// Duplicates in Language & Input
|
||||
keys.add(TTS_SETTINGS_PREFERENCE);
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in Display
|
||||
keys.add(FONT_SIZE_PREFERENCE_SCREEN);
|
||||
keys.add(KEY_DISPLAY_SIZE);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
// Duplicates in Language & Input
|
||||
keys.add(TTS_SETTINGS_PREFERENCE);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -31,14 +31,13 @@ public class AddUserWhenLockedPreferenceController extends AbstractPreferenceCon
|
||||
implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
|
||||
LifecycleObserver, OnPause, OnResume {
|
||||
|
||||
private static final String KEY_ADD_USER_WHEN_LOCKED = "add_users_when_locked";
|
||||
|
||||
private RestrictedSwitchPreference mAddUserWhenLocked;
|
||||
private UserCapabilities mUserCaps;
|
||||
private final String mPrefKey;
|
||||
private final UserCapabilities mUserCaps;
|
||||
private boolean mShouldUpdateUserList;
|
||||
|
||||
public AddUserWhenLockedPreferenceController(Context context) {
|
||||
public AddUserWhenLockedPreferenceController(Context context, String key) {
|
||||
super(context);
|
||||
mPrefKey = key;
|
||||
mUserCaps = UserCapabilities.create(context);
|
||||
}
|
||||
|
||||
@@ -80,6 +79,6 @@ public class AddUserWhenLockedPreferenceController extends AbstractPreferenceCon
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_ADD_USER_WHEN_LOCKED;
|
||||
return mPrefKey;
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ import java.util.List;
|
||||
public class UserAndAccountDashboardFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "UserAndAccountDashboard";
|
||||
private static final String KEY_ADD_USER_WHEN_LOCKED = "user_settings_add_users_when_locked";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -64,7 +65,8 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new EmergencyInfoPreferenceController(context));
|
||||
AddUserWhenLockedPreferenceController addUserWhenLockedPrefController =
|
||||
new AddUserWhenLockedPreferenceController(context);
|
||||
new AddUserWhenLockedPreferenceController(
|
||||
context, KEY_ADD_USER_WHEN_LOCKED);
|
||||
controllers.add(addUserWhenLockedPrefController);
|
||||
getLifecycle().addObserver(addUserWhenLockedPrefController);
|
||||
controllers.add(new AutoSyncDataPreferenceController(context, this));
|
||||
@@ -94,7 +96,7 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
||||
UserInfo info = mContext.getSystemService(UserManager.class).getUserInfo(
|
||||
UserHandle.myUserId());
|
||||
mSummaryLoader.setSummary(this,
|
||||
mContext.getString(R.string.users_and_accounts_summary, info.name));
|
||||
mContext.getString(R.string.users_and_accounts_summary, info.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,10 +34,6 @@ public class ScreenZoomPreference extends Preference {
|
||||
android.support.v7.preference.R.attr.preferenceStyle,
|
||||
android.R.attr.preferenceStyle));
|
||||
|
||||
if (TextUtils.isEmpty(getFragment())) {
|
||||
setFragment("com.android.settings.display.ScreenZoomSettings");
|
||||
}
|
||||
|
||||
final DisplayDensityUtils density = new DisplayDensityUtils(context);
|
||||
final int defaultIndex = density.getCurrentIndex();
|
||||
if (defaultIndex < 0) {
|
||||
|
@@ -49,6 +49,9 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
@VisibleForTesting
|
||||
static final String KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE =
|
||||
"security_setting_lock_screen_notif_work";
|
||||
@VisibleForTesting
|
||||
static final String KEY_ADD_USER_FROM_LOCK_SCREEN =
|
||||
"security_lockscreen_add_users_when_locked";
|
||||
|
||||
private OwnerInfoPreferenceController mOwnerInfoPreferenceController;
|
||||
|
||||
@@ -77,18 +80,18 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
final Lifecycle lifecycle = getLifecycle();
|
||||
final LockScreenNotificationPreferenceController notificationController =
|
||||
new LockScreenNotificationPreferenceController(context,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
|
||||
new LockScreenNotificationPreferenceController(context,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER,
|
||||
KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
|
||||
lifecycle.addObserver(notificationController);
|
||||
controllers.add(notificationController);
|
||||
final AddUserWhenLockedPreferenceController addUserWhenLockedController =
|
||||
new AddUserWhenLockedPreferenceController(context);
|
||||
new AddUserWhenLockedPreferenceController(context, KEY_ADD_USER_FROM_LOCK_SCREEN);
|
||||
lifecycle.addObserver(addUserWhenLockedController);
|
||||
controllers.add(addUserWhenLockedController);
|
||||
mOwnerInfoPreferenceController =
|
||||
new OwnerInfoPreferenceController(context, this, lifecycle);
|
||||
new OwnerInfoPreferenceController(context, this, lifecycle);
|
||||
controllers.add(mOwnerInfoPreferenceController);
|
||||
return controllers;
|
||||
}
|
||||
@@ -101,23 +104,32 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
}
|
||||
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.security_lockscreen_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.security_lockscreen_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new LockScreenNotificationPreferenceController(context));
|
||||
controllers.add(new AddUserWhenLockedPreferenceController(context));
|
||||
controllers.add(new OwnerInfoPreferenceController(
|
||||
context, null /* fragment */, null /* lifecycle */));
|
||||
return controllers;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(
|
||||
Context context) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new LockScreenNotificationPreferenceController(context));
|
||||
controllers.add(new AddUserWhenLockedPreferenceController(context,
|
||||
KEY_ADD_USER_FROM_LOCK_SCREEN));
|
||||
controllers.add(new OwnerInfoPreferenceController(
|
||||
context, null /* fragment */, null /* lifecycle */));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> niks = super.getNonIndexableKeys(context);
|
||||
niks.add(KEY_ADD_USER_FROM_LOCK_SCREEN);
|
||||
return niks;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user