Only restore the bits for wallpapers that aren't built in.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -25,7 +25,7 @@ interface IWallpaperService {
|
||||
/**
|
||||
* Set the wallpaper.
|
||||
*/
|
||||
ParcelFileDescriptor setWallpaper();
|
||||
ParcelFileDescriptor setWallpaper(String name);
|
||||
|
||||
/**
|
||||
* Get the wallpaper.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user