diff --git a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java index 3ae277a3d..21a806878 100644 --- a/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java +++ b/java-overridable/src/com/android/inputmethod/latin/utils/StatsUtils.java @@ -95,4 +95,7 @@ public final class StatsUtils { public static void onSubtypeChanged(final InputMethodSubtype oldSubtype, final InputMethodSubtype newSubtype) { } + + public static void onSettingsActivity(final String entryPoint) { + } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index a0e55c65f..9fab6b413 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -94,7 +94,6 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -1255,7 +1254,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Implement {@link ImportantNoticeDialog.ImportantNoticeDialogListener} @Override public void onClickSettingsOfImportantNoticeDialog(final int nextVersion) { - launchSettings(); + launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_NOTICE_DIALOG); } // Implement {@link ImportantNoticeDialog.ImportantNoticeDialogListener} @@ -1692,7 +1691,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } }; - void launchSettings() { + void launchSettings(final String extraEntryValue) { mInputLogic.commitTyped(mSettings.getCurrent(), LastComposedWord.NOT_A_SEPARATOR); requestHideSelf(0); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); @@ -1705,6 +1704,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false); + intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY, extraEntryValue); startActivity(intent); } @@ -1732,7 +1732,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen startActivity(intent); break; case 1: - launchSettings(); + launchSettings(SettingsActivity.EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA); break; } } diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java b/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java index b0c494098..dee4811c9 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java @@ -17,6 +17,8 @@ package com.android.inputmethod.latin.settings; import com.android.inputmethod.latin.utils.FragmentUtils; +import com.android.inputmethod.latin.utils.StatsUtils; +import com.android.inputmethod.latin.utils.StatsUtilsManager; import android.app.ActionBar; import android.content.Intent; @@ -25,19 +27,30 @@ import android.preference.PreferenceActivity; import android.view.MenuItem; public final class SettingsActivity extends PreferenceActivity { - public static final String EXTRA_SHOW_HOME_AS_UP = "show_home_as_up"; private static final String DEFAULT_FRAGMENT = SettingsFragment.class.getName(); + + public static final String EXTRA_SHOW_HOME_AS_UP = "show_home_as_up"; + public static final String EXTRA_ENTRY_KEY = "entry"; + public static final String EXTRA_ENTRY_VALUE_LONG_PRESS_COMMA = "long_press_comma"; + public static final String EXTRA_ENTRY_VALUE_APP_ICON = "app_icon"; + public static final String EXTRA_ENTRY_VALUE_NOTICE_DIALOG = "important_notice"; + public static final String EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS = "system_settings"; + private boolean mShowHomeAsUp; @Override protected void onCreate(final Bundle savedState) { super.onCreate(savedState); final ActionBar actionBar = getActionBar(); + final Intent intent = getIntent(); if (actionBar != null) { - mShowHomeAsUp = getIntent().getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true); + mShowHomeAsUp = intent.getBooleanExtra(EXTRA_SHOW_HOME_AS_UP, true); actionBar.setDisplayHomeAsUpEnabled(mShowHomeAsUp); actionBar.setHomeButtonEnabled(mShowHomeAsUp); } + StatsUtils.onSettingsActivity( + intent.hasExtra(EXTRA_ENTRY_KEY) ? intent.getStringExtra(EXTRA_ENTRY_KEY) + : intent.getStringExtra(EXTRA_ENTRY_VALUE_SYSTEM_SETTINGS)); } @Override diff --git a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java index c3b30dcb4..bee22afd5 100644 --- a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java +++ b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java @@ -265,6 +265,8 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL intent.setClass(this, SettingsActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY, + SettingsActivity.EXTRA_ENTRY_VALUE_APP_ICON); startActivity(intent); }