Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f3d78a7 authored by Adam Bookatz's avatar Adam Bookatz Committed by mse1969
Browse files

startActivityForResult with earlier new Intent

We already make sure to use a copy of the Intent, but now we do so
earlier. See bug.

Bug: 353680402
Flag: EXEMPT bugfix
Test: manual
Test: atest com.android.settings.users.UserSettingsTest
            com.android.settings.users.UserDetailsSettingsTest
(cherry picked from commit b7240e2f)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f86a8b75b191c7025599ea6911abf3aa36bb2056)
Merged-In: I860e9e606de6b8d3c99fa52a63b72ba7a99ce179
Change-Id: I860e9e606de6b8d3c99fa52a63b72ba7a99ce179
parent a409bb96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -669,8 +669,9 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
         */
        private Intent assertSafeToStartCustomActivity(Intent intent) {
            EventLog.writeEvent(0x534e4554, "223578534", -1 /* UID */, "");
            final Intent vettedIntent = new Intent(intent);
            ResolveInfo resolveInfo = mPackageManager.resolveActivity(
                    intent, PackageManager.MATCH_DEFAULT_ONLY);
                    vettedIntent, PackageManager.MATCH_DEFAULT_ONLY);

            if (resolveInfo == null) {
                throw new ActivityNotFoundException("No result for resolving " + intent);
@@ -684,7 +685,6 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen

            // We were able to vet the given intent this time. Make a copy using the components
            // that were used to do the vetting, since that's as much as we've verified is safe.
            final Intent vettedIntent = new Intent(intent);
            vettedIntent.setComponent(activityInfo.getComponentName());
            vettedIntent.setPackage(activityInfo.packageName);
            return vettedIntent;