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

Commit c3d0cd4b authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge changes from topic "wallpaper_to_displays"

* changes:
  Support wallpaper on secondary displays.(2/N)
  Support wallpaper on secondary displays.(1/N)
parents fa830752 c32538e6
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ import android.app.WallpaperColors;
 * @hide
 * @hide
 */
 */
interface IWallpaperConnection {
interface IWallpaperConnection {
	void attachEngine(IWallpaperEngine engine);
    void attachEngine(IWallpaperEngine engine, int displayId);
    void engineShown(IWallpaperEngine engine);
    void engineShown(IWallpaperEngine engine);
    ParcelFileDescriptor setWallpaper(String name);
    ParcelFileDescriptor setWallpaper(String name);
    void onWallpaperColorsChanged(in WallpaperColors colors);
    void onWallpaperColorsChanged(in WallpaperColors colors);
+2 −2
Original line number Original line Diff line number Diff line
@@ -25,5 +25,5 @@ import android.service.wallpaper.IWallpaperConnection;
oneway interface IWallpaperService {
oneway interface IWallpaperService {
    void attach(IWallpaperConnection connection,
    void attach(IWallpaperConnection connection,
            IBinder windowToken, int windowType, boolean isPreview,
            IBinder windowToken, int windowType, boolean isPreview,
    		int reqWidth, int reqHeight, in Rect padding);
            int reqWidth, int reqHeight, in Rect padding, int displayId);
}
}
+18 −10
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.app.Service;
import android.app.WallpaperColors;
import android.app.WallpaperColors;
import android.app.WallpaperInfo;
import android.app.WallpaperInfo;
import android.app.WallpaperManager;
import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
@@ -806,7 +805,7 @@ public abstract class WallpaperService extends Service {
                                com.android.internal.R.style.Animation_Wallpaper;
                                com.android.internal.R.style.Animation_Wallpaper;
                        mInputChannel = new InputChannel();
                        mInputChannel = new InputChannel();
                        if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
                        if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
                                Display.DEFAULT_DISPLAY, mWinFrame, mContentInsets, mStableInsets,
                                mDisplay.getDisplayId(), mWinFrame, mContentInsets, mStableInsets,
                                mOutsets, mDisplayCutout, mInputChannel) < 0) {
                                mOutsets, mDisplayCutout, mInputChannel) < 0) {
                            Log.w(TAG, "Failed to add window while updating wallpaper surface.");
                            Log.w(TAG, "Failed to add window while updating wallpaper surface.");
                            return;
                            return;
@@ -1016,6 +1015,14 @@ public abstract class WallpaperService extends Service {
                return;
                return;
            }
            }


            mDisplayManager = getSystemService(DisplayManager.class);
            mDisplay = mDisplayManager.getDisplay(wrapper.mDisplayId);
            if (mDisplay == null) {
                // TODO(b/115486823) Ignore this engine.
                Log.e(TAG, "Attaching to a non-existent display: " + wrapper.mDisplayId);
                return;
            }

            mIWallpaperEngine = wrapper;
            mIWallpaperEngine = wrapper;
            mCaller = wrapper.mCaller;
            mCaller = wrapper.mCaller;
            mConnection = wrapper.mConnection;
            mConnection = wrapper.mConnection;
@@ -1027,10 +1034,7 @@ public abstract class WallpaperService extends Service {
            mWindow.setSession(mSession);
            mWindow.setSession(mSession);


            mLayout.packageName = getPackageName();
            mLayout.packageName = getPackageName();

            mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE);
            mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler());
            mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler());
            mDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
            mDisplayState = mDisplay.getState();
            mDisplayState = mDisplay.getState();


            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
@@ -1268,12 +1272,14 @@ public abstract class WallpaperService extends Service {
        int mReqWidth;
        int mReqWidth;
        int mReqHeight;
        int mReqHeight;
        final Rect mDisplayPadding = new Rect();
        final Rect mDisplayPadding = new Rect();
        int mDisplayId;


        Engine mEngine;
        Engine mEngine;


        IWallpaperEngineWrapper(WallpaperService context,
        IWallpaperEngineWrapper(WallpaperService context,
                IWallpaperConnection conn, IBinder windowToken,
                IWallpaperConnection conn, IBinder windowToken,
                int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding) {
                int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding,
                int displayId) {
            mCaller = new HandlerCaller(context, context.getMainLooper(), this, true);
            mCaller = new HandlerCaller(context, context.getMainLooper(), this, true);
            mConnection = conn;
            mConnection = conn;
            mWindowToken = windowToken;
            mWindowToken = windowToken;
@@ -1282,6 +1288,7 @@ public abstract class WallpaperService extends Service {
            mReqWidth = reqWidth;
            mReqWidth = reqWidth;
            mReqHeight = reqHeight;
            mReqHeight = reqHeight;
            mDisplayPadding.set(padding);
            mDisplayPadding.set(padding);
            mDisplayId = displayId;
            
            
            Message msg = mCaller.obtainMessage(DO_ATTACH);
            Message msg = mCaller.obtainMessage(DO_ATTACH);
            mCaller.sendMessage(msg);
            mCaller.sendMessage(msg);
@@ -1353,7 +1360,7 @@ public abstract class WallpaperService extends Service {
            switch (message.what) {
            switch (message.what) {
                case DO_ATTACH: {
                case DO_ATTACH: {
                    try {
                    try {
                        mConnection.attachEngine(this);
                        mConnection.attachEngine(this, mDisplayId);
                    } catch (RemoteException e) {
                    } catch (RemoteException e) {
                        Log.w(TAG, "Wallpaper host disappeared", e);
                        Log.w(TAG, "Wallpaper host disappeared", e);
                        return;
                        return;
@@ -1453,9 +1460,10 @@ public abstract class WallpaperService extends Service {


        @Override
        @Override
        public void attach(IWallpaperConnection conn, IBinder windowToken,
        public void attach(IWallpaperConnection conn, IBinder windowToken,
                int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding) {
                int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding,
                int displayId) {
            new IWallpaperEngineWrapper(mTarget, conn, windowToken,
            new IWallpaperEngineWrapper(mTarget, conn, windowToken,
                    windowType, isPreview, reqWidth, reqHeight, padding);
                    windowType, isPreview, reqWidth, reqHeight, padding, displayId);
        }
        }
    }
    }


+230 −72

File changed.

Preview size limit exceeded, changes collapsed.

+3 −4
Original line number Original line Diff line number Diff line
@@ -51,7 +51,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_APP_TRANSITION_STARTING;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_APP_TRANSITION_STARTING;


import android.app.WindowConfiguration;
import android.os.Trace;
import android.os.Trace;
import android.util.ArraySet;
import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;
@@ -83,7 +82,7 @@ public class AppTransitionController {
    AppTransitionController(WindowManagerService service, DisplayContent displayContent) {
    AppTransitionController(WindowManagerService service, DisplayContent displayContent) {
        mService = service;
        mService = service;
        mDisplayContent = displayContent;
        mDisplayContent = displayContent;
        mWallpaperControllerLocked = new WallpaperController(mService);
        mWallpaperControllerLocked = mDisplayContent.mWallpaperController;
    }
    }


    /**
    /**
@@ -106,7 +105,7 @@ public class AppTransitionController {


        mDisplayContent.mAppTransition.removeAppTransitionTimeoutCallbacks();
        mDisplayContent.mAppTransition.removeAppTransitionTimeoutCallbacks();


        mService.mRoot.mWallpaperMayChange = false;
        mDisplayContent.mWallpaperMayChange = false;


        int i;
        int i;
        for (i = 0; i < appsCount; i++) {
        for (i = 0; i < appsCount; i++) {
@@ -121,7 +120,7 @@ public class AppTransitionController {
        // Adjust wallpaper before we pull the lower/upper target, since pending changes
        // Adjust wallpaper before we pull the lower/upper target, since pending changes
        // (like the clearAnimatingFlags() above) might affect wallpaper target result.
        // (like the clearAnimatingFlags() above) might affect wallpaper target result.
        // Or, the opening app window should be a wallpaper target.
        // Or, the opening app window should be a wallpaper target.
        mWallpaperControllerLocked.adjustWallpaperWindowsForAppTransitionIfNeeded(mDisplayContent,
        mWallpaperControllerLocked.adjustWallpaperWindowsForAppTransitionIfNeeded(
                mDisplayContent.mOpeningApps);
                mDisplayContent.mOpeningApps);


        // Determine if closing and opening app token sets are wallpaper targets, in which case
        // Determine if closing and opening app token sets are wallpaper targets, in which case
Loading