Add StatsUtils.onSettingsActivity to collect the settings page stats.

Bug:19214944
Change-Id: I113f47c49d638790d770fe2781afe7cd1565619d
main
Mohammadinamul Sheik 2015-03-13 16:12:14 -07:00
parent 116e58c437
commit 93d2ab3857
4 changed files with 24 additions and 6 deletions

View File

@ -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) {
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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);
}