summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-05-10 11:29:34 -0700
committerDianne Hackborn <hackbod@google.com>2010-05-18 10:46:33 -0700
commitdc8a7f69d7df5f1ca29763995a0d55acf7936fc6 (patch)
tree8a136169f8ff4548bfabadf95e3305589ff21677 /policy
parent400907086ac1a304daa50a72013ac27a9c63b26b (diff)
downloadframeworks_base-dc8a7f69d7df5f1ca29763995a0d55acf7936fc6.zip
frameworks_base-dc8a7f69d7df5f1ca29763995a0d55acf7936fc6.tar.gz
frameworks_base-dc8a7f69d7df5f1ca29763995a0d55acf7936fc6.tar.bz2
Add new API to take over a window's Surface.
Change-Id: Iad6245faadc95f19ea63c8e229a1c02e9188f69e
Diffstat (limited to 'policy')
-rw-r--r--policy/com/android/internal/policy/impl/PhoneWindow.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/policy/com/android/internal/policy/impl/PhoneWindow.java b/policy/com/android/internal/policy/impl/PhoneWindow.java
index 5592b6d..0cb0efc 100644
--- a/policy/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindow.java
@@ -22,6 +22,8 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+import com.android.internal.view.BaseSurfaceHolder;
+import com.android.internal.view.RootViewSurfaceTaker;
import com.android.internal.view.menu.ContextMenuBuilder;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.view.menu.MenuDialogHelper;
@@ -42,6 +44,7 @@ import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Message;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
@@ -59,6 +62,8 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
+import android.view.Surface;
+import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewManager;
@@ -100,6 +105,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
// mDecor itself, or a child of mDecor where the contents go.
private ViewGroup mContentParent;
+ SurfaceHolder.Callback mTakeSurfaceCallback;
+ BaseSurfaceHolder mSurfaceHolder;
+
private boolean mIsFloating;
private LayoutInflater mLayoutInflater;
@@ -239,6 +247,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
@Override
+ public void takeSurface(SurfaceHolder.Callback callback) {
+ mTakeSurfaceCallback = callback;
+ }
+
+ @Override
public boolean isFloating() {
return mIsFloating;
}
@@ -1554,7 +1567,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
- private final class DecorView extends FrameLayout {
+ private final class DecorView extends FrameLayout implements RootViewSurfaceTaker {
/* package */int mDefaultOpacity = PixelFormat.OPAQUE;
/** The feature ID of the panel, or -1 if this is the application's DecorView */
@@ -2019,6 +2032,23 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
closeAllPanels();
}
}
+
+ public android.view.SurfaceHolder.Callback willYouTakeTheSurface() {
+ return mFeatureId < 0 ? mTakeSurfaceCallback : null;
+ }
+
+ public void setSurfaceType(int type) {
+ PhoneWindow.this.setType(type);
+ }
+
+ public void setSurfaceFormat(int format) {
+ PhoneWindow.this.setFormat(format);
+ }
+
+ public void setSurfaceKeepScreenOn(boolean keepOn) {
+ if (keepOn) PhoneWindow.this.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ else PhoneWindow.this.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
}
protected DecorView generateDecor() {