Loading core/java/android/view/ViewRootImpl.java +0 −2 Original line number Diff line number Diff line Loading @@ -251,8 +251,6 @@ public final class ViewRootImpl implements ViewParent, CompatibilityInfoHolder mCompatibilityInfo; /*package*/ int mAddNesting; // These are accessed by multiple threads. final Rect mWinFrame; // frame given by window manager. Loading core/java/android/view/WindowManagerImpl.java +17 −66 Original line number Diff line number Diff line Loading @@ -217,15 +217,10 @@ public class WindowManagerImpl implements WindowManager { } public void addView(View view, ViewGroup.LayoutParams params) { addView(view, params, null, false); addView(view, params, null); } public void addView(View view, ViewGroup.LayoutParams params, CompatibilityInfoHolder cih) { addView(view, params, cih, false); } private void addView(View view, ViewGroup.LayoutParams params, CompatibilityInfoHolder cih, boolean nest) { if (false) Log.v("WindowManager", "addView view=" + view); if (!(params instanceof WindowManager.LayoutParams)) { Loading Loading @@ -256,26 +251,11 @@ public class WindowManagerImpl implements WindowManager { 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 // times to have it actually removed from the window manager. // This is useful specifically for the notification manager, // which can continually add/remove the same view as a // notification gets updated. int index = findViewLocked(view, false); if (index >= 0) { if (!nest) { throw new IllegalStateException("View " + view + " has already been added to the window manager."); } root = mRoots[index]; root.mAddNesting++; // Update layout parameters. view.setLayoutParams(wparams); root.setLayoutParams(wparams, true); return; } // If this is a panel window, then find the window it is being // attached to for future reference. Loading @@ -290,7 +270,6 @@ public class WindowManagerImpl implements WindowManager { } root = new ViewRootImpl(view.getContext()); root.mAddNesting = 1; if (cih == null) { root.mCompatibilityInfo = new CompatibilityInfoHolder(); } else { Loading Loading @@ -345,35 +324,17 @@ public class WindowManagerImpl implements WindowManager { } public void removeView(View view) { synchronized (this) { int index = findViewLocked(view, true); View curView = removeViewLocked(index); if (curView == view) { return; removeView(view, false); } throw new IllegalStateException("Calling with view " + view + " but the ViewAncestor is attached to " + curView); } public void removeViewImmediate(View view) { removeView(view, true); } public void removeViewImmediate(View view) { private void removeView(View view, boolean immediate) { synchronized (this) { int index = findViewLocked(view, true); ViewRootImpl root = mRoots[index]; View curView = root.getView(); root.mAddNesting = 0; if (view != null) { InputMethodManager imm = InputMethodManager.getInstance(view.getContext()); if (imm != null) { imm.windowDismissed(mViews[index].getWindowToken()); } } root.die(true); finishRemoveViewLocked(curView, index); View curView = removeViewLocked(index, immediate); if (curView == view) { return; } Loading @@ -383,28 +344,18 @@ public class WindowManagerImpl implements WindowManager { } } View removeViewLocked(int index) { View removeViewLocked(int index, boolean immediate) { ViewRootImpl root = mRoots[index]; View view = root.getView(); // Don't really remove until we have matched all calls to add(). root.mAddNesting--; if (root.mAddNesting > 0) { return view; } if (view != null) { InputMethodManager imm = InputMethodManager.getInstance(view.getContext()); if (imm != null) { imm.windowDismissed(mViews[index].getWindowToken()); } } root.die(false); finishRemoveViewLocked(view, index); return view; } root.die(immediate); void finishRemoveViewLocked(View view, int index) { final int count = mViews.length; // remove it from the list Loading @@ -426,6 +377,7 @@ public class WindowManagerImpl implements WindowManager { // func doesn't allow null... does it matter if we clear them? //view.setLayoutParams(null); } return view; } public void closeAll(IBinder token, String who, String what) { Loading @@ -440,7 +392,6 @@ public class WindowManagerImpl implements WindowManager { // + " view " + mRoots[i].getView()); if (token == null || mParams[i].token == token) { ViewRootImpl root = mRoots[i]; root.mAddNesting = 1; //Log.i("foo", "Force closing " + root); if (who != null) { Loading @@ -451,7 +402,7 @@ public class WindowManagerImpl implements WindowManager { Log.e("WindowManager", leak.getMessage(), leak); } removeViewLocked(i); removeViewLocked(i, false); i--; count--; } Loading Loading
core/java/android/view/ViewRootImpl.java +0 −2 Original line number Diff line number Diff line Loading @@ -251,8 +251,6 @@ public final class ViewRootImpl implements ViewParent, CompatibilityInfoHolder mCompatibilityInfo; /*package*/ int mAddNesting; // These are accessed by multiple threads. final Rect mWinFrame; // frame given by window manager. Loading
core/java/android/view/WindowManagerImpl.java +17 −66 Original line number Diff line number Diff line Loading @@ -217,15 +217,10 @@ public class WindowManagerImpl implements WindowManager { } public void addView(View view, ViewGroup.LayoutParams params) { addView(view, params, null, false); addView(view, params, null); } public void addView(View view, ViewGroup.LayoutParams params, CompatibilityInfoHolder cih) { addView(view, params, cih, false); } private void addView(View view, ViewGroup.LayoutParams params, CompatibilityInfoHolder cih, boolean nest) { if (false) Log.v("WindowManager", "addView view=" + view); if (!(params instanceof WindowManager.LayoutParams)) { Loading Loading @@ -256,26 +251,11 @@ public class WindowManagerImpl implements WindowManager { 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 // times to have it actually removed from the window manager. // This is useful specifically for the notification manager, // which can continually add/remove the same view as a // notification gets updated. int index = findViewLocked(view, false); if (index >= 0) { if (!nest) { throw new IllegalStateException("View " + view + " has already been added to the window manager."); } root = mRoots[index]; root.mAddNesting++; // Update layout parameters. view.setLayoutParams(wparams); root.setLayoutParams(wparams, true); return; } // If this is a panel window, then find the window it is being // attached to for future reference. Loading @@ -290,7 +270,6 @@ public class WindowManagerImpl implements WindowManager { } root = new ViewRootImpl(view.getContext()); root.mAddNesting = 1; if (cih == null) { root.mCompatibilityInfo = new CompatibilityInfoHolder(); } else { Loading Loading @@ -345,35 +324,17 @@ public class WindowManagerImpl implements WindowManager { } public void removeView(View view) { synchronized (this) { int index = findViewLocked(view, true); View curView = removeViewLocked(index); if (curView == view) { return; removeView(view, false); } throw new IllegalStateException("Calling with view " + view + " but the ViewAncestor is attached to " + curView); } public void removeViewImmediate(View view) { removeView(view, true); } public void removeViewImmediate(View view) { private void removeView(View view, boolean immediate) { synchronized (this) { int index = findViewLocked(view, true); ViewRootImpl root = mRoots[index]; View curView = root.getView(); root.mAddNesting = 0; if (view != null) { InputMethodManager imm = InputMethodManager.getInstance(view.getContext()); if (imm != null) { imm.windowDismissed(mViews[index].getWindowToken()); } } root.die(true); finishRemoveViewLocked(curView, index); View curView = removeViewLocked(index, immediate); if (curView == view) { return; } Loading @@ -383,28 +344,18 @@ public class WindowManagerImpl implements WindowManager { } } View removeViewLocked(int index) { View removeViewLocked(int index, boolean immediate) { ViewRootImpl root = mRoots[index]; View view = root.getView(); // Don't really remove until we have matched all calls to add(). root.mAddNesting--; if (root.mAddNesting > 0) { return view; } if (view != null) { InputMethodManager imm = InputMethodManager.getInstance(view.getContext()); if (imm != null) { imm.windowDismissed(mViews[index].getWindowToken()); } } root.die(false); finishRemoveViewLocked(view, index); return view; } root.die(immediate); void finishRemoveViewLocked(View view, int index) { final int count = mViews.length; // remove it from the list Loading @@ -426,6 +377,7 @@ public class WindowManagerImpl implements WindowManager { // func doesn't allow null... does it matter if we clear them? //view.setLayoutParams(null); } return view; } public void closeAll(IBinder token, String who, String what) { Loading @@ -440,7 +392,6 @@ public class WindowManagerImpl implements WindowManager { // + " view " + mRoots[i].getView()); if (token == null || mParams[i].token == token) { ViewRootImpl root = mRoots[i]; root.mAddNesting = 1; //Log.i("foo", "Force closing " + root); if (who != null) { Loading @@ -451,7 +402,7 @@ public class WindowManagerImpl implements WindowManager { Log.e("WindowManager", leak.getMessage(), leak); } removeViewLocked(i); removeViewLocked(i, false); i--; count--; } Loading