diff options
| author | Robert Carr <racarr@google.com> | 2018-12-17 13:11:48 -0800 |
|---|---|---|
| committer | Tony Mak <tonymak@google.com> | 2019-06-27 15:14:45 +0100 |
| commit | 9d431e1cc85b88afc1e06782e832e8453decdc95 (patch) | |
| tree | 693c7fad2c9a187a2540fe510edfb7df0f47fd65 /core/java/android/view/WindowlessViewRoot.java | |
| parent | 482c2c994d56a684c5945fccce7ce5ea6a60396c (diff) | |
Enable views to be placed in windowless surfaces.
For purposes of parcelling SurfaceControl to embed view hierarchies across
processes. We also want these Surfaces to receive input, but we can't
let the clients call setInputWindowInfo directly (or we could have issues
with clients stealing focus, etc...) and so we provide a method
blessInputSurface which has the WM configure a surface for input with
a minimal and safe set of parameters.
Test: WindowlessWmTests
Bug: 111373437
Bug: 134365580
Change-Id: I45fde62ba9b810e783d62c4dd5442abd038734d5
Diffstat (limited to 'core/java/android/view/WindowlessViewRoot.java')
| -rw-r--r-- | core/java/android/view/WindowlessViewRoot.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/core/java/android/view/WindowlessViewRoot.java b/core/java/android/view/WindowlessViewRoot.java new file mode 100644 index 000000000000..75057a26afae --- /dev/null +++ b/core/java/android/view/WindowlessViewRoot.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view; + +import android.content.res.Resources; +import android.content.Context; +import android.view.SurfaceControl; +import android.view.View; + +/** + * Utility class for adding a view hierarchy to a SurfaceControl. + * + * See WindowlessWmTest for example usage. + * @hide + */ +public class WindowlessViewRoot { + ViewRootImpl mViewRoot; + WindowlessWindowManager mWm; + public WindowlessViewRoot(Context c, Display d, SurfaceControl rootSurface) { + mWm = new WindowlessWindowManager(c.getResources().getConfiguration(), rootSurface); + mViewRoot = new ViewRootImpl(c, d, mWm); + } + + public void addView(View view, WindowManager.LayoutParams attrs) { + mViewRoot.setView(view, attrs, null); + } +} |
