summaryrefslogtreecommitdiffstats
path: root/core/java/android/service
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-10 10:54:46 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-10 12:08:50 -0700
commitbcbcaa7edd32ba67c6290d79f7e7821c4b5b39ac (patch)
tree7840b8a005d8261f864b8404e5cf5941cf6caf80 /core/java/android/service
parente1fd02400d69c059db2cc6299c893eba4096cc1d (diff)
downloadframeworks_base-bcbcaa7edd32ba67c6290d79f7e7821c4b5b39ac.zip
frameworks_base-bcbcaa7edd32ba67c6290d79f7e7821c4b5b39ac.tar.gz
frameworks_base-bcbcaa7edd32ba67c6290d79f7e7821c4b5b39ac.tar.bz2
Wallpapers, animations, pending intent.
Some more tweaks and fixes to wallpapers. Make sure wallpapers are told they are not visible when the screen is off. Add some new animations for transitions across tasks, and fiddle with many of the existing animations. Clean up the relationship between translucent activities and animations. Add new API to start a PendingIntent from an activity. Change-Id: Ie0bf45fe44081bb6982c75361257a55d9cd9d863
Diffstat (limited to 'core/java/android/service')
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java43
1 files changed, 38 insertions, 5 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 95b5730..e5659d5 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -22,7 +22,10 @@ import com.android.internal.view.BaseSurfaceHolder;
import android.app.Service;
import android.app.WallpaperManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.Message;
@@ -88,6 +91,8 @@ public abstract class WallpaperService extends Service {
boolean mInitializing = true;
boolean mVisible;
+ boolean mScreenOn = true;
+ boolean mReportedVisible;
boolean mDestroyed;
// Current window state.
@@ -117,6 +122,19 @@ public abstract class WallpaperService extends Service {
float mPendingYOffset;
MotionEvent mPendingMove;
+ final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) {
+ mScreenOn = true;
+ reportVisibility();
+ } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
+ mScreenOn = false;
+ reportVisibility();
+ }
+ }
+ };
+
final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() {
@Override
@@ -239,7 +257,7 @@ public abstract class WallpaperService extends Service {
* {@link #onVisibilityChanged(boolean)}.
*/
public boolean isVisible() {
- return mVisible;
+ return mReportedVisible;
}
/**
@@ -489,6 +507,11 @@ public abstract class WallpaperService extends Service {
mSession = ViewRoot.getWindowSession(getMainLooper());
mWindow.setSession(mSession);
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_SCREEN_ON);
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
+ registerReceiver(mReceiver, filter);
+
if (DEBUG) Log.v(TAG, "onCreate(): " + this);
onCreate(mSurfaceHolder);
@@ -505,11 +528,19 @@ public abstract class WallpaperService extends Service {
}
void doVisibilityChanged(boolean visible) {
+ mVisible = visible;
+ reportVisibility();
+ }
+
+ void reportVisibility() {
if (!mDestroyed) {
- mVisible = visible;
- if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
- + "): " + this);
- onVisibilityChanged(visible);
+ boolean visible = mVisible && mScreenOn;
+ if (mReportedVisible != visible) {
+ mReportedVisible = visible;
+ if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
+ + "): " + this);
+ onVisibilityChanged(visible);
+ }
}
}
@@ -562,6 +593,8 @@ public abstract class WallpaperService extends Service {
if (DEBUG) Log.v(TAG, "onDestroy(): " + this);
onDestroy();
+ unregisterReceiver(mReceiver);
+
if (mCreated) {
try {
mSession.remove(mWindow);