Source:
<code>private static void upgrade(int oldVersion) { if (oldVersion == -1) { <START> if(UserPreferences.getUsageCountingMillis() < 0){ <END> UserPreferences.resetUsageCounting(); } return; } if (oldVersion < 1070196) { int oldValueInDays = UserPreferences.getEpisodeCleanupValue(); if (oldValueInDays > 0) { UserPreferences.setEpisodeCleanupValue(oldValueInDays * 24); } } if (oldVersion < 1070197) { if (prefs.getBoolean("prefMobileUpdate", false)) { prefs.edit().putString("prefMobileUpdateAllowed", "everything").apply(); } } if (oldVersion < 1070300) { prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, UserPreferences.PREF_MEDIA_PLAYER_EXOPLAYER).apply(); if (prefs.getBoolean("prefEnableAutoDownloadOnMobile", false)) { UserPreferences.setAllowMobileAutoDownload(true); } switch (prefs.getString("prefMobileUpdateAllowed", "images")) { case "everything": UserPreferences.setAllowMobileFeedRefresh(true); UserPreferences.setAllowMobileEpisodeDownload(true); UserPreferences.setAllowMobileImages(true); break; case "images": UserPreferences.setAllowMobileImages(true); break; case "nothing": UserPreferences.setAllowMobileImages(false); break; } } if (oldVersion < 1070400) { int theme = UserPreferences.getTheme(); if (theme == R.style.Theme_AntennaPod_Light) { prefs.edit().putString(UserPreferences.PREF_THEME, "system").apply(); } UserPreferences.setQueueLocked(false); UserPreferences.setStreamOverDownload(false); if (!prefs.contains(UserPreferences.PREF_ENQUEUE_LOCATION)) { final String keyOldPrefEnqueueFront = "prefQueueAddToFront"; boolean enqueueAtFront = prefs.getBoolean(keyOldPrefEnqueueFront, false); EnqueueLocation enqueueLocation = enqueueAtFront ? EnqueueLocation.FRONT : EnqueueLocation.BACK; UserPreferences.setEnqueueLocation(enqueueLocation); } } if (oldVersion < 1080100) { prefs.edit().putString(UserPreferences.PREF_VIDEO_BEHAVIOR, "pip").apply(); } }</code><technical_language>is this "if" needed? I code called install. usage stats counting. I miss something</technical_language>

Target:
private static void upgrade(int oldVersion) { if (oldVersion == -1) { if (UserPreferences.getUsageCountingDateMillis() < 0) { UserPreferences.resetUsageCountingDate(); } return; } if (oldVersion < 1070196) { int oldValueInDays = UserPreferences.getEpisodeCleanupValue(); if (oldValueInDays > 0) { UserPreferences.setEpisodeCleanupValue(oldValueInDays * 24); } } if (oldVersion < 1070197) { if (prefs.getBoolean("prefMobileUpdate", false)) { prefs.edit().putString("prefMobileUpdateAllowed", "everything").apply(); } } if (oldVersion < 1070300) { prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, UserPreferences.PREF_MEDIA_PLAYER_EXOPLAYER).apply(); if (prefs.getBoolean("prefEnableAutoDownloadOnMobile", false)) { UserPreferences.setAllowMobileAutoDownload(true); } switch (prefs.getString("prefMobileUpdateAllowed", "images")) { case "everything": UserPreferences.setAllowMobileFeedRefresh(true); UserPreferences.setAllowMobileEpisodeDownload(true); UserPreferences.setAllowMobileImages(true); break; case "images": UserPreferences.setAllowMobileImages(true); break; case "nothing": UserPreferences.setAllowMobileImages(false); break; } } if (oldVersion < 1070400) { int theme = UserPreferences.getTheme(); if (theme == R.style.Theme_AntennaPod_Light) { prefs.edit().putString(UserPreferences.PREF_THEME, "system").apply(); } UserPreferences.setQueueLocked(false); UserPreferences.setStreamOverDownload(false); if (!prefs.contains(UserPreferences.PREF_ENQUEUE_LOCATION)) { final String keyOldPrefEnqueueFront = "prefQueueAddToFront"; boolean enqueueAtFront = prefs.getBoolean(keyOldPrefEnqueueFront, false); EnqueueLocation enqueueLocation = enqueueAtFront ? EnqueueLocation.FRONT : EnqueueLocation.BACK; UserPreferences.setEnqueueLocation(enqueueLocation); } } if (oldVersion < 1080100) { prefs.edit().putString(UserPreferences.PREF_VIDEO_BEHAVIOR, "pip").apply(); } }