1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package java.lang; 28 29 import android.compat.annotation.UnsupportedAppUsage; 30 31 @SuppressWarnings({"unchecked", "deprecation", "all"}) 32 public class Thread implements java.lang.Runnable { 33 Thread()34 public Thread() { 35 throw new RuntimeException("Stub!"); 36 } 37 Thread(java.lang.Runnable target)38 public Thread(java.lang.Runnable target) { 39 throw new RuntimeException("Stub!"); 40 } 41 Thread(java.lang.Runnable target, java.security.AccessControlContext acc)42 Thread(java.lang.Runnable target, java.security.AccessControlContext acc) { 43 throw new RuntimeException("Stub!"); 44 } 45 Thread(java.lang.ThreadGroup group, java.lang.Runnable target)46 public Thread(java.lang.ThreadGroup group, java.lang.Runnable target) { 47 throw new RuntimeException("Stub!"); 48 } 49 Thread(java.lang.String name)50 public Thread(java.lang.String name) { 51 throw new RuntimeException("Stub!"); 52 } 53 Thread(java.lang.ThreadGroup group, java.lang.String name)54 public Thread(java.lang.ThreadGroup group, java.lang.String name) { 55 throw new RuntimeException("Stub!"); 56 } 57 58 @UnsupportedAppUsage Thread(java.lang.ThreadGroup group, java.lang.String name, int priority, boolean daemon)59 Thread(java.lang.ThreadGroup group, java.lang.String name, int priority, boolean daemon) { 60 throw new RuntimeException("Stub!"); 61 } 62 Thread(java.lang.Runnable target, java.lang.String name)63 public Thread(java.lang.Runnable target, java.lang.String name) { 64 throw new RuntimeException("Stub!"); 65 } 66 Thread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)67 public Thread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name) { 68 throw new RuntimeException("Stub!"); 69 } 70 Thread( java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name, long stackSize)71 public Thread( 72 java.lang.ThreadGroup group, 73 java.lang.Runnable target, 74 java.lang.String name, 75 long stackSize) { 76 throw new RuntimeException("Stub!"); 77 } 78 nextThreadNum()79 private static synchronized int nextThreadNum() { 80 throw new RuntimeException("Stub!"); 81 } 82 nextThreadID()83 private static synchronized long nextThreadID() { 84 throw new RuntimeException("Stub!"); 85 } 86 blockedOn(sun.nio.ch.Interruptible b)87 public void blockedOn(sun.nio.ch.Interruptible b) { 88 throw new RuntimeException("Stub!"); 89 } 90 currentThread()91 public static native java.lang.Thread currentThread(); 92 yield()93 public static native void yield(); 94 sleep(long millis)95 public static void sleep(long millis) throws java.lang.InterruptedException { 96 throw new RuntimeException("Stub!"); 97 } 98 sleep(java.lang.Object lock, long millis, int nanos)99 private static native void sleep(java.lang.Object lock, long millis, int nanos) 100 throws java.lang.InterruptedException; 101 sleep(long millis, int nanos)102 public static void sleep(long millis, int nanos) throws java.lang.InterruptedException { 103 throw new RuntimeException("Stub!"); 104 } 105 init( java.lang.ThreadGroup g, java.lang.Runnable target, java.lang.String name, long stackSize)106 private void init( 107 java.lang.ThreadGroup g, 108 java.lang.Runnable target, 109 java.lang.String name, 110 long stackSize) { 111 throw new RuntimeException("Stub!"); 112 } 113 init( java.lang.ThreadGroup g, java.lang.Runnable target, java.lang.String name, long stackSize, java.security.AccessControlContext acc)114 private void init( 115 java.lang.ThreadGroup g, 116 java.lang.Runnable target, 117 java.lang.String name, 118 long stackSize, 119 java.security.AccessControlContext acc) { 120 throw new RuntimeException("Stub!"); 121 } 122 clone()123 protected java.lang.Object clone() throws java.lang.CloneNotSupportedException { 124 throw new RuntimeException("Stub!"); 125 } 126 init2(java.lang.Thread parent)127 private void init2(java.lang.Thread parent) { 128 throw new RuntimeException("Stub!"); 129 } 130 start()131 public synchronized void start() { 132 throw new RuntimeException("Stub!"); 133 } 134 nativeCreate(java.lang.Thread t, long stackSize, boolean daemon)135 private static native void nativeCreate(java.lang.Thread t, long stackSize, boolean daemon); 136 run()137 public void run() { 138 throw new RuntimeException("Stub!"); 139 } 140 exit()141 private void exit() { 142 throw new RuntimeException("Stub!"); 143 } 144 145 @Deprecated stop()146 public final void stop() { 147 throw new RuntimeException("Stub!"); 148 } 149 150 @Deprecated stop(java.lang.Throwable obj)151 public final synchronized void stop(java.lang.Throwable obj) { 152 throw new RuntimeException("Stub!"); 153 } 154 interrupt()155 public void interrupt() { 156 throw new RuntimeException("Stub!"); 157 } 158 interrupted()159 public static native boolean interrupted(); 160 isInterrupted()161 public native boolean isInterrupted(); 162 163 @Deprecated destroy()164 public void destroy() { 165 throw new RuntimeException("Stub!"); 166 } 167 isAlive()168 public final boolean isAlive() { 169 throw new RuntimeException("Stub!"); 170 } 171 172 @Deprecated suspend()173 public final void suspend() { 174 throw new RuntimeException("Stub!"); 175 } 176 177 @Deprecated resume()178 public final void resume() { 179 throw new RuntimeException("Stub!"); 180 } 181 setPriority(int newPriority)182 public final void setPriority(int newPriority) { 183 throw new RuntimeException("Stub!"); 184 } 185 getPriority()186 public final int getPriority() { 187 throw new RuntimeException("Stub!"); 188 } 189 setName(java.lang.String name)190 public final synchronized void setName(java.lang.String name) { 191 throw new RuntimeException("Stub!"); 192 } 193 getName()194 public final java.lang.String getName() { 195 throw new RuntimeException("Stub!"); 196 } 197 getThreadGroup()198 public final java.lang.ThreadGroup getThreadGroup() { 199 throw new RuntimeException("Stub!"); 200 } 201 activeCount()202 public static int activeCount() { 203 throw new RuntimeException("Stub!"); 204 } 205 enumerate(java.lang.Thread[] tarray)206 public static int enumerate(java.lang.Thread[] tarray) { 207 throw new RuntimeException("Stub!"); 208 } 209 210 @Deprecated countStackFrames()211 public int countStackFrames() { 212 throw new RuntimeException("Stub!"); 213 } 214 join(long millis)215 public final void join(long millis) throws java.lang.InterruptedException { 216 throw new RuntimeException("Stub!"); 217 } 218 join(long millis, int nanos)219 public final void join(long millis, int nanos) throws java.lang.InterruptedException { 220 throw new RuntimeException("Stub!"); 221 } 222 join()223 public final void join() throws java.lang.InterruptedException { 224 throw new RuntimeException("Stub!"); 225 } 226 dumpStack()227 public static void dumpStack() { 228 throw new RuntimeException("Stub!"); 229 } 230 setDaemon(boolean on)231 public final void setDaemon(boolean on) { 232 throw new RuntimeException("Stub!"); 233 } 234 isDaemon()235 public final boolean isDaemon() { 236 throw new RuntimeException("Stub!"); 237 } 238 checkAccess()239 public final void checkAccess() { 240 throw new RuntimeException("Stub!"); 241 } 242 toString()243 public java.lang.String toString() { 244 throw new RuntimeException("Stub!"); 245 } 246 getContextClassLoader()247 public java.lang.ClassLoader getContextClassLoader() { 248 throw new RuntimeException("Stub!"); 249 } 250 setContextClassLoader(java.lang.ClassLoader cl)251 public void setContextClassLoader(java.lang.ClassLoader cl) { 252 throw new RuntimeException("Stub!"); 253 } 254 holdsLock(java.lang.Object obj)255 public static native boolean holdsLock(java.lang.Object obj); 256 getStackTrace()257 public java.lang.StackTraceElement[] getStackTrace() { 258 throw new RuntimeException("Stub!"); 259 } 260 261 public static java.util.Map<java.lang.Thread, java.lang.StackTraceElement[]> getAllStackTraces()262 getAllStackTraces() { 263 throw new RuntimeException("Stub!"); 264 } 265 isCCLOverridden(java.lang.Class<?> cl)266 private static boolean isCCLOverridden(java.lang.Class<?> cl) { 267 throw new RuntimeException("Stub!"); 268 } 269 auditSubclass(java.lang.Class<?> subcl)270 private static boolean auditSubclass(java.lang.Class<?> subcl) { 271 throw new RuntimeException("Stub!"); 272 } 273 getId()274 public long getId() { 275 throw new RuntimeException("Stub!"); 276 } 277 getState()278 public java.lang.Thread.State getState() { 279 throw new RuntimeException("Stub!"); 280 } 281 setDefaultUncaughtExceptionHandler( java.lang.Thread.UncaughtExceptionHandler eh)282 public static void setDefaultUncaughtExceptionHandler( 283 java.lang.Thread.UncaughtExceptionHandler eh) { 284 throw new RuntimeException("Stub!"); 285 } 286 getDefaultUncaughtExceptionHandler()287 public static java.lang.Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler() { 288 throw new RuntimeException("Stub!"); 289 } 290 setUncaughtExceptionPreHandler( java.lang.Thread.UncaughtExceptionHandler eh)291 public static void setUncaughtExceptionPreHandler( 292 java.lang.Thread.UncaughtExceptionHandler eh) { 293 throw new RuntimeException("Stub!"); 294 } 295 296 @UnsupportedAppUsage getUncaughtExceptionPreHandler()297 public static java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionPreHandler() { 298 throw new RuntimeException("Stub!"); 299 } 300 getUncaughtExceptionHandler()301 public java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() { 302 throw new RuntimeException("Stub!"); 303 } 304 setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler eh)305 public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler eh) { 306 throw new RuntimeException("Stub!"); 307 } 308 309 @UnsupportedAppUsage dispatchUncaughtException(java.lang.Throwable e)310 public final void dispatchUncaughtException(java.lang.Throwable e) { 311 throw new RuntimeException("Stub!"); 312 } 313 processQueue( java.lang.ref.ReferenceQueue<java.lang.Class<?>> queue, java.util.concurrent.ConcurrentMap< ? extends java.lang.ref.WeakReference<java.lang.Class<?>>, ?> map)314 static void processQueue( 315 java.lang.ref.ReferenceQueue<java.lang.Class<?>> queue, 316 java.util.concurrent.ConcurrentMap< 317 ? extends java.lang.ref.WeakReference<java.lang.Class<?>>, ?> 318 map) { 319 throw new RuntimeException("Stub!"); 320 } 321 setPriority0(int newPriority)322 private native void setPriority0(int newPriority); 323 interrupt0()324 private native void interrupt0(); 325 setNativeName(java.lang.String name)326 private native void setNativeName(java.lang.String name); 327 nativeGetStatus(boolean hasBeenStarted)328 private native int nativeGetStatus(boolean hasBeenStarted); 329 unpark$()330 public final void unpark$() { 331 throw new RuntimeException("Stub!"); 332 } 333 parkFor$(long nanos)334 public final void parkFor$(long nanos) { 335 throw new RuntimeException("Stub!"); 336 } 337 parkUntil$(long time)338 public final void parkUntil$(long time) { 339 throw new RuntimeException("Stub!"); 340 } 341 342 private static final java.lang.StackTraceElement[] EMPTY_STACK_TRACE; 343 344 static { 345 EMPTY_STACK_TRACE = new java.lang.StackTraceElement[0]; 346 } 347 348 public static final int MAX_PRIORITY = 10; // 0xa 349 350 public static final int MIN_PRIORITY = 1; // 0x1 351 352 private static final int NANOS_PER_MILLI = 1000000; // 0xf4240 353 354 public static final int NORM_PRIORITY = 5; // 0x5 355 356 private static final java.lang.RuntimePermission SUBCLASS_IMPLEMENTATION_PERMISSION; 357 358 static { 359 SUBCLASS_IMPLEMENTATION_PERMISSION = null; 360 } 361 362 private volatile sun.nio.ch.Interruptible blocker; 363 364 private final java.lang.Object blockerLock; 365 366 { 367 blockerLock = null; 368 } 369 370 @UnsupportedAppUsage 371 private java.lang.ClassLoader contextClassLoader; 372 373 @UnsupportedAppUsage 374 private boolean daemon = false; 375 376 private static volatile java.lang.Thread.UncaughtExceptionHandler 377 defaultUncaughtExceptionHandler; 378 379 private long eetop; 380 381 @UnsupportedAppUsage 382 private java.lang.ThreadGroup group; 383 384 @UnsupportedAppUsage 385 java.lang.ThreadLocal.ThreadLocalMap inheritableThreadLocals; 386 387 @UnsupportedAppUsage 388 private java.security.AccessControlContext inheritedAccessControlContext; 389 390 @UnsupportedAppUsage 391 private final java.lang.Object lock; 392 393 { 394 lock = null; 395 } 396 397 @UnsupportedAppUsage 398 private volatile java.lang.String name; 399 400 private long nativeParkEventPointer; 401 402 @UnsupportedAppUsage 403 private volatile long nativePeer; 404 405 @UnsupportedAppUsage 406 volatile java.lang.Object parkBlocker; 407 408 private int parkState = 1; // 0x1 409 410 @UnsupportedAppUsage 411 private int priority; 412 413 private boolean single_step; 414 415 private long stackSize; 416 417 boolean started = false; 418 419 private boolean stillborn = false; 420 421 @UnsupportedAppUsage 422 private java.lang.Runnable target; 423 424 private static int threadInitNumber; 425 426 int threadLocalRandomProbe; 427 428 int threadLocalRandomSecondarySeed; 429 430 long threadLocalRandomSeed; 431 432 @UnsupportedAppUsage(publicAlternatives = "Please update to a current version of the " 433 + "{@code Streamsupport} library; older versions of {@code Streamsupport} do not " 434 + "support current versions of Android.") 435 java.lang.ThreadLocal.ThreadLocalMap threadLocals; 436 437 private java.lang.Thread threadQ; 438 439 @UnsupportedAppUsage 440 private static long threadSeqNumber; 441 442 private long tid; 443 444 private volatile java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler; 445 446 @UnsupportedAppUsage 447 private static volatile java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionPreHandler; 448 449 @SuppressWarnings({"unchecked", "deprecation", "all"}) 450 private static class Caches { 451 Caches()452 private Caches() { 453 throw new RuntimeException("Stub!"); 454 } 455 456 static final java.util.concurrent.ConcurrentMap< 457 java.lang.Thread.WeakClassKey, java.lang.Boolean> 458 subclassAudits; 459 460 static { 461 subclassAudits = null; 462 } 463 464 static final java.lang.ref.ReferenceQueue<java.lang.Class<?>> subclassAuditsQueue; 465 466 static { 467 subclassAuditsQueue = null; 468 } 469 } 470 471 @SuppressWarnings({"unchecked", "deprecation", "all"}) 472 private static class ParkState { 473 ParkState()474 private ParkState() { 475 throw new RuntimeException("Stub!"); 476 } 477 478 private static final int PARKED = 3; // 0x3 479 480 private static final int PREEMPTIVELY_UNPARKED = 2; // 0x2 481 482 private static final int UNPARKED = 1; // 0x1 483 } 484 485 @SuppressWarnings({"unchecked", "deprecation", "all"}) 486 public static enum State { 487 NEW, 488 RUNNABLE, 489 BLOCKED, 490 WAITING, 491 TIMED_WAITING, 492 TERMINATED; 493 State()494 private State() { 495 throw new RuntimeException("Stub!"); 496 } 497 } 498 499 @SuppressWarnings({"unchecked", "deprecation", "all"}) 500 public static interface UncaughtExceptionHandler { 501 uncaughtException(java.lang.Thread t, java.lang.Throwable e)502 public void uncaughtException(java.lang.Thread t, java.lang.Throwable e); 503 } 504 505 @SuppressWarnings({"unchecked", "deprecation", "all"}) 506 static class WeakClassKey extends java.lang.ref.WeakReference<java.lang.Class<?>> { 507 WeakClassKey( java.lang.Class<?> cl, java.lang.ref.ReferenceQueue<java.lang.Class<?>> refQueue)508 WeakClassKey( 509 java.lang.Class<?> cl, java.lang.ref.ReferenceQueue<java.lang.Class<?>> refQueue) { 510 super(null); 511 throw new RuntimeException("Stub!"); 512 } 513 hashCode()514 public int hashCode() { 515 throw new RuntimeException("Stub!"); 516 } 517 equals(java.lang.Object obj)518 public boolean equals(java.lang.Object obj) { 519 throw new RuntimeException("Stub!"); 520 } 521 522 private final int hash; 523 524 { 525 hash = 0; 526 } 527 } 528 } 529