File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
tools/layoutlib/bridge/src/android Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 3131 */
3232public class SystemClock_Delegate {
3333 private static long sBootTime = System .currentTimeMillis ();
34+ private static long sBootTimeNano = System .nanoTime ();
3435
3536 @ LayoutlibDelegate
3637 /*package*/ static boolean setCurrentTimeMillis (long millis ) {
@@ -59,6 +60,16 @@ public class SystemClock_Delegate {
5960 return System .currentTimeMillis () - sBootTime ;
6061 }
6162
63+ /**
64+ * Returns nanoseconds since boot, including time spent in sleep.
65+ *
66+ * @return elapsed nanoseconds since boot.
67+ */
68+ @ LayoutlibDelegate
69+ /*package*/ static long elapsedRealtimeNano () {
70+ return System .nanoTime () - sBootTimeNano ;
71+ }
72+
6273 /**
6374 * Returns milliseconds running in the current thread.
6475 *
Original file line number Diff line number Diff line change @@ -91,4 +91,42 @@ private FloatMath_Delegate() {}
9191 /*package*/ static float sqrt (float value ) {
9292 return (float )Math .sqrt (value );
9393 }
94+
95+ /**
96+ * Returns the closest float approximation of the raising "e" to the power
97+ * of the argument.
98+ *
99+ * @param value to compute the exponential of
100+ * @return the exponential of value
101+ */
102+ @ LayoutlibDelegate
103+ /*package*/ static float exp (float value ) {
104+ return (float )Math .exp (value );
105+ }
106+
107+ /**
108+ * Returns the closest float approximation of the result of raising {@code
109+ * x} to the power of {@code y}.
110+ *
111+ * @param x the base of the operation.
112+ * @param y the exponent of the operation.
113+ * @return {@code x} to the power of {@code y}.
114+ */
115+ @ LayoutlibDelegate
116+ /*package*/ static float pow (float x , float y ) {
117+ return (float )Math .pow (x , y );
118+ }
119+
120+ /**
121+ * Returns {@code sqrt(}<i>{@code x}</i><sup>{@code 2}</sup>{@code +} <i>
122+ * {@code y}</i><sup>{@code 2}</sup>{@code )}.
123+ *
124+ * @param x a float number
125+ * @param y a float number
126+ * @return the hypotenuse
127+ */
128+ @ LayoutlibDelegate
129+ /*package*/ static float hypot (float x , float y ) {
130+ return (float )Math .sqrt (x *x + y *y );
131+ }
94132}
You can’t perform that action at this time.
0 commit comments