Source:
<code>protected void finishLogin() { SharedPreferences sharedPreferences = getSharedPreferences(Constants.GCM_PREFERENCE_NAME, Context.MODE_PRIVATE); sharedPreferences.edit().putBoolean(GCMPreference.SENT_TOKEN_TO_SERVER, false).apply(); CommonUtils.registerDevice(this, testpressService); final Account account = new Account(username, APPLICATION_ID); <START> deleteDownloadedVideos(); <END> saveUsernameToPreference(); if (requestNewAccount) { accountManager.addAccountExplicitly(account, password, null); accountManager.setAuthToken(account, APPLICATION_ID, authToken); } else { accountManager.setPassword(account, password); } DaoSession daoSession = ((TestpressApplication) getApplicationContext()).getDaoSession(); PostDao postDao = daoSession.getPostDao(); postDao.deleteAll(); daoSession.clear(); if (authTokenType != null && authTokenType.equals(APPLICATION_ID)) { final Intent intent = new Intent(); intent.putExtra(KEY_ACCOUNT_NAME, username); intent.putExtra(KEY_ACCOUNT_TYPE, APPLICATION_ID); intent.putExtra(KEY_AUTHTOKEN, authToken); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); } else { Intent intent = new Intent(this, MainActivity.class); if (getIntent().getStringExtra(Constants.DEEP_LINK_TO) != null) { switch (getIntent().getStringExtra(Constants.DEEP_LINK_TO)) { case Constants.DEEP_LINK_TO_POST: intent = new Intent(this, PostActivity.class); intent.putExtra(Constants.IS_DEEP_LINK, true); intent.putExtras(getIntent().getExtras()); break; default: intent = new Intent(this, MainActivity.class); break; } } intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } finish(); }</code><technical_language>I read story deleteDownloadedVideos I this method is deleting based some condition</technical_language>

Target:
protected void finishLogin() { SharedPreferences sharedPreferences = getSharedPreferences(Constants.GCM_PREFERENCE_NAME, Context.MODE_PRIVATE); sharedPreferences.edit().putBoolean(GCMPreference.SENT_TOKEN_TO_SERVER, false).apply(); CommonUtils.registerDevice(this, testpressService); final Account account = new Account(username, APPLICATION_ID); if (!isPreviouslyLoggedInUser()) { deleteDownloadedVideos(); } saveLoggedInUsername(); if (requestNewAccount) { accountManager.addAccountExplicitly(account, password, null); accountManager.setAuthToken(account, APPLICATION_ID, authToken); } else { accountManager.setPassword(account, password); } DaoSession daoSession = ((TestpressApplication) getApplicationContext()).getDaoSession(); PostDao postDao = daoSession.getPostDao(); postDao.deleteAll(); daoSession.clear(); if (authTokenType != null && authTokenType.equals(APPLICATION_ID)) { final Intent intent = new Intent(); intent.putExtra(KEY_ACCOUNT_NAME, username); intent.putExtra(KEY_ACCOUNT_TYPE, APPLICATION_ID); intent.putExtra(KEY_AUTHTOKEN, authToken); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); } else { Intent intent = new Intent(this, MainActivity.class); if (getIntent().getStringExtra(Constants.DEEP_LINK_TO) != null) { switch (getIntent().getStringExtra(Constants.DEEP_LINK_TO)) { case Constants.DEEP_LINK_TO_POST: intent = new Intent(this, PostActivity.class); intent.putExtra(Constants.IS_DEEP_LINK, true); intent.putExtras(getIntent().getExtras()); break; default: intent = new Intent(this, MainActivity.class); break; } } intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } finish(); }