Merge "Clean up debug related preference keys"

main
Tadashi G. Takaoka 2013-01-08 16:56:10 -08:00 committed by Android (Google) Code Review
commit 8315e8168b
2 changed files with 10 additions and 10 deletions

View File

@ -387,7 +387,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final boolean forceNonDistinctMultitouch = prefs.getBoolean( final boolean forceNonDistinctMultitouch = prefs.getBoolean(
DebugSettings.FORCE_NON_DISTINCT_MULTITOUCH_KEY, false); DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH, false);
final boolean hasDistinctMultitouch = context.getPackageManager() final boolean hasDistinctMultitouch = context.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT); .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
mHasDistinctMultitouch = hasDistinctMultitouch && !forceNonDistinctMultitouch; mHasDistinctMultitouch = hasDistinctMultitouch && !forceNonDistinctMultitouch;

View File

@ -32,12 +32,12 @@ import com.android.inputmethod.research.ResearchLogger;
public final class DebugSettings extends PreferenceFragment public final class DebugSettings extends PreferenceFragment
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = DebugSettings.class.getSimpleName(); private static final String TAG = DebugSettings.class.getSimpleName();
private static final String DEBUG_MODE_KEY = "debug_mode";
public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch"; public static final String PREF_DEBUG_MODE = "debug_mode";
public static final String PREF_FORCE_NON_DISTINCT_MULTITOUCH = "force_non_distinct_multitouch";
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode"; public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
private static final String PREF_STATISTICS_LOGGING_KEY = "enable_logging"; public static final String PREF_STATISTICS_LOGGING = "enable_logging";
private static final boolean SHOW_STATISTICS_LOGGING = false; private static final boolean SHOW_STATISTICS_LOGGING = false;
private boolean mServiceNeedsRestart = false; private boolean mServiceNeedsRestart = false;
@ -58,7 +58,7 @@ public final class DebugSettings extends PreferenceFragment
ResearchLogger.DEFAULT_USABILITY_STUDY_MODE)); ResearchLogger.DEFAULT_USABILITY_STUDY_MODE));
checkbox.setSummary(R.string.settings_warning_researcher_mode); checkbox.setSummary(R.string.settings_warning_researcher_mode);
} }
final Preference statisticsLoggingPref = findPreference(PREF_STATISTICS_LOGGING_KEY); final Preference statisticsLoggingPref = findPreference(PREF_STATISTICS_LOGGING);
if (statisticsLoggingPref instanceof CheckBoxPreference) { if (statisticsLoggingPref instanceof CheckBoxPreference) {
mStatisticsLoggingPref = (CheckBoxPreference) statisticsLoggingPref; mStatisticsLoggingPref = (CheckBoxPreference) statisticsLoggingPref;
if (!SHOW_STATISTICS_LOGGING) { if (!SHOW_STATISTICS_LOGGING) {
@ -67,7 +67,7 @@ public final class DebugSettings extends PreferenceFragment
} }
mServiceNeedsRestart = false; mServiceNeedsRestart = false;
mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY); mDebugMode = (CheckBoxPreference) findPreference(PREF_DEBUG_MODE);
updateDebugMode(); updateDebugMode();
} }
@ -79,9 +79,9 @@ public final class DebugSettings extends PreferenceFragment
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (key.equals(DEBUG_MODE_KEY)) { if (key.equals(PREF_DEBUG_MODE)) {
if (mDebugMode != null) { if (mDebugMode != null) {
mDebugMode.setChecked(prefs.getBoolean(DEBUG_MODE_KEY, false)); mDebugMode.setChecked(prefs.getBoolean(PREF_DEBUG_MODE, false));
final boolean checked = mDebugMode.isChecked(); final boolean checked = mDebugMode.isChecked();
if (mStatisticsLoggingPref != null) { if (mStatisticsLoggingPref != null) {
if (checked) { if (checked) {
@ -93,7 +93,7 @@ public final class DebugSettings extends PreferenceFragment
updateDebugMode(); updateDebugMode();
mServiceNeedsRestart = true; mServiceNeedsRestart = true;
} }
} else if (key.equals(FORCE_NON_DISTINCT_MULTITOUCH_KEY) } else if (key.equals(PREF_FORCE_NON_DISTINCT_MULTITOUCH)
|| key.equals(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT)) { || key.equals(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT)) {
mServiceNeedsRestart = true; mServiceNeedsRestart = true;
} }