am 7c122b60: Merge "Use SystemClock time to keep track of last event times. (Bug 17995039)" into lmp-mr1-dev
* commit '7c122b60b93c9ef4fa428bc142ea61bf4252b70b': Use SystemClock time to keep track of last event times. (Bug 17995039)
This commit is contained in:
@@ -32,6 +32,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.LayoutInflater;
|
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
|
// If the user has toggled it too quickly, then just eat up the event here (it's better than
|
||||||
// showing a janky screenshot).
|
// showing a janky screenshot).
|
||||||
// NOTE: Ideally, the screenshot mechanism would take the window transform into account
|
// NOTE: Ideally, the screenshot mechanism would take the window transform into account
|
||||||
long currentTime = System.currentTimeMillis();
|
if ((SystemClock.elapsedRealtime() - mLastToggleTime) < sMinToggleDelay) {
|
||||||
if ((currentTime > mLastToggleTime) && (currentTime - mLastToggleTime) < sMinToggleDelay) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
|
|||||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
|
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT |
|
||||||
Intent.FLAG_RECEIVER_FOREGROUND);
|
Intent.FLAG_RECEIVER_FOREGROUND);
|
||||||
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
|
mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT);
|
||||||
mLastToggleTime = System.currentTimeMillis();
|
mLastToggleTime = SystemClock.elapsedRealtime();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, start the recents activity
|
// Otherwise, start the recents activity
|
||||||
@@ -559,7 +559,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
|
|||||||
startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_HOME, stackVr);
|
startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_HOME, stackVr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mLastToggleTime = System.currentTimeMillis();
|
mLastToggleTime = SystemClock.elapsedRealtime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts the recents activity */
|
/** Starts the recents activity */
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -564,13 +565,13 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
|
|||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.KEYCODE_TAB: {
|
case KeyEvent.KEYCODE_TAB: {
|
||||||
boolean hasRepKeyTimeElapsed = (System.currentTimeMillis() -
|
boolean hasRepKeyTimeElapsed = (SystemClock.elapsedRealtime() -
|
||||||
mLastTabKeyEventTime) > mConfig.altTabKeyDelay;
|
mLastTabKeyEventTime) > mConfig.altTabKeyDelay;
|
||||||
if (event.getRepeatCount() <= 0 || hasRepKeyTimeElapsed) {
|
if (event.getRepeatCount() <= 0 || hasRepKeyTimeElapsed) {
|
||||||
// Focus the next task in the stack
|
// Focus the next task in the stack
|
||||||
final boolean backward = event.isShiftPressed();
|
final boolean backward = event.isShiftPressed();
|
||||||
mRecentsView.focusNextTask(!backward);
|
mRecentsView.focusNextTask(!backward);
|
||||||
mLastTabKeyEventTime = System.currentTimeMillis();
|
mLastTabKeyEventTime = SystemClock.elapsedRealtime();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user