Rotate profile key when learning of a block by a linked device.

This commit is contained in:
Cody Henthorne
2025-08-14 13:19:58 -04:00
committed by Jeffrey Starke
parent cd26929d39
commit 9ccdbb8e40
5 changed files with 52 additions and 15 deletions

View File

@@ -176,18 +176,30 @@ public class RecipientUtil {
SignalDatabase.recipients().setBlocked(recipient.getId(), true);
insertBlockedUpdate(recipient, SignalDatabase.threads().getOrCreateThreadIdFor(recipient));
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
AppDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
.then(new RotateProfileKeyJob())
.enqueue();
}
RecipientUtil.updateProfileSharingAfterBlock(recipient, true);
AppDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
StorageSyncHelper.scheduleSyncForDataChange();
}
@WorkerThread
public static boolean updateProfileSharingAfterBlock(@NonNull Recipient recipient, boolean rotateProfileKeyOnBlock) {
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
if (rotateProfileKeyOnBlock) {
Log.i(TAG, "Rotating profile key");
AppDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
.then(new RotateProfileKeyJob())
.enqueue();
return true;
}
}
return false;
}
@WorkerThread
public static void unblock(@NonNull Recipient recipient) {
if (!isBlockable(recipient)) {