������������������.apk分析 / ec.java


package com.xiaomi.push;

import android.app.Activity;
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 ec implements eh {
    ec() {
    }

    private void a(Activity activity, Intent intent) {
        String stringExtra = intent.getStringExtra("awake_info");
        if (!TextUtils.isEmpty(stringExtra)) {
            String b = dz.b(stringExtra);
            boolean isEmpty = TextUtils.isEmpty(b);
            Context applicationContext = activity.getApplicationContext();
            if (!isEmpty) {
                ea.a(applicationContext, b, 1007, "play with activity successfully");
            } else {
                ea.a(applicationContext, PushConstants.INTENT_ACTIVITY_NAME, 1008, "B get incorrect message");
            }
        } else {
            ea.a(activity.getApplicationContext(), PushConstants.INTENT_ACTIVITY_NAME, 1008, "B get 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, PushConstants.INTENT_ACTIVITY_NAME, 1008, "argument error");
            } else {
                ea.a(context, d, 1008, "argument error");
            }
        } else if (!l.b(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");
            Intent intent = new Intent(b);
            intent.setPackage(a);
            intent.putExtra("awake_info", dz.a(d));
            intent.addFlags(276824064);
            intent.setAction(b);
            if (a2 == 1) {
                try {
                    if (!ee.m9312a(context)) {
                        ea.a(context, d, 1008, "A not in foreground");
                        return;
                    }
                } catch (Exception e) {
                    b.a(e);
                    ea.a(context, d, 1008, "A meet a exception when help B's activity");
                    return;
                }
            }
            context.startActivity(intent);
            ea.a(context, d, 1005, "A is successful");
            ea.a(context, d, 1006, "The job is finished");
        }
    }

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

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