package com.umeng.commonsdk.utils; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; import com.umeng.commonsdk.framework.UMEnvelopeBuild; import com.umeng.commonsdk.service.UMGlobalContext; import java.util.Calendar; import java.util.Date; /* compiled from: SLModeUtil */ public class b { private static final String a = "um_slmode_sp"; private static final String b = "lastReqTime"; private static final int c = 48; private static final int d = 1; private static final int e = 720; private static final String f = "iss"; private static final String g = "sinr"; private static final String h = "clean"; private static boolean i = true; private static int j = 720; private static Object k = new Object(); private static int a(int i2) { if (i2 > e) { return e; } if (i2 < 1) { return 1; } return i2; } static { Context appContext = UMGlobalContext.getAppContext(); if (appContext != null) { String imprintProperty = UMEnvelopeBuild.imprintProperty(appContext, f, ""); if (!TextUtils.isEmpty(imprintProperty) && "1".equals(imprintProperty)) { synchronized (k) { } String imprintProperty2 = UMEnvelopeBuild.imprintProperty(appContext, g, ""); if (!TextUtils.isEmpty(imprintProperty)) { try { j = a(Integer.parseInt(imprintProperty2)); } catch (Throwable unused) { j = 48; } } else { j = 48; } } } } public static boolean a() { boolean z; synchronized (k) { z = i; } return z; } public static int a(Context context) { int i2; synchronized (k) { i2 = j; } return i2; } public static boolean a(long j2, long j3, int i2) { Date date = new Date(j3); Calendar instance = Calendar.getInstance(); instance.setTime(new Date(j2)); instance.add(10, i2); return date.after(instance.getTime()); } public static long b(Context context) { SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences(a, 0); if (sharedPreferences != null) { return sharedPreferences.getLong(b, 0); } return 0; } public static void a(Context context, long j2) { SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences(a, 0); if (sharedPreferences != null) { sharedPreferences.edit().putLong(b, j2).commit(); } } public static void c(Context context) { SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences(a, 0); if (sharedPreferences != null) { sharedPreferences.edit().putBoolean(h, true).commit(); } } public static void d(Context context) { SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences(a, 0); if (sharedPreferences != null) { sharedPreferences.edit().putBoolean(h, false).commit(); } } public static boolean e(Context context) { SharedPreferences sharedPreferences = context.getApplicationContext().getSharedPreferences(a, 0); if (sharedPreferences != null) { return sharedPreferences.getBoolean(h, false); } return false; } }