Skip to content
Commit 3b5011af authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Add a compat hack into SurfaceView#setWindowType()

This is a follow up CL to a previous CL [1] that removed an @hide method
SurfaceView#setWindowType(int).

It turns out that at least one application has relied on this @hide method
via refection to set TYPE_APPLICATION_PANEL to the internal Window object
for some reasons.  Such an operation has never ever been allowed to the
application developers.

To minimize the risk of compatibility issues and to help developers and
QA teams figure out what is going on, this CL re-introduces the method in
question to do three things:

 1. Show an error message with stack trace in logcat if this method was
    still called.
 2. To emulate the previous behavior for applications that set
    TYPE_APPLICATION_PANEL, call SurfaceView#setZOrderOnTop(true) on behalf
    of them as a stop-gap, short-term solution until application developers
    are notified that their products are doing something unsupported.
 3. Throw an exception if the targetApi is Android O or later.

 [1]: Ie56b6f7ab16f32d7fc459b8eba26594337ad55de
      d5c7dd6d

Test: Manually verified that the complaint in Bug 36345857 disappeared
Bug: 36345857
Change-Id: I5217f6417a73690ae8a978754218b7b089070fdd
parent b30ee8d0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment