Tracker { public void setSessionTimeout(int milliseconds) { synchronized (mTrackingLock) { mSessionTimeout = milliseconds; } } protected  Tracker(Matomo matomo, TrackerBuilder config); void addTrackingCallback(Callback callback); void removeTrackingCallback(Callback callback); void setOptOut(boolean optOut); boolean isOptOut(); String getName(); Matomo getMatomo(); String getAPIUrl(); TrackMe getDefaultTrackMe(); void startNewSession(); void setSessionTimeout(int milliseconds); long getSessionTimeout(); int getDispatchTimeout(); void setDispatchTimeout(int timeout); void dispatch(); void dispatchBlocking(); Tracker setDispatchInterval(long dispatchInterval); Tracker setDispatchGzipped(boolean dispatchGzipped); long getDispatchInterval(); void setOfflineCacheAge(long age); long getOfflineCacheAge(); void setOfflineCacheSize(long size); long getOfflineCacheSize(); DispatchMode getDispatchMode(); void setDispatchMode(DispatchMode mode); Tracker setUserId(String userId); String getUserId(); Tracker setVisitorId(String visitorId); String getVisitorId(); Tracker track(TrackMe trackMe); static String makeRandomVisitorId(); SharedPreferences getPreferences(); @Override boolean equals(Object o); @Override int hashCode(); @VisibleForTesting TrackMe getLastEventX(); void setDryRunTarget(List<Packet> dryRunTarget); List<Packet> getDryRunTarget();  }
@Test public void testSetSessionTimeout() { Tracker tracker = new Tracker(mMatomo, mTrackerBuilder); tracker.setSessionTimeout(10000); TrackHelper.track().screen("test1").with(tracker); assertThat(tracker.getLastEventX().get(QueryParams.SESSION_START), notNullValue()); TrackHelper.track().screen("test2").with(tracker); assertThat(tracker.getLastEventX().get(QueryParams.SESSION_START), nullValue()); tracker.setSessionTimeout(0); TestHelper.sleep(1); TrackHelper.track().screen("test3").with(tracker); assertThat(tracker.getLastEventX().get(QueryParams.SESSION_START), notNullValue()); tracker.setSessionTimeout(10000); assertEquals(tracker.getSessionTimeout(), 10000); TrackHelper.track().screen("test3").with(tracker); assertThat(tracker.getLastEventX().get(QueryParams.SESSION_START), nullValue()); }