From 8adedbf47c7ac150d4ac7e6cdbee3ece38f346e7 Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Wed, 12 Feb 2014 16:52:44 +0900
Subject: [PATCH] Show the suggestion strip for the important notice

Bug: 10587358
Change-Id: Ia060a9ca9dfc2e7fe0750536a9fea3b9cc5900c4
---
 java/src/com/android/inputmethod/latin/LatinIME.java       | 5 ++++-
 .../inputmethod/latin/suggestions/SuggestionStripView.java | 3 +--
 .../inputmethod/latin/utils/ImportantNoticeUtils.java      | 7 ++++---
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 845bafe17e..30bb505cb8 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1320,6 +1320,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
             return false;
         if (mSuggestionStripView.isShowingAddToDictionaryHint())
             return true;
+        if (ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(this))
+            return true;
         if (null == currentSettings)
             return false;
         if (!currentSettings.isSuggestionStripVisible())
@@ -1352,7 +1354,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
         if (mSuggestionStripView != null) {
             final boolean showSuggestions;
             if (SuggestedWords.EMPTY == suggestedWords
-                    || suggestedWords.mIsPunctuationSuggestions) {
+                    || suggestedWords.mIsPunctuationSuggestions
+                    || !mSettings.getCurrent().isSuggestionsRequested()) {
                 showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle();
             } else {
                 showSuggestions = true;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 68c891bf31..29c0613e4b 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -225,8 +225,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
     // it has been shown once already or not, and if in the setup wizard). If applicable, it shows
     // the notice. In all cases, it returns true if it was shown, false otherwise.
     public boolean maybeShowImportantNoticeTitle() {
-        if (!ImportantNoticeUtils.hasNewImportantNotice(getContext())
-                || ImportantNoticeUtils.isInSystemSetupWizard(getContext())) {
+        if (!ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(getContext())) {
             return false;
         }
         final int width = getWidth();
diff --git a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
index 4a0823155c..604c364886 100644
--- a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
@@ -42,7 +42,7 @@ public final class ImportantNoticeUtils {
         // This utility class is not publicly instantiable.
     }
 
-    public static boolean isInSystemSetupWizard(final Context context) {
+    private static boolean isInSystemSetupWizard(final Context context) {
         try {
             final int userSetupComplete = Settings.Secure.getInt(
                     context.getContentResolver(), Settings_Secure_USER_SETUP_COMPLETE);
@@ -62,10 +62,11 @@ public final class ImportantNoticeUtils {
         return context.getResources().getInteger(R.integer.config_important_notice_version);
     }
 
-    public static boolean hasNewImportantNotice(final Context context) {
+    public static boolean hasNewImportantNoticeAndNotInSetupWizard(final Context context) {
         final SharedPreferences prefs = getImportantNoticePreferences(context);
         final int lastVersion = prefs.getInt(KEY_IMPORTANT_NOTICE_VERSION, 0);
-        return getCurrentImportantNoticeVersion(context) > lastVersion;
+        return getCurrentImportantNoticeVersion(context) > lastVersion
+                && !isInSystemSetupWizard(context);
     }
 
     public static void updateLastImportantNoticeVersion(final Context context) {
-- 
GitLab