本文整理汇总了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);
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}
示例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();
}
示例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());
}
示例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);
}