* commit '0b2512017edb0161d51643560cd41dac9b1a1559': Make isInternal mutable
This commit is contained in:
commit
cb8ed32be5
5 changed files with 22 additions and 16 deletions
|
@ -1451,7 +1451,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
} else {
|
} else {
|
||||||
didAutoCorrect = false;
|
didAutoCorrect = false;
|
||||||
if (SPACE_STATE_PHANTOM == spaceState) {
|
if (SPACE_STATE_PHANTOM == spaceState) {
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
if (mWordComposer.isComposingWord() && mWordComposer.isBatchMode()) {
|
if (mWordComposer.isComposingWord() && mWordComposer.isBatchMode()) {
|
||||||
Stats.onAutoCorrection(
|
Stats.onAutoCorrection(
|
||||||
"", mWordComposer.getTypedWord(), " ", mWordComposer);
|
"", mWordComposer.getTypedWord(), " ", mWordComposer);
|
||||||
|
@ -1506,7 +1506,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
mHandler.cancelUpdateSuggestionStrip();
|
mHandler.cancelUpdateSuggestionStrip();
|
||||||
mConnection.beginBatchEdit();
|
mConnection.beginBatchEdit();
|
||||||
if (mWordComposer.isComposingWord()) {
|
if (mWordComposer.isComposingWord()) {
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
if (mWordComposer.isBatchMode()) {
|
if (mWordComposer.isBatchMode()) {
|
||||||
Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer);
|
Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer);
|
||||||
}
|
}
|
||||||
|
@ -1736,7 +1736,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mLastComposedWord.canRevertCommit()) {
|
if (mLastComposedWord.canRevertCommit()) {
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Stats.onAutoCorrectionCancellation();
|
Stats.onAutoCorrectionCancellation();
|
||||||
}
|
}
|
||||||
revertCommit();
|
revertCommit();
|
||||||
|
@ -1895,7 +1895,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
if (null != mSuggestionStripView) mSuggestionStripView.dismissAddToDictionaryHint();
|
if (null != mSuggestionStripView) mSuggestionStripView.dismissAddToDictionaryHint();
|
||||||
}
|
}
|
||||||
mHandler.postUpdateSuggestionStrip();
|
mHandler.postUpdateSuggestionStrip();
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Utils.Stats.onNonSeparator((char)primaryCode, x, y);
|
Utils.Stats.onNonSeparator((char)primaryCode, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1962,7 +1962,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
// already displayed or not, so it's okay.
|
// already displayed or not, so it's okay.
|
||||||
setPunctuationSuggestions();
|
setPunctuationSuggestions();
|
||||||
}
|
}
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Utils.Stats.onSeparator((char)primaryCode, x, y);
|
Utils.Stats.onSeparator((char)primaryCode, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2145,7 +2145,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
throw new RuntimeException("We have an auto-correction but the typed word "
|
throw new RuntimeException("We have an auto-correction but the typed word "
|
||||||
+ "is empty? Impossible! I must commit suicide.");
|
+ "is empty? Impossible! I must commit suicide.");
|
||||||
}
|
}
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
|
Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
|
||||||
}
|
}
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
|
@ -2244,7 +2244,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
// If the suggestion is not in the dictionary, the hint should be shown.
|
// If the suggestion is not in the dictionary, the hint should be shown.
|
||||||
&& !AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(), suggestion, true);
|
&& !AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(), suggestion, true);
|
||||||
|
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Stats.onSeparator((char)Constants.CODE_SPACE,
|
Stats.onSeparator((char)Constants.CODE_SPACE,
|
||||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
||||||
}
|
}
|
||||||
|
@ -2368,7 +2368,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
mUserHistoryDictionary.cancelAddingUserHistory(previousWord, committedWord);
|
mUserHistoryDictionary.cancelAddingUserHistory(previousWord, committedWord);
|
||||||
}
|
}
|
||||||
mConnection.commitText(originallyTypedWord + mLastComposedWord.mSeparatorString, 1);
|
mConnection.commitText(originallyTypedWord + mLastComposedWord.mSeparatorString, 1);
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (mSettings.isInternal()) {
|
||||||
Stats.onSeparator(mLastComposedWord.mSeparatorString,
|
Stats.onSeparator(mLastComposedWord.mSeparatorString,
|
||||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
|
||||||
}
|
}
|
||||||
|
@ -2502,12 +2502,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
launchSubActivity(SettingsActivity.class);
|
launchSubActivity(SettingsActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from debug code only
|
|
||||||
public void launchDebugSettings() {
|
|
||||||
handleClose();
|
|
||||||
launchSubActivity(DebugSettingsActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void launchKeyboardedDialogActivity(final Class<? extends Activity> activityClass) {
|
public void launchKeyboardedDialogActivity(final Class<? extends Activity> activityClass) {
|
||||||
// Put the text in the attached EditText into a safe, saved state before switching to a
|
// Put the text in the attached EditText into a safe, saved state before switching to a
|
||||||
// new activity that will also use the soft keyboard.
|
// new activity that will also use the soft keyboard.
|
||||||
|
|
|
@ -70,6 +70,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static final String PREF_INPUT_LANGUAGE = "input_language";
|
public static final String PREF_INPUT_LANGUAGE = "input_language";
|
||||||
public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
|
public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
|
||||||
public static final String PREF_DEBUG_SETTINGS = "debug_settings";
|
public static final String PREF_DEBUG_SETTINGS = "debug_settings";
|
||||||
|
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
|
||||||
|
|
||||||
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
|
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
|
||||||
// This is being used only for the backward compatibility.
|
// This is being used only for the backward compatibility.
|
||||||
|
@ -127,6 +128,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
return mSettingsValues;
|
return mSettingsValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInternal() {
|
||||||
|
return mSettingsValues.mIsInternal;
|
||||||
|
}
|
||||||
|
|
||||||
// Accessed from the settings interface, hence public
|
// Accessed from the settings interface, hence public
|
||||||
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
|
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
|
@ -274,4 +279,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
}
|
}
|
||||||
return prefs.getBoolean(Settings.PREF_SHOW_SETUP_WIZARD_ICON, false);
|
return prefs.getBoolean(Settings.PREF_SHOW_SETUP_WIZARD_ICON, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isInternal(final SharedPreferences prefs) {
|
||||||
|
return prefs.getBoolean(Settings.PREF_KEY_IS_INTERNAL, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
||||||
|
|
||||||
final Preference debugSettings = findPreference(Settings.PREF_DEBUG_SETTINGS);
|
final Preference debugSettings = findPreference(Settings.PREF_DEBUG_SETTINGS);
|
||||||
if (debugSettings != null) {
|
if (debugSettings != null) {
|
||||||
if (ProductionFlag.IS_INTERNAL) {
|
if (Settings.isInternal(prefs)) {
|
||||||
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
|
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
|
||||||
debugSettingsIntent.setClassName(
|
debugSettingsIntent.setClassName(
|
||||||
context.getPackageName(), DebugSettingsActivity.class.getName());
|
context.getPackageName(), DebugSettingsActivity.class.getName());
|
||||||
|
|
|
@ -76,6 +76,9 @@ public final class SettingsValues {
|
||||||
private final boolean mVoiceKeyEnabled;
|
private final boolean mVoiceKeyEnabled;
|
||||||
private final boolean mVoiceKeyOnMain;
|
private final boolean mVoiceKeyOnMain;
|
||||||
|
|
||||||
|
// Debug settings
|
||||||
|
public final boolean mIsInternal;
|
||||||
|
|
||||||
public SettingsValues(final SharedPreferences prefs, final Resources res,
|
public SettingsValues(final SharedPreferences prefs, final Resources res,
|
||||||
final InputAttributes inputAttributes) {
|
final InputAttributes inputAttributes) {
|
||||||
// Get the resources
|
// Get the resources
|
||||||
|
@ -141,6 +144,7 @@ public final class SettingsValues {
|
||||||
Settings.PREF_SHOW_SUGGESTIONS_SETTING,
|
Settings.PREF_SHOW_SUGGESTIONS_SETTING,
|
||||||
res.getString(R.string.prefs_suggestion_visibility_default_value));
|
res.getString(R.string.prefs_suggestion_visibility_default_value));
|
||||||
mSuggestionVisibility = createSuggestionVisibility(res, showSuggestionsSetting);
|
mSuggestionVisibility = createSuggestionVisibility(res, showSuggestionsSetting);
|
||||||
|
mIsInternal = Settings.isInternal(prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isApplicationSpecifiedCompletionsOn() {
|
public boolean isApplicationSpecifiedCompletionsOn() {
|
||||||
|
|
|
@ -22,7 +22,6 @@ public final class ProductionFlag {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final boolean IS_EXPERIMENTAL = false;
|
public static final boolean IS_EXPERIMENTAL = false;
|
||||||
public static final boolean IS_INTERNAL = false;
|
|
||||||
|
|
||||||
// When false, IS_EXPERIMENTAL_DEBUG suggests that all guarded class-private DEBUG flags should
|
// When false, IS_EXPERIMENTAL_DEBUG suggests that all guarded class-private DEBUG flags should
|
||||||
// be false, and any privacy controls should be enforced. IS_EXPERIMENTAL_DEBUG should be false
|
// be false, and any privacy controls should be enforced. IS_EXPERIMENTAL_DEBUG should be false
|
||||||
|
|
Loading…
Reference in a new issue