public interface

HandlerWrapper

 androidx.media3.common.util.HandlerWrapper

Gradle dependencies

compile group: 'androidx.media3', name: 'media3-common', version: '1.5.0-alpha01'

  • groupId: androidx.media3
  • artifactId: media3-common
  • version: 1.5.0-alpha01

Artifact androidx.media3:media3-common:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

An interface to call through to a Handler. Instances must be created by calling Clock.createHandler(Looper, Handler.Callback) on Clock.DEFAULT for all non-test cases.

Summary

Methods
public LoopergetLooper()

See Handler.

public booleanhasMessages(int what)

See Handler.

public HandlerWrapper.MessageobtainMessage(int what)

See Handler.

public HandlerWrapper.MessageobtainMessage(int what, int arg1, int arg2)

See Handler.

public HandlerWrapper.MessageobtainMessage(int what, int arg1, int arg2, java.lang.Object obj)

See Handler.

public HandlerWrapper.MessageobtainMessage(int what, java.lang.Object obj)

See Handler.

public booleanpost(java.lang.Runnable runnable)

See Handler.

public booleanpostAtFrontOfQueue(java.lang.Runnable runnable)

See android.os.Handler.

public booleanpostDelayed(java.lang.Runnable runnable, long delayMs)

See Handler.

public voidremoveCallbacksAndMessages(java.lang.Object token)

See Handler.

public voidremoveMessages(int what)

See Handler.

public booleansendEmptyMessage(int what)

See Handler.

public booleansendEmptyMessageAtTime(int what, long uptimeMs)

See Handler.

public booleansendEmptyMessageDelayed(int what, int delayMs)

See Handler.

public booleansendMessageAtFrontOfQueue(HandlerWrapper.Message message)

See Handler.

Methods

public Looper getLooper()

See Handler.

public boolean hasMessages(int what)

See Handler.

public HandlerWrapper.Message obtainMessage(int what)

See Handler.

public HandlerWrapper.Message obtainMessage(int what, java.lang.Object obj)

See Handler.

public HandlerWrapper.Message obtainMessage(int what, int arg1, int arg2)

See Handler.

public HandlerWrapper.Message obtainMessage(int what, int arg1, int arg2, java.lang.Object obj)

See Handler.

public boolean sendMessageAtFrontOfQueue(HandlerWrapper.Message message)

See Handler.

public boolean sendEmptyMessage(int what)

See Handler.

public boolean sendEmptyMessageDelayed(int what, int delayMs)

See Handler.

public boolean sendEmptyMessageAtTime(int what, long uptimeMs)

See Handler.

public void removeMessages(int what)

See Handler.

public void removeCallbacksAndMessages(java.lang.Object token)

See Handler.

public boolean post(java.lang.Runnable runnable)

See Handler.

public boolean postDelayed(java.lang.Runnable runnable, long delayMs)

See Handler.

public boolean postAtFrontOfQueue(java.lang.Runnable runnable)

See android.os.Handler.

Source

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package androidx.media3.common.util;

import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;

/**
 * An interface to call through to a {@link Handler}. Instances must be created by calling {@link
 * Clock#createHandler(Looper, Handler.Callback)} on {@link Clock#DEFAULT} for all non-test cases.
 */
@UnstableApi
public interface HandlerWrapper {

  /** A message obtained from the handler. */
  interface Message {

    /** See {@link android.os.Message#sendToTarget()}. */
    void sendToTarget();

    /** See {@link android.os.Message#getTarget()}. */
    HandlerWrapper getTarget();
  }

  /** See {@link Handler#getLooper()}. */
  Looper getLooper();

  /** See {@link Handler#hasMessages(int)}. */
  boolean hasMessages(int what);

  /** See {@link Handler#obtainMessage(int)}. */
  Message obtainMessage(int what);

  /** See {@link Handler#obtainMessage(int, Object)}. */
  Message obtainMessage(int what, @Nullable Object obj);

  /** See {@link Handler#obtainMessage(int, int, int)}. */
  Message obtainMessage(int what, int arg1, int arg2);

  /** See {@link Handler#obtainMessage(int, int, int, Object)}. */
  Message obtainMessage(int what, int arg1, int arg2, @Nullable Object obj);

  /** See {@link Handler#sendMessageAtFrontOfQueue(android.os.Message)}. */
  boolean sendMessageAtFrontOfQueue(Message message);

  /** See {@link Handler#sendEmptyMessage(int)}. */
  boolean sendEmptyMessage(int what);

  /** See {@link Handler#sendEmptyMessageDelayed(int, long)}. */
  boolean sendEmptyMessageDelayed(int what, int delayMs);

  /** See {@link Handler#sendEmptyMessageAtTime(int, long)}. */
  boolean sendEmptyMessageAtTime(int what, long uptimeMs);

  /** See {@link Handler#removeMessages(int)}. */
  void removeMessages(int what);

  /** See {@link Handler#removeCallbacksAndMessages(Object)}. */
  void removeCallbacksAndMessages(@Nullable Object token);

  /** See {@link Handler#post(Runnable)}. */
  boolean post(Runnable runnable);

  /** See {@link Handler#postDelayed(Runnable, long)}. */
  boolean postDelayed(Runnable runnable, long delayMs);

  /** See {@link android.os.Handler#postAtFrontOfQueue(Runnable)}. */
  boolean postAtFrontOfQueue(Runnable runnable);
}