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

Commit da3d5a91 authored by Jeff Brown's avatar Jeff Brown
Browse files

Support chorded fallback keys.

Also be more careful about canceling fallback keys during focus
transitions, when the application handles the key, or when the
policy decides to do something different.

Fixed a crash due to JNI CallObjectMethod returning an undefined
value (not null) when an exception is thrown.

Fixed a crash due to the policy trying to create a Dialog for
recent apps on the dispatcher thread.  It should happen on the
policy's Looper instead.

Bug: 4187302
Change-Id: I659a3fd1bd2325ed36d965f9beb75dacb89790c9
parent a2cc28d7
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -646,11 +646,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     * Create (if necessary) and launch the recent apps dialog
     */
    void showRecentAppsDialog() {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                if (mRecentAppsDialog == null) {
                    mRecentAppsDialog = new RecentApplicationsDialog(mContext);
                }
                mRecentAppsDialog.show();
            }
        });
    }

    /** {@inheritDoc} */
    public void init(Context context, IWindowManager windowManager,
@@ -1386,7 +1391,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
            return false;
        } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
            if (!down) {
            if (down && repeatCount == 0) {
                showRecentAppsDialog();
            }
            return true;
+179 −86

File changed.

Preview size limit exceeded, changes collapsed.

+42 −13

File changed.

Preview size limit exceeded, changes collapsed.

+6 −2
Original line number Diff line number Diff line
@@ -789,7 +789,9 @@ bool NativeInputManager::dispatchUnhandledKey(const sp<InputWindowHandle>& input
            jobject fallbackKeyEventObj = env->CallObjectMethod(mCallbacksObj,
                    gCallbacksClassInfo.dispatchUnhandledKey,
                    inputWindowHandleObj, keyEventObj, policyFlags);
            checkAndClearExceptionFromCallback(env, "dispatchUnhandledKey");
            if (checkAndClearExceptionFromCallback(env, "dispatchUnhandledKey")) {
                fallbackKeyEventObj = NULL;
            }
            android_view_KeyEvent_recycle(env, keyEventObj);
            env->DeleteLocalRef(keyEventObj);

@@ -820,7 +822,9 @@ bool NativeInputManager::checkInjectEventsPermissionNonReentrant(
    JNIEnv* env = jniEnv();
    jboolean result = env->CallBooleanMethod(mCallbacksObj,
            gCallbacksClassInfo.checkInjectEventsPermission, injectorPid, injectorUid);
    checkAndClearExceptionFromCallback(env, "checkInjectEventsPermission");
    if (checkAndClearExceptionFromCallback(env, "checkInjectEventsPermission")) {
        result = false;
    }
    return result;
}