Update target SDK to 34.

This commit is contained in:
Cody Henthorne
2024-07-30 14:08:23 -04:00
committed by mtang-signal
parent 6424c6bc99
commit dc7208922c
10 changed files with 38 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ import android.os.Bundle;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import org.greenrobot.eventbus.EventBus;
@@ -295,7 +296,7 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
};
IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT);
registerReceiver(clearKeyReceiver, filter, KeyCachingService.KEY_PERMISSION, null);
ContextCompat.registerReceiver(this, clearKeyReceiver, filter, KeyCachingService.KEY_PERMISSION, null, ContextCompat.RECEIVER_NOT_EXPORTED);
}
private void removeClearKeyReceiver(Context context) {

View File

@@ -3389,12 +3389,12 @@ class ConversationFragment :
}
}
requireActivity().registerReceiver(pinnedShortcutReceiver, IntentFilter(ACTION_PINNED_SHORTCUT))
ContextCompat.registerReceiver(requireActivity(), pinnedShortcutReceiver, IntentFilter(ACTION_PINNED_SHORTCUT), ContextCompat.RECEIVER_EXPORTED)
}
viewModel.getContactPhotoIcon(requireContext(), Glide.with(this@ConversationFragment))
.subscribe { infoCompat ->
val intent = Intent(ACTION_PINNED_SHORTCUT)
val intent = Intent(ACTION_PINNED_SHORTCUT).apply { `package` = requireContext().packageName }
val callback = PendingIntent.getBroadcast(requireContext(), 902, intent, PendingIntentFlags.mutable())
ShortcutManagerCompat.requestPinShortcut(requireContext(), infoCompat, callback.intentSender)
}

View File

@@ -8,6 +8,7 @@ import android.content.IntentFilter;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.google.android.gms.auth.api.phone.SmsRetriever;
import com.google.android.gms.common.api.CommonStatusCodes;
@@ -34,7 +35,7 @@ public class SmsRetrieverReceiver extends BroadcastReceiver {
public void registerReceiver() {
Log.d(TAG, "Registering SMS retriever receiver");
context.registerReceiver(this, new IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION));
ContextCompat.registerReceiver(context, this, new IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION), ContextCompat.RECEIVER_EXPORTED);
}
public void unregisterReceiver() {

View File

@@ -274,7 +274,7 @@ class ActiveCallManager(
@get:RequiresApi(30)
override val serviceType: Int
get() = ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
get() = ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
private var hangUpRtcOnDeviceCallAnswered: PhoneStateListener? = null
private var notification: Notification? = null

View File

@@ -315,7 +315,7 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
}
if (Build.VERSION.SDK_INT >= 30) {
startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
} else {
startForeground(notificationId, notification);
}

View File

@@ -10,6 +10,7 @@ import android.os.Build;
import android.os.SystemClock;
import androidx.core.app.AlarmManagerCompat;
import androidx.core.content.ContextCompat;
import org.signal.core.util.PendingIntentFlags;
import org.signal.core.util.logging.Log;
@@ -42,7 +43,7 @@ public class AlarmSleepTimer implements SleepTimer {
try {
String actionName = buildActionName(actionId);
context.registerReceiver(alarmReceiver, new IntentFilter(actionName));
ContextCompat.registerReceiver(context, alarmReceiver, new IntentFilter(actionName), ContextCompat.RECEIVER_NOT_EXPORTED);
long startTime = System.currentTimeMillis();
alarmReceiver.setAlarm(sleepDuration, actionName);
@@ -72,7 +73,9 @@ public class AlarmSleepTimer implements SleepTimer {
private static final String WAKE_UP_THREAD_ACTION = "org.thoughtcrime.securesms.util.AlarmSleepTimer.AlarmReceiver.WAKE_UP_THREAD";
private void setAlarm(long millis, String action) {
final Intent intent = new Intent(action);
final Intent intent = new Intent(action);
intent.setPackage(context.getPackageName());
final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntentFlags.mutable());
final AlarmManager alarmManager = ServiceUtil.getAlarmManager(context);