Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014 Merged-In: I81c01202306d856f6f8f8b74a5a28d7c1011fcec Change-Id: If491aeefb40d37249174a40dfe1e37a978addf73
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
|
||||
<!-- Optional features -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
|
||||
@@ -74,7 +74,7 @@ public class MediaMetadataRetrieverWrapper {
|
||||
public void release() {
|
||||
try {
|
||||
mRetriever.release();
|
||||
} catch (RuntimeException e) {
|
||||
} catch (RuntimeException | IOException e) {
|
||||
LogUtil.e(LogUtil.BUGLE_TAG, "MediaMetadataRetriever.release failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.database.Cursor;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Telephony;
|
||||
import androidx.collection.ArrayMap;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.telephony.SmsManager;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
@@ -34,14 +33,18 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.core.os.BuildCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.sms.MmsSmsUtils;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
|
||||
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -369,6 +372,9 @@ public abstract class PhoneUtils {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isDataRoamingEnabled() {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
return mTelephonyManager.isDataRoamingEnabled();
|
||||
}
|
||||
boolean dataRoamingEnabled = false;
|
||||
final ContentResolver cr = mContext.getContentResolver();
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
|
||||
@@ -49,6 +49,8 @@ public class UriUtil {
|
||||
private static final String SCHEME_MMSTO = "smsto";
|
||||
public static final HashSet<String> SMS_MMS_SCHEMES = new HashSet<String>(
|
||||
Arrays.asList(SCHEME_SMS, SCHEME_MMS, SCHEME_SMSTO, SCHEME_MMSTO));
|
||||
private static final String SCHEME_HTTP = "http";
|
||||
private static final String SCHEME_HTTPS = "https";
|
||||
|
||||
public static final String SCHEME_BUGLE = "bugle";
|
||||
public static final HashSet<String> SUPPORTED_SCHEME = new HashSet<String>(
|
||||
@@ -98,8 +100,7 @@ public class UriUtil {
|
||||
public static boolean isFileUri(final Uri uri) {
|
||||
return uri != null &&
|
||||
uri.getScheme() != null &&
|
||||
TextUtils.equals(uri.getScheme().trim().toLowerCase(),
|
||||
ContentResolver.SCHEME_FILE);
|
||||
uri.getScheme().trim().toLowerCase().contains(ContentResolver.SCHEME_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,9 +217,10 @@ public class UriUtil {
|
||||
inputStream = context.getContentResolver().openInputStream(sourceUri);
|
||||
} else {
|
||||
// The content is remote. Download it.
|
||||
final URL url = new URL(sourceUri.toString());
|
||||
final URLConnection ucon = url.openConnection();
|
||||
inputStream = new BufferedInputStream(ucon.getInputStream());
|
||||
inputStream = getInputStreamFromRemoteUri(sourceUri);
|
||||
if (inputStream == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return persistContentToScratchSpace(inputStream);
|
||||
} catch (final Exception ex) {
|
||||
@@ -235,6 +237,23 @@ public class UriUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@DoesNotRunOnMainThread
|
||||
private static InputStream getInputStreamFromRemoteUri(final Uri sourceUri)
|
||||
throws IOException {
|
||||
if (isRemoteUri(sourceUri)) {
|
||||
final URL url = new URL(sourceUri.toString());
|
||||
final URLConnection ucon = url.openConnection();
|
||||
return new BufferedInputStream(ucon.getInputStream());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isRemoteUri(final Uri sourceUri) {
|
||||
return sourceUri.getScheme().equals(SCHEME_HTTP)
|
||||
|| sourceUri.getScheme().equals(SCHEME_HTTPS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist a piece of content from the given input stream, byte by byte to the specified
|
||||
* directory.
|
||||
@@ -273,9 +292,10 @@ public class UriUtil {
|
||||
inputStream = context.getContentResolver().openInputStream(sourceUri);
|
||||
} else {
|
||||
// The content is remote. Download it.
|
||||
final URL url = new URL(sourceUri.toString());
|
||||
final URLConnection ucon = url.openConnection();
|
||||
inputStream = new BufferedInputStream(ucon.getInputStream());
|
||||
inputStream = getInputStreamFromRemoteUri(sourceUri);
|
||||
if (inputStream == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return persistContent(inputStream, outputDir, contentType);
|
||||
} catch (final Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user