aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Zivkovic <zivkovic@google.com>2015-03-30 11:36:22 -0700
committerDan Zivkovic <zivkovic@google.com>2015-03-30 21:23:44 +0000
commit94a1bea852bbc8232795198e746b54e00c2044ad (patch)
treee823c4245fce050575adab16f567672e6e1a2729
parent4b43b8798c5ed01b78f96a664f01f2111323fea8 (diff)
downloadlatinime-94a1bea852bbc8232795198e746b54e00c2044ad.tar.gz
latinime-94a1bea852bbc8232795198e746b54e00c2044ad.tar.xz
latinime-94a1bea852bbc8232795198e746b54e00c2044ad.zip
Setup wizard status only available on Lollipop++
Bug 19959791. Change-Id: Iac2bf1a2550795e75e866aded57130dac1619a81
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsFragment.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
index f5455e3db..874f221c6 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
@@ -18,6 +18,7 @@ package com.android.inputmethod.latin.settings;
import android.app.Activity;
import android.content.Intent;
+import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
@@ -71,11 +72,7 @@ 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 (!isUserSetupComplete(activity)) {
// 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;
@@ -94,4 +91,11 @@ public final class SettingsFragment extends InputMethodSettingsFragment {
}
return super.onOptionsItemSelected(item);
}
+
+ private static boolean isUserSetupComplete(final Activity activity) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
+ return true;
+ }
+ return Secure.getInt(activity.getContentResolver(), "user_setup_complete", 0) != 0;
+ }
}