Merge changes from topic "trusted_overlay_backport" into rvc-dev

* changes:
  DO NOT MERGE: Revert "Map TYPE_TRUSTED_APPLICATION_OVERLAY to system window type for A11y"
  Add mechanism for a task's windows to be trusted overlays
  Change InputWindowInfo::isTrustedOverlay() to be permission and flag based
This commit is contained in:
Winson Chung
2021-11-09 23:03:14 +00:00
committed by Android (Google) Code Review
18 changed files with 136 additions and 40 deletions

View File

@@ -336,11 +336,12 @@ interface IWindowSession {
* an input channel where the client can receive input.
*/
void grantInputChannel(int displayId, in SurfaceControl surface, in IWindow window,
in IBinder hostInputToken, int flags, int type, out InputChannel outInputChannel);
in IBinder hostInputToken, int flags, int privateFlags, int type,
out InputChannel outInputChannel);
/**
* Update the flags on an input channel associated with a particular surface.
*/
void updateInputChannel(in IBinder channelToken, int displayId, in SurfaceControl surface,
int flags, in Region region);
int flags, int privateFlags, in Region region);
}

View File

@@ -82,6 +82,9 @@ public final class InputWindowHandle {
// Input event dispatching is paused.
public boolean paused;
// Window is trusted overlay.
public boolean trustedOverlay;
// Id of process and user that owns the window.
public int ownerPid;
public int ownerUid;

View File

@@ -139,6 +139,8 @@ public final class SurfaceControl implements Parcelable {
int blurRadius);
private static native void nativeSetLayerStack(long transactionObj, long nativeObject,
int layerStack);
private static native void nativeSetTrustedOverlay(long transactionObj, long nativeObject,
boolean isTrustedOverlay);
private static native boolean nativeClearContentFrameStats(long nativeObject);
private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats);
@@ -3037,6 +3039,17 @@ public final class SurfaceControl implements Parcelable {
return this;
}
/**
* Sets the trusted overlay state on this SurfaceControl and it is inherited to all the
* children. The caller must hold the ACCESS_SURFACE_FLINGER permission.
* @hide
*/
public Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) {
checkPreconditions(sc);
nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, isTrustedOverlay);
return this;
}
/**
* Merge the other transaction into this transaction, clearing the
* other transaction as if it had been applied.

View File

@@ -1216,14 +1216,6 @@ public interface WindowManager extends ViewManager {
*/
public static final int TYPE_STATUS_BAR_ADDITIONAL = FIRST_SYSTEM_WINDOW + 41;
/**
* Similar to TYPE_APPLICATION_OVERLAY, but trusted to overlay other windows since it is
* is coming from the system.
* @hide
*/
// TODO(b/155781676): Remove and replace call points with trustedOverlay when that is ready.
public static final int TYPE_TRUSTED_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 42;
/**
* End of types of system windows.
*/
@@ -2032,6 +2024,11 @@ public interface WindowManager extends ViewManager {
*/
public static final int PRIVATE_FLAG_FIT_INSETS_CONTROLLED = 0x10000000;
/**
* Flag to indicate that the window is a trusted overlay.
* @hide
*/
public static final int PRIVATE_FLAG_TRUSTED_OVERLAY = 0x20000000;
/**
* An internal annotation for flags that can be specified to {@link #softInputMode}.
*
@@ -2940,6 +2937,20 @@ public interface WindowManager extends ViewManager {
privateFlags |= PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
}
/**
* Specifies that the window should be considered a trusted system overlay. Trusted system
* overlays are ignored when considering whether windows are obscured during input
* dispatch. Requires the {@link android.Manifest.permission.INTERNAL_SYSTEM_WINDOW}
* permission.
*
* {@see android.view.MotionEvent#FLAG_WINDOW_IS_OBSCURED}
* {@see android.view.MotionEvent#FLAG_WINDOW_IS_PARTIALLY_OBSCURED}
* @hide
*/
public void setTrustedOverlay() {
privateFlags |= PRIVATE_FLAG_TRUSTED_OVERLAY;
}
/**
* @return the insets types that this window is avoiding overlapping.
*/

View File

@@ -115,7 +115,8 @@ public class WindowlessWindowManager implements IWindowSession {
if (state.mInputChannelToken != null) {
try {
mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId,
state.mSurfaceControl, state.mParams.flags, state.mInputRegion);
state.mSurfaceControl, state.mParams.flags, state.mParams.privateFlags,
state.mInputRegion);
} catch (RemoteException e) {
Log.e(TAG, "Failed to update surface input channel: ", e);
}
@@ -144,7 +145,7 @@ public class WindowlessWindowManager implements IWindowSession {
WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0)) {
try {
mRealWm.grantInputChannel(displayId, sc, window, mHostInputToken, attrs.flags,
attrs.type, outInputChannel);
attrs.privateFlags, attrs.type, outInputChannel);
} catch (RemoteException e) {
Log.e(TAG, "Failed to grant input to surface: ", e);
}
@@ -262,7 +263,7 @@ public class WindowlessWindowManager implements IWindowSession {
&& state.mInputChannelToken != null) {
try {
mRealWm.updateInputChannel(state.mInputChannelToken, state.mDisplayId, sc,
attrs.flags, state.mInputRegion);
attrs.flags, attrs.privateFlags, state.mInputRegion);
} catch (RemoteException e) {
Log.e(TAG, "Failed to update surface input channel: ", e);
}
@@ -432,12 +433,13 @@ public class WindowlessWindowManager implements IWindowSession {
@Override
public void grantInputChannel(int displayId, SurfaceControl surface, IWindow window,
IBinder hostInputToken, int flags, int type, InputChannel outInputChannel) {
IBinder hostInputToken, int flags, int privateFlags, int type,
InputChannel outInputChannel) {
}
@Override
public void updateInputChannel(IBinder channelToken, int displayId, SurfaceControl surface,
int flags, Region region) {
int flags, int privateFlags, Region region) {
}
@Override

View File

@@ -59,6 +59,7 @@ static struct {
jfieldID hasFocus;
jfieldID hasWallpaper;
jfieldID paused;
jfieldID trustedOverlay;
jfieldID ownerPid;
jfieldID ownerUid;
jfieldID inputFeatures;
@@ -151,6 +152,7 @@ bool NativeInputWindowHandle::updateInfo() {
gInputWindowHandleClassInfo.hasWallpaper);
mInfo.paused = env->GetBooleanField(obj,
gInputWindowHandleClassInfo.paused);
mInfo.trustedOverlay = env->GetBooleanField(obj, gInputWindowHandleClassInfo.trustedOverlay);
mInfo.ownerPid = env->GetIntField(obj,
gInputWindowHandleClassInfo.ownerPid);
mInfo.ownerUid = env->GetIntField(obj,
@@ -329,6 +331,8 @@ int register_android_view_InputWindowHandle(JNIEnv* env) {
GET_FIELD_ID(gInputWindowHandleClassInfo.paused, clazz,
"paused", "Z");
GET_FIELD_ID(gInputWindowHandleClassInfo.trustedOverlay, clazz, "trustedOverlay", "Z");
GET_FIELD_ID(gInputWindowHandleClassInfo.ownerPid, clazz,
"ownerPid", "I");

View File

@@ -627,6 +627,14 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb
transaction->setShadowRadius(ctrl, shadowRadius);
}
static void nativeSetTrustedOverlay(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject, jboolean isTrustedOverlay) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
transaction->setTrustedOverlay(ctrl, isTrustedOverlay);
}
static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject,
jfloat frameRate, jint compatibility) {
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -1666,7 +1674,10 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
(void*)nativeSetGlobalShadowSettings },
{"nativeGetHandle", "(J)J",
(void*)nativeGetHandle },
{"nativeSetFixedTransformHint", "(JJI)V", (void*)nativeSetFixedTransformHint},
{"nativeSetFixedTransformHint", "(JJI)V",
(void*)nativeSetFixedTransformHint},
{"nativeSetTrustedOverlay", "(JJZ)V",
(void*)nativeSetTrustedOverlay },
};
int register_android_view_SurfaceControl(JNIEnv* env)

View File

@@ -754,13 +754,14 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
// themselves.
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_TRUSTED_APPLICATION_OVERLAY,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
// Start not focusable - we'll become focusable when expanded so the ActivityView
// can use the IME.
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
PixelFormat.TRANSLUCENT);
mWmLayoutParams.setTrustedOverlay();
mWmLayoutParams.setFitInsetsTypes(0);
mWmLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
mWmLayoutParams.token = new Binder();

View File

@@ -725,8 +725,7 @@ public class AccessibilityWindowManager {
case WindowManager.LayoutParams.TYPE_SYSTEM_ERROR:
case WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY:
case WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY:
case WindowManager.LayoutParams.TYPE_SCREENSHOT:
case WindowManager.LayoutParams.TYPE_TRUSTED_APPLICATION_OVERLAY: {
case WindowManager.LayoutParams.TYPE_SCREENSHOT: {
return AccessibilityWindowInfo.TYPE_SYSTEM;
}

View File

@@ -56,7 +56,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_TRUSTED_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
@@ -791,7 +790,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
// in a higher layer than TYPE_APPLICATION_OVERLAY.
return canAddInternalSystemWindow ? 13 : 10;
case TYPE_APPLICATION_OVERLAY:
case TYPE_TRUSTED_APPLICATION_OVERLAY:
return 12;
case TYPE_INPUT_METHOD:
// on-screen keyboards and other such input method user interfaces go here.

View File

@@ -716,7 +716,7 @@ class ActivityStack extends Task {
: WINDOWING_MODE_FULLSCREEN;
}
if (currentMode == WINDOWING_MODE_PINNED) {
mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
mRootWindowContainer.notifyActivityPipModeChanged(this, null);
}
if (likelyResolvedMode == WINDOWING_MODE_PINNED
&& taskDisplayArea.getRootPinnedTask() != null) {

View File

@@ -73,6 +73,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BA
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
@@ -95,7 +96,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_TRUSTED_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION;
import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
@@ -949,6 +949,11 @@ public class DisplayPolicy {
android.Manifest.permission.STATUS_BAR_SERVICE, callingPid, callingUid,
"DisplayPolicy");
}
if ((attrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0) {
mContext.enforcePermission(
android.Manifest.permission.INTERNAL_SYSTEM_WINDOW, callingPid, callingUid,
"DisplayPolicy");
}
switch (attrs.type) {
case TYPE_STATUS_BAR:
@@ -996,11 +1001,6 @@ public class DisplayPolicy {
android.Manifest.permission.STATUS_BAR_SERVICE, callingPid, callingUid,
"DisplayPolicy");
break;
case TYPE_TRUSTED_APPLICATION_OVERLAY:
mContext.enforcePermission(
android.Manifest.permission.INTERNAL_SYSTEM_WINDOW, callingPid, callingUid,
"DisplayPolicy");
break;
case TYPE_STATUS_BAR_PANEL:
return WindowManagerGlobal.ADD_INVALID_TYPE;
}

View File

@@ -2212,7 +2212,27 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
ensureActivitiesVisible(null, 0, false /* preserveWindows */);
resumeFocusedStacksTopActivities();
mService.getTaskChangeNotificationController().notifyActivityPinned(r);
notifyActivityPipModeChanged(r.getTask(), r);
}
/**
* Notifies when an activity enters or leaves PIP mode.
*
* @param task the task of {@param r}
* @param r indicates the activity currently in PIP, can be null to indicate no activity is
* currently in PIP mode.
*/
void notifyActivityPipModeChanged(@NonNull Task task, @Nullable ActivityRecord r) {
final boolean inPip = r != null;
if (inPip) {
mService.getTaskChangeNotificationController().notifyActivityPinned(r);
} else {
mService.getTaskChangeNotificationController().notifyActivityUnpinned();
}
mWindowManager.mPolicy.setPipVisibilityLw(inPip);
mWmService.mTransactionFactory.get()
.setTrustedOverlay(task.getSurfaceControl(), inPip)
.apply();
}
void executeAppTransitionForAllDisplay() {

View File

@@ -662,7 +662,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public void grantInputChannel(int displayId, SurfaceControl surface,
IWindow window, IBinder hostInputToken, int flags, int type,
IWindow window, IBinder hostInputToken, int flags, int privateFlags, int type,
InputChannel outInputChannel) {
if (hostInputToken == null && !mCanAddInternalSystemWindow) {
// Callers without INTERNAL_SYSTEM_WINDOW permission cannot grant input channel to
@@ -678,7 +678,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
final long identity = Binder.clearCallingIdentity();
try {
mService.grantInputChannel(mUid, mPid, displayId, surface, window, hostInputToken,
flags, mCanAddInternalSystemWindow ? type : 0, outInputChannel);
flags, mCanAddInternalSystemWindow ? privateFlags : 0,
mCanAddInternalSystemWindow ? type : 0, outInputChannel);
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -686,10 +687,11 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public void updateInputChannel(IBinder channelToken, int displayId, SurfaceControl surface,
int flags, Region region) {
int flags, int privateFlags, Region region) {
final long identity = Binder.clearCallingIdentity();
try {
mService.updateInputChannel(channelToken, displayId, surface, flags, region);
mService.updateInputChannel(channelToken, displayId, surface, flags,
mCanAddInternalSystemWindow ? privateFlags : 0, region);
} finally {
Binder.restoreCallingIdentity(identity);
}

View File

@@ -1131,7 +1131,7 @@ class Task extends WindowContainer<WindowContainer> {
&& (newParent == null || !newParent.inPinnedWindowingMode())) {
// Notify if a task from the pinned stack is being removed
// (or moved depending on the mode).
mAtmService.getTaskChangeNotificationController().notifyActivityUnpinned();
mRootWindowContainer.notifyActivityPipModeChanged(this, null);
}
}
@@ -4583,5 +4583,4 @@ class Task extends WindowContainer<WindowContainer> {
long getProtoFieldId() {
return TASK;
}
}

View File

@@ -59,6 +59,7 @@ import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHA
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
@@ -8055,7 +8056,7 @@ public class WindowManagerService extends IWindowManager.Stub
* views.
*/
void grantInputChannel(int callingUid, int callingPid, int displayId, SurfaceControl surface,
IWindow window, IBinder hostInputToken, int flags, int type,
IWindow window, IBinder hostInputToken, int flags, int privateFlags, int type,
InputChannel outInputChannel) {
final InputApplicationHandle applicationHandle;
final String name;
@@ -8071,7 +8072,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
updateInputChannel(clientChannel.getToken(), callingUid, callingPid, displayId, surface,
name, applicationHandle, flags, type, null /* region */);
name, applicationHandle, flags, privateFlags, type, null /* region */);
clientChannel.transferTo(outInputChannel);
clientChannel.dispose();
@@ -8079,7 +8080,8 @@ public class WindowManagerService extends IWindowManager.Stub
private void updateInputChannel(IBinder channelToken, int callingUid, int callingPid,
int displayId, SurfaceControl surface, String name,
InputApplicationHandle applicationHandle, int flags, int type, Region region) {
InputApplicationHandle applicationHandle, int flags, int privateFlags, int type,
Region region) {
InputWindowHandle h = new InputWindowHandle(applicationHandle, displayId);
h.token = channelToken;
h.name = name;
@@ -8107,6 +8109,9 @@ public class WindowManagerService extends IWindowManager.Stub
h.setTouchableRegionCrop(surface);
}
// Check private trusted overlay flag to set trustedOverlay field of input window handle.
h.trustedOverlay = (privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0;
SurfaceControl.Transaction t = mTransactionFactory.get();
t.setInputWindowInfo(surface, h);
t.apply();
@@ -8120,7 +8125,7 @@ public class WindowManagerService extends IWindowManager.Stub
* is undefined.
*/
void updateInputChannel(IBinder channelToken, int displayId, SurfaceControl surface,
int flags, Region region) {
int flags, int privateFlags, Region region) {
final InputApplicationHandle applicationHandle;
final String name;
final EmbeddedWindowController.EmbeddedWindow win;
@@ -8135,7 +8140,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
updateInputChannel(channelToken, win.mOwnerUid, win.mOwnerPid, displayId, surface, name,
applicationHandle, flags, win.mWindowType, region);
applicationHandle, flags, privateFlags, win.mWindowType, region);
}
/** Return whether layer tracing is enabled */

View File

@@ -55,11 +55,14 @@ import static android.view.WindowManager.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
@@ -84,6 +87,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
@@ -946,6 +950,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
? mActivityRecord.getInputApplicationHandle(false /* update */) : null,
getDisplayId());
// Check private trusted overlay flag and window type to set trustedOverlay variable of
// input window handle.
mInputWindowHandle.trustedOverlay =
(mAttrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0
&& mOwnerCanAddInternalSystemWindow;
mInputWindowHandle.trustedOverlay |=
mAttrs.type == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY
|| mAttrs.type == TYPE_INPUT_METHOD || mAttrs.type == TYPE_INPUT_METHOD_DIALOG
|| mAttrs.type == TYPE_MAGNIFICATION_OVERLAY || mAttrs.type == TYPE_STATUS_BAR
|| mAttrs.type == TYPE_NOTIFICATION_SHADE
|| mAttrs.type == TYPE_NAVIGATION_BAR
|| mAttrs.type == TYPE_NAVIGATION_BAR_PANEL
|| mAttrs.type == TYPE_SECURE_SYSTEM_OVERLAY
|| mAttrs.type == TYPE_DOCK_DIVIDER
|| mAttrs.type == TYPE_ACCESSIBILITY_OVERLAY
|| mAttrs.type == TYPE_INPUT_CONSUMER;
// Make sure we initial all fields before adding to parentWindow, to prevent exception
// during onDisplayChanged.
if (mIsChildWindow) {

View File

@@ -277,4 +277,10 @@ public class StubTransaction extends SurfaceControl.Transaction {
public SurfaceControl.Transaction unsetFixedTransformHint(@NonNull SurfaceControl sc) {
return this;
}
@Override
public SurfaceControl.Transaction setTrustedOverlay(SurfaceControl sc,
boolean isTrustedOverlay) {
return this;
}
}