Skip to content
Snippets Groups Projects
Commit 35e712c8 authored by Xin Li's avatar Xin Li
Browse files

Merge Android Pie into master

Bug: 112104996
Change-Id: Ia50af15c2dbe544047e806de7d0ecff91385bf2c
parents a75d7022 268d3c8c
No related branches found
No related tags found
No related merge requests found
......@@ -58,10 +58,10 @@ public class GifImageResource extends ImageResource {
public Drawable getDrawable(Resources resources) {
try {
return new FrameSequenceDrawable(mFrameSequence);
} catch (final Exception e) {
// Malicious gif images can make platform throw different kind of exceptions. Catch
// them all.
LogUtil.e(LogUtil.BUGLE_TAG, "Error getting drawable for GIF", e);
} catch (final Throwable t) {
// Malicious gif images can make the platform throw different kind of throwables, such
// as OutOfMemoryError and NullPointerException. Catch them all.
LogUtil.e(LogUtil.BUGLE_TAG, "Error getting drawable for GIF", t);
return null;
}
}
......
......@@ -35,6 +35,7 @@ import com.android.messaging.util.ContentType;
import com.android.messaging.util.LogUtil;
import com.android.messaging.util.MediaMetadataRetrieverWrapper;
import com.android.messaging.util.FileUtil;
import com.android.messaging.util.UriUtil;
import java.io.IOException;
import java.util.ArrayList;
......@@ -75,6 +76,12 @@ public class ShareIntentActivity extends BaseBugleActivity implements
final String action = intent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
final Uri contentUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (UriUtil.isFileUri(contentUri)) {
LogUtil.i(
LogUtil.BUGLE_TAG,
"Ignoring attachment from file URI which are no longer supported.");
return;
}
final String contentType = extractContentType(contentUri, intent.getType());
if (LogUtil.isLoggable(LogUtil.BUGLE_TAG, LogUtil.DEBUG)) {
LogUtil.d(LogUtil.BUGLE_TAG, String.format(
......@@ -112,6 +119,12 @@ public class ShareIntentActivity extends BaseBugleActivity implements
if (imageUris != null && imageUris.size() > 0) {
mDraftMessage = MessageData.createSharedMessage(null);
for (final Uri imageUri : imageUris) {
if (UriUtil.isFileUri(imageUri)) {
LogUtil.i(
LogUtil.BUGLE_TAG,
"Ignoring attachment from file URI which are no longer supported.");
continue;
}
final String actualContentType = extractContentType(imageUri, contentType);
addSharedImagePartToDraft(actualContentType, imageUri);
}
......
......@@ -22,12 +22,15 @@ import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Environment;
import android.telephony.SmsMessage;
import android.text.TextUtils;
import android.widget.ArrayAdapter;
import com.android.messaging.Factory;
import com.android.messaging.R;
import com.android.messaging.datamodel.SyncManager;
import com.android.messaging.datamodel.action.DumpDatabaseAction;
......@@ -179,6 +182,13 @@ public class DebugUtils {
}
});
arrayAdapter.add(new DebugAction("Test sharing a file URI") {
@Override
public void run() {
shareFileUri();
}
});
builder.setAdapter(arrayAdapter,
new android.content.DialogInterface.OnClickListener() {
@Override
......@@ -422,4 +432,16 @@ public class DebugUtils {
public static boolean debugClassZeroSmsEnabled() {
return sDebugClassZeroSms;
}
/** Shares a ringtone file via file URI. */
private static void shareFileUri() {
final String packageName = "com.android.messaging";
final String fileName = "/system/media/audio/ringtones/Andromeda.ogg";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage(packageName);
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + fileName));
intent.setType("image/*");
Factory.get().getApplicationContext().startActivity(intent);
}
}
......@@ -32,7 +32,11 @@ LOCAL_CERTIFICATE := platform
LOCAL_STATIC_JAVA_LIBRARIES := \
mockito-target
LOCAL_JAVA_LIBRARIES := android.test.mock.stubs legacy-android-test
LOCAL_JAVA_LIBRARIES := \
android.test.mock.stubs \
android.test.runner.stubs \
android.test.base.stubs \
include $(BUILD_PACKAGE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment