If the pip activity is started by context.startActivity(intent, optionsBundle) and optionsBundle is created by ActivityOptions.makeLaunchIntoPip(params).toBundle(); we can detect close and maximized click event by the given solutions.