3427 private final class ActivityStackSupervisorHandler extends Handler {
3428
3429 public ActivityStackSupervisorHandler(Looper looper) {
3430 super(looper);
3431 }
3432
3433 void activityIdleInternal(ActivityRecord r) {
3434 synchronized (mService) {
3435 activityIdleInternalLocked(r != null ? r.appToken : null, true, null);
3436 }
3437 }
3438
3439 @Override
3440 public void handleMessage(Message msg) {
3441 switch (msg.what) {
3442 case IDLE_TIMEOUT_MSG: {
3443 if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_TIMEOUT_MSG: r=" + msg.obj);
3444 if (mService.mDidDexOpt) {
3445 mService.mDidDexOpt = false;
3446 Message nmsg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
3447 nmsg.obj = msg.obj;
3448 mHandler.sendMessageDelayed(nmsg, IDLE_TIMEOUT);
3449 return;
3450 }
3451
3452
3453 activityIdleInternal((ActivityRecord)msg.obj);
3454 } break;
3455 case IDLE_NOW_MSG: {
3456 if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_NOW_MSG: r=" + msg.obj);
3457 activityIdleInternal((ActivityRecord)msg.obj);
3458 } break;
3459 case RESUME_TOP_ACTIVITY_MSG: {
3460 synchronized (mService) {
3461 resumeTopActivitiesLocked();
3462 }
3463 } break;
3464 case SLEEP_TIMEOUT_MSG: {
3465 synchronized (mService) {
3466 if (mService.isSleepingOrShuttingDown()) {
3467 Slog.w(TAG, "Sleep timeout! Sleeping now.");
3468 mSleepTimeout = true;
3469 checkReadyForSleepLocked();
3470 }
3471 }
3472 } break;
3473 case LAUNCH_TIMEOUT_MSG: {
3474 if (mService.mDidDexOpt) {
3475 mService.mDidDexOpt = false;
3476 mHandler.sendEmptyMessageDelayed(LAUNCH_TIMEOUT_MSG, LAUNCH_TIMEOUT);
3477 return;
3478 }
3479 synchronized (mService) {
3480 if (mLaunchingActivity.isHeld()) {
3481 Slog.w(TAG, "Launch timeout has expired, giving up wake lock!");
3482 if (VALIDATE_WAKE_LOCK_CALLER
3483 && Binder.getCallingUid() != Process.myUid()) {
3484 throw new IllegalStateException("Calling must be system uid");
3485 }
3486 mLaunchingActivity.release();
3487 }
3488 }
3489 } break;