summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuprabh Shukla <suprabh@google.com>2017-06-01 18:21:32 -0700
committerSuprabh Shukla <suprabh@google.com>2017-06-22 22:13:39 +0000
commitdc9bffedf196361dde67a887bb8669d619926c24 (patch)
tree307f4017ec9be1bba8e0fd2d5cd9ad34ec4dfc99
parent6ce29a9908d271bdfe8fedce3f43629c65bb239c (diff)
downloadandroid_packages_providers_DownloadProvider-dc9bffedf196361dde67a887bb8669d619926c24.zip
android_packages_providers_DownloadProvider-dc9bffedf196361dde67a887bb8669d619926c24.tar.gz
android_packages_providers_DownloadProvider-dc9bffedf196361dde67a887bb8669d619926c24.tar.bz2
Not sending my uid as ORIGINATING_UID to package installer
In some cases the UID column may have download provider uid. We should not send this as the originating uid for blaming app installs. Test: Manually copied an apk to internal storage and back to downloads. Tapping on apk launches package installer as expected. Fixes: 62909163 Change-Id: Ie75da734b1bd43bc61112c023cb1587e4c2ff20e Merged-In: Ie75da734b1bd43bc61112c023cb1587e4c2ff20e (cherry picked from commit b7aea795beec6721c60b59c9d945e4d964466323)
-rw-r--r--src/com/android/providers/downloads/OpenHelper.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/providers/downloads/OpenHelper.java b/src/com/android/providers/downloads/OpenHelper.java
index 31561ff..c88902b 100644
--- a/src/com/android/providers/downloads/OpenHelper.java
+++ b/src/com/android/providers/downloads/OpenHelper.java
@@ -31,6 +31,7 @@ import android.content.Intent;
import android.content.pm.PackageInstaller;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Process;
import android.provider.DocumentsContract;
import android.provider.Downloads.Impl.RequestHeaders;
import android.util.Log;
@@ -127,7 +128,10 @@ public class OpenHelper {
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
- return cursor.getInt(cursor.getColumnIndexOrThrow(Constants.UID));
+ final int uid = cursor.getInt(cursor.getColumnIndexOrThrow(Constants.UID));
+ if (uid != Process.myUid()) {
+ return uid;
+ }
}
} finally {
cursor.close();