summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-08-08 20:40:27 -0700
committerDianne Hackborn <hackbod@google.com>2009-08-08 22:13:46 -0700
commit4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3 (patch)
tree4bda953a3a1e32695c3c22006dc320b6a0cbcb1b /core/java/android/view
parent542040c51c49874c92d01381de1b1986cb53b4dd (diff)
downloadframeworks_base-4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3.zip
frameworks_base-4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3.tar.gz
frameworks_base-4c62fc0e1e5ea9c69a12a7d1cf8b3ec8b2d114a3.tar.bz2
Very primitive wallpapers in a surface.
This is all of the basic pieces: - The WallpaperService now creates a surface with the window manager for its contents. - There is a simple service that displays a bitmap. - The wallpaper manager takes care of starting and stopping the service. - The window manager knows about wallpaper windows and how to layer them with the windows that want to be shown on top of wallpaper. Lots and lots of issues remain, but at this point you can actually write a wallpaper service, select it in the UI, and see it behind an activity.
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/ViewRoot.java31
-rw-r--r--core/java/android/view/WindowManager.java19
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java11
3 files changed, 44 insertions, 17 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 0d44b4e..216fc5e 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -192,22 +192,11 @@ public final class ViewRoot extends Handler implements ViewParent,
private final int mDensity;
- public ViewRoot(Context context) {
- super();
-
- if (MEASURE_LATENCY && lt == null) {
- lt = new LatencyTimer(100, 1000);
- }
-
- ++sInstanceCount;
-
- // Initialize the statics when this class is first instantiated. This is
- // done here instead of in the static block because Zygote does not
- // allow the spawning of threads.
+ public static IWindowSession getWindowSession(Looper mainLooper) {
synchronized (mStaticInit) {
if (!mInitialized) {
try {
- InputMethodManager imm = InputMethodManager.getInstance(context);
+ InputMethodManager imm = InputMethodManager.getInstance(mainLooper);
sWindowSession = IWindowManager.Stub.asInterface(
ServiceManager.getService("window"))
.openSession(imm.getClient(), imm.getInputContext());
@@ -215,8 +204,24 @@ public final class ViewRoot extends Handler implements ViewParent,
} catch (RemoteException e) {
}
}
+ return sWindowSession;
+ }
+ }
+
+ public ViewRoot(Context context) {
+ super();
+
+ if (MEASURE_LATENCY && lt == null) {
+ lt = new LatencyTimer(100, 1000);
}
+ ++sInstanceCount;
+
+ // Initialize the statics when this class is first instantiated. This is
+ // done here instead of in the static block because Zygote does not
+ // allow the spawning of threads.
+ getWindowSession(context.getMainLooper());
+
mThread = Thread.currentThread();
mLocation = new WindowLeaked(null);
mLocation.fillInStackTrace();
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index c0be9e8..35d7cc9 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -314,6 +314,12 @@ public interface WindowManager extends ViewManager {
public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
/**
+ * Window type: wallpaper window, placed behind any window that wants
+ * to sit on top of the wallpaper.
+ */
+ public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
+
+ /**
* End of types of system windows.
*/
public static final int LAST_SYSTEM_WINDOW = 2999;
@@ -479,16 +485,23 @@ public interface WindowManager extends ViewManager {
* key guard or any other lock screens. Can be used with
* {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
* directly before showing the key guard window
- *
- * {@hide} */
+ */
public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
+ /** Window flag: ask that the system wallpaper be shown behind
+ * your window. The window surface must be translucent to be able
+ * to actually see the wallpaper behind it; this flag just ensures
+ * that the wallpaper surface will be there if this window actually
+ * has translucent regions.
+ */
+ public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
+
/** Window flag: special flag to limit the size of the window to be
* original size ([320x480] x density). Used to create window for applications
* running under compatibility mode.
*
* {@hide} */
- public static final int FLAG_COMPATIBLE_WINDOW = 0x00100000;
+ public static final int FLAG_COMPATIBLE_WINDOW = 0x20000000;
/** Window flag: a special option intended for system dialogs. When
* this flag is set, the window will demand focus unconditionally when
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index d797890..e30687f 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -446,13 +446,22 @@ public final class InputMethodManager {
* @hide
*/
static public InputMethodManager getInstance(Context context) {
+ return getInstance(context.getMainLooper());
+ }
+
+ /**
+ * Internally, the input method manager can't be context-dependent, so
+ * we have this here for the places that need it.
+ * @hide
+ */
+ static public InputMethodManager getInstance(Looper mainLooper) {
synchronized (mInstanceSync) {
if (mInstance != null) {
return mInstance;
}
IBinder b = ServiceManager.getService(Context.INPUT_METHOD_SERVICE);
IInputMethodManager service = IInputMethodManager.Stub.asInterface(b);
- mInstance = new InputMethodManager(service, context.getMainLooper());
+ mInstance = new InputMethodManager(service, mainLooper);
}
return mInstance;
}