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

Commit c6f2b3b3 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Fix policy issues when screen is off. (DO NOT MERGE)" into gingerbread

parents 2dda21b9 eb9f7a01
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -544,16 +544,18 @@ public interface WindowManagerPolicy {
     * Generally, it's best to keep as little as possible in the queue thread
     * because it's the most fragile.
     * @param whenNanos The event time in uptime nanoseconds.
     * @param action The key event action.
     * @param flags The key event flags.
     * @param keyCode The key code.
     * @param down True if the key is down.
     * @param scanCode The key's scan code.
     * @param policyFlags The policy flags associated with the key.
     * @param isScreenOn True if the screen is already on
     *
     * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
     *          {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
     */
    public int interceptKeyBeforeQueueing(long whenNanos, int keyCode, boolean down, int policyFlags,
            boolean isScreenOn);
    public int interceptKeyBeforeQueueing(long whenNanos, int action, int flags,
            int keyCode, int scanCode, int policyFlags, boolean isScreenOn);
    
    /**
     * Called from the input dispatcher thread before a key is dispatched to a window.
@@ -571,6 +573,7 @@ public interface WindowManagerPolicy {
     * @param action The key event action.
     * @param flags The key event flags.
     * @param keyCode The key code.
     * @param scanCode The key's scan code.
     * @param metaState bit mask of meta keys that are held.
     * @param repeatCount Number of times a key down has repeated.
     * @param policyFlags The policy flags associated with the key.
@@ -578,7 +581,7 @@ public interface WindowManagerPolicy {
     * not be further dispatched.
     */
    public boolean interceptKeyBeforeDispatching(WindowState win, int action, int flags,
            int keyCode, int metaState, int repeatCount, int policyFlags);
            int keyCode, int scanCode, int metaState, int repeatCount, int policyFlags);

    /**
     * Called when layout of the windows is about to start.
+15 −1
Original line number Diff line number Diff line
@@ -1405,8 +1405,13 @@ String8 InputDispatcher::getApplicationWindowLabelLocked(const InputApplication*

void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
    int32_t eventType = POWER_MANAGER_BUTTON_EVENT;
    if (eventEntry->type == EventEntry::TYPE_MOTION) {
    switch (eventEntry->type) {
    case EventEntry::TYPE_MOTION: {
        const MotionEntry* motionEntry = static_cast<const MotionEntry*>(eventEntry);
        if (motionEntry->action == AMOTION_EVENT_ACTION_CANCEL) {
            return;
        }

        if (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) {
            switch (motionEntry->action) {
            case AMOTION_EVENT_ACTION_DOWN:
@@ -1424,6 +1429,15 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
                break;
            }
        }
        break;
    }
    case EventEntry::TYPE_KEY: {
        const KeyEntry* keyEntry = static_cast<const KeyEntry*>(eventEntry);
        if (keyEntry->flags & AKEY_EVENT_FLAG_CANCELED) {
            return;
        }
        break;
    }
    }

    CommandEntry* commandEntry = postCommandLocked(
+6 −1
Original line number Diff line number Diff line
@@ -333,8 +333,13 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
            mSelector.setRightHintText(mSilentMode ? R.string.lockscreen_sound_on_label
                    : R.string.lockscreen_sound_off_label);
        }
        // Don't poke the wake lock when returning to a state where the handle is
        // not grabbed since that can happen when the system (instead of the user)
        // cancels the grab.
        if (grabbedState != SlidingTab.OnTriggerListener.NO_HANDLE) {
            mCallback.pokeWakelock();
        }
    }

    /**
     * Displays a message in a text view and then restores the previous text.
+211 −235

File changed.

Preview size limit exceeded, changes collapsed.

+6 −5
Original line number Diff line number Diff line
@@ -379,17 +379,18 @@ public class InputManager {
        }
        
        @SuppressWarnings("unused")
        public int interceptKeyBeforeQueueing(long whenNanos, int keyCode, boolean down,
                int policyFlags, boolean isScreenOn) {
        public int interceptKeyBeforeQueueing(long whenNanos, int action, int flags,
                int keyCode, int scanCode, int policyFlags, boolean isScreenOn) {
            return mWindowManagerService.mInputMonitor.interceptKeyBeforeQueueing(
                    whenNanos, keyCode, down, policyFlags, isScreenOn);
                    whenNanos, action, flags, keyCode, scanCode, policyFlags, isScreenOn);
        }
        
        @SuppressWarnings("unused")
        public boolean interceptKeyBeforeDispatching(InputChannel focus, int action,
                int flags, int keyCode, int metaState, int repeatCount, int policyFlags) {
                int flags, int keyCode, int scanCode, int metaState, int repeatCount,
                int policyFlags) {
            return mWindowManagerService.mInputMonitor.interceptKeyBeforeDispatching(focus,
                    action, flags, keyCode, metaState, repeatCount, policyFlags);
                    action, flags, keyCode, scanCode, metaState, repeatCount, policyFlags);
        }
        
        @SuppressWarnings("unused")
Loading