当前位置: 首页>>代码示例>>Java>>正文


Java ParcelUtil类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.util.ParcelUtil的典型用法代码示例。如果您正苦于以下问题:Java ParcelUtil类的具体用法?Java ParcelUtil怎么用?Java ParcelUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParcelUtil类属于org.thoughtcrime.securesms.util包,在下文中一共展示了ParcelUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
@Override
public Job deserialize(EncryptionKeys keys, boolean encrypted, String serialized) throws IOException {
  try {
    String plaintext;

    if (encrypted) {
      MasterSecret masterSecret = ParcelUtil.deserialize(keys.getEncoded(), MasterSecret.CREATOR);
      MasterCipher masterCipher = new MasterCipher(masterSecret);
      plaintext = masterCipher.decryptBody(serialized);
    } else {
      plaintext = serialized;
    }

    return delegate.deserialize(keys, encrypted, plaintext);
  } catch (InvalidMessageException e) {
    throw new IOException(e);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:19,代码来源:EncryptingJobSerializer.java

示例2: setMasterSecret

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
public void setMasterSecret(final MasterSecret masterSecret) {
  synchronized (KeyCachingService.class) {
    KeyCachingService.masterSecret = masterSecret;

    foregroundService();
    broadcastNewSecret();
    startTimeoutIfAppropriate();

    new AsyncTask<Void, Void, Void>() {
      @Override
      protected Void doInBackground(Void... params) {
        if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
          ApplicationContext.getInstance(KeyCachingService.this)
                            .getJobManager()
                            .setEncryptionKeys(new EncryptionKeys(ParcelUtil.serialize(masterSecret)));
          MessageNotifier.updateNotification(KeyCachingService.this, masterSecret);
        }
        return null;
      }
    }.execute();
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:23,代码来源:KeyCachingService.java

示例3: onCreate

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
@Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    this.masterSecret = getIntent().getParcelableExtra("master_secret");

    if (needsUpgradeTask()) {
      Log.w("DatabaseUpgradeActivity", "Upgrading...");
      setContentView(R.layout.database_upgrade_activity);

      ProgressBar indeterminateProgress = (ProgressBar)findViewById(R.id.indeterminate_progress);
      ProgressBar determinateProgress   = (ProgressBar)findViewById(R.id.determinate_progress);

      new DatabaseUpgradeTask(indeterminateProgress, determinateProgress)
          .execute(VersionTracker.getLastSeenVersion(this));
    } else {
      VersionTracker.updateLastSeenVersion(this);
      ApplicationContext.getInstance(this)
                        .getJobManager()
                        .setEncryptionKeys(new EncryptionKeys(ParcelUtil.serialize(masterSecret)));
//      DecryptingQueue.schedulePendingDecrypts(DatabaseUpgradeActivity.this, masterSecret);
      MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret);
      startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
      finish();
    }
  }
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:26,代码来源:DatabaseUpgradeActivity.java

示例4: serialize

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
@Override
public String serialize(Job job) throws IOException {
  String plaintext = delegate.serialize(job);

  if (job.getEncryptionKeys() != null) {
    MasterSecret masterSecret = ParcelUtil.deserialize(job.getEncryptionKeys().getEncoded(),
                                                       MasterSecret.CREATOR);
    MasterCipher masterCipher = new MasterCipher(masterSecret);

    return masterCipher.encryptBody(plaintext);
  } else {
    return plaintext;
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:EncryptingJobSerializer.java

示例5: onPostExecute

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
@Override
    protected void onPostExecute(Void result) {
      VersionTracker.updateLastSeenVersion(DatabaseUpgradeActivity.this);
//      DecryptingQueue.schedulePendingDecrypts(DatabaseUpgradeActivity.this, masterSecret);
      ApplicationContext.getInstance(DatabaseUpgradeActivity.this)
                        .getJobManager()
                        .setEncryptionKeys(new EncryptionKeys(ParcelUtil.serialize(masterSecret)));

      MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret);

      startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
      finish();
    }
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:14,代码来源:DatabaseUpgradeActivity.java

示例6: CreateSignedPreKeyJob

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
public CreateSignedPreKeyJob(Context context, MasterSecret masterSecret) {
  super(context, JobParameters.newBuilder()
                              .withPersistence()
                              .withRequirement(new NetworkRequirement(context))
                              .withEncryption(new EncryptionKeys(ParcelUtil.serialize(masterSecret)))
                              .withGroupId(CreateSignedPreKeyJob.class.getSimpleName())
                              .create());
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:9,代码来源:CreateSignedPreKeyJob.java

示例7: onRun

import org.thoughtcrime.securesms.util.ParcelUtil; //导入依赖的package包/类
@Override
public void onRun() throws IOException {
  MasterSecret masterSecret = ParcelUtil.deserialize(getEncryptionKeys().getEncoded(), MasterSecret.CREATOR);

  if (TextSecurePreferences.isSignedPreKeyRegistered(context)) {
    Log.w(TAG, "Signed prekey already registered...");
    return;
  }

  IdentityKeyPair    identityKeyPair    = IdentityKeyUtil.getIdentityKeyPair(context, masterSecret);
  SignedPreKeyRecord signedPreKeyRecord = PreKeyUtil.generateSignedPreKey(context, masterSecret, identityKeyPair);

  accountManager.setSignedPreKey(signedPreKeyRecord);
  TextSecurePreferences.setSignedPreKeyRegistered(context, true);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:16,代码来源:CreateSignedPreKeyJob.java


注:本文中的org.thoughtcrime.securesms.util.ParcelUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。