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

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

Fix NPE by disabling key preview popup of Emoji palette

Bug: 15579928
Change-Id: I6bcf885f2c1aa37b337a85978409ccf41e459c2a
parent 89899e14
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -195,7 +195,8 @@ public class Key implements Comparable<Key> {
        mHintLabel = hintLabel;
        mHintLabel = hintLabel;
        mLabelFlags = labelFlags;
        mLabelFlags = labelFlags;
        mBackgroundType = backgroundType;
        mBackgroundType = backgroundType;
        mActionFlags = 0;
        // TODO: Pass keyActionFlags as an argument.
        mActionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
        mMoreKeys = null;
        mMoreKeys = null;
        mMoreKeysColumnAndFlags = 0;
        mMoreKeysColumnAndFlags = 0;
        mLabel = label;
        mLabel = label;
+6 −6
Original line number Original line Diff line number Diff line
@@ -446,15 +446,15 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack


    @Override
    @Override
    public void showKeyPreview(final Key key) {
    public void showKeyPreview(final Key key) {
        // If key is invalid or IME is already closed, we must not show key preview.
        // If the key is invalid or has no key preview, we must not show key preview.
        // Trying to show key preview while root window is closed causes
        if (key == null || key.noKeyPreview()) {
        // WindowManager.BadTokenException.
        if (key == null) {
            return;
            return;
        }
        }

        final KeyPreviewDrawParams previewParams = mKeyPreviewDrawParams;
        final Keyboard keyboard = getKeyboard();
        final Keyboard keyboard = getKeyboard();
        if (keyboard == null) {
            return;
        }
        final KeyPreviewDrawParams previewParams = mKeyPreviewDrawParams;
        if (!previewParams.isPopupEnabled()) {
        if (!previewParams.isPopupEnabled()) {
            previewParams.setVisibleOffset(-keyboard.mVerticalGap);
            previewParams.setVisibleOffset(-keyboard.mVerticalGap);
            return;
            return;
+1 −0
Original line number Original line Diff line number Diff line
@@ -444,6 +444,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
                    continue;
                    continue;
                }
                }
                final int labelFlags = row.getDefaultKeyLabelFlags();
                final int labelFlags = row.getDefaultKeyLabelFlags();
                // TODO: Should be able to assign default keyActionFlags as well.
                final int backgroundType = row.getDefaultBackgroundType();
                final int backgroundType = row.getDefaultBackgroundType();
                final int x = (int)row.getKeyX(null);
                final int x = (int)row.getKeyX(null);
                final int y = row.getKeyY();
                final int y = row.getKeyY();
+1 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ public final class KeyboardRow {


    private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();
    private final ArrayDeque<RowAttributes> mRowAttributesStack = new ArrayDeque<>();


    // TODO: Add keyActionFlags.
    private static class RowAttributes {
    private static class RowAttributes {
        /** Default width of a key in this row. */
        /** Default width of a key in this row. */
        public final float mDefaultKeyWidth;
        public final float mDefaultKeyWidth;