When I call ContentResolver.getCurrentSyncs() and print the account name of the SyncInfo object, I get stars (*****) instead of chars.
Is it only censored on the log, or is the string itself unreadable? Any idea how I can specifically compare it? (equals)
String original = "myName";
for (SyncInfo info : ContentResolver.getCurrentSyncs()) {
Log.i(info.account.name); // prints ******
boolean result = original.equals(info.account.name); // always false?
}
permissions granted:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
on Android M
EDIT: Accessing the account names directly from AccountManager are readable. (getAccounts())
Got it.
Did not find any documentation but in the source code of SyncInfo.java at line 32:
/**
* Used when the caller receiving this object doesn't have permission to access the accounts
* on device.
* @See Manifest.permission.GET_ACCOUNTS
*/
private static final Account REDACTED_ACCOUNT = new Account("*****", "*****");
I double checked the permission, but did not find something wrong, so I disconnected the phone, got icetea and watched netflix. That fixed the issue.
Edit: I changed the account type definition at one point, but that does not explain why getCurrentSyncs() got censored and getAccounts() wasn't.
Edit2: Got the issue on another phone: After disabling and re-enabling the CONTACTS permission my app required, GET_ACCOUNTS was granted truly and the issue disappeared.