Add ActivityOptions for SecondDisplayLaucher to launch activity

Currently, SecondDisplayLauncher doesn't specify ActivityOption to
launch on second display, so application will launch on main display
even the user tries to launch APP from SecondDisplayLauncher.
So need to specify ActivityOption then activity can launch on the correct
display

Bug: 162042798
Test: manual testing
Change-Id: Iceb4e01b725834983a5d01cf54350f61851ad172
(cherry picked from commit 3a8075366c)
This commit is contained in:
andychou
2020-07-24 13:26:14 +08:00
committed by Sean Stout
parent 52b1c94b76
commit ca394a3eab

View File

@@ -20,6 +20,7 @@ import android.animation.AnimatorListenerAdapter;
import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewAnimationUtils;
@@ -168,7 +169,9 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
@Override
public ActivityOptions getActivityLaunchOptions(View v) {
return null;
final Display display = getWindow().getDecorView().getDisplay();
return display != null ? ActivityOptions.makeBasic().setLaunchDisplayId(
display.getDisplayId()) : null;
}
@Override