Messaging: Replace ExifInterface with its androidx counterpart

Change-Id: I35ba14886b9f837d576f1cd385869614454c921f
This commit is contained in:
Michael W
2024-12-26 14:55:12 +01:00
parent d869533f6f
commit 3b7f05ba67
10 changed files with 26 additions and 11 deletions
+2
View File
@@ -1,4 +1,5 @@
// Copyright (C) 2015 The Android Open Source Project // Copyright (C) 2015 The Android Open Source Project
// Copyright (C) 2024 The LineageOS Project
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@@ -61,6 +62,7 @@ android_app {
"androidx.appcompat_appcompat", "androidx.appcompat_appcompat",
"androidx.collection_collection", "androidx.collection_collection",
"androidx.core_core", "androidx.core_core",
"androidx.exifinterface_exifinterface",
"androidx.fragment_fragment", "androidx.fragment_fragment",
"androidx.media_media", "androidx.media_media",
"androidx.legacy_legacy-support-core-utils", "androidx.legacy_legacy-support-core-utils",
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -24,11 +25,11 @@ import android.graphics.Paint;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.VectorDrawable; import android.graphics.drawable.VectorDrawable;
import android.media.ExifInterface;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.exifinterface.media.ExifInterface;
import com.android.messaging.R; import com.android.messaging.R;
import com.android.messaging.util.Assert; import com.android.messaging.util.Assert;
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -21,7 +22,8 @@ import android.graphics.Canvas;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.RectF; import android.graphics.RectF;
import android.media.ExifInterface;
import androidx.exifinterface.media.ExifInterface;
import com.android.messaging.util.Assert; import com.android.messaging.util.Assert;
import com.android.messaging.util.ImageUtils; import com.android.messaging.util.ImageUtils;
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -18,7 +19,8 @@ package com.android.messaging.datamodel.media;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.ExifInterface;
import androidx.exifinterface.media.ExifInterface;
import com.android.messaging.datamodel.media.PoolableImageCache.ReusableImageResourcePool; import com.android.messaging.datamodel.media.PoolableImageCache.ReusableImageResourcePool;
import com.android.messaging.util.ImageUtils; import com.android.messaging.util.ImageUtils;
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -20,7 +21,8 @@ import android.graphics.Bitmap;
import android.graphics.ImageDecoder; import android.graphics.ImageDecoder;
import android.graphics.drawable.AnimatedImageDrawable; import android.graphics.drawable.AnimatedImageDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import androidx.exifinterface.media.ExifInterface;
import com.android.messaging.util.Assert; import com.android.messaging.util.Assert;
import com.android.messaging.util.LogUtil; import com.android.messaging.util.LogUtil;
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -39,7 +40,7 @@ public class NetworkUriImageRequest<D extends UriImageRequestDescriptor> extends
public NetworkUriImageRequest(Context context, D descriptor) { public NetworkUriImageRequest(Context context, D descriptor) {
super(context, descriptor); super(context, descriptor);
mOrientation = android.media.ExifInterface.ORIENTATION_UNDEFINED; mOrientation = androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED;
} }
@Override @Override
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -26,9 +27,10 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.media.ExifInterface;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.exifinterface.media.ExifInterface;
import com.android.messaging.R; import com.android.messaging.R;
import com.android.messaging.util.Assert; import com.android.messaging.util.Assert;
import com.android.messaging.util.AvatarUriUtil; import com.android.messaging.util.AvatarUriUtil;
+3 -2
View File
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -488,8 +489,8 @@ public class MmsUtils {
if (imageSize <= maxPartSize && if (imageSize <= maxPartSize &&
width <= widthLimit && width <= widthLimit &&
height <= heightLimit && height <= heightLimit &&
(orientation == android.media.ExifInterface.ORIENTATION_UNDEFINED || (orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED ||
orientation == android.media.ExifInterface.ORIENTATION_NORMAL)) { orientation == androidx.exifinterface.media.ExifInterface.ORIENTATION_NORMAL)) {
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) { if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
LogUtil.v(TAG, "addPicturePart - already sized"); LogUtil.v(TAG, "addPicturePart - already sized");
} }
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -78,7 +79,7 @@ public class ImagePersistTask extends SafeAsyncTask<Void, Void, Void> {
outputStream = outputStream =
mContext.getContentResolver().openOutputStream(mOutputUri); mContext.getContentResolver().openOutputStream(mOutputUri);
if (mHeightPercent != 1.0f) { if (mHeightPercent != 1.0f) {
int orientation = android.media.ExifInterface.ORIENTATION_UNDEFINED; int orientation = androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED;
final ExifInterface exifInterface = new ExifInterface(); final ExifInterface exifInterface = new ExifInterface();
try { try {
exifInterface.readExif(mBytes); exifInterface.readExif(mBytes);
@@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2015 The Android Open Source Project * Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -254,7 +255,7 @@ public class ImageUtils {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
LogUtil.e(TAG, "getOrientation couldn't open: " + uri, e); LogUtil.e(TAG, "getOrientation couldn't open: " + uri, e);
} }
return android.media.ExifInterface.ORIENTATION_UNDEFINED; return androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED;
} }
/** /**
@@ -262,7 +263,7 @@ public class ImageUtils {
* @return The exif orientation value for the image in the specified stream * @return The exif orientation value for the image in the specified stream
*/ */
public static int getOrientation(final InputStream inputStream) { public static int getOrientation(final InputStream inputStream) {
int orientation = android.media.ExifInterface.ORIENTATION_UNDEFINED; int orientation = androidx.exifinterface.media.ExifInterface.ORIENTATION_UNDEFINED;
if (inputStream != null) { if (inputStream != null) {
try { try {
final ExifInterface exifInterface = new ExifInterface(); final ExifInterface exifInterface = new ExifInterface();