/TMessagesProj/src/main/java/com/google/android/exoplayer2/util/SystemClock.java

https://github.com/NekoX-Dev/NekoX · Java · 55 lines · 28 code · 8 blank · 19 comment · 0 complexity · 4c1e4a70878d26102a995d07f497001c MD5 · raw file

  1. /*
  2. * Copyright (C) 2014 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.google.android.exoplayer2.util;
  17. import android.os.Handler;
  18. import android.os.Handler.Callback;
  19. import android.os.Looper;
  20. import androidx.annotation.Nullable;
  21. /**
  22. * The standard implementation of {@link Clock}, an instance of which is available via {@link
  23. * SystemClock#DEFAULT}.
  24. */
  25. public class SystemClock implements Clock {
  26. protected SystemClock() {}
  27. @Override
  28. public long currentTimeMillis() {
  29. return System.currentTimeMillis();
  30. }
  31. @Override
  32. public long elapsedRealtime() {
  33. return android.os.SystemClock.elapsedRealtime();
  34. }
  35. @Override
  36. public long uptimeMillis() {
  37. return android.os.SystemClock.uptimeMillis();
  38. }
  39. @Override
  40. public void sleep(long sleepTimeMs) {
  41. android.os.SystemClock.sleep(sleepTimeMs);
  42. }
  43. @Override
  44. public HandlerWrapper createHandler(Looper looper, @Nullable Callback callback) {
  45. return new SystemHandlerWrapper(new Handler(looper, callback));
  46. }
  47. }