/services/java/com/android/server/am/UserStartedState.java

https://github.com/aizuzi/platform_frameworks_base · Java · 60 lines · 33 code · 8 blank · 19 comment · 3 complexity · e250b6c05b85552b19e4317c3a59f8ed MD5 · raw file

  1. /*
  2. * Copyright (C) 2012 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.android.server.am;
  17. import java.io.PrintWriter;
  18. import java.util.ArrayList;
  19. import android.app.IStopUserCallback;
  20. import android.os.UserHandle;
  21. public final class UserStartedState {
  22. // User is first coming up.
  23. public final static int STATE_BOOTING = 0;
  24. // User is in the normal running state.
  25. public final static int STATE_RUNNING = 1;
  26. // User is in the initial process of being stopped.
  27. public final static int STATE_STOPPING = 2;
  28. // User is in the final phase of stopping, sending Intent.ACTION_SHUTDOWN.
  29. public final static int STATE_SHUTDOWN = 3;
  30. public final UserHandle mHandle;
  31. public final ArrayList<IStopUserCallback> mStopCallbacks
  32. = new ArrayList<IStopUserCallback>();
  33. public int mState = STATE_BOOTING;
  34. public boolean switching;
  35. public boolean initializing;
  36. public UserStartedState(UserHandle handle, boolean initial) {
  37. mHandle = handle;
  38. }
  39. void dump(String prefix, PrintWriter pw) {
  40. pw.print(prefix); pw.print("mState=");
  41. switch (mState) {
  42. case STATE_BOOTING: pw.print("BOOTING"); break;
  43. case STATE_RUNNING: pw.print("RUNNING"); break;
  44. case STATE_STOPPING: pw.print("STOPPING"); break;
  45. case STATE_SHUTDOWN: pw.print("SHUTDOWN"); break;
  46. default: pw.print(mState); break;
  47. }
  48. if (switching) pw.print(" SWITCHING");
  49. if (initializing) pw.print(" INITIALIZING");
  50. pw.println();
  51. }
  52. }