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

Commit 4ddbed3d authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am de04d557: am 7c122b60: Merge "Use SystemClock time to keep track of last...

am de04d557: am 7c122b60: Merge "Use SystemClock time to keep track of last event times. (Bug 17995039)" into lmp-mr1-dev

* commit 'de04d557':
  Use SystemClock time to keep track of last event times. (Bug 17995039)
parents aba9abae de04d557
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Handler;
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Pair;
import android.view.LayoutInflater;
@@ -361,8 +362,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
        // If the user has toggled it too quickly, then just eat up the event here (it's better than
        // showing a janky screenshot).
        // NOTE: Ideally, the screenshot mechanism would take the window transform into account
        long currentTime = System.currentTimeMillis();
        if ((currentTime > mLastToggleTime) && (currentTime - mLastToggleTime) < sMinToggleDelay) {
        if ((SystemClock.elapsedRealtime() - mLastToggleTime) < sMinToggleDelay) {
            return;
        }

@@ -377,7 +377,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
            intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
                    Intent.FLAG_RECEIVER_FOREGROUND);
            mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
            mLastToggleTime = System.currentTimeMillis();
            mLastToggleTime = SystemClock.elapsedRealtime();
            return;
        } else {
            // Otherwise, start the recents activity
@@ -559,7 +559,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
                startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_HOME, stackVr);
            }
        }
        mLastToggleTime = System.currentTimeMillis();
        mLastToggleTime = SystemClock.elapsedRealtime();
    }

    /** Starts the recents activity */
+3 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Pair;
import android.view.KeyEvent;
@@ -564,13 +565,13 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_TAB: {
                boolean hasRepKeyTimeElapsed = (System.currentTimeMillis() -
                boolean hasRepKeyTimeElapsed = (SystemClock.elapsedRealtime() -
                        mLastTabKeyEventTime) > mConfig.altTabKeyDelay;
                if (event.getRepeatCount() <= 0 || hasRepKeyTimeElapsed) {
                    // Focus the next task in the stack
                    final boolean backward = event.isShiftPressed();
                    mRecentsView.focusNextTask(!backward);
                    mLastTabKeyEventTime = System.currentTimeMillis();
                    mLastTabKeyEventTime = SystemClock.elapsedRealtime();
                }
                return true;
            }