package o; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; /* loaded from: classes.dex */ public final class uLO { public static Intent mn_(Activity activity) { Intent mr_ = LWm.mr_(activity); if (mr_ != null) { return mr_; } String mp_ = mp_(activity); if (mp_ == null) { return null; } ComponentName componentName = new ComponentName(activity, mp_); try { if (mq_(activity, componentName) == null) { return Intent.makeMainActivity(componentName); } return new Intent().setComponent(componentName); } catch (PackageManager.NameNotFoundException unused) { return null; } } public static Intent mo_(Context context, ComponentName componentName) throws PackageManager.NameNotFoundException { String mq_ = mq_(context, componentName); if (mq_ == null) { return null; } ComponentName componentName2 = new ComponentName(componentName.getPackageName(), mq_); if (mq_(context, componentName2) == null) { return Intent.makeMainActivity(componentName2); } return new Intent().setComponent(componentName2); } public static String mp_(Activity activity) { try { return mq_(activity, activity.getComponentName()); } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException(e); } } private static String mq_(Context context, ComponentName componentName) throws PackageManager.NameNotFoundException { String string; ActivityInfo activityInfo = context.getPackageManager().getActivityInfo(componentName, Build.VERSION.SDK_INT >= 29 ? 269222528 : 787072); String str = activityInfo.parentActivityName; if (str != null) { return str; } if (PackageItemInfo.class.getField("metaData").get(activityInfo) == null || (string = ((Bundle) PackageItemInfo.class.getField("metaData").get(activityInfo)).getString("android.support.PARENT_ACTIVITY")) == null) { return null; } if (string.charAt(0) != '.') { return string; } StringBuilder sb = new StringBuilder(); sb.append(context.getPackageName()); sb.append(string); return sb.toString(); } /* loaded from: classes.dex */ public static class LWm { public static boolean mt_(Activity activity, Intent intent) { return activity.shouldUpRecreateTask(intent); } public static boolean ms_(Activity activity, Intent intent) { return activity.navigateUpTo(intent); } static Intent mr_(Activity activity) { return activity.getParentActivityIntent(); } } }