1200+ lines of WindowManagerService.performLayoutAndPlaceSurfacesLockedInner!

156 views
Skip to first unread message

Jon Shemitz

unread,
Jan 27, 2011, 1:47:54 PM1/27/11
to android-platform
I was blown away to find yesterday that the Gingerbread version of
WindowManagerService.performLayoutAndPlaceSurfacesLockedInner comes to
1233 lines. That's, well, unimaginably far from "one screen".

Is it just too risky to touch? (Obviously, it's a lot harder to write
unit tests for GUI code than for engine code.) Or is it simply that no
one has had the time to refactor it?

Actually, both these are proxies for my real question: If I broke it
into a series of calls to smaller private methods, would this be a
plausible patch candidate, or is it a 'protected species'?

Dianne Hackborn

unread,
Jan 27, 2011, 2:59:47 PM1/27/11
to android-...@googlegroups.com
Hi Jon,

What, you have a problem with my 1000 line function?? :)

Actually there are much biggest aspects to WindowManagerService that I would like to refactor to ease maintenance -- the first being turning this nearly 12,000 line file with multiple inner classes into a bunch of separate classes in their own package.

I have been wanting to do this for over a year.  The problem is finding a good time to do it that won't cause huge merge headaches -- we often tend to have multiple development branches running in parallel, so if you do this at the wrong time you suddenly have painful merges between them.  I think we have an opportunity coming up for this post-HC, but we'll see.

What that means for AOSP contributions, though, is that refactoring code like this is fairly problematic to accept as a contribution, because of the merge pain that will arise from that.  Even changes that do things like just "fix" a bunch of whitespace are difficult to deal with.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Jon Shemitz

unread,
Jan 27, 2011, 3:51:12 PM1/27/11
to android-...@googlegroups.com
Thanks again, Dianne.

I'm in the process of making some Window Manager tweaks that do require changing pLAPSLI, and it seems prudent to do a bit of refactoring first. I just won't submit it as a patch.
Reply all
Reply to author
Forward
0 new messages