package X; import android.app.Activity; import android.app.WallpaperInfo; import android.app.WallpaperManager; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.widget.ImageView; import com.bytedance.covode.number.Covode; import com.bytedance.ies.abmock.SettingsManager; import com.bytedance.router.SmartRouter; import com.ss.android.ugc.aweme.base.model.UrlModel; import com.ss.android.ugc.aweme.feed.model.Aweme; import com.ss.android.ugc.aweme.feed.model.Video; import com.ss.android.ugc.aweme.feedback.runtime.behavior.RuntimeBehaviorServiceImpl; import com.ss.android.ugc.aweme.livewallpaper.model.LiveWallPaperBean; import com.ss.android.ugc.aweme.ug.UgCommonServiceImpl; import com.zhiliaoapp.musically.R; import java.io.File; import java.util.Collection; import java.util.List; /* renamed from: X.N2i reason: case insensitive filesystem */ public final class C58683N2i { static { Covode.recordClassIndex(81112); } public static float LIZ(int i2) { return (((float) i2) * 1.0f) / 100.0f; } public static final /* synthetic */ C23860x5 LIZ(Aweme aweme, Activity activity, boolean z) { Video video; UrlModel cover; if (aweme != null) { C58687N2m n2m = C58687N2m.LJ; if (!(n2m.LIZIZ(aweme.getAid()) || (video = aweme.getVideo()) == null || (cover = video.getCover()) == null || video.getPlayAddrH264() == null || AnonymousClass0N6.LIZ((Collection) video.getPlayAddrH264().getUrlList()))) { List<String> urlList = video.getPlayAddrH264().getUrlList(); String LIZ = C44674HgV.LIZ(aweme, urlList.size() > 2 ? urlList.get(2) : urlList.get(0)); if (!TextUtils.isEmpty(LIZ)) { C58694N2t newBuilder = LiveWallPaperBean.newBuilder(); newBuilder.LIZ = aweme.getAid(); newBuilder.LJII = cover; newBuilder.LJIIIIZZ = LIZ; newBuilder.LJIIIZ = video.getPlayAddrH264().getUri(); newBuilder.LIZLLL = video.getWidth(); newBuilder.LJ = video.getHeight(); newBuilder.LJFF = "video_share"; newBuilder.LJI = 0.0f; newBuilder.LJIIJ = C19370pq.LIZ.LIZ(aweme); n2m.LIZ.add(0, newBuilder.LIZ()); n2m.LIZIZ(); } } } if (activity != null) { try { if (!C11450d4.LIZIZ(activity, "com.android.vending")) { SmartRouter.buildRoute(activity, "aweme://webview/").withParam(Uri.parse("https://play.google.com/store/apps/details?id=com.zhiliao.musically.livewallpaper")).withParam("hide_nav_bar", true).withParam("hide_status_bar", true).open(); } else { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=com.zhiliao.musically.livewallpaper")); intent.setPackage("com.android.vending"); intent.addFlags(268435456); C21280sv.LIZ(intent, activity); activity.startActivity(intent); } } catch (Exception e) { e.printStackTrace(); } } LIZ(activity, true, z); return C23860x5.LIZ; } public static AbstractC58675N2a LIZ(Context context, AbstractC181577Bq r2) { return N33.LIZ.LIZ() ? new C181557Bo(context, r2) : new C58689N2o(r2); } public static File LIZ(Context context) { if (C16490lC.LIZJ != null && C16490lC.LJ) { return C16490lC.LIZJ; } File filesDir = context.getFilesDir(); C16490lC.LIZJ = filesDir; return filesDir; } public static final /* synthetic */ Object LIZ(Context context, boolean z) { try { if (LIZLLL() && C11450d4.LIZIZ(context, IK7.LIZ)) { Bundle bundle = new Bundle(); bundle.putBoolean("need_tighten", z); context.getContentResolver().call(IK7.LIZJ, "change_mode", "", bundle); } } catch (RuntimeException unused) { } return null; } public static String LIZ() { File LIZ = LIZ(AnonymousClass0WE.LJJI.LIZ()); return LIZ != null ? LIZ + "/LiveWallpaper/" : ""; } public static void LIZ(int i2, String str) { C29021Cx.LIZ("livewall_paper_setting", i2, new C12720f7().LIZ("message", str).LIZ()); if (!TextUtils.isEmpty(str)) { C29021Cx.LIZ("type_livewallpaper_setting", "", new C12720f7().LIZ("message", str).LIZ()); } } public static void LIZ(Activity activity, boolean z, String str, Aweme aweme) { if (activity != null && !activity.isFinishing()) { int i2 = z ? R.string.ijw : R.string.iu8; int i3 = z ? R.string.ijx : R.string.iu9; int i4 = z ? R.string.ijv : R.string.d96; ImageView imageView = new ImageView(activity); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setImageDrawable(new BP8(activity, R.raw.icon_2pt_live_wallpaper)); C46363IIm iIm = new C46363IIm(activity); iIm.LIZJ(i3).LIZLLL(i2); IJ6 ij6 = new IJ6(activity); ij6.LIZ(i4, new N39(aweme, activity, z)); ij6.LIZIZ(R.string.e81, new N3F(activity, z)); iIm.LIZ(ij6).LIZ(new C97333sI(activity, imageView)).LIZ().LIZJ().show(); LIZIZ(str); } } public static void LIZ(Activity activity, boolean z, boolean z2) { C14300hf.LIZ("wallpaper_plugin_download_dialog_click", new C12740f9().LIZ("action", z ? 1 : 0).LIZ("is_gp_install", C11450d4.LIZIZ(activity, "com.android.vending") ? 1 : 0).LIZ("type", z2 ? 1 : 0).LIZ); } public static void LIZ(Aweme aweme, String str) { if (aweme != null) { C14300hf.LIZ("wall_paper_show", new C12740f9().LIZ("group_id", aweme.getAid()).LIZ("request_id", aweme.getRequestId()).LIZ("enter_from", str).LIZ); } } public static void LIZ(String str) { C14300hf.LIZ("wallpaper_start_download", new C12740f9().LIZ("enter_from", str).LIZ); } public static void LIZ(String str, String str2) { LIZ(str, str2, true, ""); } public static void LIZ(String str, String str2, boolean z) { C14300hf.LIZ("wallpaper_download_result", new C12740f9().LIZ("enter_from", str).LIZ("group_id", str2).LIZ("is_success", z ? 1 : 0).LIZ); } public static void LIZ(String str, String str2, boolean z, String str3) { LiveWallPaperBean liveWallPaperBean = C58687N2m.LJ.LIZJ; C14300hf.LIZ(z ? "wall_paper_success" : "wall_paper_fail", new C12740f9().LIZ("group_id", str).LIZ("enter_from", str2).LIZ("is_volume_enable", (liveWallPaperBean == null || liveWallPaperBean.getVolume() <= 0.0f) ? 0 : 1).LIZ("error_msg", str3).LIZ); if (z) { UgCommonServiceImpl.LJIIL().LIZLLL(); } RuntimeBehaviorServiceImpl.LIZJ().LIZ(z ? "wallpaper_set_success" : "wallpaper_set_error", String.valueOf(AnonymousClass3UM.LIZ.LJII())); } public static boolean LIZ(Activity activity) { return N34.LIZIZ.LIZ() > C46211s2.LIZ(activity, IK7.LIZ); } public static boolean LIZ(Activity activity, String str, Aweme aweme) { if (!LIZLLL() || activity == null || activity.isFinishing()) { return false; } boolean LIZIZ = C11450d4.LIZIZ(activity, IK7.LIZ); if (LIZIZ && !LIZ(activity)) { return false; } LIZ(activity, LIZIZ, str, aweme); return true; } public static boolean LIZ(Context context, String str) { try { WallpaperInfo wallpaperInfo = WallpaperManager.getInstance(context).getWallpaperInfo(); if (wallpaperInfo == null) { return false; } String packageName = wallpaperInfo.getPackageName(); return LIZLLL() ? IK7.LIZ.equals(packageName) : packageName.equals(str); } catch (Exception e) { e.printStackTrace(); return false; } } public static boolean LIZ(Aweme aweme) { if (!LIZIZ(aweme)) { return aweme != null && aweme.getAuthor() != null && !C12290eQ.LJFF().isMe(aweme.getAuthor().getUid()) && aweme.getAuthor().isSecret(); } return true; } public static String LIZIZ() { return LIZ() + "fallback.mp4"; } public static void LIZIZ(int i2, String str) { C29021Cx.LIZ("livewall_paper_download", i2, new C12720f7().LIZ("message", str).LIZ()); if (!TextUtils.isEmpty(str)) { C29021Cx.LIZ("type_livewall_paper_download", "", new C12720f7().LIZ("message", str).LIZ()); } } public static void LIZIZ(String str) { C14300hf.LIZ("wallpaper_plugin_alert", new C12740f9().LIZ("group_id", str).LIZ("is_gp_install", Boolean.valueOf(C11450d4.LIZIZ(AnonymousClass0WE.LJJI.LIZ(), "com.android.vending"))).LIZ); } public static boolean LIZIZ(Aweme aweme) { Video video; if (aweme == null || (video = aweme.getVideo()) == null) { return true; } return video.getWidth() == 0 || video.getHeight() == 0 || aweme.getAwemeType() == 2; } public static boolean LIZJ() { return SettingsManager.LIZ().LIZ("live_wallpaper_block", false); } public static boolean LIZLLL() { return !LJ() && !N3D.LIZ.LIZ(); } public static boolean LJ() { return C46581sd.LIZ() && Build.VERSION.SDK_INT >= 26; } }