Skip to content

Commit

Permalink
Merge pull request #19979 from wordpress-mobile/fix/target-sdk-14-ima…
Browse files Browse the repository at this point in the history
…ge-bug-fixes

[Fix] Made updates related to targetSdk update for media.
  • Loading branch information
irfano authored Jan 24, 2024
2 parents ff72121 + a1e0fb9 commit 943c886
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<!-- GCM all build types configuration -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
Expand Down Expand Up @@ -828,11 +829,13 @@
<!-- Services -->
<service
android:name=".ui.uploads.UploadService"
android:label="Upload Service" />
android:label="Upload Service"
android:foregroundServiceType="dataSync"/>
<service
android:name=".ui.media.services.MediaDeleteService"
android:label="Media Delete Service"
android:exported="false"
android:foregroundServiceType="dataSync"
/>

<service
Expand Down Expand Up @@ -1053,7 +1056,7 @@

<service
android:name=".push.GCMMessageService"
android:exported="false">
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
Expand Down Expand Up @@ -467,7 +469,15 @@ protected void onSaveInstanceState(@NonNull Bundle outState) {
@SuppressLint("UnspecifiedRegisterReceiverFlag")
public void onStart() {
super.onStart();
registerReceiver(mDownloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
if (Build.VERSION.SDK_INT >= VERSION_CODES.UPSIDE_DOWN_CAKE) {
registerReceiver(
mDownloadReceiver,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
ContextWrapper.RECEIVER_NOT_EXPORTED
);
} else {
registerReceiver(mDownloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
mDispatcher.register(this);

// we only register with EventBus the first time - necessary since we don't unregister in onStop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DeviceListBuilder(
// This item sets the threshold for the visible items in all the list
val lastShownTimestamp = results.fold(0L) { timestamp, (_, result) ->
val nextTimestamp = result?.nextTimestamp
if (nextTimestamp != null && nextTimestamp > timestamp) {
if (result?.items?.isNotEmpty() == true && nextTimestamp != null && nextTimestamp > timestamp) {
nextTimestamp
} else {
timestamp
Expand Down

0 comments on commit 943c886

Please sign in to comment.