1 package com.android.layoutlib.bridge; 2 3 import com.android.layoutlib.bridge.util.ChoreographerCallbacks; 4 import com.android.layoutlib.bridge.util.HandlerMessageQueue; 5 import com.android.tools.layoutlib.annotations.NotNull; 6 7 import java.util.concurrent.atomic.AtomicLong; 8 9 public class SessionInteractiveData { 10 private final HandlerMessageQueue mHandlerMessageQueue = new HandlerMessageQueue(); 11 private final ChoreographerCallbacks mChoreographerCallbacks = new ChoreographerCallbacks(); 12 // Current system time 13 private final AtomicLong mNanosTime = new AtomicLong(System.nanoTime()); 14 // Time that the system booted up in nanos 15 private final AtomicLong mBootNanosTime = new AtomicLong(System.nanoTime()); 16 17 @NotNull getHandlerMessageQueue()18 public HandlerMessageQueue getHandlerMessageQueue() { 19 return mHandlerMessageQueue; 20 } 21 22 @NotNull getChoreographerCallbacks()23 public ChoreographerCallbacks getChoreographerCallbacks() { return mChoreographerCallbacks; } 24 setNanosTime(long nanos)25 public void setNanosTime(long nanos) { 26 mNanosTime.set(nanos); 27 } 28 getNanosTime()29 public long getNanosTime() { 30 return mNanosTime.get(); 31 } 32 setBootNanosTime(long nanos)33 public void setBootNanosTime(long nanos) { 34 mBootNanosTime.set(nanos); 35 } 36 getBootNanosTime()37 public long getBootNanosTime() { 38 return mBootNanosTime.get(); 39 } 40 dispose()41 public void dispose() { 42 mHandlerMessageQueue.clear(); 43 mChoreographerCallbacks.clear(); 44 } 45 } 46