List of usage examples for android.os SystemClock uptimeMillis
@CriticalNative native public static long uptimeMillis();
From source file:net.hoodalabs.cordova.plugins.touchevent.HoodalabsTouchEvent.java
@Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if ("fireAt".equals(action)) { final float x = args.getInt(0); final float y = args.getInt(1); // List of meta states found here: developer.android.com/reference/android/view/KeyEvent.html#getMetaState() final int metaState = 0; final long timestamp = SystemClock.uptimeMillis(); MotionEvent touchStart = MotionEvent.obtain(timestamp, timestamp + 50, MotionEvent.ACTION_DOWN, x, y, metaState);//from w ww . ja va 2s .com touchStart.setSource(InputDevice.SOURCE_TOUCHSCREEN); webView.dispatchTouchEvent(touchStart); MotionEvent touchEnd = MotionEvent.obtain(timestamp + 50, timestamp + 100, MotionEvent.ACTION_UP, x, y, metaState); touchEnd.setSource(InputDevice.SOURCE_TOUCHSCREEN); webView.dispatchTouchEvent(touchEnd); callbackContext.success(); // Thread-safe. return true; } return false; }
From source file:com.android.screenspeak.PasteHistory.java
/** * Stores the finish time for a paste action. This should be called immediately after * {@link AccessibilityNodeInfoCompat#performAction}. *//*w w w . j a v a2 s.c o m*/ public void after() { mFinishTime = SystemClock.uptimeMillis(); }
From source file:com.android.talkback.EditTextActionHistory.java
/** * Stores the start time for a cut action. This should be called immediately before * {@link AccessibilityNodeInfoCompat#performAction}. *//*from w w w . j av a 2 s.c o m*/ public void beforeCut() { mCutStartTime = SystemClock.uptimeMillis(); }
From source file:org.mycard.net.network.IdleCache.java
/*** * Caches connection, if there is room./* www.j a va2 s.co m*/ * @return true if connection cached */ synchronized boolean cacheConnection(HttpHost host, Connection connection) { boolean ret = false; //if (HttpLog.LOGV) { // HttpLog.v("IdleCache size " + mCount + " host " + host); //} if (mCount < IDLE_CACHE_MAX) { long time = SystemClock.uptimeMillis(); for (int i = 0; i < IDLE_CACHE_MAX; i++) { Entry entry = mEntries[i]; if (entry.mHost == null) { entry.mHost = host; entry.mConnection = connection; entry.mTimeout = time + TIMEOUT; mCount++; ret = true; if (mThread == null) { mThread = new IdleReaper(); mThread.start(); } break; } } } return ret; }
From source file:org.kontalk.ui.AudioFragment.java
public void startRecording() throws IOException { mStartTime = SystemClock.uptimeMillis(); MediaRecorder recorder = getRecorder(); recorder.prepare();//from w w w. j a va 2 s. co m recorder.start(); acquireLock(); }
From source file:android.net.http.IdleCache.java
/** * Caches connection, if there is room.//from ww w . java 2 s. co m * @return true if connection cached */ synchronized boolean cacheConnection(HttpHost host, Connection connection) { boolean ret = false; if (HttpLog.LOGV) { HttpLog.v("IdleCache size " + mCount + " host " + host); } if (mCount < IDLE_CACHE_MAX) { long time = SystemClock.uptimeMillis(); for (int i = 0; i < IDLE_CACHE_MAX; i++) { Entry entry = mEntries[i]; if (entry.mHost == null) { entry.mHost = host; entry.mConnection = connection; entry.mTimeout = time + TIMEOUT; mCount++; if (HttpLog.LOGV) mCached++; ret = true; if (mThread == null) { mThread = new IdleReaper(); mThread.start(); } break; } } } return ret; }
From source file:br.com.cybereagle.androidtestlibrary.shadow.ShadowAsyncTaskLoader.java
private void updateLastLoadCompleteTimeField() { try {/*from w w w .j ava 2s .c om*/ Field mLastLoadCompleteTimeField = AsyncTaskLoader.class.getDeclaredField("mLastLoadCompleteTimeField"); if (!mLastLoadCompleteTimeField.isAccessible()) { mLastLoadCompleteTimeField.setAccessible(true); } mLastLoadCompleteTimeField.set(asyncTaskLoader, SystemClock.uptimeMillis()); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
From source file:com.android.talkback.EditTextActionHistory.java
/** * Stores the finish time for a cut action. This should be called immediately after * {@link AccessibilityNodeInfoCompat#performAction}. */// w ww . ja v a 2s. c o m public void afterCut() { mCutFinishTime = SystemClock.uptimeMillis(); }
From source file:com.google.android.marvin.mytalkback.ActionHistory.java
/** * Stores the finish time for an action. This should be called immediately * after {@link AccessibilityNodeInfoCompat#performAction}. * * @param action The action that was performed. *//*from w w w . j a v a2s .co m*/ public void after(int action) { mActionFinishMap.put(action, SystemClock.uptimeMillis()); }
From source file:org.kontalk.ui.AudioFragment.java
public long getElapsedTime() { return mStartTime > 0 ? SystemClock.uptimeMillis() - mStartTime : 0; }