@Test public void setInstallingTest() { mockReleaseDetails(false); Distribute.getInstance().startFromBackground(mContext); Distribute.getInstance().setInstalling(mReleaseDetails); verifyStatic(); SharedPreferencesManager.remove(eq(PREFERENCE_KEY_RELEASE_DETAILS)); verifyStatic(); SharedPreferencesManager.remove(eq(PREFERENCE_KEY_DOWNLOAD_STATE)); verifyStatic(never()); SharedPreferencesManager.putInt(eq(PREFERENCE_KEY_DOWNLOAD_STATE), eq(DOWNLOAD_STATE_INSTALLING)); verifyReleaseDetailsAreStored(); }
@WorkerThread synchronized void setInstalling(@NonNull ReleaseDetails releaseDetails) { if (releaseDetails != mReleaseDetails) { return; } if (releaseDetails.isMandatoryUpdate()) { cancelNotification(); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_INSTALLING); } else { completeWorkflow(releaseDetails); } String groupId = releaseDetails.getDistributionGroupId(); String releaseHash = releaseDetails.getReleaseHash(); int releaseId = releaseDetails.getId(); AppCenterLog.debug(LOG_TAG, "Stored release details: group id=" + groupId + " release hash=" + releaseHash + " release id=" + releaseId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_DISTRIBUTION_GROUP_ID, groupId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_RELEASE_HASH, releaseHash); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOADED_RELEASE_ID, releaseId); }
Distribute extends AbstractAppCenterService { @WorkerThread synchronized void setInstalling(@NonNull ReleaseDetails releaseDetails) { if (releaseDetails != mReleaseDetails) { return; } if (releaseDetails.isMandatoryUpdate()) { cancelNotification(); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_INSTALLING); } else { completeWorkflow(releaseDetails); } String groupId = releaseDetails.getDistributionGroupId(); String releaseHash = releaseDetails.getReleaseHash(); int releaseId = releaseDetails.getId(); AppCenterLog.debug(LOG_TAG, "Stored release details: group id=" + groupId + " release hash=" + releaseHash + " release id=" + releaseId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_DISTRIBUTION_GROUP_ID, groupId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_RELEASE_HASH, releaseHash); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOADED_RELEASE_ID, releaseId); } }
Distribute extends AbstractAppCenterService { @WorkerThread synchronized void setInstalling(@NonNull ReleaseDetails releaseDetails) { if (releaseDetails != mReleaseDetails) { return; } if (releaseDetails.isMandatoryUpdate()) { cancelNotification(); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_INSTALLING); } else { completeWorkflow(releaseDetails); } String groupId = releaseDetails.getDistributionGroupId(); String releaseHash = releaseDetails.getReleaseHash(); int releaseId = releaseDetails.getId(); AppCenterLog.debug(LOG_TAG, "Stored release details: group id=" + groupId + " release hash=" + releaseHash + " release id=" + releaseId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_DISTRIBUTION_GROUP_ID, groupId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_RELEASE_HASH, releaseHash); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOADED_RELEASE_ID, releaseId); } private  Distribute(); }
Distribute extends AbstractAppCenterService { @WorkerThread synchronized void setInstalling(@NonNull ReleaseDetails releaseDetails) { if (releaseDetails != mReleaseDetails) { return; } if (releaseDetails.isMandatoryUpdate()) { cancelNotification(); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_INSTALLING); } else { completeWorkflow(releaseDetails); } String groupId = releaseDetails.getDistributionGroupId(); String releaseHash = releaseDetails.getReleaseHash(); int releaseId = releaseDetails.getId(); AppCenterLog.debug(LOG_TAG, "Stored release details: group id=" + groupId + " release hash=" + releaseHash + " release id=" + releaseId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_DISTRIBUTION_GROUP_ID, groupId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_RELEASE_HASH, releaseHash); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOADED_RELEASE_ID, releaseId); } private  Distribute(); static synchronized Distribute getInstance(); static AppCenterFuture<Boolean> isEnabled(); static AppCenterFuture<Void> setEnabled(boolean enabled); static void setInstallUrl(String installUrl); static void setApiUrl(String apiUrl); @SuppressWarnings("WeakerAccess") static int getUpdateTrack(); static void setUpdateTrack(@UpdateTrack int updateTrack); static void setListener(DistributeListener listener); static void setEnabledForDebuggableBuild(boolean enabled); static void notifyUpdateAction(@UpdateAction int updateAction); static void checkForUpdate(); static void disableAutomaticCheckForUpdate(); @Override String getServiceName(); @Override Map<String, LogFactory> getLogFactories(); @Override synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp); @Override synchronized void onActivityResumed(Activity activity); @Override synchronized void onActivityPaused(Activity activity); @Override void onApplicationEnterForeground(); }
Distribute extends AbstractAppCenterService { @WorkerThread synchronized void setInstalling(@NonNull ReleaseDetails releaseDetails) { if (releaseDetails != mReleaseDetails) { return; } if (releaseDetails.isMandatoryUpdate()) { cancelNotification(); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOAD_STATE, DOWNLOAD_STATE_INSTALLING); } else { completeWorkflow(releaseDetails); } String groupId = releaseDetails.getDistributionGroupId(); String releaseHash = releaseDetails.getReleaseHash(); int releaseId = releaseDetails.getId(); AppCenterLog.debug(LOG_TAG, "Stored release details: group id=" + groupId + " release hash=" + releaseHash + " release id=" + releaseId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_DISTRIBUTION_GROUP_ID, groupId); SharedPreferencesManager.putString(PREFERENCE_KEY_DOWNLOADED_RELEASE_HASH, releaseHash); SharedPreferencesManager.putInt(PREFERENCE_KEY_DOWNLOADED_RELEASE_ID, releaseId); } private  Distribute(); static synchronized Distribute getInstance(); static AppCenterFuture<Boolean> isEnabled(); static AppCenterFuture<Void> setEnabled(boolean enabled); static void setInstallUrl(String installUrl); static void setApiUrl(String apiUrl); @SuppressWarnings("WeakerAccess") static int getUpdateTrack(); static void setUpdateTrack(@UpdateTrack int updateTrack); static void setListener(DistributeListener listener); static void setEnabledForDebuggableBuild(boolean enabled); static void notifyUpdateAction(@UpdateAction int updateAction); static void checkForUpdate(); static void disableAutomaticCheckForUpdate(); @Override String getServiceName(); @Override Map<String, LogFactory> getLogFactories(); @Override synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp); @Override synchronized void onActivityResumed(Activity activity); @Override synchronized void onActivityPaused(Activity activity); @Override void onApplicationEnterForeground();  }