<commit_before>package android.support.v7.preference;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;

import net.xpece.android.support.preference.plugins.XpSupportPreferencePlugins;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @deprecated This class will be moved to a different package. Use the public API in
 * {@link net.xpece.android.support.preference.XpPreferenceManager}.
 */
@Deprecated
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@SuppressWarnings("DeprecatedIsStillUsed")
public class XpPreferenceManager extends PreferenceManager {

    private static final Method METHOD_SET_NO_COMMIT;

    private static final String[] DEFAULT_PACKAGES;

    static {
        Method setNoCommit = null;
        try {
            setNoCommit = PreferenceManager.class.getDeclaredMethod("setNoCommit", boolean.class);
            setNoCommit.setAccessible(true);
        } catch (NoSuchMethodException e) {
            XpSupportPreferencePlugins.onError(e, "setNoCommit not available.");
        }
        METHOD_SET_NO_COMMIT = setNoCommit;

        final Set<String> defaultPackages = new HashSet<>();
        defaultPackages.add(net.xpece.android.support.preference.Preference.class.getPackage().getName() + ".");
        // Support the AndroidX relocated classes.
        defaultPackages.add(android.support.v7.preference.Preference.class.getPackage().getName() + ".");
        try {
            defaultPackages.add(android.support.v14.preference.SwitchPreference.class.getPackage().getName() + ".");
        } catch (NoClassDefFoundError ignore) {
            // preference-v14 is an optional dependency; classes were merged in 27.0.0.
        }
        // For backwards compatibility. Someone may have put their classes in these packages.
        defaultPackages.add("android.support.v7.preference.");
        defaultPackages.add("android.support.v14.preference.");
        DEFAULT_PACKAGES = defaultPackages.toArray(new String[defaultPackages.size()]);
    }

    private String[] mCustomDefaultPackages;<commit_msg>Fixed regression: Preserve order of default preference packages<commit_after>package android.support.v7.preference;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;

import net.xpece.android.support.preference.plugins.XpSupportPreferencePlugins;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

/**
 * @deprecated This class will be moved to a different package. Use the public API in
 * {@link net.xpece.android.support.preference.XpPreferenceManager}.
 */
@Deprecated
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@SuppressWarnings("DeprecatedIsStillUsed")
public class XpPreferenceManager extends PreferenceManager {

    private static final Method METHOD_SET_NO_COMMIT;

    private static final String[] DEFAULT_PACKAGES;

    static {
        Method setNoCommit = null;
        try {
            setNoCommit = PreferenceManager.class.getDeclaredMethod("setNoCommit", boolean.class);
            setNoCommit.setAccessible(true);
        } catch (NoSuchMethodException e) {
            XpSupportPreferencePlugins.onError(e, "setNoCommit not available.");
        }
        METHOD_SET_NO_COMMIT = setNoCommit;

        final Set<String> defaultPackages = new LinkedHashSet<>(); // Preserve order.
        defaultPackages.add(net.xpece.android.support.preference.Preference.class.getPackage().getName() + ".");
        // Support the AndroidX relocated classes.
        defaultPackages.add(android.support.v7.preference.Preference.class.getPackage().getName() + ".");
        try {
            defaultPackages.add(android.support.v14.preference.SwitchPreference.class.getPackage().getName() + ".");
        } catch (NoClassDefFoundError ignore) {
            // preference-v14 is an optional dependency; classes were merged in 27.0.0.
        }
        // For backwards compatibility. Someone may have put their classes in these packages.
        defaultPackages.add("android.support.v7.preference.");
        defaultPackages.add("android.support.v14.preference.");
        DEFAULT_PACKAGES = defaultPackages.toArray(new String[defaultPackages.size()]);
    }

    private String[] mCustomDefaultPackages;
{'fraction_non_alphanumeric': 0.10177267987486965, 'fraction_numerical': 0.005422314911366006, 'mean_word_length': 3.883910386965377, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1223975', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1311, 'n_words': 264}