Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fde7efd8 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Add private constructor to utility classes

Bug: 6129704
Change-Id: I52925ae7bd80683f63efc48649448865a5654f41
parent d2c5533f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -21,12 +21,16 @@ import android.view.inputmethod.EditorInfo;
import java.lang.reflect.Field;

public class EditorInfoCompatUtils {
    // EditorInfo.IME_FLAG_FORCE_ASCII has been introduced since API#16 (JellyBean).
    private static final Field FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(
            EditorInfo.class, "IME_FLAG_FORCE_ASCII");
    private static final Integer OBJ_IME_FLAG_FORCE_ASCII = (Integer) CompatUtils
            .getFieldValue(null, null, FIELD_IME_FLAG_FORCE_ASCII);

    // EditorInfo.IME_FLAG_FORCE_ASCII has been introduced since API#16 (JellyBean).
    private EditorInfoCompatUtils() {
        // This utility class is not publicly instantiable.
    }

    public static boolean hasFlagForceAscii(int imeOptions) {
        if (OBJ_IME_FLAG_FORCE_ASCII == null)
            return false;
+4 −0
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ public class InputMethodManagerCompatWrapper {

    private InputMethodManager mImm;

    private InputMethodManagerCompatWrapper() {
        // This wrapper class is not publicly instantiable.
    }

    public static InputMethodManagerCompatWrapper getInstance() {
        if (sInstance.mImm == null)
            Log.w(TAG, "getInstance() is called before initialization");
+4 −0
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ public class SuggestionSpanUtils {
        }
    }

    private SuggestionSpanUtils() {
        // This utility class is not publicly instantiable.
    }

    public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(
            Context context, CharSequence text) {
        if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ public class SuggestionsInfoCompatUtils {
                    ? OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS : 0;

    private SuggestionsInfoCompatUtils() {
        // This utility class is not publicly instantiable.
    }

    /**