From 983c78e92899b94b237c292968c1be2bf53c5d57 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Thu, 6 Sep 2012 14:29:31 -0700 Subject: [PATCH] Log capabilities (w/ STOPSHIP) Change-Id: Id448fd48ee1d7a2eabab8f3bd4dae34b6e401a7d --- .../android/email/provider/EmailProvider.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 49707d8c7..68d5cf6f0 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2718,17 +2718,35 @@ outer: .appendQueryParameter("account", account).build().toString(); } + private String getBits(int bitField) { + StringBuilder sb = new StringBuilder(" "); + for (int i = 0; i < 32; i++, bitField >>= 1) { + if ((bitField & 1) != 0) { + sb.append("" + i + " "); + } + } + return sb.toString(); + } + private int getCapabilities(Context context, long accountId) { EmailServiceProxy service = EmailServiceUtils.getServiceForAccount(context, mServiceCallback, accountId); int capabilities = 0; + Account acct = null; try { service.setTimeout(10); - Account acct = Account.restoreAccountWithId(context, accountId); - if (acct == null) return 0; + acct = Account.restoreAccountWithId(context, accountId); + if (acct == null) { + Log.d(TAG, "getCapabilities() for " + accountId + ": returning 0x0 (no account)"); + return 0; + } capabilities = service.getCapabilities(acct); - } catch (RemoteException e) { + // STOPSHIP + Log.d(TAG, "getCapabilities() for " + acct.mDisplayName + ": 0x" + + Integer.toHexString(capabilities) + getBits(capabilities)); + } catch (RemoteException e) { // Nothing to do + Log.w(TAG, "getCapabilities() for " + acct.mDisplayName + ": RemoteException"); } return capabilities; }