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

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

Merge "Support wallpaper on secondary displays.(3/N)"

parents efbe4dfb 81e10a70
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -189,10 +189,10 @@ Landroid/app/IUiModeManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app
Landroid/app/IUiModeManager;->disableCarMode(I)V
Landroid/app/IUiModeManager;->disableCarMode(I)V
Landroid/app/IUserSwitchObserver$Stub;-><init>()V
Landroid/app/IUserSwitchObserver$Stub;-><init>()V
Landroid/app/IWallpaperManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IWallpaperManager;
Landroid/app/IWallpaperManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IWallpaperManager;
Landroid/app/IWallpaperManager;->getHeightHint()I
Landroid/app/IWallpaperManager;->getHeightHint(I)I
Landroid/app/IWallpaperManager;->getWallpaper(Ljava/lang/String;Landroid/app/IWallpaperManagerCallback;ILandroid/os/Bundle;I)Landroid/os/ParcelFileDescriptor;
Landroid/app/IWallpaperManager;->getWallpaper(Ljava/lang/String;Landroid/app/IWallpaperManagerCallback;ILandroid/os/Bundle;I)Landroid/os/ParcelFileDescriptor;
Landroid/app/IWallpaperManager;->getWallpaperInfo(I)Landroid/app/WallpaperInfo;
Landroid/app/IWallpaperManager;->getWallpaperInfo(I)Landroid/app/WallpaperInfo;
Landroid/app/IWallpaperManager;->getWidthHint()I
Landroid/app/IWallpaperManager;->getWidthHint(I)I
Landroid/app/IWallpaperManager;->hasNamedWallpaper(Ljava/lang/String;)Z
Landroid/app/IWallpaperManager;->hasNamedWallpaper(Ljava/lang/String;)Z
Landroid/app/IWallpaperManager;->setWallpaperComponent(Landroid/content/ComponentName;)V
Landroid/app/IWallpaperManager;->setWallpaperComponent(Landroid/content/ComponentName;)V
Landroid/app/IWallpaperManagerCallback$Stub;-><init>()V
Landroid/app/IWallpaperManagerCallback$Stub;-><init>()V
+7 −7
Original line number Original line Diff line number Diff line
@@ -87,24 +87,24 @@ interface IWallpaperManager {


    /**
    /**
     * Sets the dimension hint for the wallpaper. These hints indicate the desired
     * Sets the dimension hint for the wallpaper. These hints indicate the desired
     * minimum width and height for the wallpaper.
     * minimum width and height for the wallpaper in a particular display.
     */
     */
    void setDimensionHints(in int width, in int height, in String callingPackage);
    void setDimensionHints(in int width, in int height, in String callingPackage, int displayId);


    /**
    /**
     * Returns the desired minimum width for the wallpaper.
     * Returns the desired minimum width for the wallpaper in a particular display.
     */
     */
    int getWidthHint();
    int getWidthHint(int displayId);


    /**
    /**
     * Returns the desired minimum height for the wallpaper.
     * Returns the desired minimum height for the wallpaper in a particular display.
     */
     */
    int getHeightHint();
    int getHeightHint(int displayId);


    /**
    /**
     * Sets extra padding that we would like the wallpaper to have outside of the display.
     * Sets extra padding that we would like the wallpaper to have outside of the display.
     */
     */
    void setDisplayPadding(in Rect padding, in String callingPackage);
    void setDisplayPadding(in Rect padding, in String callingPackage, int displayId);


    /**
    /**
     * Returns the name of the wallpaper. Private API.
     * Returns the name of the wallpaper. Private API.
+5 −4
Original line number Original line Diff line number Diff line
@@ -1485,7 +1485,7 @@ public class WallpaperManager {
            throw new RuntimeException(new DeadSystemException());
            throw new RuntimeException(new DeadSystemException());
        }
        }
        try {
        try {
            return sGlobals.mService.getWidthHint();
            return sGlobals.mService.getWidthHint(mContext.getDisplayId());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -1511,7 +1511,7 @@ public class WallpaperManager {
            throw new RuntimeException(new DeadSystemException());
            throw new RuntimeException(new DeadSystemException());
        }
        }
        try {
        try {
            return sGlobals.mService.getHeightHint();
            return sGlobals.mService.getHeightHint(mContext.getDisplayId());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -1572,7 +1572,7 @@ public class WallpaperManager {
                throw new RuntimeException(new DeadSystemException());
                throw new RuntimeException(new DeadSystemException());
            } else {
            } else {
                sGlobals.mService.setDimensionHints(minimumWidth, minimumHeight,
                sGlobals.mService.setDimensionHints(minimumWidth, minimumHeight,
                        mContext.getOpPackageName());
                        mContext.getOpPackageName(), mContext.getDisplayId());
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
@@ -1597,7 +1597,8 @@ public class WallpaperManager {
                Log.w(TAG, "WallpaperService not running");
                Log.w(TAG, "WallpaperService not running");
                throw new RuntimeException(new DeadSystemException());
                throw new RuntimeException(new DeadSystemException());
            } else {
            } else {
                sGlobals.mService.setDisplayPadding(padding, mContext.getOpPackageName());
                sGlobals.mService.setDisplayPadding(padding, mContext.getOpPackageName(),
                        mContext.getDisplayId());
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
+22 −18
Original line number Original line Diff line number Diff line
@@ -208,7 +208,6 @@ public abstract class WallpaperService extends Service {
        private final Supplier<Long> mClockFunction;
        private final Supplier<Long> mClockFunction;
        private final Handler mHandler;
        private final Handler mHandler;


        DisplayManager mDisplayManager;
        Display mDisplay;
        Display mDisplay;
        private int mDisplayState;
        private int mDisplayState;


@@ -1015,14 +1014,6 @@ 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;
@@ -1034,13 +1025,16 @@ public abstract class WallpaperService extends Service {
            mWindow.setSession(mSession);
            mWindow.setSession(mSession);


            mLayout.packageName = getPackageName();
            mLayout.packageName = getPackageName();
            mDisplayManager.registerDisplayListener(mDisplayListener, mCaller.getHandler());
            mIWallpaperEngine.mDisplayManager.registerDisplayListener(mDisplayListener,
                    mCaller.getHandler());
            mDisplay = mIWallpaperEngine.mDisplay;
            mDisplayState = mDisplay.getState();
            mDisplayState = mDisplay.getState();


            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            onCreate(mSurfaceHolder);
            onCreate(mSurfaceHolder);


            mInitializing = false;
            mInitializing = false;

            mReportedVisible = false;
            mReportedVisible = false;
            updateSurface(false, false, false);
            updateSurface(false, false, false);
        }
        }
@@ -1202,8 +1196,8 @@ public abstract class WallpaperService extends Service {
            
            
            mDestroyed = true;
            mDestroyed = true;


            if (mDisplayManager != null) {
            if (mIWallpaperEngine.mDisplayManager != null) {
                mDisplayManager.unregisterDisplayListener(mDisplayListener);
                mIWallpaperEngine.mDisplayManager.unregisterDisplayListener(mDisplayListener);
            }
            }


            if (mVisible) {
            if (mVisible) {
@@ -1272,7 +1266,9 @@ 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;
        final int mDisplayId;
        final DisplayManager mDisplayManager;
        final Display mDisplay;


        Engine mEngine;
        Engine mEngine;


@@ -1290,6 +1286,14 @@ public abstract class WallpaperService extends Service {
            mDisplayPadding.set(padding);
            mDisplayPadding.set(padding);
            mDisplayId = displayId;
            mDisplayId = displayId;


            // Create a display context before onCreateEngine.
            mDisplayManager = getSystemService(DisplayManager.class);
            mDisplay = mDisplayManager.getDisplay(mDisplayId);

            if (mDisplay == null) {
                // Ignore this engine.
                throw new IllegalArgumentException("Cannot find display with id" + mDisplayId);
            }
            Message msg = mCaller.obtainMessage(DO_ATTACH);
            Message msg = mCaller.obtainMessage(DO_ATTACH);
            mCaller.sendMessage(msg);
            mCaller.sendMessage(msg);
        }
        }
+212 −113

File changed.

Preview size limit exceeded, changes collapsed.