public static final String STATUS_PATH = "/status.php";\r
\r
/**\r
- * Can be used to get the currently selected ownCloud account in the\r
- * preferences\r
+ * Can be used to get the currently selected ownCloud {@link Account} in the\r
+ * application preferences.\r
* \r
- * @param context The current appContext\r
- * @return The current account or first available, if none is available,\r
- * then null.\r
+ * @param context The current application {@link Context}\r
+ * @return The ownCloud {@link Account} currently saved in preferences, or the first \r
+ * {@link Account} available, if valid (still registered in the system as ownCloud \r
+ * account). If none is available and valid, returns null.\r
*/\r
public static Account getCurrentOwnCloudAccount(Context context) {\r
Account[] ocAccounts = AccountManager.get(context).getAccountsByType(\r
String accountName = appPreferences\r
.getString("select_oc_account", null);\r
\r
+ // account validation: the saved account MUST be in the list of ownCloud Accounts known by the AccountManager\r
if (accountName != null) {\r
for (Account account : ocAccounts) {\r
if (account.name.equals(accountName)) {\r
}\r
\r
if (defaultAccount == null && ocAccounts.length != 0) {\r
- // we at least need to take first account as fallback\r
+ // take first account as fallback\r
defaultAccount = ocAccounts[0];\r
}\r
\r