Merge "Check permission for FLAG_WILL_BE_FOREGROUND." into nyc-dev