From 37355a9f5d1e82c6d3eb3d6c919462373457af4c Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 5 Feb 2016 16:19:10 -0700 Subject: [PATCH] Tweaks to file:// Uri StrictMode checks. Whitelist two more legacy intent actions, and don't enforce the StrictMode checks when resolving intents that might be coming from legacy apps. Newer apps would have already been yelled at directly before getting to the resolver. Bug: 26976516, 26977622 Change-Id: Ibf72a361ed68c52cfaac16c32ab40e79005a42e7 --- core/java/android/content/Intent.java | 2 ++ core/java/com/android/internal/app/ResolverActivity.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 83943ade7d82b..7dc74010aa77f 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -8939,6 +8939,8 @@ public class Intent implements Parcelable, Cloneable { case ACTION_MEDIA_SCANNER_STARTED: case ACTION_MEDIA_SCANNER_FINISHED: case ACTION_MEDIA_SCANNER_SCAN_FILE: + case ACTION_PACKAGE_NEEDS_VERIFICATION: + case ACTION_PACKAGE_VERIFIED: // Ignore legacy actions break; default: diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 53e329d090cf8..3fb768f68ee60 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -52,6 +52,7 @@ import android.os.Build; import android.os.Bundle; import android.os.PatternMatcher; import android.os.RemoteException; +import android.os.StrictMode; import android.os.UserHandle; import android.os.UserManager; import android.util.Log; @@ -173,6 +174,10 @@ public class ResolverActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { + // We're dispatching intents that might be coming from legacy apps, so + // don't kill ourselves. + StrictMode.disableDeathOnFileUriExposure(); + // Use a specialized prompt when we're handling the 'Home' app startActivity() final Intent intent = makeMyIntent(); final Set categories = intent.getCategories();