• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wm;
18 
19 import android.annotation.SystemApi;
20 import android.app.ActivityOptions;
21 import android.content.pm.ActivityInfo;
22 
23 
24 /**
25  * Wrapper of the parameters of {@code LaunchParamsController.LaunchParamsModifier.onCalculate()}
26  * @hide
27  */
28 @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
29 public final class CalculateParams {
30     private TaskWrapper mTask;
31     private WindowLayoutWrapper mLayout;
32     private ActivityRecordWrapper mActivity;
33     private ActivityRecordWrapper mSource;
34     private ActivityOptionsWrapper mOptions;
35     private RequestWrapper mRequest;
36     private int mPhase;
37     private LaunchParamsWrapper mCurrentParams;
38     private LaunchParamsWrapper mOutParams;
39     private boolean mSupportsMultiDisplay;
40 
CalculateParams()41     private CalculateParams() {}
42 
43     /** @hide */
create(Task task, ActivityInfo.WindowLayout layout, ActivityRecord actvity, ActivityRecord source, ActivityOptions options, ActivityStarter.Request request, int phase, LaunchParamsController.LaunchParams currentParams, LaunchParamsController.LaunchParams outParms, boolean supportsMultiDisplay)44     public static CalculateParams create(Task task, ActivityInfo.WindowLayout layout,
45             ActivityRecord actvity, ActivityRecord source,
46             ActivityOptions options, ActivityStarter.Request request, int phase,
47             LaunchParamsController.LaunchParams currentParams,
48             LaunchParamsController.LaunchParams outParms,
49             boolean supportsMultiDisplay) {
50         CalculateParams params = new CalculateParams();
51         params.mTask = TaskWrapper.create(task);
52         params.mLayout = WindowLayoutWrapper.create(layout);
53         params.mActivity = ActivityRecordWrapper.create(actvity);
54         params.mSource = ActivityRecordWrapper.create(source);
55         params.mOptions = ActivityOptionsWrapper.create(options);
56         params.mRequest = RequestWrapper.create(request);
57         params.mPhase = phase;
58         params.mCurrentParams = LaunchParamsWrapper.create(currentParams);
59         params.mOutParams = LaunchParamsWrapper.create(outParms);
60         params.mSupportsMultiDisplay = supportsMultiDisplay;
61         return params;
62     }
63 
64     /**
65      * Gets the {@link TaskWrapper} currently being positioned.
66      */
getTask()67     public TaskWrapper getTask() {
68         return mTask;
69     }
70 
71     /**
72      * Gets the specified {@link WindowLayoutWrapper}.
73      */
getWindowLayout()74     public WindowLayoutWrapper getWindowLayout() {
75         return mLayout;
76     }
77 
78     /**
79      * Gets the {@link ActivityRecordWrapper} currently being positioned.
80      */
getActivity()81     public ActivityRecordWrapper getActivity() {
82         return mActivity;
83     }
84 
85     /**
86      * Gets the {@link ActivityRecordWrapper} from which activity was started from.
87      */
getSource()88     public ActivityRecordWrapper getSource() {
89         return mSource;
90     }
91 
92     /**
93      * Gets the {@link ActivityOptionsWrapper} specified for the activity.
94      */
getOptions()95     public ActivityOptionsWrapper getOptions() {
96         return mOptions;
97     }
98 
99     /**
100      * Gets the optional {@link RequestWrapper} from the activity starter.
101      */
getRequest()102     public RequestWrapper getRequest() {
103         return mRequest;
104     }
105 
106     /**
107      * Gets the {@link LaunchParamsController.LaunchParamsModifier.Phase} that the resolution should
108      * finish.
109      */
getPhase()110     public int getPhase() {
111         return mPhase;
112     }
113 
114     /**
115      * Gets the current {@link LaunchParamsWrapper}.
116      */
getCurrentParams()117     public LaunchParamsWrapper getCurrentParams() {
118         return mCurrentParams;
119     }
120 
121     /**
122      * Gets the resulting {@link LaunchParamsWrapper}.
123      */
getOutParams()124     public LaunchParamsWrapper getOutParams() {
125         return mOutParams;
126     }
127 
128     /**
129      * Returns whether the current system supports the multiple display.
130      */
supportsMultiDisplay()131     public boolean supportsMultiDisplay() {
132         return mSupportsMultiDisplay;
133     }
134 }
135