diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ApplicationContext.java | 11 | ||||
-rw-r--r-- | core/java/android/app/IWallpaperService.aidl | 2 | ||||
-rw-r--r-- | core/java/android/backup/BackupDataInput.java | 7 | ||||
-rw-r--r-- | core/java/android/os/FileObserver.java | 39 | ||||
-rw-r--r-- | core/java/com/android/internal/backup/SystemBackupAgent.java | 35 |
5 files changed, 35 insertions, 59 deletions
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java index 1e4ab68..b095e30 100644 --- a/core/java/android/app/ApplicationContext.java +++ b/core/java/android/app/ApplicationContext.java @@ -578,7 +578,7 @@ class ApplicationContext extends Context { @Override public void setWallpaper(Bitmap bitmap) throws IOException { try { - ParcelFileDescriptor fd = getWallpaperService().setWallpaper(); + ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } @@ -598,7 +598,7 @@ class ApplicationContext extends Context { @Override public void setWallpaper(InputStream data) throws IOException { try { - ParcelFileDescriptor fd = getWallpaperService().setWallpaper(); + ParcelFileDescriptor fd = getWallpaperService().setWallpaper(null); if (fd == null) { return; } @@ -627,13 +627,16 @@ class ApplicationContext extends Context { @Override public void clearWallpaper() throws IOException { try { + Resources resources = getResources(); /* Set the wallpaper to the default values */ - ParcelFileDescriptor fd = getWallpaperService().setWallpaper(); + ParcelFileDescriptor fd = getWallpaperService().setWallpaper( + "res:" + resources.getResourceName( + com.android.internal.R.drawable.default_wallpaper)); if (fd != null) { FileOutputStream fos = null; try { fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); - setWallpaper(getResources().openRawResource( + setWallpaper(resources.openRawResource( com.android.internal.R.drawable.default_wallpaper), fos); } finally { diff --git a/core/java/android/app/IWallpaperService.aidl b/core/java/android/app/IWallpaperService.aidl index a332b1a..281a060 100644 --- a/core/java/android/app/IWallpaperService.aidl +++ b/core/java/android/app/IWallpaperService.aidl @@ -25,7 +25,7 @@ interface IWallpaperService { /** * Set the wallpaper. */ - ParcelFileDescriptor setWallpaper(); + ParcelFileDescriptor setWallpaper(String name); /** * Get the wallpaper. diff --git a/core/java/android/backup/BackupDataInput.java b/core/java/android/backup/BackupDataInput.java index 69c206c..e67b0be 100644 --- a/core/java/android/backup/BackupDataInput.java +++ b/core/java/android/backup/BackupDataInput.java @@ -97,12 +97,7 @@ public class BackupDataInput { public void skipEntityData() throws IOException { if (mHeaderReady) { - int result = skipEntityData_native(mBackupReader); - if (result >= 0) { - return; - } else { - throw new IOException("result=0x" + Integer.toHexString(result)); - } + skipEntityData_native(mBackupReader); } else { throw new IllegalStateException("mHeaderReady=false"); } diff --git a/core/java/android/os/FileObserver.java b/core/java/android/os/FileObserver.java index d9804ea..38d252e 100644 --- a/core/java/android/os/FileObserver.java +++ b/core/java/android/os/FileObserver.java @@ -25,22 +25,35 @@ import java.util.ArrayList; import java.util.HashMap; public abstract class FileObserver { - public static final int ACCESS = 0x00000001; /* File was accessed */ - public static final int MODIFY = 0x00000002; /* File was modified */ - public static final int ATTRIB = 0x00000004; /* Metadata changed */ - public static final int CLOSE_WRITE = 0x00000008; /* Writtable file was closed */ - public static final int CLOSE_NOWRITE = 0x00000010; /* Unwrittable file closed */ - public static final int OPEN = 0x00000020; /* File was opened */ - public static final int MOVED_FROM = 0x00000040; /* File was moved from X */ - public static final int MOVED_TO = 0x00000080; /* File was moved to Y */ - public static final int CREATE = 0x00000100; /* Subfile was created */ - public static final int DELETE = 0x00000200; /* Subfile was deleted */ - public static final int DELETE_SELF = 0x00000400; /* Self was deleted */ - public static final int MOVE_SELF = 0x00000800; /* Self was moved */ + /** File was accessed */ + public static final int ACCESS = 0x00000001; + /** File was modified */ + public static final int MODIFY = 0x00000002; + /** Metadata changed */ + public static final int ATTRIB = 0x00000004; + /** Writable file was closed */ + public static final int CLOSE_WRITE = 0x00000008; + /** Unwrittable file closed */ + public static final int CLOSE_NOWRITE = 0x00000010; + /** File was opened */ + public static final int OPEN = 0x00000020; + /** File was moved from X */ + public static final int MOVED_FROM = 0x00000040; + /** File was moved to Y */ + public static final int MOVED_TO = 0x00000080; + /** Subfile was created */ + public static final int CREATE = 0x00000100; + /** Subfile was deleted */ + public static final int DELETE = 0x00000200; + /** Self was deleted */ + public static final int DELETE_SELF = 0x00000400; + /** Self was moved */ + public static final int MOVE_SELF = 0x00000800; + public static final int ALL_EVENTS = ACCESS | MODIFY | ATTRIB | CLOSE_WRITE | CLOSE_NOWRITE | OPEN | MOVED_FROM | MOVED_TO | DELETE | CREATE | DELETE_SELF | MOVE_SELF; - + private static final String LOG_TAG = "FileObserver"; private static class ObserverThread extends Thread { diff --git a/core/java/com/android/internal/backup/SystemBackupAgent.java b/core/java/com/android/internal/backup/SystemBackupAgent.java deleted file mode 100644 index 6b396d7..0000000 --- a/core/java/com/android/internal/backup/SystemBackupAgent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.backup; - -import android.backup.AbsoluteFileBackupHelper; -import android.backup.BackupHelperAgent; - -/** - * Backup agent for various system-managed data - */ -public class SystemBackupAgent extends BackupHelperAgent { - // the set of files that we back up whole, as absolute paths - String[] mFiles = { - /* WallpaperService.WALLPAPER_FILE */ - "/data/data/com.android.settings/files/wallpaper", - }; - - public void onCreate() { - addHelper("system_files", new AbsoluteFileBackupHelper(this, mFiles)); - } -} |