OSDN Git Service

Remove a compat hack SurfaceView#setWindowType()
authorYohei Yukawa <yukawa@google.com>
Mon, 31 Jul 2017 03:54:08 +0000 (20:54 -0700)
committerYohei Yukawa <yukawa@google.com>
Mon, 31 Jul 2017 03:54:08 +0000 (20:54 -0700)
This CL logically reverts a compatibility hack I introduced [1] for
apps that had relied on @hide method SurfaceView#setWindowType(int).

 [1]: I5217f6417a73690ae8a978754218b7b089070fdd
      3b5011afc9e17963607269bfb6665d04e3ab4ca1

Fixes: 62054282
Test: Manually verified that Bug 36345857 is still not reproducible
Change-Id: Icee198c554de558cfa4ffe0b264064969839654e

core/java/android/view/SurfaceView.java

index cac27af..1d206ab 100644 (file)
@@ -16,7 +16,6 @@
 
 package android.view;
 
-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;
@@ -872,31 +871,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
         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.O) {
-            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());
-    }
-
     private void runOnUiThread(Runnable runnable) {
         Handler handler = getHandler();
         if (handler != null && handler.getLooper() != Looper.myLooper()) {