am c787bd66: am 6f09e99d: am 2bc9f407: Block overflow menu during setup. DO NOT MERGE

* commit 'c787bd666330f872e2f3aff0d3f590724f95d574':
  Block overflow menu during setup. DO NOT MERGE
main
Dan Zivkovic 2015-03-23 23:22:26 +00:00 committed by Android Git Automerger
commit 823aaf0f7d
1 changed files with 14 additions and 2 deletions

View File

@ -16,10 +16,12 @@
package com.android.inputmethod.latin.settings;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.provider.Settings.Secure;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@ -67,13 +69,23 @@ public final class SettingsFragment extends InputMethodSettingsFragment {
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
final Activity activity = getActivity();
final int setupStatus = Secure.getInt(
activity.getContentResolver(),
"user_setup_complete",
0 /* default */);
if (setupStatus == 0) {
// If setup is not complete, it's not safe to launch Help or other activities
// because they might go to the Play Store. See b/19866981.
return true;
}
final int itemId = item.getItemId();
if (itemId == MENU_HELP_AND_FEEDBACK) {
FeedbackUtils.showHelpAndFeedbackForm(getActivity());
FeedbackUtils.showHelpAndFeedbackForm(activity);
return true;
}
if (itemId == MENU_ABOUT) {
final Intent aboutIntent = FeedbackUtils.getAboutKeyboardIntent(getActivity());
final Intent aboutIntent = FeedbackUtils.getAboutKeyboardIntent(activity);
if (aboutIntent != null) {
startActivity(aboutIntent);
return true;