summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2013-04-01 17:17:32 -0700
committerPaul Westbrook <pwestbro@google.com>2013-04-01 17:20:27 -0700
commit11472650d1fce7548939d311c4434128930c18ba (patch)
tree0d77ee52545ecfb7ea3833183ccd333905868db3 /src
parenta8135c3d316867464ea0a8912424cf2fda8d0af3 (diff)
downloadandroid_packages_apps_Email-11472650d1fce7548939d311c4434128930c18ba.tar.gz
android_packages_apps_Email-11472650d1fce7548939d311c4434128930c18ba.tar.bz2
android_packages_apps_Email-11472650d1fce7548939d311c4434128930c18ba.zip
Fix apk attachments
Bug: 7585865 Change-Id: I20191523377d99472e333dece4d727415f97c67a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/email/provider/EmailProvider.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java
index d7a0cb7ce..6f04313f3 100644
--- a/src/com/android/email/provider/EmailProvider.java
+++ b/src/com/android/email/provider/EmailProvider.java
@@ -95,6 +95,7 @@ import com.android.mail.utils.AttachmentUtils;
import com.android.mail.utils.LogUtils;
import com.android.mail.utils.MatrixCursorWithCachedColumns;
import com.android.mail.utils.MatrixCursorWithExtra;
+import com.android.mail.utils.MimeType;
import com.android.mail.utils.Utils;
import com.android.mail.widget.BaseWidgetProvider;
import com.android.mail.widget.WidgetProvider;
@@ -3353,11 +3354,24 @@ outer:
@Override
public String getString(int column) {
if (column == mContentUriIndex) {
- Uri uri = Uri.parse(getString(mUriIndex));
- long id = Long.parseLong(uri.getLastPathSegment());
- Attachment att = Attachment.restoreAttachmentWithId(mContext, id);
+ final Uri uri = Uri.parse(getString(mUriIndex));
+ final long id = Long.parseLong(uri.getLastPathSegment());
+ final Attachment att = Attachment.restoreAttachmentWithId(mContext, id);
if (att == null) return "";
- return AttachmentUtilities.getAttachmentUri(att.mAccountKey, id).toString();
+
+ final String contentUri;
+ // Until the package installer can handle opening apks from a content:// uri, for
+ // any apk that was successfully saved in external storage, return the
+ // content uri from the attachment
+ if (att.mUiDestination == UIProvider.AttachmentDestination.EXTERNAL &&
+ att.mUiState == UIProvider.AttachmentState.SAVED &&
+ TextUtils.equals(att.mMimeType, MimeType.ANDROID_ARCHIVE)) {
+ contentUri = att.getContentUri();
+ } else {
+ contentUri =
+ AttachmentUtilities.getAttachmentUri(att.mAccountKey, id).toString();
+ }
+ return contentUri;
} else {
return super.getString(column);
}