ActivityIntentResolver: Filter protected applications in queryIntents

Any calls from System UID(1000) are not filtered

Change-Id: Iba68617b36ee31b3dbe0d4abd89319a6389f55aa
Fix frontOfTask assignment.

If all activities of a given stack were finishing, no activity was
marked as front-of-task. This confused ActivityManager, so make sure
there's always exactly one activity marked as front-of-task.

Change-Id: I087cbe10280d4a60aa5ccfaefe24a223523fb3f2