Commit d2a6ed36 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Disabling stricty mode checks when launching an activity.

The default strict mode policy in NYC cause death penalty when
when sharing file URI in intent. This causes launcher to crash
for users who have shortcuts of images and documents on their
homescreen.

Bug: 28853579
Change-Id: If84cd5ff732713aaff5d3164edf428c8b4233ea2
(cherry picked from commit 85fc55a9)
parent ad3ca7d1
......@@ -855,7 +855,7 @@ public class Launcher extends Activity
sPendingAddItem = null;
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startActivity(v, intent, null);
startActivitySafely(v, intent, null);
} else {
// TODO: Show a snack bar with link to settings
Toast.makeText(this, getString(R.string.msg_no_phone_permission,
......@@ -2967,8 +2967,18 @@ public class Launcher extends Activity
}
if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
// Could be launching some bookkeeping activity
startActivity(intent, optsBundle);
StrictMode.VmPolicy oldPolicy = StrictMode.getVmPolicy();
try {
// Temporarily disable deathPenalty on all default checks. For eg, shortcuts
// containing file Uris would cause a crash as penaltyDeathOnFileUriExposure
// is enabled by default on NYC.
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
.penaltyLog().build());
// Could be launching some bookkeeping activity
startActivity(intent, optsBundle);
} finally {
StrictMode.setVmPolicy(oldPolicy);
}
} else {
// TODO Component can be null when shortcuts are supported for secondary user
launcherApps.startActivityForProfile(intent.getComponent(), user,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment