Loading services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan } try { mWindowManagerInternal.addTaskOverlay( mWindowManagerInternal.addTrustedTaskOverlay( taskId, createGameSessionResult.getSurfacePackage()); } catch (IllegalArgumentException ex) { Loading Loading @@ -519,7 +519,7 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan SurfacePackage surfacePackage = gameSessionRecord.getSurfacePackage(); if (surfacePackage != null) { try { mWindowManagerInternal.removeTaskOverlay( mWindowManagerInternal.removeTrustedTaskOverlay( gameSessionRecord.getTaskId(), surfacePackage); } catch (IllegalArgumentException ex) { Loading services/core/java/com/android/server/wm/OverlayHost.java→services/core/java/com/android/server/wm/TrustedOverlayHost.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,14 +32,20 @@ import java.util.ArrayList; * * Also handles multiplexing of event dispatch and tracking of overlays * to make things easier for WindowContainer. * * These overlays are to be used for various types of System UI and UI * under the systems control. Provided SurfacePackages will be able * to overlay application content, without engaging the usual cross process * obscured touch filtering mechanisms. It's imperative that all UI provided * be under complete control of the system. */ class OverlayHost { class TrustedOverlayHost { // Lazily initialized when required SurfaceControl mSurfaceControl; final ArrayList<SurfaceControlViewHost.SurfacePackage> mOverlays = new ArrayList<>(); final WindowManagerService mWmService; OverlayHost(WindowManagerService wms) { TrustedOverlayHost(WindowManagerService wms) { mWmService = wms; } Loading @@ -51,6 +57,8 @@ class OverlayHost { .setName("Overlay Host Leash"); mSurfaceControl = b.build(); SurfaceControl.Transaction t = mWmService.mTransactionFactory.get(); t.setTrustedOverlay(mSurfaceControl, true).apply(); } } Loading services/core/java/com/android/server/wm/WindowContainer.java +5 −5 Original line number Diff line number Diff line Loading @@ -314,7 +314,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< private final List<WindowContainerListener> mListeners = new ArrayList<>(); protected OverlayHost mOverlayHost; protected TrustedOverlayHost mOverlayHost; WindowContainer(WindowManagerService wms) { mWmService = wms; Loading Loading @@ -3600,9 +3600,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< @AnimationType int type, @Nullable AnimationAdapter snapshotAnim); } void addOverlay(SurfaceControlViewHost.SurfacePackage overlay) { void addTrustedOverlay(SurfaceControlViewHost.SurfacePackage overlay) { if (mOverlayHost == null) { mOverlayHost = new OverlayHost(mWmService); mOverlayHost = new TrustedOverlayHost(mWmService); } mOverlayHost.addOverlay(overlay, mSurfaceControl); Loading @@ -3613,11 +3613,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< overlay.getRemoteInterface().onConfigurationChanged(getConfiguration()); } catch (Exception e) { Slog.e(TAG, "Error sending initial configuration change to WindowContainer overlay"); removeOverlay(overlay); removeTrustedOverlay(overlay); } } void removeOverlay(SurfaceControlViewHost.SurfacePackage overlay) { void removeTrustedOverlay(SurfaceControlViewHost.SurfacePackage overlay) { if (mOverlayHost != null && !mOverlayHost.removeOverlay(overlay)) { mOverlayHost.release(); mOverlayHost = null; Loading services/core/java/com/android/server/wm/WindowManagerInternal.java +9 −2 Original line number Diff line number Diff line Loading @@ -827,6 +827,11 @@ public abstract class WindowManagerInternal { * Internal methods for other parts of SystemServer to manage * SurfacePackage based overlays on tasks. * * Since these overlays will overlay application content, they exist * in a container with setTrustedOverlay(true). This means its imperative * that this overlay feature only be used with UI completely under the control * of the system, without 3rd party content. * * Callers prepare a view hierarchy with SurfaceControlViewHost * and send the package to WM here. The remote view hierarchy will receive * configuration change, lifecycle events, etc, forwarded over the Loading @@ -837,8 +842,10 @@ public abstract class WindowManagerInternal { * The embedded hierarchy exists in a coordinate space relative to the task * bounds. */ public abstract void addTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void removeTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void addTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void removeTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); /** * Get a SurfaceControl that is the container layer that should be used to receive input to Loading services/core/java/com/android/server/wm/WindowManagerService.java +7 −5 Original line number Diff line number Diff line Loading @@ -8015,24 +8015,26 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public void addTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { public void addTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { synchronized (mGlobalLock) { final Task task = mRoot.getRootTask(taskId); if (task == null) { throw new IllegalArgumentException("no task with taskId" + taskId); } task.addOverlay(overlay); task.addTrustedOverlay(overlay); } } @Override public void removeTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { public void removeTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { synchronized (mGlobalLock) { final Task task = mRoot.getRootTask(taskId); if (task == null) { throw new IllegalArgumentException("no task with taskId" + taskId); } task.removeOverlay(overlay); task.removeTrustedOverlay(overlay); } } Loading Loading
services/core/java/com/android/server/app/GameServiceProviderInstanceImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -473,7 +473,7 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan } try { mWindowManagerInternal.addTaskOverlay( mWindowManagerInternal.addTrustedTaskOverlay( taskId, createGameSessionResult.getSurfacePackage()); } catch (IllegalArgumentException ex) { Loading Loading @@ -519,7 +519,7 @@ final class GameServiceProviderInstanceImpl implements GameServiceProviderInstan SurfacePackage surfacePackage = gameSessionRecord.getSurfacePackage(); if (surfacePackage != null) { try { mWindowManagerInternal.removeTaskOverlay( mWindowManagerInternal.removeTrustedTaskOverlay( gameSessionRecord.getTaskId(), surfacePackage); } catch (IllegalArgumentException ex) { Loading
services/core/java/com/android/server/wm/OverlayHost.java→services/core/java/com/android/server/wm/TrustedOverlayHost.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,14 +32,20 @@ import java.util.ArrayList; * * Also handles multiplexing of event dispatch and tracking of overlays * to make things easier for WindowContainer. * * These overlays are to be used for various types of System UI and UI * under the systems control. Provided SurfacePackages will be able * to overlay application content, without engaging the usual cross process * obscured touch filtering mechanisms. It's imperative that all UI provided * be under complete control of the system. */ class OverlayHost { class TrustedOverlayHost { // Lazily initialized when required SurfaceControl mSurfaceControl; final ArrayList<SurfaceControlViewHost.SurfacePackage> mOverlays = new ArrayList<>(); final WindowManagerService mWmService; OverlayHost(WindowManagerService wms) { TrustedOverlayHost(WindowManagerService wms) { mWmService = wms; } Loading @@ -51,6 +57,8 @@ class OverlayHost { .setName("Overlay Host Leash"); mSurfaceControl = b.build(); SurfaceControl.Transaction t = mWmService.mTransactionFactory.get(); t.setTrustedOverlay(mSurfaceControl, true).apply(); } } Loading
services/core/java/com/android/server/wm/WindowContainer.java +5 −5 Original line number Diff line number Diff line Loading @@ -314,7 +314,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< private final List<WindowContainerListener> mListeners = new ArrayList<>(); protected OverlayHost mOverlayHost; protected TrustedOverlayHost mOverlayHost; WindowContainer(WindowManagerService wms) { mWmService = wms; Loading Loading @@ -3600,9 +3600,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< @AnimationType int type, @Nullable AnimationAdapter snapshotAnim); } void addOverlay(SurfaceControlViewHost.SurfacePackage overlay) { void addTrustedOverlay(SurfaceControlViewHost.SurfacePackage overlay) { if (mOverlayHost == null) { mOverlayHost = new OverlayHost(mWmService); mOverlayHost = new TrustedOverlayHost(mWmService); } mOverlayHost.addOverlay(overlay, mSurfaceControl); Loading @@ -3613,11 +3613,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< overlay.getRemoteInterface().onConfigurationChanged(getConfiguration()); } catch (Exception e) { Slog.e(TAG, "Error sending initial configuration change to WindowContainer overlay"); removeOverlay(overlay); removeTrustedOverlay(overlay); } } void removeOverlay(SurfaceControlViewHost.SurfacePackage overlay) { void removeTrustedOverlay(SurfaceControlViewHost.SurfacePackage overlay) { if (mOverlayHost != null && !mOverlayHost.removeOverlay(overlay)) { mOverlayHost.release(); mOverlayHost = null; Loading
services/core/java/com/android/server/wm/WindowManagerInternal.java +9 −2 Original line number Diff line number Diff line Loading @@ -827,6 +827,11 @@ public abstract class WindowManagerInternal { * Internal methods for other parts of SystemServer to manage * SurfacePackage based overlays on tasks. * * Since these overlays will overlay application content, they exist * in a container with setTrustedOverlay(true). This means its imperative * that this overlay feature only be used with UI completely under the control * of the system, without 3rd party content. * * Callers prepare a view hierarchy with SurfaceControlViewHost * and send the package to WM here. The remote view hierarchy will receive * configuration change, lifecycle events, etc, forwarded over the Loading @@ -837,8 +842,10 @@ public abstract class WindowManagerInternal { * The embedded hierarchy exists in a coordinate space relative to the task * bounds. */ public abstract void addTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void removeTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void addTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); public abstract void removeTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay); /** * Get a SurfaceControl that is the container layer that should be used to receive input to Loading
services/core/java/com/android/server/wm/WindowManagerService.java +7 −5 Original line number Diff line number Diff line Loading @@ -8015,24 +8015,26 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public void addTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { public void addTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { synchronized (mGlobalLock) { final Task task = mRoot.getRootTask(taskId); if (task == null) { throw new IllegalArgumentException("no task with taskId" + taskId); } task.addOverlay(overlay); task.addTrustedOverlay(overlay); } } @Override public void removeTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { public void removeTrustedTaskOverlay(int taskId, SurfaceControlViewHost.SurfacePackage overlay) { synchronized (mGlobalLock) { final Task task = mRoot.getRootTask(taskId); if (task == null) { throw new IllegalArgumentException("no task with taskId" + taskId); } task.removeOverlay(overlay); task.removeTrustedOverlay(overlay); } } Loading