private void unregisterListeners() {
    try {
      mConn.unregisterConnectionListener(mConnectionListener);
    } catch (RemoteException e) {

      mHandler.showServiceErrorAlert(e.getLocalizedMessage());
      LogCleaner.error(ImApp.LOG_TAG, "remote error", e);
    }
  }
 public boolean export(String password, File storeFile) {
   try {
     saveOpenSSL(password, storeFile);
     return true;
   } catch (IOException e) {
     LogCleaner.error(ImApp.LOG_TAG, "error saving keystore", e);
     return false;
   }
 }
 public boolean save() {
   try {
     if (mPassword != null) saveOpenSSL(mPassword, mStoreFile);
     else savePlain(mStoreFile);
     return true;
   } catch (IOException e) {
     LogCleaner.error(ImApp.LOG_TAG, "error saving keystore", e);
     return false;
   }
 }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Intent intent = getIntent();
    Uri data = intent.getData();
    if (data == null) {
      Log.e(ImApp.LOG_TAG, "Need account data to sign in");
      // finish();
      return;
    }

    ContentResolver cr = getContentResolver();

    Cursor c =
        cr.query(
            data,
            ACCOUNT_SELECTION,
            null /* selection */,
            null /* selection args */,
            null /* sort order */);
    final long providerId;
    final long accountId;

    try {
      if (!c.moveToFirst()) {
        LogCleaner.warn(ImApp.LOG_TAG, "[SignoutActivity] No data for " + data);
        //   finish();
        return;
      }

      providerId = c.getLong(c.getColumnIndexOrThrow(Imps.Account.PROVIDER));
      accountId = c.getLong(c.getColumnIndexOrThrow(Imps.Account._ID));
    } finally {
      c.close();
    }

    mApp = (ImApp) getApplication();
    mApp.callWhenServiceConnected(
        mHandler,
        new Runnable() {
          public void run() {
            signOut(providerId, accountId);
          }
        });
  }