Merge "Propagate UIDs for all SurfaceControl instances" into oc-dev

This commit is contained in:
Albert Chaulk
2017-05-11 15:19:21 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 2 deletions

View File

@@ -16,10 +16,13 @@
package android.view;
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
import android.view.Surface.OutOfResourcesException;
@@ -302,7 +305,7 @@ public class SurfaceControl {
public SurfaceControl(SurfaceSession session,
String name, int w, int h, int format, int flags)
throws OutOfResourcesException {
this(session, name, w, h, format, flags, null, -1, -1);
this(session, name, w, h, format, flags, null, INVALID_WINDOW_TYPE, Binder.getCallingUid());
}
public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,

View File

@@ -742,6 +742,12 @@ public interface WindowManager extends ViewManager {
*/
public static final int LAST_SYSTEM_WINDOW = 2999;
/**
* @hide
* Used internally when there is no suitable type available.
*/
public static final int INVALID_WINDOW_TYPE = -1;
/**
* Return true if the window type is an alert window.
*

View File

@@ -41,6 +41,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.Binder;
import android.os.Debug;
import android.os.Trace;
import android.util.ArraySet;
@@ -683,9 +684,11 @@ class WindowSurfacePlacer {
final DisplayInfo displayInfo = displayContent.getDisplayInfo();
// Create a new surface for the thumbnail
WindowState window = appToken.findMainWindow();
SurfaceControl surfaceControl = new SurfaceControl(mService.mFxSession,
"thumbnail anim", dirty.width(), dirty.height(),
PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN);
PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN,
appToken.windowType, window.mOwnerUid);
surfaceControl.setLayerStack(display.getLayerStack());
if (SHOW_TRANSACTIONS) {
Slog.i(TAG, " THUMBNAIL " + surfaceControl + ": CREATE");