package com.ubt.jimu.utils; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.SystemClock; import android.os.Vibrator; import com.ubt.jimu.Channel; import com.ubt.jimu.base.cache.Cache; import com.ubt.jimu.unity.bluetooth.UnityActivity; import java.io.File; /* loaded from: classes2.dex */ public class SystemUtils { public static boolean a(Context context, String str) { if (android.text.TextUtils.isEmpty(str)) { return false; } try { } catch (Exception e) { e.printStackTrace(); } return context.getPackageManager().getApplicationInfo(str, UnityActivity.BLOCKLY_TYPE_NONE) != null; } public static void b(String str) { try { a(str); new File(str.toString()).delete(); } catch (Exception e) { e.printStackTrace(); } } private static boolean a(String str) { File file; File file2 = new File(str); if (!file2.exists() || !file2.isDirectory()) { return false; } String[] list = file2.list(); boolean z = false; for (int i = 0; i < list.length; i++) { if (str.endsWith(File.separator)) { file = new File(str + list[i]); } else { file = new File(str + File.separator + list[i]); } if (file.isFile()) { file.delete(); } if (file.isDirectory()) { a(str + "/" + list[i]); z = true; } } return z; } public static void b(Context context) { ((Vibrator) context.getSystemService("vibrator")).vibrate(50L); } private static long b() { long j = Cache.getInstance().differ; if (j <= 0) { return System.currentTimeMillis(); } return j + SystemClock.elapsedRealtime(); } public static long a() { long b = b(); LogUtils.c("当前时间:" + b + "服务器校准的时间:" + b()); return b; } public static long a(long j) { String valueOf; int length; if (!Channel.FIR_TEST.getChannelName().equals("google_play")) { return j; } if (j > 0 && (length = (valueOf = String.valueOf(j)).length()) >= 4) { return Long.valueOf(valueOf.substring(0, length - 3)).longValue() * 1000; } return 0L; } public static boolean a(Context context) { Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(Uri.parse("market://details?id=" + context.getPackageName())); intent.setPackage("com.android.vending"); if (intent.resolveActivity(context.getPackageManager()) != null) { context.startActivity(intent); return true; } Intent intent2 = new Intent("android.intent.action.VIEW"); intent2.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())); if (intent2.resolveActivity(context.getPackageManager()) == null) { return false; } context.startActivity(intent2); return true; } }