Merge "Add a compat hack into SurfaceView#setWindowType()"
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import static android.view.WindowManagerPolicy.APPLICATION_MEDIA_SUBLAYER;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
|
||||
import static android.view.WindowManagerPolicy.APPLICATION_MEDIA_OVERLAY_SUBLAYER;
|
||||
import static android.view.WindowManagerPolicy.APPLICATION_MEDIA_SUBLAYER;
|
||||
import static android.view.WindowManagerPolicy.APPLICATION_PANEL_SUBLAYER;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -28,6 +29,7 @@ import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
@@ -776,6 +778,31 @@ public class SurfaceView extends View {
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method still exists only for compatibility reasons because some applications have relied
|
||||
* on this method via reflection. See Issue 36345857 for details.
|
||||
*
|
||||
* @deprecated No platform code is using this method anymore.
|
||||
* @hide
|
||||
*/
|
||||
@Deprecated
|
||||
public void setWindowType(int type) {
|
||||
if (getContext().getApplicationInfo().targetSdkVersion > Build.VERSION_CODES.N_MR1) {
|
||||
throw new UnsupportedOperationException(
|
||||
"SurfaceView#setWindowType() has never been a public API.");
|
||||
}
|
||||
|
||||
if (type == TYPE_APPLICATION_PANEL) {
|
||||
Log.e(TAG, "If you are calling SurfaceView#setWindowType(TYPE_APPLICATION_PANEL) "
|
||||
+ "just to make the SurfaceView to be placed on top of its window, you must "
|
||||
+ "call setZOrderOnTop(true) instead.", new Throwable());
|
||||
setZOrderOnTop(true);
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "SurfaceView#setWindowType(int) is deprecated and now does nothing. "
|
||||
+ "type=" + type, new Throwable());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the surface has fixed size dimensions or if the surface's
|
||||
* dimensions are dimensions are dependent on its current layout.
|
||||
|
||||
Reference in New Issue
Block a user