package o; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ComponentInfo; import android.content.pm.PackageItemInfo; import android.content.pm.ResolveInfo; import android.net.Uri; import android.widget.Toast; import com.google.android.gms.internal.common.zzd; import com.huawei.hms.support.api.entity.common.CommonConstant; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.embedding.engine.plugins.activity.ActivityAware; import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import java.util.Iterator; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes3.dex */ public final class YaE implements MethodChannel.MethodCallHandler, FlutterPlugin, ActivityAware { private Activity d; @Override // io.flutter.embedding.engine.plugins.activity.ActivityAware public final void onDetachedFromActivity() { } @Override // io.flutter.embedding.engine.plugins.activity.ActivityAware public final void onDetachedFromActivityForConfigChanges() { } @Override // io.flutter.embedding.engine.plugins.FlutterPlugin public final void onDetachedFromEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) { } @Override // io.flutter.embedding.engine.plugins.activity.ActivityAware public final void onReattachedToActivityForConfigChanges(ActivityPluginBinding activityPluginBinding) { } @Override // io.flutter.plugin.common.MethodChannel.MethodCallHandler public final void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { if (methodCall.method.equals("launch")) { String str = (String) methodCall.argument("android_id"); if (str == null) { str = this.d.getPackageName(); } Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse("market://details?id=".concat(String.valueOf(str)))); Iterator it = this.d.getPackageManager().queryIntentActivities(intent, 0).iterator(); while (true) { if (it.hasNext()) { ResolveInfo next = it.next(); if (PackageItemInfo.class.getField(CommonConstant.ReqAccessTokenParam.PACKAGE_NAME).get(ComponentInfo.class.getField("applicationInfo").get(next.activityInfo)).equals("com.android.vending")) { ActivityInfo activityInfo = next.activityInfo; ComponentName componentName = new ComponentName((String) PackageItemInfo.class.getField(CommonConstant.ReqAccessTokenParam.PACKAGE_NAME).get(ComponentInfo.class.getField("applicationInfo").get(activityInfo)), (String) PackageItemInfo.class.getField("name").get(activityInfo)); intent.addFlags(268435456); intent.addFlags(PKIFailureInfo.badSenderNonce); intent.addFlags(zzd.zza); intent.setComponent(componentName); Toast.makeText(this.d, "Please Rate Application", 0).show(); this.d.startActivity(intent); break; } } else { try { Activity activity = this.d; StringBuilder sb = new StringBuilder(); sb.append("market://details?id="); sb.append(str); activity.startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(sb.toString()))); break; } catch (ActivityNotFoundException unused) { this.d.startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse("https://play.google.com/store/apps/details?id=".concat(String.valueOf(str))))); } } } result.success(null); return; } result.notImplemented(); } @Override // io.flutter.embedding.engine.plugins.FlutterPlugin public final void onAttachedToEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) { MethodChannel methodChannel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "launch_review"); this.d = null; methodChannel.setMethodCallHandler(this); } @Override // io.flutter.embedding.engine.plugins.activity.ActivityAware public final void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) { this.d = activityPluginBinding.getActivity(); } }