From b6ca354431367b625daf9fff5fbe4b1f5ef996ab Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sun, 6 Jan 2013 11:10:27 +0900 Subject: Small code cleanups Multi-project commit with I249d5fbe Change-Id: Ia28c4e970992aa1299a30e604eaa5d096655c3a5 --- .../inputmethod/compat/SuggestionsInfoCompatUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'java/src/com/android/inputmethod/compat/SuggestionsInfoCompatUtils.java') diff --git a/java/src/com/android/inputmethod/compat/SuggestionsInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/SuggestionsInfoCompatUtils.java index 8314212c9..d8d2be04c 100644 --- a/java/src/com/android/inputmethod/compat/SuggestionsInfoCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/SuggestionsInfoCompatUtils.java @@ -21,10 +21,13 @@ import android.view.textservice.SuggestionsInfo; import java.lang.reflect.Field; public final class SuggestionsInfoCompatUtils { - private static final Field FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = CompatUtils.getField( - SuggestionsInfo.class, "RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS"); - private static final Integer OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = (Integer) CompatUtils - .getFieldValue(null, null, FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS); + // Note that SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS has been introduced + // in API level 15 (Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1). + private static final Field FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = + CompatUtils.getField(SuggestionsInfo.class, "RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS"); + private static final Integer OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = + (Integer) CompatUtils.getFieldValue(null /* receiver */, null /* defaultValue */, + FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS); private static final int RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS != null ? OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS : 0; -- cgit v1.2.3-83-g751a