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

Commit 4aaed145 authored by Adam Skory's avatar Adam Skory
Browse files

nullcheck Activity.getIntent() for AssistContent

Nothing stopping an Activity from giving us a
null Intent, and the Intent copy constructor
requires a non-null arg.

Bug: 20419159
Change-Id: I8b12a127431869394697e947e2298d4dbbe08604
parent ce510d5f
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -2541,11 +2541,16 @@ public final class ActivityThread {
            if (cmd.requestType == ActivityManager.ASSIST_CONTEXT_FULL) {
                data.putParcelable(AssistStructure.ASSIST_KEY, new AssistStructure(r.activity));
                AssistContent content = new AssistContent();
                Intent intent = new Intent(r.activity.getIntent());
                Intent activityIntent = r.activity.getIntent();
                if (activityIntent != null) {
                    Intent intent = new Intent(activityIntent);
                    intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_WRITE_URI_PERMISSION
                            | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION));
                    intent.removeUnsafeExtras();
                    content.setIntent(intent);
                } else {
                    content.setIntent(new Intent());
                }
                r.activity.onProvideAssistContent(content);
                data.putParcelable(AssistContent.ASSIST_KEY, content);
            }