Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf9fa828 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Run the SELinux wallpaper restorecon operations on all users" into nyc-mr1-dev

parents ebbbead9 38a5dc33
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -487,6 +487,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
    final SparseArray<WallpaperData> mWallpaperMap = new SparseArray<WallpaperData>();
    final SparseArray<WallpaperData> mLockWallpaperMap = new SparseArray<WallpaperData>();

    final SparseArray<Boolean> mUserRestorecon = new SparseArray<Boolean>();
    int mCurrentUserId;

    static class WallpaperData {
@@ -944,13 +945,18 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {

    void onUnlockUser(final int userId) {
        synchronized (mLock) {
            if (mCurrentUserId == userId && mWaitingForUnlock) {
            if (mCurrentUserId == userId) {
                if (mWaitingForUnlock) {
                    // If we're switching users, now is when we transition the wallpaper
                    switchUser(userId, null);
                }

                // Make sure that the SELinux labeling of all the relevant files is correct.
                // This corrects for mislabeling bugs that might have arisen from move-to
                // operations involving the wallpaper files.  This isn't timing-critical,
                // so we do it in the background to avoid holding up the user unlock operation.
                if (mUserRestorecon.get(userId) != Boolean.TRUE) {
                    mUserRestorecon.put(userId, Boolean.TRUE);
                    Runnable relabeler = new Runnable() {
                        @Override
                        public void run() {
@@ -967,6 +973,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
                }
            }
        }
    }

    void onRemoveUser(int userId) {
        if (userId < 1) return;