Skip to content

Commit f991ae3

Browse files
fix: logic issue
1 parent 6c58e18 commit f991ae3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

  • src/plugins/system/android/com/foxdebug/system

src/plugins/system/android/com/foxdebug/system/System.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,13 +1134,19 @@ private void pinFileShortcut(JSONObject shortcutJson, CallbackContext callback)
11341134
Bitmap bitmap;
11351135

11361136
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
1137-
ImageDecoder.Source imgSrc =
1138-
ImageDecoder.createSource(context.getContentResolver(), iconUri);
1139-
bitmap = ImageDecoder.decodeBitmap(imgSrc);
1140-
} else {
1141-
ContentResolver resolver = context.getContentResolver();
1142-
ImageDecoder.Source source = ImageDecoder.createSource(resolver, iconUri);
1137+
// API 28+
1138+
ImageDecoder.Source source =
1139+
ImageDecoder.createSource(
1140+
context.getContentResolver(),
1141+
iconUri
1142+
);
11431143
bitmap = ImageDecoder.decodeBitmap(source);
1144+
} else {
1145+
// Below API 28
1146+
bitmap = MediaStore.Images.Media.getBitmap(
1147+
context.getContentResolver(),
1148+
iconUri
1149+
);
11441150
}
11451151

11461152
icon = IconCompat.createWithBitmap(bitmap);

0 commit comments

Comments
 (0)