Disabling stricty mode checks when launching an activity.

am: 85fc55a976

* commit '85fc55a976a1f1605ad22deff74f5ceb080913e6':
  Disabling stricty mode checks when launching an activity.

Change-Id: I251843ed4926781c54e8eb1feb7d9b309b8f4127
This commit is contained in:
Sunny Goyal
2016-05-31 20:53:10 +00:00
committed by android-build-merger
+13 -3
View File
@@ -880,7 +880,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,
@@ -2873,8 +2873,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,