Merge "Setup wizard status only available on Lollipop++"
commit
fa22abb94d
|
@ -18,6 +18,7 @@ package com.android.inputmethod.latin.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
|
@ -71,11 +72,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
final int setupStatus = Secure.getInt(
|
if (!isUserSetupComplete(activity)) {
|
||||||
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
|
// 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.
|
// because they might go to the Play Store. See b/19866981.
|
||||||
return true;
|
return true;
|
||||||
|
@ -94,4 +91,11 @@ public final class SettingsFragment extends InputMethodSettingsFragment {
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue