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

Commit 49585937 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Get WallpaperInfo for current user"

parents f41fd61b f132a8d7
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -996,17 +996,29 @@ public class WallpaperManager {
    }

    /**
     * If the current wallpaper is a live wallpaper component, return the
     * information about that wallpaper.  Otherwise, if it is a static image,
     * simply return null.
     * Returns the information about the wallpaper if the current wallpaper is
     * a live wallpaper component. Otherwise, if the wallpaper is a static image,
     * this returns null.
     */
    public WallpaperInfo getWallpaperInfo() {
        return getWallpaperInfo(mContext.getUserId());
    }

    /**
     * Returns the information about the wallpaper if the current wallpaper is
     * a live wallpaper component. Otherwise, if the wallpaper is a static image,
     * this returns null.
     *
     * @param userId Owner of the wallpaper.
     * @hide
     */
    public WallpaperInfo getWallpaperInfo(int userId) {
        try {
            if (sGlobals.mService == null) {
                Log.w(TAG, "WallpaperService not running");
                throw new RuntimeException(new DeadSystemException());
            } else {
                return sGlobals.mService.getWallpaperInfo(mContext.getUserId());
                return sGlobals.mService.getWallpaperInfo(userId);
            }
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
+5 −3
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected NotificationLockscreenUserManager mLockscreenUserManager;
    protected NotificationRemoteInputManager mRemoteInputManager;

    private BroadcastReceiver mWallpaperChangedReceiver = new BroadcastReceiver() {
    private final BroadcastReceiver mWallpaperChangedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class);
@@ -513,7 +513,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                Log.w(TAG, "WallpaperManager not available");
                return;
            }
            WallpaperInfo info = wallpaperManager.getWallpaperInfo();
            WallpaperInfo info = wallpaperManager.getWallpaperInfo(UserHandle.USER_CURRENT);
            final boolean supportsAmbientMode = info != null &&
                    info.getSupportsAmbientMode();

@@ -707,7 +707,8 @@ public class StatusBar extends SystemUI implements DemoMode,

        // Make sure we always have the most current wallpaper info.
        IntentFilter wallpaperChangedFilter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
        mContext.registerReceiver(mWallpaperChangedReceiver, wallpaperChangedFilter);
        mContext.registerReceiverAsUser(mWallpaperChangedReceiver, UserHandle.ALL,
                wallpaperChangedFilter, null /* broadcastPermission */, null /* scheduler */);
        mWallpaperChangedReceiver.onReceive(mContext, null);

        mLockscreenUserManager.setUpWithPresenter(this, mEntryManager);
@@ -3156,6 +3157,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        updateNotificationViews();
        mMediaManager.clearCurrentMediaNotification();
        setLockscreenUser(newUserId);
        mWallpaperChangedReceiver.onReceive(mContext, null);
    }

    @Override