diff options
Diffstat (limited to 'core/java/android/view')
| -rw-r--r-- | core/java/android/view/View.java | 2 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 26 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerImpl.java | 19 |
3 files changed, 46 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9fa67ac..aad6756 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -17250,7 +17250,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Show where the margins, bounds and layout bounds are for each view. */ - final boolean mDebugLayout = SystemProperties.getBoolean(DEBUG_LAYOUT_PROPERTY, false); + boolean mDebugLayout = SystemProperties.getBoolean(DEBUG_LAYOUT_PROPERTY, false); /** * Point used to compute visible regions. diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 5f295cb..6e6fab2 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -408,6 +408,7 @@ public final class ViewRootImpl implements ViewParent, PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mAttachInfo.mScreenOn = powerManager.isScreenOn(); + loadSystemProperties(); } /** @@ -846,6 +847,16 @@ public final class ViewRootImpl implements ViewParent, scheduleTraversals(); } + void invalidateWorld(View view) { + view.invalidate(); + if (view instanceof ViewGroup) { + ViewGroup parent = (ViewGroup)view; + for (int i=0; i<parent.getChildCount(); i++) { + invalidateWorld(parent.getChildAt(i)); + } + } + } + public void invalidateChild(View child, Rect dirty) { invalidateChildInParent(null, dirty); } @@ -2730,6 +2741,7 @@ public final class ViewRootImpl implements ViewParent, private final static int MSG_INVALIDATE_DISPLAY_LIST = 21; private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 22; private final static int MSG_DISPATCH_DONE_ANIMATING = 23; + private final static int MSG_INVALIDATE_WORLD = 24; final class ViewRootHandler extends Handler { @Override @@ -2997,6 +3009,9 @@ public final class ViewRootImpl implements ViewParent, case MSG_DISPATCH_DONE_ANIMATING: { handleDispatchDoneAnimating(); } break; + case MSG_INVALIDATE_WORLD: { + invalidateWorld(mView); + } break; } } } @@ -4016,6 +4031,17 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } + public void loadSystemProperties() { + boolean layout = SystemProperties.getBoolean( + View.DEBUG_LAYOUT_PROPERTY, false); + if (layout != mAttachInfo.mDebugLayout) { + mAttachInfo.mDebugLayout = layout; + if (!mHandler.hasMessages(MSG_INVALIDATE_WORLD)) { + mHandler.sendEmptyMessageDelayed(MSG_INVALIDATE_WORLD, 200); + } + } + } + private void destroyHardwareRenderer() { AttachInfo attachInfo = mAttachInfo; HardwareRenderer hardwareRenderer = attachInfo.mHardwareRenderer; diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java index b5690e9..5d33cec 100644 --- a/core/java/android/view/WindowManagerImpl.java +++ b/core/java/android/view/WindowManagerImpl.java @@ -23,6 +23,7 @@ import android.content.res.Configuration; import android.graphics.PixelFormat; import android.opengl.ManagedEGLContext; import android.os.IBinder; +import android.os.SystemProperties; import android.util.AndroidRuntimeException; import android.util.Log; import android.view.inputmethod.InputMethodManager; @@ -112,6 +113,8 @@ public class WindowManagerImpl implements WindowManager { private WindowManager.LayoutParams[] mParams; private boolean mNeedsEglTerminate; + private Runnable mSystemPropertyUpdater = null; + private final static Object sLock = new Object(); private final static WindowManagerImpl sWindowManager = new WindowManagerImpl(); private final static HashMap<CompatibilityInfo, WindowManager> sCompatWindowManagers @@ -237,6 +240,22 @@ public class WindowManagerImpl implements WindowManager { View panelParentView = null; synchronized (this) { + // Start watching for system property changes. + if (mSystemPropertyUpdater == null) { + mSystemPropertyUpdater = new Runnable() { + @Override public void run() { + synchronized (this) { + synchronized (this) { + for (ViewRootImpl root : mRoots) { + root.loadSystemProperties(); + } + } + } + } + }; + SystemProperties.addChangeCallback(mSystemPropertyUpdater); + } + // Here's an odd/questionable case: if someone tries to add a // view multiple times, then we simply bump up a nesting count // and they need to remove the view the corresponding number of |
