package com.google.android.gms.wearable;

import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import com.google.android.gms.wearable.CapabilityApi.CapabilityListener;
import com.google.android.gms.wearable.ChannelApi.ChannelListener;
import com.google.android.gms.wearable.ChannelClient.Channel;
import com.google.android.gms.wearable.DataApi.DataListener;
import com.google.android.gms.wearable.MessageApi.MessageListener;
import com.google.android.gms.wearable.internal.zzas;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.List;

public class WearableListenerService extends Service implements CapabilityListener, ChannelListener, DataListener, MessageListener {
    public static final String BIND_LISTENER_INTENT_ACTION = "com.google.android.gms.wearable.BIND_LISTENER";
    private ComponentName service;
    private zzc zzad;
    private IBinder zzae;
    private Intent zzaf;
    private Looper zzag;
    private final Object zzah = new Object();
    private boolean zzai;
    private zzas zzaj = new zzas(new zza(this, null));

    public WearableListenerService() {
        AppMethodBeat.i(70933);
        AppMethodBeat.o(70933);
    }

    public Looper getLooper() {
        AppMethodBeat.i(70937);
        if (this.zzag == null) {
            HandlerThread handlerThread = new HandlerThread("WearableListenerService");
            handlerThread.start();
            this.zzag = handlerThread.getLooper();
        }
        Looper looper = this.zzag;
        AppMethodBeat.o(70937);
        return looper;
    }

    public final IBinder onBind(Intent intent) {
        AppMethodBeat.i(70936);
        if (BIND_LISTENER_INTENT_ACTION.equals(intent.getAction())) {
            IBinder iBinder = this.zzae;
            AppMethodBeat.o(70936);
            return iBinder;
        }
        AppMethodBeat.o(70936);
        return null;
    }

    public void onCapabilityChanged(CapabilityInfo capabilityInfo) {
    }

    public void onChannelClosed(Channel channel, int i, int i2) {
    }

    public void onChannelClosed(Channel channel, int i, int i2) {
    }

    public void onChannelOpened(Channel channel) {
    }

    public void onChannelOpened(Channel channel) {
    }

    public void onConnectedNodes(List<Node> list) {
    }

    public void onCreate() {
        AppMethodBeat.i(70934);
        super.onCreate();
        this.service = new ComponentName(this, getClass().getName());
        if (Log.isLoggable("WearableLS", 3)) {
            String valueOf = String.valueOf(this.service);
            new StringBuilder(String.valueOf(valueOf).length() + 10).append("onCreate: ").append(valueOf);
        }
        this.zzad = new zzc(this, getLooper());
        this.zzaf = new Intent(BIND_LISTENER_INTENT_ACTION);
        this.zzaf.setComponent(this.service);
        this.zzae = new zzd(this, null);
        AppMethodBeat.o(70934);
    }

    public void onDataChanged(DataEventBuffer dataEventBuffer) {
    }

    public void onDestroy() {
        AppMethodBeat.i(70935);
        if (Log.isLoggable("WearableLS", 3)) {
            String valueOf = String.valueOf(this.service);
            new StringBuilder(String.valueOf(valueOf).length() + 11).append("onDestroy: ").append(valueOf);
        }
        synchronized (this.zzah) {
            try {
                this.zzai = true;
                if (this.zzad == null) {
                    String valueOf2 = String.valueOf(this.service);
                    Object illegalStateException = new IllegalStateException(new StringBuilder(String.valueOf(valueOf2).length() + 111).append("onDestroy: mServiceHandler not set, did you override onCreate() but forget to call super.onCreate()? component=").append(valueOf2).toString());
                    throw illegalStateException;
                }
                this.zzad.quit();
            } finally {
                AppMethodBeat.o(70935);
            }
        }
        super.onDestroy();
        AppMethodBeat.o(70935);
    }

    public void onEntityUpdate(zzb zzb) {
    }

    public void onInputClosed(Channel channel, int i, int i2) {
    }

    public void onInputClosed(Channel channel, int i, int i2) {
    }

    public void onMessageReceived(MessageEvent messageEvent) {
    }

    public void onNotificationReceived(zzd zzd) {
    }

    public void onOutputClosed(Channel channel, int i, int i2) {
    }

    public void onOutputClosed(Channel channel, int i, int i2) {
    }

    public void onPeerConnected(Node node) {
    }

    public void onPeerDisconnected(Node node) {
    }
}
