diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index b86192129a..0e84467163 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -4,6 +4,9 @@ android { compileSdkVersion 30 compileOptions { + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true + sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -76,6 +79,8 @@ android { } dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9' + implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.exifinterface:exifinterface:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index 4ef8a5bd18..ed6415821e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -11,12 +11,12 @@ import androidx.fragment.app.FragmentActivity; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.activities.EmulationActivity; -import java.util.Date; +import java.time.Instant; +import java.time.temporal.ChronoUnit; public final class StartupHandler { public static final String LAST_CLOSED = "LAST_CLOSED"; - public static final long SESSION_TIMEOUT = 21600000L; // 6 hours in milliseconds public static void HandleInit(FragmentActivity parent) { @@ -61,7 +61,7 @@ public final class StartupHandler { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor sPrefsEditor = preferences.edit(); - sPrefsEditor.putLong(LAST_CLOSED, new Date(System.currentTimeMillis()).getTime()); + sPrefsEditor.putLong(LAST_CLOSED, System.currentTimeMillis()); sPrefsEditor.apply(); } @@ -70,10 +70,11 @@ public final class StartupHandler */ public static void checkSessionReset(Context context) { - long currentTime = new Date(System.currentTimeMillis()).getTime(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); long lastOpen = preferences.getLong(LAST_CLOSED, 0); - if (currentTime > (lastOpen + SESSION_TIMEOUT)) + final Instant current = Instant.now(); + final Instant lastOpened = Instant.ofEpochMilli(lastOpen); + if (current.isAfter(lastOpened.plus(6, ChronoUnit.HOURS))) { new AfterDirectoryInitializationRunner().run(context, false, NativeLibrary::ReportStartToAnalytics); diff --git a/Source/Android/build.gradle b/Source/Android/build.gradle index 3333dd49ac..8d8b1e2d4f 100644 --- a/Source/Android/build.gradle +++ b/Source/Android/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.0.0' } } diff --git a/Source/Android/gradle/wrapper/gradle-wrapper.properties b/Source/Android/gradle/wrapper/gradle-wrapper.properties index e972e5cc78..cfdbb2c3bb 100644 --- a/Source/Android/gradle/wrapper/gradle-wrapper.properties +++ b/Source/Android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip