blob: f4bdd1f2ffbf7abb3c07444fa5803ca7513c80ba [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server;
18
19import static android.os.FileObserver.*;
20import static android.os.ParcelFileDescriptor.*;
Christopher Tate111bd4a2009-06-24 17:29:38 -070021
Dianne Hackborn8cc6a502009-08-05 21:29:42 -070022import android.app.IWallpaperManager;
23import android.app.IWallpaperManagerCallback;
Dianne Hackborndd9b82c2009-09-03 00:18:47 -070024import android.app.PendingIntent;
Dianne Hackborneb034652009-09-07 00:49:58 -070025import android.app.WallpaperInfo;
Christopher Tate45281862010-03-05 15:46:30 -080026import android.app.backup.BackupManager;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070027import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.Context;
29import android.content.Intent;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070030import android.content.ServiceConnection;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.PackageManager;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070032import android.content.pm.ResolveInfo;
33import android.content.pm.ServiceInfo;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070034import android.content.pm.PackageManager.NameNotFoundException;
35import android.content.res.Resources;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036import android.os.Binder;
Dianne Hackborn284ac932009-08-28 10:34:25 -070037import android.os.Bundle;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070038import android.os.IBinder;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.RemoteException;
40import android.os.FileObserver;
41import android.os.ParcelFileDescriptor;
42import android.os.RemoteCallbackList;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070043import android.os.ServiceManager;
Dianne Hackborn0cd48872009-08-13 18:51:59 -070044import android.os.SystemClock;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070045import android.service.wallpaper.IWallpaperConnection;
46import android.service.wallpaper.IWallpaperEngine;
47import android.service.wallpaper.IWallpaperService;
48import android.service.wallpaper.WallpaperService;
Joe Onorato8a9b2202010-02-26 18:56:32 -080049import android.util.Slog;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070050import android.util.Xml;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070051import android.view.IWindowManager;
52import android.view.WindowManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053
Dianne Hackborneb034652009-09-07 00:49:58 -070054import java.io.FileDescriptor;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070055import java.io.IOException;
56import java.io.InputStream;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057import java.io.File;
58import java.io.FileNotFoundException;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070059import java.io.FileInputStream;
60import java.io.FileOutputStream;
Dianne Hackborneb034652009-09-07 00:49:58 -070061import java.io.PrintWriter;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070062import java.util.List;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070063
64import org.xmlpull.v1.XmlPullParser;
65import org.xmlpull.v1.XmlPullParserException;
66import org.xmlpull.v1.XmlSerializer;
67
Dianne Hackborn21f1bd12010-02-19 17:02:21 -080068import com.android.internal.content.PackageMonitor;
Dianne Hackbornf21adf62009-08-13 10:20:21 -070069import com.android.internal.service.wallpaper.ImageWallpaper;
Dianne Hackborn2269d1572010-02-24 19:54:22 -080070import com.android.internal.util.FastXmlSerializer;
Dianne Hackborn21f1bd12010-02-19 17:02:21 -080071import com.android.server.DevicePolicyManagerService.ActiveAdmin;
72import com.android.server.DevicePolicyManagerService.MyPackageMonitor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073
Dianne Hackborn8cc6a502009-08-05 21:29:42 -070074class WallpaperManagerService extends IWallpaperManager.Stub {
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070075 static final String TAG = "WallpaperService";
Dianne Hackborncbf15042009-08-18 18:29:09 -070076 static final boolean DEBUG = false;
Joe Onorato9bb8fd72009-07-28 18:24:51 -070077
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070078 Object mLock = new Object();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080079
Dianne Hackborn0cd48872009-08-13 18:51:59 -070080 /**
81 * Minimum time between crashes of a wallpaper service for us to consider
82 * restarting it vs. just reverting to the static wallpaper.
83 */
84 static final long MIN_WALLPAPER_CRASH_TIME = 10000;
85
86 static final File WALLPAPER_DIR = new File(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 "/data/data/com.android.settings/files");
Dianne Hackborn0cd48872009-08-13 18:51:59 -070088 static final String WALLPAPER = "wallpaper";
89 static final File WALLPAPER_FILE = new File(WALLPAPER_DIR, WALLPAPER);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 /**
92 * List of callbacks registered they should each be notified
93 * when the wallpaper is changed.
94 */
Dianne Hackborn8cc6a502009-08-05 21:29:42 -070095 private final RemoteCallbackList<IWallpaperManagerCallback> mCallbacks
96 = new RemoteCallbackList<IWallpaperManagerCallback>();
Joe Onorato9bb8fd72009-07-28 18:24:51 -070097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 /**
99 * Observes the wallpaper for changes and notifies all IWallpaperServiceCallbacks
100 * that the wallpaper has changed. The CREATE is triggered when there is no
101 * wallpaper set and is created for the first time. The CLOSE_WRITE is triggered
102 * everytime the wallpaper is changed.
103 */
104 private final FileObserver mWallpaperObserver = new FileObserver(
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700105 WALLPAPER_DIR.getAbsolutePath(), CREATE | CLOSE_WRITE | DELETE | DELETE_SELF) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 @Override
107 public void onEvent(int event, String path) {
Joe Onoratoe712ee32009-07-29 16:23:58 -0700108 if (path == null) {
109 return;
110 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700111 synchronized (mLock) {
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700112 // changing the wallpaper means we'll need to back up the new one
113 long origId = Binder.clearCallingIdentity();
114 BackupManager bm = new BackupManager(mContext);
115 bm.dataChanged();
116 Binder.restoreCallingIdentity(origId);
117
118 File changedFile = new File(WALLPAPER_DIR, path);
119 if (WALLPAPER_FILE.equals(changedFile)) {
120 notifyCallbacksLocked();
121 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 }
123 }
124 };
125
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700126 final Context mContext;
127 final IWindowManager mIWindowManager;
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800128 final MyPackageMonitor mMonitor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700130 int mWidth = -1;
131 int mHeight = -1;
Mike Clerona428b2c2009-11-15 22:53:08 -0800132
133 /**
134 * Resource name if using a picture from the wallpaper gallery
135 */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700136 String mName = "";
Mike Clerond6c0b842009-11-13 16:37:27 -0800137
138 /**
Mike Clerona428b2c2009-11-15 22:53:08 -0800139 * The component name of the currently set live wallpaper.
Mike Clerond6c0b842009-11-13 16:37:27 -0800140 */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700141 ComponentName mWallpaperComponent;
Mike Clerona428b2c2009-11-15 22:53:08 -0800142
143 /**
144 * The component name of the wallpaper that should be set next.
145 */
146 ComponentName mNextWallpaperComponent;
147
148 /**
149 * Name of the component used to display bitmap wallpapers from either the gallery or
150 * built-in wallpapers.
151 */
152 ComponentName mImageWallpaperComponent = new ComponentName("android",
153 ImageWallpaper.class.getName());
154
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700155 WallpaperConnection mWallpaperConnection;
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700156 long mLastDiedTime;
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800157 boolean mWallpaperUpdating;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700158
159 class WallpaperConnection extends IWallpaperConnection.Stub
160 implements ServiceConnection {
Dianne Hackborneb034652009-09-07 00:49:58 -0700161 final WallpaperInfo mInfo;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700162 final Binder mToken = new Binder();
163 IWallpaperService mService;
164 IWallpaperEngine mEngine;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165
Dianne Hackborneb034652009-09-07 00:49:58 -0700166 public WallpaperConnection(WallpaperInfo info) {
167 mInfo = info;
168 }
169
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700170 public void onServiceConnected(ComponentName name, IBinder service) {
171 synchronized (mLock) {
172 if (mWallpaperConnection == this) {
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800173 mLastDiedTime = SystemClock.uptimeMillis();
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700174 mService = IWallpaperService.Stub.asInterface(service);
175 attachServiceLocked(this);
Dianne Hackborneb034652009-09-07 00:49:58 -0700176 // XXX should probably do saveSettingsLocked() later
177 // when we have an engine, but I'm not sure about
178 // locking there and anyway we always need to be able to
179 // recover if there is something wrong.
180 saveSettingsLocked();
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700181 }
182 }
183 }
184
185 public void onServiceDisconnected(ComponentName name) {
186 synchronized (mLock) {
187 mService = null;
188 mEngine = null;
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700189 if (mWallpaperConnection == this) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800190 Slog.w(TAG, "Wallpaper service gone: " + mWallpaperComponent);
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800191 if (!mWallpaperUpdating && (mLastDiedTime+MIN_WALLPAPER_CRASH_TIME)
192 > SystemClock.uptimeMillis()) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800193 Slog.w(TAG, "Reverting to built-in wallpaper!");
Mike Clerona428b2c2009-11-15 22:53:08 -0800194 bindWallpaperComponentLocked(null);
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700195 }
196 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700197 }
198 }
199
200 public void attachEngine(IWallpaperEngine engine) {
201 mEngine = engine;
202 }
203
204 public ParcelFileDescriptor setWallpaper(String name) {
205 synchronized (mLock) {
206 if (mWallpaperConnection == this) {
Dianne Hackborneb034652009-09-07 00:49:58 -0700207 return updateWallpaperBitmapLocked(name);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700208 }
209 return null;
210 }
211 }
212 }
213
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800214 class MyPackageMonitor extends PackageMonitor {
215 @Override
216 public void onPackageUpdateFinished(String packageName, int uid) {
217 synchronized (mLock) {
218 if (mWallpaperComponent != null &&
219 mWallpaperComponent.getPackageName().equals(packageName)) {
220 mWallpaperUpdating = false;
221 ComponentName comp = mWallpaperComponent;
222 clearWallpaperComponentLocked();
223 bindWallpaperComponentLocked(comp);
224 }
225 }
226 }
227
228 @Override
229 public void onPackageUpdateStarted(String packageName, int uid) {
230 synchronized (mLock) {
231 if (mWallpaperComponent != null &&
232 mWallpaperComponent.getPackageName().equals(packageName)) {
233 mWallpaperUpdating = true;
234 }
235 }
236 }
237
238 @Override
239 public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) {
240 return doPackagesChanged(doit);
241 }
242
243 @Override
244 public void onSomePackagesChanged() {
245 doPackagesChanged(true);
246 }
247
248 boolean doPackagesChanged(boolean doit) {
249 boolean changed = false;
250 synchronized (mLock) {
251 if (mWallpaperComponent != null) {
252 int change = isPackageDisappearing(mWallpaperComponent.getPackageName());
253 if (change == PACKAGE_PERMANENT_CHANGE
254 || change == PACKAGE_TEMPORARY_CHANGE) {
255 changed = true;
256 if (doit) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800257 Slog.w(TAG, "Wallpaper uninstalled, removing: " + mWallpaperComponent);
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800258 clearWallpaperLocked();
259 }
260 }
261 }
262 if (mNextWallpaperComponent != null) {
263 int change = isPackageDisappearing(mNextWallpaperComponent.getPackageName());
264 if (change == PACKAGE_PERMANENT_CHANGE
265 || change == PACKAGE_TEMPORARY_CHANGE) {
266 mNextWallpaperComponent = null;
267 }
268 }
269 if (mWallpaperComponent != null
270 && isPackageModified(mWallpaperComponent.getPackageName())) {
271 try {
272 mContext.getPackageManager().getServiceInfo(
273 mWallpaperComponent, 0);
274 } catch (NameNotFoundException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800275 Slog.w(TAG, "Wallpaper component gone, removing: " + mWallpaperComponent);
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800276 clearWallpaperLocked();
277 }
278 }
279 if (mNextWallpaperComponent != null
280 && isPackageModified(mNextWallpaperComponent.getPackageName())) {
281 try {
282 mContext.getPackageManager().getServiceInfo(
283 mNextWallpaperComponent, 0);
284 } catch (NameNotFoundException e) {
285 mNextWallpaperComponent = null;
286 }
287 }
288 }
289 return changed;
290 }
291 }
292
Dianne Hackborn8cc6a502009-08-05 21:29:42 -0700293 public WallpaperManagerService(Context context) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800294 if (DEBUG) Slog.v(TAG, "WallpaperService startup");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295 mContext = context;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700296 mIWindowManager = IWindowManager.Stub.asInterface(
297 ServiceManager.getService(Context.WINDOW_SERVICE));
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800298 mMonitor = new MyPackageMonitor();
299 mMonitor.register(context, true);
Joe Onoratoe712ee32009-07-29 16:23:58 -0700300 WALLPAPER_DIR.mkdirs();
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700301 loadSettingsLocked();
Joe Onoratoe712ee32009-07-29 16:23:58 -0700302 mWallpaperObserver.startWatching();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 }
304
305 @Override
306 protected void finalize() throws Throwable {
307 super.finalize();
308 mWallpaperObserver.stopWatching();
309 }
310
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700311 public void systemReady() {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800312 if (DEBUG) Slog.v(TAG, "systemReady");
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700313 synchronized (mLock) {
314 try {
Mike Clerona428b2c2009-11-15 22:53:08 -0800315 bindWallpaperComponentLocked(mNextWallpaperComponent);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700316 } catch (RuntimeException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800317 Slog.w(TAG, "Failure starting previous wallpaper", e);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700318 try {
Mike Clerona428b2c2009-11-15 22:53:08 -0800319 bindWallpaperComponentLocked(null);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700320 } catch (RuntimeException e2) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800321 Slog.w(TAG, "Failure starting default wallpaper", e2);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700322 clearWallpaperComponentLocked();
323 }
324 }
325 }
326 }
327
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 public void clearWallpaper() {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800329 if (DEBUG) Slog.v(TAG, "clearWallpaper");
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700330 synchronized (mLock) {
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800331 clearWallpaperLocked();
332 }
333 }
334
335 public void clearWallpaperLocked() {
336 File f = WALLPAPER_FILE;
337 if (f.exists()) {
338 f.delete();
339 }
340 final long ident = Binder.clearCallingIdentity();
341 try {
342 bindWallpaperComponentLocked(null);
Dianne Hackbornc9421ba2010-03-11 22:23:46 -0800343 } catch (IllegalArgumentException e) {
344 // This can happen if the default wallpaper component doesn't
345 // exist. This should be a system configuration problem, but
346 // let's not let it crash the system and just live with no
347 // wallpaper.
348 Slog.e(TAG, "Default wallpaper component not found!", e);
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800349 } finally {
350 Binder.restoreCallingIdentity(ident);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 }
352 }
353
354 public void setDimensionHints(int width, int height) throws RemoteException {
355 checkPermission(android.Manifest.permission.SET_WALLPAPER_HINTS);
356
357 if (width <= 0 || height <= 0) {
358 throw new IllegalArgumentException("width and height must be > 0");
359 }
360
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700361 synchronized (mLock) {
362 if (width != mWidth || height != mHeight) {
363 mWidth = width;
364 mHeight = height;
365 saveSettingsLocked();
Dianne Hackborn284ac932009-08-28 10:34:25 -0700366 if (mWallpaperConnection != null) {
367 if (mWallpaperConnection.mEngine != null) {
368 try {
369 mWallpaperConnection.mEngine.setDesiredSize(
370 width, height);
371 } catch (RemoteException e) {
372 }
373 notifyCallbacksLocked();
374 }
375 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700376 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377 }
378 }
379
380 public int getWidthHint() throws RemoteException {
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700381 synchronized (mLock) {
382 return mWidth;
383 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 }
385
386 public int getHeightHint() throws RemoteException {
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700387 synchronized (mLock) {
388 return mHeight;
389 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 }
391
Dianne Hackborn284ac932009-08-28 10:34:25 -0700392 public ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb,
393 Bundle outParams) {
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700394 synchronized (mLock) {
395 try {
Dianne Hackborn284ac932009-08-28 10:34:25 -0700396 if (outParams != null) {
397 outParams.putInt("width", mWidth);
398 outParams.putInt("height", mHeight);
399 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700400 mCallbacks.register(cb);
401 File f = WALLPAPER_FILE;
402 if (!f.exists()) {
403 return null;
404 }
405 return ParcelFileDescriptor.open(f, MODE_READ_ONLY);
406 } catch (FileNotFoundException e) {
407 /* Shouldn't happen as we check to see if the file exists */
Joe Onorato8a9b2202010-02-26 18:56:32 -0800408 Slog.w(TAG, "Error getting wallpaper", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700410 return null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800412 }
413
Dianne Hackborneb034652009-09-07 00:49:58 -0700414 public WallpaperInfo getWallpaperInfo() {
415 synchronized (mLock) {
416 if (mWallpaperConnection != null) {
417 return mWallpaperConnection.mInfo;
418 }
419 return null;
420 }
421 }
422
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700423 public ParcelFileDescriptor setWallpaper(String name) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800424 if (DEBUG) Slog.v(TAG, "setWallpaper");
Mike Clerona428b2c2009-11-15 22:53:08 -0800425
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800426 checkPermission(android.Manifest.permission.SET_WALLPAPER);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700427 synchronized (mLock) {
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700428 final long ident = Binder.clearCallingIdentity();
429 try {
430 ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name);
431 if (pfd != null) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800432 // Bind the wallpaper to an ImageWallpaper
Mike Clerona428b2c2009-11-15 22:53:08 -0800433 bindWallpaperComponentLocked(mImageWallpaperComponent);
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700434 saveSettingsLocked();
435 }
436 return pfd;
437 } finally {
438 Binder.restoreCallingIdentity(ident);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700439 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 }
441 }
442
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700443 ParcelFileDescriptor updateWallpaperBitmapLocked(String name) {
444 if (name == null) name = "";
445 try {
446 ParcelFileDescriptor fd = ParcelFileDescriptor.open(WALLPAPER_FILE,
447 MODE_CREATE|MODE_READ_WRITE);
448 mName = name;
449 return fd;
450 } catch (FileNotFoundException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800451 Slog.w(TAG, "Error setting wallpaper", e);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700452 }
453 return null;
454 }
455
456 public void setWallpaperComponent(ComponentName name) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800457 if (DEBUG) Slog.v(TAG, "setWallpaperComponent name=" + name);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700458 checkPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT);
459 synchronized (mLock) {
460 final long ident = Binder.clearCallingIdentity();
461 try {
Mike Clerona428b2c2009-11-15 22:53:08 -0800462 bindWallpaperComponentLocked(name);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700463 } finally {
464 Binder.restoreCallingIdentity(ident);
465 }
466 }
467 }
468
Mike Clerona428b2c2009-11-15 22:53:08 -0800469 void bindWallpaperComponentLocked(ComponentName componentName) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800470 if (DEBUG) Slog.v(TAG, "bindWallpaperComponentLocked: componentName=" + componentName);
Mike Clerona428b2c2009-11-15 22:53:08 -0800471
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700472 // Has the component changed?
473 if (mWallpaperConnection != null) {
474 if (mWallpaperComponent == null) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800475 if (componentName == null) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800476 if (DEBUG) Slog.v(TAG, "bindWallpaperComponentLocked: still using default");
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700477 // Still using default wallpaper.
478 return;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700479 }
Mike Cleron322b6ee2009-11-12 07:45:47 -0800480 } else if (mWallpaperComponent.equals(componentName)) {
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700481 // Changing to same wallpaper.
Joe Onorato8a9b2202010-02-26 18:56:32 -0800482 if (DEBUG) Slog.v(TAG, "same wallpaper");
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700483 return;
484 }
485 }
486
487 try {
Mike Clerona428b2c2009-11-15 22:53:08 -0800488 if (componentName == null) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800489 String defaultComponent =
490 mContext.getString(com.android.internal.R.string.default_wallpaper_component);
Mike Clerona428b2c2009-11-15 22:53:08 -0800491 if (defaultComponent != null) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800492 // See if there is a default wallpaper component specified
Mike Clerona428b2c2009-11-15 22:53:08 -0800493 componentName = ComponentName.unflattenFromString(defaultComponent);
Joe Onorato8a9b2202010-02-26 18:56:32 -0800494 if (DEBUG) Slog.v(TAG, "Use default component wallpaper:" + componentName);
Mike Cleron322b6ee2009-11-12 07:45:47 -0800495 }
Mike Clerona428b2c2009-11-15 22:53:08 -0800496 if (componentName == null) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800497 // Fall back to static image wallpaper
Mike Clerona428b2c2009-11-15 22:53:08 -0800498 componentName = mImageWallpaperComponent;
Mike Cleron322b6ee2009-11-12 07:45:47 -0800499 //clearWallpaperComponentLocked();
500 //return;
Joe Onorato8a9b2202010-02-26 18:56:32 -0800501 if (DEBUG) Slog.v(TAG, "Using image wallpaper");
Mike Cleron322b6ee2009-11-12 07:45:47 -0800502 }
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700503 }
Mike Clerona428b2c2009-11-15 22:53:08 -0800504 ServiceInfo si = mContext.getPackageManager().getServiceInfo(componentName,
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700505 PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS);
506 if (!android.Manifest.permission.BIND_WALLPAPER.equals(si.permission)) {
507 throw new SecurityException("Selected service does not require "
508 + android.Manifest.permission.BIND_WALLPAPER
Mike Clerona428b2c2009-11-15 22:53:08 -0800509 + ": " + componentName);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700510 }
511
Dianne Hackborneb034652009-09-07 00:49:58 -0700512 WallpaperInfo wi = null;
513
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700514 Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE);
Mike Clerona428b2c2009-11-15 22:53:08 -0800515 if (componentName != null && !componentName.equals(mImageWallpaperComponent)) {
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700516 // Make sure the selected service is actually a wallpaper service.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700517 List<ResolveInfo> ris = mContext.getPackageManager()
Dianne Hackborneb034652009-09-07 00:49:58 -0700518 .queryIntentServices(intent, PackageManager.GET_META_DATA);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700519 for (int i=0; i<ris.size(); i++) {
520 ServiceInfo rsi = ris.get(i).serviceInfo;
521 if (rsi.name.equals(si.name) &&
522 rsi.packageName.equals(si.packageName)) {
Dianne Hackborneb034652009-09-07 00:49:58 -0700523 try {
524 wi = new WallpaperInfo(mContext, ris.get(i));
525 } catch (XmlPullParserException e) {
526 throw new IllegalArgumentException(e);
527 } catch (IOException e) {
528 throw new IllegalArgumentException(e);
529 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700530 break;
531 }
532 }
Dianne Hackborneb034652009-09-07 00:49:58 -0700533 if (wi == null) {
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700534 throw new SecurityException("Selected service is not a wallpaper: "
Mike Clerona428b2c2009-11-15 22:53:08 -0800535 + componentName);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700536 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700537 }
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700538
539 // Bind the service!
Joe Onorato8a9b2202010-02-26 18:56:32 -0800540 if (DEBUG) Slog.v(TAG, "Binding to:" + componentName);
Dianne Hackborneb034652009-09-07 00:49:58 -0700541 WallpaperConnection newConn = new WallpaperConnection(wi);
Mike Clerona428b2c2009-11-15 22:53:08 -0800542 intent.setComponent(componentName);
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700543 intent.putExtra(Intent.EXTRA_CLIENT_LABEL,
544 com.android.internal.R.string.wallpaper_binding_label);
545 intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
Dianne Hackborneb034652009-09-07 00:49:58 -0700546 mContext, 0,
547 Intent.createChooser(new Intent(Intent.ACTION_SET_WALLPAPER),
548 mContext.getText(com.android.internal.R.string.chooser_wallpaper)),
549 0));
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700550 if (!mContext.bindService(intent, newConn,
551 Context.BIND_AUTO_CREATE)) {
552 throw new IllegalArgumentException("Unable to bind service: "
Mike Cleron322b6ee2009-11-12 07:45:47 -0800553 + componentName);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700554 }
555
556 clearWallpaperComponentLocked();
Mike Cleron322b6ee2009-11-12 07:45:47 -0800557 mWallpaperComponent = componentName;
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700558 mWallpaperConnection = newConn;
Dianne Hackborn0cd48872009-08-13 18:51:59 -0700559 mLastDiedTime = SystemClock.uptimeMillis();
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700560 try {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800561 if (DEBUG) Slog.v(TAG, "Adding window token: " + newConn.mToken);
Dianne Hackbornf21adf62009-08-13 10:20:21 -0700562 mIWindowManager.addWindowToken(newConn.mToken,
563 WindowManager.LayoutParams.TYPE_WALLPAPER);
564 } catch (RemoteException e) {
565 }
566
567 } catch (PackageManager.NameNotFoundException e) {
Mike Cleron322b6ee2009-11-12 07:45:47 -0800568 throw new IllegalArgumentException("Unknown component " + componentName);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700569 }
570 }
571
572 void clearWallpaperComponentLocked() {
573 mWallpaperComponent = null;
574 if (mWallpaperConnection != null) {
575 if (mWallpaperConnection.mEngine != null) {
576 try {
577 mWallpaperConnection.mEngine.destroy();
578 } catch (RemoteException e) {
579 }
580 }
581 mContext.unbindService(mWallpaperConnection);
Dianne Hackborne9e9bca2009-08-18 15:08:22 -0700582 try {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800583 if (DEBUG) Slog.v(TAG, "Removing window token: "
Dianne Hackborne9e9bca2009-08-18 15:08:22 -0700584 + mWallpaperConnection.mToken);
585 mIWindowManager.removeWindowToken(mWallpaperConnection.mToken);
586 } catch (RemoteException e) {
587 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700588 mWallpaperConnection = null;
589 }
590 }
591
592 void attachServiceLocked(WallpaperConnection conn) {
593 try {
Dianne Hackborn3be63c02009-08-20 19:31:38 -0700594 conn.mService.attach(conn, conn.mToken,
595 WindowManager.LayoutParams.TYPE_WALLPAPER, false,
596 mWidth, mHeight);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700597 } catch (RemoteException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800598 Slog.w(TAG, "Failed attaching wallpaper; clearing", e);
Dianne Hackborn21f1bd12010-02-19 17:02:21 -0800599 if (!mWallpaperUpdating) {
600 bindWallpaperComponentLocked(null);
601 }
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700602 }
603 }
604
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700605 private void notifyCallbacksLocked() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800606 final int n = mCallbacks.beginBroadcast();
607 for (int i = 0; i < n; i++) {
608 try {
609 mCallbacks.getBroadcastItem(i).onWallpaperChanged();
610 } catch (RemoteException e) {
611
612 // The RemoteCallbackList will take care of removing
613 // the dead object for us.
614 }
615 }
616 mCallbacks.finishBroadcast();
617 final Intent intent = new Intent(Intent.ACTION_WALLPAPER_CHANGED);
618 mContext.sendBroadcast(intent);
619 }
620
621 private void checkPermission(String permission) {
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700622 if (PackageManager.PERMISSION_GRANTED!= mContext.checkCallingOrSelfPermission(permission)) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 throw new SecurityException("Access denied to process: " + Binder.getCallingPid()
624 + ", must have permission " + permission);
625 }
626 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700627
628 private static JournaledFile makeJournaledFile() {
629 final String base = "/data/system/wallpaper_info.xml";
630 return new JournaledFile(new File(base), new File(base + ".tmp"));
631 }
632
633 private void saveSettingsLocked() {
634 JournaledFile journal = makeJournaledFile();
635 FileOutputStream stream = null;
636 try {
637 stream = new FileOutputStream(journal.chooseForWrite(), false);
638 XmlSerializer out = new FastXmlSerializer();
639 out.setOutput(stream, "utf-8");
640 out.startDocument(null, true);
641
642 out.startTag(null, "wp");
643 out.attribute(null, "width", Integer.toString(mWidth));
644 out.attribute(null, "height", Integer.toString(mHeight));
645 out.attribute(null, "name", mName);
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700646 if (mWallpaperComponent != null) {
647 out.attribute(null, "component",
648 mWallpaperComponent.flattenToShortString());
649 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700650 out.endTag(null, "wp");
651
652 out.endDocument();
653 stream.close();
654 journal.commit();
655 } catch (IOException e) {
656 try {
657 if (stream != null) {
658 stream.close();
659 }
660 } catch (IOException ex) {
661 // Ignore
662 }
663 journal.rollback();
664 }
665 }
666
667 private void loadSettingsLocked() {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800668 if (DEBUG) Slog.v(TAG, "loadSettingsLocked");
Mike Clerona428b2c2009-11-15 22:53:08 -0800669
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700670 JournaledFile journal = makeJournaledFile();
671 FileInputStream stream = null;
672 File file = journal.chooseForRead();
673 boolean success = false;
674 try {
675 stream = new FileInputStream(file);
676 XmlPullParser parser = Xml.newPullParser();
677 parser.setInput(stream, null);
678
679 int type;
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700680 do {
681 type = parser.next();
682 if (type == XmlPullParser.START_TAG) {
683 String tag = parser.getName();
684 if ("wp".equals(tag)) {
685 mWidth = Integer.parseInt(parser.getAttributeValue(null, "width"));
686 mHeight = Integer.parseInt(parser.getAttributeValue(null, "height"));
687 mName = parser.getAttributeValue(null, "name");
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700688 String comp = parser.getAttributeValue(null, "component");
Mike Clerona428b2c2009-11-15 22:53:08 -0800689 mNextWallpaperComponent = comp != null
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700690 ? ComponentName.unflattenFromString(comp)
691 : null;
Mike Clerona428b2c2009-11-15 22:53:08 -0800692
693 if (DEBUG) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800694 Slog.v(TAG, "mWidth:" + mWidth);
695 Slog.v(TAG, "mHeight:" + mHeight);
696 Slog.v(TAG, "mName:" + mName);
697 Slog.v(TAG, "mNextWallpaperComponent:" + mNextWallpaperComponent);
Mike Clerona428b2c2009-11-15 22:53:08 -0800698 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700699 }
700 }
701 } while (type != XmlPullParser.END_DOCUMENT);
702 success = true;
703 } catch (NullPointerException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800704 Slog.w(TAG, "failed parsing " + file + " " + e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700705 } catch (NumberFormatException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800706 Slog.w(TAG, "failed parsing " + file + " " + e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700707 } catch (XmlPullParserException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800708 Slog.w(TAG, "failed parsing " + file + " " + e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700709 } catch (IOException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800710 Slog.w(TAG, "failed parsing " + file + " " + e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700711 } catch (IndexOutOfBoundsException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800712 Slog.w(TAG, "failed parsing " + file + " " + e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700713 }
714 try {
715 if (stream != null) {
716 stream.close();
717 }
718 } catch (IOException e) {
719 // Ignore
720 }
721
722 if (!success) {
723 mWidth = -1;
724 mHeight = -1;
725 mName = "";
726 }
727 }
728
729 void settingsRestored() {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800730 if (DEBUG) Slog.v(TAG, "settingsRestored");
Mike Clerona428b2c2009-11-15 22:53:08 -0800731
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700732 boolean success = false;
733 synchronized (mLock) {
734 loadSettingsLocked();
Mike Clerona428b2c2009-11-15 22:53:08 -0800735 if (mNextWallpaperComponent != null &&
736 !mNextWallpaperComponent.equals(mImageWallpaperComponent)) {
Christopher Tatee3ab4d02009-12-16 14:03:31 -0800737 try {
738 bindWallpaperComponentLocked(mNextWallpaperComponent);
739 } catch (IllegalArgumentException e) {
740 // No such live wallpaper or other failure; fall back to the default
741 // live wallpaper (since the profile being restored indicated that the
742 // user had selected a live rather than static one).
743 bindWallpaperComponentLocked(null);
744 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700745 success = true;
746 } else {
Mike Clerona428b2c2009-11-15 22:53:08 -0800747 // If there's a wallpaper name, we use that. If that can't be loaded, then we
748 // use the default.
749 if ("".equals(mName)) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800750 if (DEBUG) Slog.v(TAG, "settingsRestored: name is empty");
Mike Clerona428b2c2009-11-15 22:53:08 -0800751 success = true;
752 } else {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800753 if (DEBUG) Slog.v(TAG, "settingsRestored: attempting to restore named resource");
Mike Clerona428b2c2009-11-15 22:53:08 -0800754 success = restoreNamedResourceLocked();
755 }
Joe Onorato8a9b2202010-02-26 18:56:32 -0800756 if (DEBUG) Slog.v(TAG, "settingsRestored: success=" + success);
Mike Clerona428b2c2009-11-15 22:53:08 -0800757 if (success) {
758 bindWallpaperComponentLocked(mImageWallpaperComponent);
759 }
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700760 }
761 }
762
763 if (!success) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800764 Slog.e(TAG, "Failed to restore wallpaper: '" + mName + "'");
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700765 mName = "";
766 WALLPAPER_FILE.delete();
767 }
768 saveSettingsLocked();
769 }
770
771 boolean restoreNamedResourceLocked() {
772 if (mName.length() > 4 && "res:".equals(mName.substring(0, 4))) {
773 String resName = mName.substring(4);
774
775 String pkg = null;
776 int colon = resName.indexOf(':');
777 if (colon > 0) {
778 pkg = resName.substring(0, colon);
779 }
780
781 String ident = null;
782 int slash = resName.lastIndexOf('/');
783 if (slash > 0) {
784 ident = resName.substring(slash+1);
785 }
786
787 String type = null;
788 if (colon > 0 && slash > 0 && (slash-colon) > 1) {
789 type = resName.substring(colon+1, slash);
790 }
791
792 if (pkg != null && ident != null && type != null) {
793 int resId = -1;
794 InputStream res = null;
795 FileOutputStream fos = null;
796 try {
797 Context c = mContext.createPackageContext(pkg, Context.CONTEXT_RESTRICTED);
798 Resources r = c.getResources();
799 resId = r.getIdentifier(resName, null, null);
800 if (resId == 0) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800801 Slog.e(TAG, "couldn't resolve identifier pkg=" + pkg + " type=" + type
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700802 + " ident=" + ident);
803 return false;
804 }
805
806 res = r.openRawResource(resId);
807 fos = new FileOutputStream(WALLPAPER_FILE);
808
809 byte[] buffer = new byte[32768];
810 int amt;
811 while ((amt=res.read(buffer)) > 0) {
812 fos.write(buffer, 0, amt);
813 }
814 // mWallpaperObserver will notice the close and send the change broadcast
815
Joe Onorato8a9b2202010-02-26 18:56:32 -0800816 Slog.v(TAG, "Restored wallpaper: " + resName);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700817 return true;
818 } catch (NameNotFoundException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800819 Slog.e(TAG, "Package name " + pkg + " not found");
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700820 } catch (Resources.NotFoundException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800821 Slog.e(TAG, "Resource not found: " + resId);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700822 } catch (IOException e) {
Joe Onorato8a9b2202010-02-26 18:56:32 -0800823 Slog.e(TAG, "IOException while restoring wallpaper ", e);
Joe Onorato9bb8fd72009-07-28 18:24:51 -0700824 } finally {
825 if (res != null) {
826 try {
827 res.close();
828 } catch (IOException ex) {}
829 }
830 if (fos != null) {
831 try {
832 fos.close();
833 } catch (IOException ex) {}
834 }
835 }
836 }
837 }
838 return false;
839 }
Dianne Hackborneb034652009-09-07 00:49:58 -0700840
841 @Override
842 protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
843 if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
844 != PackageManager.PERMISSION_GRANTED) {
845
846 pw.println("Permission Denial: can't dump wallpaper service from from pid="
847 + Binder.getCallingPid()
848 + ", uid=" + Binder.getCallingUid());
849 return;
850 }
851
852 synchronized (mLock) {
853 pw.println("Current Wallpaper Service state:");
854 pw.print(" mWidth="); pw.print(mWidth);
855 pw.print(" mHeight="); pw.println(mHeight);
856 pw.print(" mName="); pw.println(mName);
857 pw.print(" mWallpaperComponent="); pw.println(mWallpaperComponent);
858 if (mWallpaperConnection != null) {
859 WallpaperConnection conn = mWallpaperConnection;
860 pw.print(" Wallpaper connection ");
861 pw.print(conn); pw.println(":");
862 pw.print(" mInfo.component="); pw.println(conn.mInfo.getComponent());
863 pw.print(" mToken="); pw.println(conn.mToken);
864 pw.print(" mService="); pw.println(conn.mService);
865 pw.print(" mEngine="); pw.println(conn.mEngine);
866 pw.print(" mLastDiedTime=");
867 pw.println(mLastDiedTime - SystemClock.uptimeMillis());
868 }
869 }
870 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800871}