EmailProvider dump
Change-Id: Id975c99427b41f4a56235dc6ba5ad515d6700fe5
This commit is contained in:
parent
fdb1635868
commit
af092bd5f8
|
@ -96,6 +96,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -4484,4 +4486,35 @@ outer:
|
|||
context.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
Context context = getContext();
|
||||
writer.println("Installed services:");
|
||||
for (EmailServiceInfo info: EmailServiceUtils.getServiceInfoList(context)) {
|
||||
writer.println(" " + info);
|
||||
}
|
||||
writer.println();
|
||||
writer.println("Accounts: ");
|
||||
Cursor cursor = query(Account.CONTENT_URI, Account.CONTENT_PROJECTION, null, null, null);
|
||||
if (cursor.getCount() == 0) {
|
||||
writer.println(" None");
|
||||
}
|
||||
try {
|
||||
while (cursor.moveToNext()) {
|
||||
Account account = new Account();
|
||||
account.restore(cursor);
|
||||
writer.println(" Account " + account.mDisplayName);
|
||||
HostAuth hostAuth =
|
||||
HostAuth.restoreHostAuthWithId(context, account.mHostAuthKeyRecv);
|
||||
if (hostAuth != null) {
|
||||
writer.println(" Protocol = " + hostAuth.mProtocol +
|
||||
(TextUtils.isEmpty(account.mProtocolVersion) ? "" : " version " +
|
||||
account.mProtocolVersion));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,8 @@ public class EmailServiceUtils {
|
|||
sb.append(protocol);
|
||||
sb.append(", ");
|
||||
sb.append(klass != null ? "Local" : "Remote");
|
||||
sb.append(" , Account Type: ");
|
||||
sb.append(accountType);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue