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

Commit 1a542c7b authored by Joe Onorato's avatar Joe Onorato
Browse files

The CHEEK_TOUCH stuff never worked. Remove it.

Bug: 3104906
Change-Id: Ia37236ba1775fc3ec8c111e2e0b85b105e0dea6a
parent 3915bb84
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -21,18 +21,13 @@ public interface LocalPowerManager {
    // Note: be sure to update BatteryStats if adding or modifying event constants.
    
    public static final int OTHER_EVENT = 0;
    public static final int CHEEK_EVENT = 1;
    public static final int TOUCH_EVENT = 2;  // touch events are TOUCH for 300ms, and then either
                                              // up events or LONG_TOUCH events.
    public static final int LONG_TOUCH_EVENT = 3;
    public static final int TOUCH_UP_EVENT = 4;
    public static final int BUTTON_EVENT = 5;  // Button and trackball events.

    public static final int POKE_LOCK_IGNORE_CHEEK_EVENTS = 0x1;
    public static final int BUTTON_EVENT = 1;
    public static final int TOUCH_EVENT = 2;

    public static final int POKE_LOCK_IGNORE_TOUCH_EVENTS = 0x1;

    public static final int POKE_LOCK_SHORT_TIMEOUT = 0x2;
    public static final int POKE_LOCK_MEDIUM_TIMEOUT = 0x4;
    public static final int POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS = 0x8;

    public static final int POKE_LOCK_TIMEOUT_MASK = 0x6;

    void goToSleep(long time);
+3 −7
Original line number Diff line number Diff line
@@ -22,14 +22,10 @@ namespace android {

enum {
    POWER_MANAGER_OTHER_EVENT = 0,
    POWER_MANAGER_CHEEK_EVENT = 1,
    POWER_MANAGER_TOUCH_EVENT = 2, // touch events are TOUCH for 300ms, and then either
                                   // up events or LONG_TOUCH events.
    POWER_MANAGER_LONG_TOUCH_EVENT = 3,
    POWER_MANAGER_TOUCH_UP_EVENT = 4,
    POWER_MANAGER_BUTTON_EVENT = 5, // Button and trackball events.
    POWER_MANAGER_BUTTON_EVENT = 1,
    POWER_MANAGER_TOUCH_EVENT = 2,

    POWER_MANAGER_LAST_EVENT = POWER_MANAGER_BUTTON_EVENT, // Last valid event code.
    POWER_MANAGER_LAST_EVENT = POWER_MANAGER_TOUCH_EVENT, // Last valid event code.
};

} // namespace android
+1 −18
Original line number Diff line number Diff line
@@ -51,9 +51,6 @@

namespace android {

// Delay before reporting long touch events to the power manager.
const nsecs_t LONG_TOUCH_DELAY = 300 * 1000000LL; // 300 ms

// Default input dispatching timeout if there is no focused application or paused window
// from which to determine an appropriate dispatching timeout.
const nsecs_t DEFAULT_INPUT_DISPATCHING_TIMEOUT = 5000 * 1000000LL; // 5 sec
@@ -1416,21 +1413,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
        }

        if (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) {
            switch (motionEntry->action) {
            case AMOTION_EVENT_ACTION_DOWN:
            eventType = POWER_MANAGER_TOUCH_EVENT;
                break;
            case AMOTION_EVENT_ACTION_UP:
                eventType = POWER_MANAGER_TOUCH_UP_EVENT;
                break;
            default:
                if (motionEntry->eventTime - motionEntry->downTime < LONG_TOUCH_DELAY) {
                    eventType = POWER_MANAGER_TOUCH_EVENT;
                } else {
                    eventType = POWER_MANAGER_LONG_TOUCH_EVENT;
                }
                break;
            }
        }
        break;
    }
+3 −23
Original line number Diff line number Diff line
@@ -1175,10 +1175,8 @@ class PowerManagerService extends IPowerManager.Stub
            pw.println("mPokeLocks.size=" + mPokeLocks.size() + ":");
            for (PokeLock p: mPokeLocks.values()) {
                pw.println("    poke lock '" + p.tag + "':"
                        + ((p.pokey & POKE_LOCK_IGNORE_CHEEK_EVENTS) != 0
                                ? " POKE_LOCK_IGNORE_CHEEK_EVENTS" : "")
                        + ((p.pokey & POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS) != 0
                                ? " POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS" : "")
                        + ((p.pokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0
                                ? " POKE_LOCK_IGNORE_TOUCH_EVENTS" : "")
                        + ((p.pokey & POKE_LOCK_SHORT_TIMEOUT) != 0
                                ? " POKE_LOCK_SHORT_TIMEOUT" : "")
                        + ((p.pokey & POKE_LOCK_MEDIUM_TIMEOUT) != 0
@@ -2218,31 +2216,13 @@ class PowerManagerService extends IPowerManager.Stub
    private void userActivity(long time, long timeoutOverride, boolean noChangeLights,
            int eventType, boolean force) {

        if (((mPokey & POKE_LOCK_IGNORE_CHEEK_EVENTS) != 0)
                && (eventType == CHEEK_EVENT)) {
            if (false) {
                Slog.d(TAG, "dropping cheek event mPokey=0x" + Integer.toHexString(mPokey));
            }
            return;
        }

        if (((mPokey & POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS) != 0)
                && (eventType == TOUCH_EVENT || eventType == TOUCH_UP_EVENT
                    || eventType == LONG_TOUCH_EVENT || eventType == CHEEK_EVENT)) {
        if (((mPokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0) && (eventType == TOUCH_EVENT)) {
            if (false) {
                Slog.d(TAG, "dropping touch mPokey=0x" + Integer.toHexString(mPokey));
            }
            return;
        }

        if (false) {
            if (((mPokey & POKE_LOCK_IGNORE_CHEEK_EVENTS) != 0)) {
                Slog.d(TAG, "userActivity !!!");//, new RuntimeException());
            } else {
                Slog.d(TAG, "mPokey=0x" + Integer.toHexString(mPokey));
            }
        }

        synchronized (mLocks) {
            if (mSpew) {
                Slog.d(TAG, "userActivity mLastEventTime=" + mLastEventTime + " time=" + time
+4 −24
Original line number Diff line number Diff line
@@ -81,9 +81,9 @@ public class PowerTest extends TestActivity
                mProx.release(PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE);
            }
        },
        new Test("Cheek events don't poke") {
        new Test("Touch events don't poke") {
            public void run() {
                mPokeState |= LocalPowerManager.POKE_LOCK_IGNORE_CHEEK_EVENTS;
                mPokeState |= LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_EVENTS;
                try {
                    mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG);
                } catch (RemoteException e) {
@@ -92,29 +92,9 @@ public class PowerTest extends TestActivity
            }
        },

        new Test("Cheek events poke") {
        new Test("Touch events poke") {
            public void run() {
                mPokeState &= ~LocalPowerManager.POKE_LOCK_IGNORE_CHEEK_EVENTS;
                try {
                    mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG);
                } catch (RemoteException e) {
                    throw new RuntimeException(e);
                }
            }
        },
        new Test("Touch and Cheek events don't poke") {
            public void run() {
                mPokeState |= LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS;
                try {
                    mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG);
                } catch (RemoteException e) {
                    throw new RuntimeException(e);
                }
            }
        },
        new Test("Touch and Cheek events poke") {
            public void run() {
                mPokeState &= ~LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_AND_CHEEK_EVENTS;
                mPokeState &= ~LocalPowerManager.POKE_LOCK_IGNORE_TOUCH_EVENTS;
                try {
                    mPowerManager.setPokeLock(mPokeState, mPokeToken, TAG);
                } catch (RemoteException e) {