智能工厂.apk(点击下载) / d.java


package cn.jpush.android.g;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import cn.asus.push.DataBuffer;
import cn.asus.push.IAIDLInvoke;
import cn.jpush.android.f.c;
import cn.jpush.android.i.b;

public final class d extends a {
    private IAIDLInvoke b = null;

    @Override // cn.jpush.android.g.a
    public final void a(String str, String str2) {
        if (this.b != null) {
            try {
                Bundle bundle = new Bundle();
                bundle.putString("JPUSH_CONTENT", str2);
                this.b.asyncCall(new DataBuffer(str, bundle), new b());
            } catch (Throwable th) {
                b.g("ServiceConnection", "send data fail:" + th);
            }
        } else {
            b.g("ServiceConnection", "send data fail, please init first.");
        }
    }

    @Override // cn.jpush.android.g.a
    public final boolean a() {
        if (a.get()) {
            b.b("ServiceConnection", "already connecting.");
            return false;
        }
        a.set(true);
        try {
            Intent intent = new Intent();
            intent.setComponent(new ComponentName(c.e, "cn.jpush.android.service.PushManagerService"));
            e eVar = new e(this, (byte) 0);
            boolean bindService = c.a.bindService(intent, eVar, 1);
            b.b("ServiceConnection", "connect--" + bindService);
            if (!bindService) {
                a.set(false);
            } else {
                this.b = IAIDLInvoke.Stub.asInterface(eVar.a.take());
            }
            return bindService;
        } catch (Throwable th) {
            b.g("ServiceConnection", "init fail:" + th);
            a.set(false);
            return false;
        }
    }

    @Override // cn.jpush.android.g.a
    public final boolean b() {
        IAIDLInvoke iAIDLInvoke = this.b;
        if (iAIDLInvoke == null) {
            return false;
        }
        return iAIDLInvoke.asBinder().isBinderAlive();
    }
}