am 71d73a0d: Merge "Add a method to hide/show a SurfaceView\'s surface." into froyo

Merge commit '71d73a0dfc110d0bdfc1b7ba385db3e2cfe007e5' into kraken

* commit '71d73a0dfc110d0bdfc1b7ba385db3e2cfe007e5':
  Add a method to hide/show a SurfaceView's surface.
This commit is contained in:
Romain Guy
2010-06-08 13:00:30 -07:00
committed by Android Git Automerger

View File

@@ -16,6 +16,7 @@
package android.view;
import android.util.DisplayMetrics;
import com.android.internal.view.BaseIWindow;
import android.content.Context;
@@ -219,6 +220,46 @@ public class SurfaceView extends View {
mRequestedVisible = mWindowVisibility && mViewVisibility;
updateWindow(false);
}
/**
* This method is not intended for general use. It was created
* temporarily to improve performance of 3D layers in Launcher
* and should be removed and fixed properly.
*
* Do not call this method. Ever.
*
* @hide
*/
protected void showSurface() {
if (mSession != null) {
updateWindow(true);
}
}
/**
* This method is not intended for general use. It was created
* temporarily to improve performance of 3D layers in Launcher
* and should be removed and fixed properly.
*
* Do not call this method. Ever.
*
* @hide
*/
protected void hideSurface() {
if (mSession != null && mWindow != null) {
mSurfaceLock.lock();
try {
DisplayMetrics metrics = getResources().getDisplayMetrics();
mLayout.x = metrics.widthPixels * 3;
mSession.relayout(mWindow, mLayout, mWidth, mHeight, VISIBLE, false,
mWinFrame, mContentInsets, mVisibleInsets, mConfiguration, mSurface);
} catch (RemoteException e) {
// Ignore
} finally {
mSurfaceLock.unlock();
}
}
}
@Override
protected void onDetachedFromWindow() {