Merge "Make sure that updated wallpaper id is immediate" into oc-mr1-dev
This commit is contained in:
@@ -1138,7 +1138,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
mMonitor = new MyPackageMonitor();
|
mMonitor = new MyPackageMonitor();
|
||||||
mMonitor.register(context, null, UserHandle.ALL, true);
|
mMonitor.register(context, null, UserHandle.ALL, true);
|
||||||
getWallpaperDir(UserHandle.USER_SYSTEM).mkdirs();
|
getWallpaperDir(UserHandle.USER_SYSTEM).mkdirs();
|
||||||
|
|
||||||
|
// Initialize state from the persistent store, then guarantee that the
|
||||||
|
// WallpaperData for the system imagery is instantiated & active, creating
|
||||||
|
// it from defaults if necessary.
|
||||||
loadSettingsLocked(UserHandle.USER_SYSTEM, false);
|
loadSettingsLocked(UserHandle.USER_SYSTEM, false);
|
||||||
|
getWallpaperSafeLocked(UserHandle.USER_SYSTEM, FLAG_SYSTEM);
|
||||||
|
|
||||||
mColorsChangedListeners = new SparseArray<>();
|
mColorsChangedListeners = new SparseArray<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1627,13 +1633,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
(which == FLAG_LOCK) ? mLockWallpaperMap : mWallpaperMap;
|
(which == FLAG_LOCK) ? mLockWallpaperMap : mWallpaperMap;
|
||||||
WallpaperData wallpaper = whichSet.get(wallpaperUserId);
|
WallpaperData wallpaper = whichSet.get(wallpaperUserId);
|
||||||
if (wallpaper == null) {
|
if (wallpaper == null) {
|
||||||
// common case, this is the first lookup post-boot of the system or
|
// There is no established wallpaper imagery of this type (expected
|
||||||
// unified lock, so we bring up the saved state lazily now and recheck.
|
// only for lock wallpapers; a system WallpaperData is established at
|
||||||
loadSettingsLocked(wallpaperUserId, false);
|
// user switch)
|
||||||
wallpaper = whichSet.get(wallpaperUserId);
|
return null;
|
||||||
if (wallpaper == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (outParams != null) {
|
if (outParams != null) {
|
||||||
@@ -1658,7 +1661,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public WallpaperInfo getWallpaperInfo(int userId) {
|
public WallpaperInfo getWallpaperInfo(int userId) {
|
||||||
userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
|
userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
|
||||||
Binder.getCallingUid(), userId, false, true, "getWallpaperIdForUser", null);
|
Binder.getCallingUid(), userId, false, true, "getWallpaperInfo", null);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
WallpaperData wallpaper = mWallpaperMap.get(userId);
|
WallpaperData wallpaper = mWallpaperMap.get(userId);
|
||||||
if (wallpaper != null && wallpaper.connection != null) {
|
if (wallpaper != null && wallpaper.connection != null) {
|
||||||
@@ -2260,7 +2263,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
private void writeWallpaperAttributes(XmlSerializer out, String tag, WallpaperData wallpaper)
|
private void writeWallpaperAttributes(XmlSerializer out, String tag, WallpaperData wallpaper)
|
||||||
throws IllegalArgumentException, IllegalStateException, IOException {
|
throws IllegalArgumentException, IllegalStateException, IOException {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.v(TAG, "writeWallpaperAttributes");
|
Slog.v(TAG, "writeWallpaperAttributes id=" + wallpaper.wallpaperId);
|
||||||
}
|
}
|
||||||
out.startTag(null, tag);
|
out.startTag(null, tag);
|
||||||
out.attribute(null, "id", Integer.toString(wallpaper.wallpaperId));
|
out.attribute(null, "id", Integer.toString(wallpaper.wallpaperId));
|
||||||
@@ -2359,6 +2362,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
* the event yet. We use this safe method when we don't care about this ordering and just
|
* the event yet. We use this safe method when we don't care about this ordering and just
|
||||||
* want to update the data. The data is going to be applied when the user switch observer
|
* want to update the data. The data is going to be applied when the user switch observer
|
||||||
* is eventually executed.
|
* is eventually executed.
|
||||||
|
*
|
||||||
|
* Important: this method loads settings to initialize the given user's wallpaper data if
|
||||||
|
* there is no current in-memory state.
|
||||||
*/
|
*/
|
||||||
private WallpaperData getWallpaperSafeLocked(int userId, int which) {
|
private WallpaperData getWallpaperSafeLocked(int userId, int which) {
|
||||||
// We're setting either just system (work with the system wallpaper),
|
// We're setting either just system (work with the system wallpaper),
|
||||||
@@ -2397,8 +2403,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadSettingsLocked(int userId, boolean keepDimensionHints) {
|
private void loadSettingsLocked(int userId, boolean keepDimensionHints) {
|
||||||
if (DEBUG) Slog.v(TAG, "loadSettingsLocked");
|
|
||||||
|
|
||||||
JournaledFile journal = makeJournaledFile(userId);
|
JournaledFile journal = makeJournaledFile(userId);
|
||||||
FileInputStream stream = null;
|
FileInputStream stream = null;
|
||||||
File file = journal.chooseForRead();
|
File file = journal.chooseForRead();
|
||||||
|
|||||||
Reference in New Issue
Block a user