Get rid of isSentenceSpellCheckSupported corresponding to I0e931b7248f8c65268b60af599c07

Bug: 6320351

Change-Id: I6dae866d19bc6a22a3e2dc7631f00a0490477239
diff --git a/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java b/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java
index f88b023..9a18a22 100644
--- a/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java
+++ b/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java
@@ -45,11 +45,7 @@
     }
 
     private boolean isSentenceSpellCheckSupported() {
-        if (mScs == null || Build.VERSION.SDK_INT < 16) {
-            return false;
-        }
-        // Note that isSentenceSpellCheckSupported works on JB or later.
-        return mScs.isSentenceSpellCheckSupported();
+        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
     }
 
     @Override
@@ -70,6 +66,9 @@
                         "I wold like to here form you")}, 3);
                 mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo("hell othere")}, 3);
             } else {
+                // Note that getSuggestions() is a deprecated API.
+                // It is recommended for an application running on Jelly Bean or later
+                // to call getSentenceSuggestions() only.
                 mScs.getSuggestions(new TextInfo("tgis"), 3);
                 mScs.getSuggestions(new TextInfo("hllo"), 3);
                 mScs.getSuggestions(new TextInfo("helloworld"), 3);
diff --git a/samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml b/samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml
index b3a078a..f4601d2 100644
--- a/samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml
+++ b/samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml
@@ -22,8 +22,7 @@
 
 <spell-checker xmlns:android="http://schemas.android.com/apk/res/android"
         android:label="@string/spellchecker_name"
-        android:settingsActivity="com.example.android.samplespellcheckerservice.SpellCheckerSettingsActivity"
-        android:supportsSentenceSpellCheck="true">
+        android:settingsActivity="com.example.android.samplespellcheckerservice.SpellCheckerSettingsActivity">
     <subtype
             android:label="@string/subtype_generic"
             android:subtypeLocale="en"
diff --git a/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java b/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
index 8778cc0..e0abb4c 100644
--- a/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
+++ b/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
@@ -37,8 +37,8 @@
     private static class AndroidSpellCheckerSession extends Session {
 
         private boolean isSentenceSpellCheckApiSupported() {
-            // Note that the sentence level spell check APIs work on JB or later.
-            return Build.VERSION.SDK_INT >= 16;
+            // Note that the sentence level spell check APIs work on Jelly Bean or later.
+            return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
         }
 
         private String mLocale;
@@ -47,6 +47,15 @@
             mLocale = getLocale();
         }
 
+        /**
+         * This method should have a concrete implementation in all spell checker services.
+         * Please note that the default implementation of
+         * {@link SpellCheckerService.Session#onGetSuggestionsMultiple(TextInfo[], int, boolean)}
+         * calls up this method. You may want to override
+         * {@link SpellCheckerService.Session#onGetSuggestionsMultiple(TextInfo[], int, boolean)}
+         * by your own implementation if you'd like to provide an optimized implementation for
+         * {@link SpellCheckerService.Session#onGetSuggestionsMultiple(TextInfo[], int, boolean)}.
+         */
         @Override
         public SuggestionsInfo onGetSuggestions(TextInfo textInfo, int suggestionsLimit) {
             if (DBG) {
@@ -63,6 +72,16 @@
                     new String[] {"aaa", "bbb", "Candidate for " + input, mLocale});
         }
 
+        /**
+         * Please consider providing your own implementation of sentence level spell checking.
+         * Please note that this sample implementation is just a mock to demonstrate how a sentence
+         * level spell checker returns the result.
+         * If you don't override this method, the framework converts queries of
+         * {@link SpellCheckerService.Session#onGetSentenceSuggestionsMultiple(TextInfo[], int)}
+         * to queries of
+         * {@link SpellCheckerService.Session#onGetSuggestionsMultiple(TextInfo[], int, boolean)}
+         * by the default implementation.
+         */
         @Override
         public SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(
                 TextInfo[] textInfos, int suggestionsLimit) {
@@ -99,7 +118,7 @@
                     offsets = new int[] { 2, 15, 20 };
                     lengths = new int[] { 4, 4, 4 };
                 } else {
-                    // Just a fake logic:
+                    // Just a mock logic:
                     // length <= 3 for short words that we assume are in the fake dictionary
                     // length > 20 for too long words that we assume can't be recognized
                     // (such as CJK words)