大漢易經書院.apk(点击下载) / ek.java


package com.xiaomi.push;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.channel.commonutils.logger.b;
import com.xiaomi.push.service.l;

/* access modifiers changed from: package-private */
public class ek implements eh {
    ek() {
    }

    private void a(Service service, Intent intent) {
        String stringExtra = intent.getStringExtra("awake_info");
        if (!TextUtils.isEmpty(stringExtra)) {
            String b = dz.b(stringExtra);
            boolean isEmpty = TextUtils.isEmpty(b);
            Context applicationContext = service.getApplicationContext();
            if (!isEmpty) {
                ea.a(applicationContext, b, 1007, "play with service successfully");
            } else {
                ea.a(applicationContext, "service", 1008, "B get a incorrect message");
            }
        } else {
            ea.a(service.getApplicationContext(), "service", 1008, "B get a incorrect message");
        }
    }

    private void b(Context context, ed edVar) {
        String a = edVar.m9311a();
        String b = edVar.b();
        String d = edVar.d();
        int a2 = edVar.a();
        if (context == null || TextUtils.isEmpty(a) || TextUtils.isEmpty(b) || TextUtils.isEmpty(d)) {
            if (TextUtils.isEmpty(d)) {
                ea.a(context, "service", 1008, "argument error");
            } else {
                ea.a(context, d, 1008, "argument error");
            }
        } else if (!l.a(context, a, b)) {
            ea.a(context, d, 1003, "B is not ready");
        } else {
            ea.a(context, d, PushConstants.PUSHSERVICE_INFO_SEND_MESSAGE_BY_NOTIFICATION_SERVICE_ERROR, "B is ready");
            ea.a(context, d, 1004, "A is ready");
            try {
                Intent intent = new Intent();
                intent.setAction(b);
                intent.setPackage(a);
                intent.putExtra("awake_info", dz.a(d));
                if (a2 == 1 && !ee.m9312a(context)) {
                    ea.a(context, d, 1008, "A not in foreground");
                } else if (context.startService(intent) != null) {
                    ea.a(context, d, 1005, "A is successful");
                    ea.a(context, d, 1006, "The job is finished");
                } else {
                    ea.a(context, d, 1008, "A is fail to help B's service");
                }
            } catch (Exception e) {
                b.a(e);
                ea.a(context, d, 1008, "A meet a exception when help B's service");
            }
        }
    }

    @Override // com.xiaomi.push.eh
    public void a(Context context, Intent intent, String str) {
        if (context == null || !(context instanceof Service)) {
            ea.a(context, "service", 1008, "A receive incorrect message");
        } else {
            a((Service) context, intent);
        }
    }

    @Override // com.xiaomi.push.eh
    public void a(Context context, ed edVar) {
        if (edVar != null) {
            b(context, edVar);
        } else {
            ea.a(context, "service", 1008, "A receive incorrect message");
        }
    }
}