Example #1
0
 private void addAdapter(Context paramContext, ITccSyncDbAdapter.DbAdapterType paramDbAdapterType, String[] paramArrayOfString)
 {
   this.adapterType = paramDbAdapterType;
   int i = $SWITCH_TABLE$com$tencent$tccsync$ITccSyncDbAdapter$DbAdapterType()[paramDbAdapterType.ordinal()];
   Object localObject = null;
   switch (i)
   {
   case 3:
   case 5:
   default:
   case 2:
   case 4:
   case 6:
   case 7:
   }
   while (true)
   {
     this.adapterNameVec.add(localObject);
     return;
     this.adapterVec.add(TccSyncDb.getITccSyncDbAdapter(paramContext, paramDbAdapterType));
     localObject = QQPimUtils.getContactMapPath_LoginedAccount(this.mUseSdcard);
     continue;
     this.adapterVec.add(TccSyncDb.getITccSyncDbAdapter(paramContext, paramDbAdapterType, paramArrayOfString));
     localObject = QQPimUtils.getSmsMapPath(this.mUseSdcard);
     this.smsApapterAdded = true;
     continue;
     this.adapterVec.add(TccSyncDb.getITccSyncDbAdapter(paramContext, paramDbAdapterType));
     localObject = QQPimUtils.getCalllogMapPath(this.mUseSdcard);
     continue;
     this.adapterVec.add(TccSyncDb.getITccSyncDbAdapter(paramContext, paramDbAdapterType));
     localObject = QQPimUtils.getBookmarkPath(this.mUseSdcard);
   }
 }
Example #2
0
 protected ISyncModel.SyncResult safeWork()
 {
   LOCAL_SYNC_RUNNING = true;
   registerSyncStatusReceiver();
   this.startTime = System.currentTimeMillis();
   try
   {
     ISyncModel.SyncResult localSyncResult = work();
     if (localSyncResult == ISyncModel.SyncResult.SUCCEED)
       writeSyncLog(1, this.startTime, this.syncMethod, this.localBackupId);
     while (true)
     {
       if (this.smsApapterAdded)
       {
         if (this.mHandler != null)
         {
           Message localMessage = this.mHandler.obtainMessage();
           localMessage.what = 256;
           this.mHandler.sendMessage(localMessage);
         }
         ((SYSSmsDao)SYSSmsDao.getIDao(this.context)).updateAllThreadTime();
       }
       unregisterSyncStstusReceiver();
       LOCAL_SYNC_RUNNING = false;
       return localSyncResult;
       if (localSyncResult != ISyncModel.SyncResult.USER_CANCEL)
         writeSyncLog(0, this.startTime, this.syncMethod, this.localBackupId);
     }
   }
   catch (SyncException localSyncException)
   {
     if (this.stoppedCommand)
       return ISyncModel.SyncResult.USER_CANCEL;
     this.lastErrorDes = localSyncException.getMessage();
     if (this.lastErrorDes == null)
       this.lastErrorDes = "unknown exception(SyncException), its getMessage() is null";
     QQPimUtils.writeToLog("SYNC ENGINE", this.lastErrorDes);
     writeSyncLog(0, this.startTime, this.syncMethod, this.localBackupId);
     return ISyncModel.SyncResult.FAIL;
   }
   catch (Throwable localThrowable)
   {
     if (this.stoppedCommand)
       return ISyncModel.SyncResult.USER_CANCEL;
     this.lastErrorDes = localThrowable.getMessage();
     if (this.lastErrorDes == null)
       this.lastErrorDes = "unknown exception(Throwable), its getMessage() is null";
     QQPimUtils.writeToLog("SYNC ENGINE", this.lastErrorDes);
     writeSyncLog(0, this.startTime, this.syncMethod, this.localBackupId);
   }
   return ISyncModel.SyncResult.FAIL;
 }
Example #3
0
 public static boolean isContactMapFileExist()
 {
   if (LoginInformation.getSingleInstance().isLogined());
   for (String str = QQPimUtils.getContactMapPath_LoginedAccount(SDCardUtil.isSDCardMounted()); str == null; str = QQPimUtils.getContactMapPath(ConfigDao.getInstance(null).getStringValue(IConfigDao.ConfigValueTag.DEFAULT_ACCOUNT), SDCardUtil.isSDCardMounted()))
     return false;
   return new File(str).exists();
 }
Example #4
0
 private boolean releaseLockFile()
 {
   File localFile = new File(this.mSdcardLockFilePath);
   boolean bool1 = localFile.exists();
   boolean bool2 = false;
   if (bool1);
   try
   {
     boolean bool3 = localFile.delete();
     bool2 = bool3;
     return bool2;
   }
   catch (Throwable localThrowable)
   {
     QQPimUtils.writeToLog("SYNC ENGINE", "checkLockFile throwable:" + localThrowable.toString());
   }
   return false;
 }
Example #5
0
 private boolean checkLockFileAvailableAndAdd()
 {
   try
   {
     File localFile = new File(this.mSdcardLockFilePath);
     if (!localFile.exists())
     {
       localFile.getParentFile().mkdirs();
       boolean bool = localFile.createNewFile();
       FileOutputStream localFileOutputStream = new FileOutputStream(localFile);
       localFileOutputStream.write(0);
       localFileOutputStream.close();
       return bool;
     }
     return false;
   }
   catch (Throwable localThrowable)
   {
     QQPimUtils.writeToLog("SYNC ENGINE", "checkLockFile throwable:" + localThrowable.toString());
   }
   return false;
 }
Example #6
0
 protected ISyncModel.SyncResult work()
 {
   Object localObject;
   if (this.mUseSdcard)
   {
     if (!checkLockFileAvailableAndAdd())
       syncSendBroadcastAndCheckIfRemoteSyncRunning();
     if (!syncSendBroadcastAndCheckIfRemoteSyncRunning())
     {
       localObject = ISyncModel.SyncResult.FAIL_CONFLICT;
       return localObject;
     }
   }
   QQPimUtils.userStoppedSync = false;
   this.workingThread = Thread.currentThread();
   this.downloadBytes = 0L;
   this.uploadBytes = 0L;
   if (!QQPimUtils.createFilesDir(this.mUseSdcard))
     return ISyncModel.SyncResult.FAIL;
   RemoteSync localRemoteSync = new RemoteSync();
   HttpHelper localHttpHelper = new HttpHelper();
   String str1 = LoginInformation.getSingleInstance().getLoginKey();
   String str2 = LoginInformation.getSingleInstance().getLoginedAccount();
   String str3 = QQPimUtils.getServerURL();
   String str4 = QQPimUtils.getUniqueMachineAppID(this.mUseSdcard);
   ISyncModel.SyncResult localSyncResult1 = ISyncModel.SyncResult.SUCCEED;
   localRemoteSync.setConfigure(str3, str2, str1, str4, this, 45600, 272);
   int i = 0;
   label140: int j;
   int k;
   ISyncModel.SyncResult localSyncResult2;
   label165: label170: int n;
   if (i >= this.adapterNameVec.size())
   {
     j = localRemoteSync.start();
     k = 0;
     localSyncResult2 = localSyncResult1;
     if (j == 0)
       break label332;
     int i2 = k;
     localObject = localSyncResult2;
     n = i2;
     label182: QQPimUtils.writeToLog("SyncmlEngine, do,while leave time: ", String.valueOf(System.currentTimeMillis()));
     if (!this.stoppedCommand)
       break label609;
     localObject = ISyncModel.SyncResult.USER_CANCEL;
   }
   while (true)
   {
     long l = System.currentTimeMillis();
     localRemoteSync.end();
     QQPimUtils.writeToLog("SyncmlEngine.end cost:", String.valueOf(System.currentTimeMillis() - l));
     this.workingThread = null;
     if (!this.stoppedCommand)
       break;
     return ISyncModel.SyncResult.USER_CANCEL;
     ITccSyncDbAdapter localITccSyncDbAdapter = (ITccSyncDbAdapter)this.adapterVec.get(i);
     String str5 = (String)this.adapterNameVec.get(i);
     QQPimUtils.writeToLog("SyncModel.work, syncType: ", this.syncType.toInt());
     RemoteSync.SyncType localSyncType = this.syncType;
     if (str5 == null)
       str5 = "";
     localRemoteSync.addDataSource(localSyncType, localITccSyncDbAdapter, str5);
     i++;
     break label140;
     label332: if (this.stoppedCommand)
       break label170;
     QQPimUtils.writeToLog("SyncmlEngine, do,while entry/asyncnext leave time: ", String.valueOf(System.currentTimeMillis()));
     k++;
     String str6 = localRemoteSync.getPostUrl();
     byte[] arrayOfByte1 = localRemoteSync.GetPostBuf();
     if (localHttpHelper.postSync(str6, arrayOfByte1) != 0)
     {
       localSyncResult2 = ISyncModel.SyncResult.FAIL;
       this.lastErrorDes = this.syncErrorAlertBecauseNetwork;
       QQPimUtils.writeToLog("SYNC_JAVA", this.syncErrorAlertBecauseNetwork);
     }
     QQPimUtils.writeToLog("SyncmlEngine, post leave time: ", String.valueOf(System.currentTimeMillis()));
     this.uploadBytes += arrayOfByte1.length;
     QQPimUtils.writeToLog("POST UPLOAD TOTAL COUNT", new Long(this.uploadBytes).toString());
     if (this.stoppedCommand)
       break label170;
     QQPimUtils.writeToLog("SyncmlEngine, recv entry time: ", String.valueOf(System.currentTimeMillis()));
     byte[] arrayOfByte2 = localHttpHelper.syncRecv();
     if (arrayOfByte2 == null)
     {
       ISyncModel.SyncResult localSyncResult3 = ISyncModel.SyncResult.FAIL;
       this.lastErrorDes = this.syncErrorAlertBecauseNetwork;
       QQPimUtils.writeToLog("SYNC_JAVA", this.syncErrorAlertBecauseNetwork);
       int m = k;
       localObject = localSyncResult3;
       n = m;
       break label182;
     }
     this.downloadBytes += arrayOfByte2.length;
     QQPimUtils.writeToLog("POST DOWNLOAD TOTAL COUNT", new Long(this.downloadBytes).toString());
     QQPimUtils.writeToLog("SyncmlEngine, writeBackRecvBuf entry time: ", String.valueOf(System.currentTimeMillis()));
     localRemoteSync.writeBackRecvBuf(arrayOfByte2);
     QQPimUtils.writeToLog("SyncmlEngine, writeBackRecvBuf leave time: ", String.valueOf(System.currentTimeMillis()));
     QQPimUtils.writeToLog("SyncmlEngine, asyncNext entry time: ", String.valueOf(System.currentTimeMillis()));
     for (j = localRemoteSync.next(); 3 == j; j = localRemoteSync.nextStep());
     break label165;
     label609: int i1 = localRemoteSync.getLastError();
     if ((n == 1) && (i1 == -32215))
     {
       localObject = ISyncModel.SyncResult.RELOGIN;
       LoginInformation.getSingleInstance().clearLoginInformation();
     }
     else if ((localObject != ISyncModel.SyncResult.FAIL) && (i1 != 0))
     {
       localObject = ISyncModel.SyncResult.FAIL;
       this.lastErrorDes = this.syncErrorAlert;
       QQPimUtils.writeToLog("SYNC_JAVA", this.syncErrorAlertBecauseEngine + i1);
     }
   }
 }