Skip to content

Commit

Permalink
Merge branch 'molly-7.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Apr 19, 2024
2 parents 6bc9644 + 21d25a0 commit 81866b1
Show file tree
Hide file tree
Showing 156 changed files with 4,665 additions and 3,847 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ apply {
from("fix-profm.gradle")
}

val canonicalVersionCode = 1407
val canonicalVersionName = "7.3.1"
val canonicalVersionCode = 1410
val canonicalVersionName = "7.4.2"
val mollyRevision = 1

val postFixSize = 100
Expand Down
18 changes: 11 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1049,12 +1049,6 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="false"/>

<service
android:enabled="true"
android:name=".service.webrtc.WebRtcCallService"
android:foregroundServiceType="camera|microphone"
android:exported="false"/>

<service
android:enabled="true"
android:exported="false"
Expand Down Expand Up @@ -1239,6 +1233,12 @@
</intent-filter>
</receiver>

<receiver android:name=".service.AnalyzeDatabaseAlarmListener" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

<receiver android:name="org.thoughtcrime.securesms.jobs.ForegroundServiceUtil$Receiver" android:exported="false" />

<receiver android:name=".service.PersistentConnectionBootListener" android:exported="false">
Expand Down Expand Up @@ -1293,7 +1293,11 @@
android:enabled="@bool/enable_alarm_manager"
android:exported="false"/>

<service android:name=".service.webrtc.ActiveCallManager$ActiveCallForegroundService" android:exported="false" />
<service
android:name=".service.webrtc.ActiveCallManager$ActiveCallForegroundService"
android:exported="false"
android:foregroundServiceType="camera|microphone" />

<receiver android:name=".service.webrtc.ActiveCallManager$ActiveCallServiceReceiver" android:exported="false">
<intent-filter>
<action android:name="org.thoughtcrime.securesms.service.webrtc.ActiveCallAction.DENY"/>
Expand Down
5,688 changes: 3,159 additions & 2,529 deletions app/src/main/baseline-prof.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.registration.RegistrationUtil;
import org.thoughtcrime.securesms.ringrtc.RingRtcLogger;
import org.thoughtcrime.securesms.service.AnalyzeDatabaseAlarmListener;
import org.thoughtcrime.securesms.service.DirectoryRefreshListener;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.service.LocalBackupListener;
import org.thoughtcrime.securesms.service.WipeMemoryService;
import org.thoughtcrime.securesms.service.RotateSenderCertificateListener;
import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
import org.thoughtcrime.securesms.service.webrtc.ActiveCallManager;
import org.thoughtcrime.securesms.service.webrtc.AndroidTelecomUtil;
import org.thoughtcrime.securesms.service.webrtc.WebRtcCallService;
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
import org.thoughtcrime.securesms.util.AppForegroundObserver;
import org.thoughtcrime.securesms.util.AppStartup;
Expand Down Expand Up @@ -243,6 +244,7 @@ private void onCreateUnlock() {
.addPostRender(AccountConsistencyWorkerJob::enqueueIfNecessary)
.addPostRender(GroupRingCleanupJob::enqueue)
.addPostRender(LinkedDeviceInactiveCheckJob::enqueueIfNecessary)
.addPostRender(() -> ActiveCallManager.clearNotifications(this))
.execute();

Log.d(TAG, "onCreateUnlock() took " + (System.currentTimeMillis() - startTime) + " ms");
Expand Down Expand Up @@ -321,7 +323,7 @@ public void onUnlock() {
public void onLock(boolean keyExpired) {
Log.i(TAG, "onLock()");

stopService(new Intent(this, WebRtcCallService.class));
ActiveCallManager.stop();

finalizeExpiringMessageManager();
finalizeMessageRetrieval();
Expand Down Expand Up @@ -551,6 +553,7 @@ private void initializePeriodicTasks() {
LocalBackupListener.schedule(this);
RotateSenderCertificateListener.schedule(this);
RoutineMessageFetchReceiver.startOrUpdateAlarm(this);
AnalyzeDatabaseAlarmListener.schedule(this);

if (TextSecurePreferences.isUpdateApkEnabled(this)) {
ApkUpdateRefreshListener.scheduleIfAllowed(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
private ControlsAndInfoController controlsAndInfo;
private boolean enterPipOnResume;
private long lastProcessedIntentTimestamp;
private WebRtcViewModel previousEvent = null;

private Disposable ephemeralStateDisposable = Disposable.empty();

Expand Down Expand Up @@ -909,7 +910,8 @@ private void delayedFinish(int delayMillis) {

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(@NonNull WebRtcViewModel event) {
Log.i(TAG, "Got message from service: " + event);
Log.i(TAG, "Got message from service: " + event.describeDifference(previousEvent));
previousEvent = event;

viewModel.setRecipient(event.getRecipient());
callScreen.setRecipient(event.getRecipient());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ public void setNone() {
setVisibility(View.GONE);
}

public void setPendingApproval() {
setVisibility(View.VISIBLE);
setColorFilter(ContextCompat.getColor(getContext(), R.color.signal_colorOnSurfaceVariant));
setContentDescription(getContext().getString(R.string.conversation_item_sent__pending_approval_description));
}

public void setFailed() {
setVisibility(View.VISIBLE);
setColorFilter(ContextCompat.getColor(getContext(), R.color.signal_colorError));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public void setAudio(final @NonNull AudioSlide audio,
} else if (showControls && audio.getTransferState() == AttachmentTable.TRANSFER_PROGRESS_STARTED) {
controlToggle.displayQuick(progressAndPlay);
seekBar.setEnabled(false);
showPlayButton();
if (circleProgress != null) {
circleProgress.setVisibility(View.VISIBLE);
circleProgress.spin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ private void presentDate(@NonNull MessageRecord messageRecord, @NonNull Locale l
}

dateView.setText(errorMsg);
} else if (messageRecord.isPendingInsecureSmsFallback()) {
dateView.setText(R.string.ConversationItem_click_to_approve_unencrypted);
} else if (messageRecord.isRateLimited()) {
dateView.setText(R.string.ConversationItem_send_paused);
} else if (MessageRecordUtil.isScheduled(messageRecord)) {
Expand Down Expand Up @@ -391,7 +389,7 @@ private void presentDeliveryStatus(@NonNull MessageRecord messageRecord) {
previousMessageId = newMessageId;


if (messageRecord.isFailed() || messageRecord.isPendingInsecureSmsFallback() || MessageRecordUtil.isScheduled(messageRecord)) {
if (messageRecord.isFailed() || MessageRecordUtil.isScheduled(messageRecord)) {
deliveryStatusView.setNone();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ConversationSearchBottomBar extends ConstraintLayout {
private View searchUp;
private TextView searchPositionText;
private View progressWheel;
private View jumpToDateButton;

private EventListener eventListener;

Expand All @@ -42,6 +43,7 @@ protected void onFinishInflate() {
this.searchDown = findViewById(R.id.conversation_search_down);
this.searchPositionText = findViewById(R.id.conversation_search_position);
this.progressWheel = findViewById(R.id.conversation_search_progress_wheel);
this.jumpToDateButton = findViewById(R.id.conversation_jump_to_date_button);
}

public void setData(int position, int count) {
Expand All @@ -65,6 +67,12 @@ public void setData(int position, int count) {
searchPositionText.setText(R.string.ConversationActivity_no_results);
}

jumpToDateButton.setOnClickListener(v -> {
if (eventListener != null) {
eventListener.onDatePickerSelected();
}
});

setViewEnabled(searchUp, position < (count - 1));
setViewEnabled(searchDown, position > 0);
}
Expand All @@ -85,5 +93,6 @@ public void setEventListener(@Nullable EventListener eventListener) {
public interface EventListener {
void onSearchMoveUpPressed();
void onSearchMoveDownPressed();
void onDatePickerSelected();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ class ScrollToPositionDelegate private constructor(
if (abs(layoutManager.findFirstVisibleItemPosition() - position) < SCROLL_ANIMATION_THRESHOLD) {
val child: View? = layoutManager.findViewByPosition(position)
if (child == null || !layoutManager.isViewPartiallyVisible(child, true, false)) {
layoutManager.scrollToPositionWithOffset(position, recyclerView.height / 4)
layoutManager.scrollToPositionWithOffset(position, recyclerView.height / 3)
}
} else {
layoutManager.scrollToPositionWithOffset(position, recyclerView.height / 4)
layoutManager.scrollToPositionWithOffset(position, recyclerView.height / 3)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ import org.thoughtcrime.securesms.util.CommunicationActions
import org.thoughtcrime.securesms.util.ContextUtil
import org.thoughtcrime.securesms.util.DateUtils
import org.thoughtcrime.securesms.util.ExpirationUtil
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.Material3OnScrollHelper
import org.thoughtcrime.securesms.util.ViewUtil
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
Expand Down Expand Up @@ -498,7 +497,7 @@ class ConversationSettingsFragment : DSLSettingsFragment(
)
}

if (FeatureFlags.nicknames() && state.recipient.isIndividual && !state.recipient.isSelf) {
if (state.recipient.isIndividual && !state.recipient.isSelf) {
clickPref(
title = DSLSettingsText.from(R.string.NicknameActivity__nickname),
icon = DSLSettingsIcon.from(R.drawable.symbol_edit_24),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ void setCallParticipant(@NonNull CallParticipant participant) {
} else {
infoOverlay.setVisibility(View.GONE);

boolean hasContentToRender = (participant.isVideoEnabled() || participant.isScreenSharing()) && participant.isForwardingVideo();
//TODO: [calling] SFU instability causes the forwarding video flag to alternate quickly, should restore after calling server update
boolean hasContentToRender = (participant.isVideoEnabled() || participant.isScreenSharing()); // && participant.isForwardingVideo();

rendererFrame.setVisibility(hasContentToRender ? View.VISIBLE : View.INVISIBLE);
renderer.setVisibility(hasContentToRender ? View.VISIBLE : View.INVISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
private CallParticipant focusedParticipant = null;
private boolean shouldRenderInPip;
private boolean isPortrait;
private boolean isIncomingRing;
private boolean hideAvatar;
private int navBarBottomInset;
private LayoutStrategy layoutStrategy;

Expand All @@ -54,15 +54,15 @@ void update(@NonNull List<CallParticipant> callParticipants,
@NonNull CallParticipant focusedParticipant,
boolean shouldRenderInPip,
boolean isPortrait,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset,
@NonNull LayoutStrategy layoutStrategy)
{
this.callParticipants = callParticipants;
this.focusedParticipant = focusedParticipant;
this.shouldRenderInPip = shouldRenderInPip;
this.isPortrait = isPortrait;
this.isIncomingRing = isIncomingRing;
this.hideAvatar = hideAvatar;
this.navBarBottomInset = navBarBottomInset;
this.layoutStrategy = layoutStrategy;

Expand Down Expand Up @@ -134,7 +134,7 @@ private void update(int index, int count, @NonNull CallParticipant participant)
callParticipantView.setBottomInset(navBarBottomInset);
}

if (isIncomingRing) {
if (hideAvatar) {
callParticipantView.hideAvatar();
} else {
callParticipantView.showAvatar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ data class CallParticipantsState(
val allRemoteParticipants: List<CallParticipant> = remoteParticipants.allParticipants
val isFolded: Boolean = foldableState.isFolded
val isLargeVideoGroup: Boolean = allRemoteParticipants.size > SMALL_GROUP_MAX && !isInPipMode && !isFolded
val isIncomingRing: Boolean = callState == WebRtcViewModel.State.CALL_INCOMING
val hideAvatar: Boolean = callState.isIncomingOrHandledElsewhere

val raisedHands: List<GroupCallRaiseHandEvent>
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ class WebRtcCallParticipantsPage {
private final boolean isRenderInPip;
private final boolean isPortrait;
private final boolean isLandscapeEnabled;
private final boolean isIncomingRing;
private final boolean hideAvatar;
private final int navBarBottomInset;

static WebRtcCallParticipantsPage forMultipleParticipants(@NonNull List<CallParticipant> callParticipants,
@NonNull CallParticipant focusedParticipant,
boolean isRenderInPip,
boolean isPortrait,
boolean isLandscapeEnabled,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset)
{
return new WebRtcCallParticipantsPage(callParticipants, focusedParticipant, false, isRenderInPip, isPortrait, isLandscapeEnabled, isIncomingRing, navBarBottomInset);
return new WebRtcCallParticipantsPage(callParticipants, focusedParticipant, false, isRenderInPip, isPortrait, isLandscapeEnabled, hideAvatar, navBarBottomInset);
}

static WebRtcCallParticipantsPage forSingleParticipant(@NonNull CallParticipant singleParticipant,
Expand All @@ -44,7 +44,7 @@ private WebRtcCallParticipantsPage(@NonNull List<CallParticipant> callParticipan
boolean isRenderInPip,
boolean isPortrait,
boolean isLandscapeEnabled,
boolean isIncomingRing,
boolean hideAvatar,
int navBarBottomInset)
{
this.callParticipants = callParticipants;
Expand All @@ -53,7 +53,7 @@ private WebRtcCallParticipantsPage(@NonNull List<CallParticipant> callParticipan
this.isRenderInPip = isRenderInPip;
this.isPortrait = isPortrait;
this.isLandscapeEnabled = isLandscapeEnabled;
this.isIncomingRing = isIncomingRing;
this.hideAvatar = hideAvatar;
this.navBarBottomInset = navBarBottomInset;
}

Expand All @@ -77,8 +77,8 @@ public boolean isPortrait() {
return isPortrait;
}

public boolean isIncomingRing() {
return isIncomingRing;
public boolean shouldHideAvatar() {
return hideAvatar;
}

public int getNavBarBottomInset() {
Expand All @@ -98,14 +98,14 @@ public boolean equals(Object o) {
isRenderInPip == that.isRenderInPip &&
isPortrait == that.isPortrait &&
isLandscapeEnabled == that.isLandscapeEnabled &&
isIncomingRing == that.isIncomingRing &&
hideAvatar == that.hideAvatar &&
callParticipants.equals(that.callParticipants) &&
focusedParticipant.equals(that.focusedParticipant) &&
navBarBottomInset == that.navBarBottomInset;
}

@Override
public int hashCode() {
return Objects.hash(callParticipants, focusedParticipant, isSpeaker, isRenderInPip, isPortrait, isLandscapeEnabled, isIncomingRing, navBarBottomInset);
return Objects.hash(callParticipants, focusedParticipant, isSpeaker, isRenderInPip, isPortrait, isLandscapeEnabled, hideAvatar, navBarBottomInset);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private MultipleParticipantViewHolder(@NonNull CallParticipantsLayout callPartic

@Override
void bind(WebRtcCallParticipantsPage page) {
callParticipantsLayout.update(page.getCallParticipants(), page.getFocusedParticipant(), page.isRenderInPip(), page.isPortrait(), page.isIncomingRing(), page.getNavBarBottomInset(), page.getLayoutStrategy());
callParticipantsLayout.update(page.getCallParticipants(), page.getFocusedParticipant(), page.isRenderInPip(), page.isPortrait(), page.shouldHideAvatar(), page.getNavBarBottomInset(), page.getLayoutStrategy());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public void updateCallParticipants(@NonNull CallParticipantsViewState callPartic
List<WebRtcCallParticipantsPage> pages = new ArrayList<>(2);

if (!state.getGridParticipants().isEmpty()) {
pages.add(WebRtcCallParticipantsPage.forMultipleParticipants(state.getGridParticipants(), state.getFocusedParticipant(), state.isInPipMode(), isPortrait, isLandscapeEnabled, state.isIncomingRing(), navBarBottomInset));
pages.add(WebRtcCallParticipantsPage.forMultipleParticipants(state.getGridParticipants(), state.getFocusedParticipant(), state.isInPipMode(), isPortrait, isLandscapeEnabled, state.getHideAvatar(), navBarBottomInset));
}

if (state.getFocusedParticipant() != CallParticipant.EMPTY && state.getAllRemoteParticipants().size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ private void updateWebRtcControls(@NonNull WebRtcViewModel.State state,
case CALL_ACCEPTED_ELSEWHERE:
case CALL_DECLINED_ELSEWHERE:
case CALL_ONGOING_ELSEWHERE:
callState = WebRtcControls.CallState.HANDLED_ELSEWHERE;
break;
case CALL_NEEDS_PERMISSION:
case CALL_BUSY:
case CALL_DISCONNECTED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private WebRtcControls() {
* This is only true at the very start of a call and will then never be true again
*/
public boolean hideControlsSheetInitially() {
return displayIncomingCallButtons() || callState == CallState.NONE;
return displayIncomingCallButtons() || callState == CallState.NONE || isHandledElsewhere();
}

public boolean displayErrorControls() {
Expand Down Expand Up @@ -263,6 +263,10 @@ private boolean isIncoming() {
return callState == CallState.INCOMING;
}

private boolean isHandledElsewhere() {
return callState == CallState.HANDLED_ELSEWHERE;
}

private boolean isAtLeastOutgoing() {
return callState.isAtLeast(CallState.OUTGOING);
}
Expand All @@ -284,6 +288,7 @@ private int displayedButtonCount() {
public enum CallState {
NONE,
ERROR,
HANDLED_ELSEWHERE,
PRE_JOIN,
RECONNECTING,
INCOMING,
Expand Down
Loading

0 comments on commit 81866b1

Please sign in to comment.