Fix non-visual Context in ImageWallpaper
Before, it tried to access WindowManager from a non-visual context. Now, it should use a window context. Bug: 187644235 Test: manual Change-Id: I3994d7b86fd28598d375c1c8033d72bbc9a9fdcf
This commit is contained in:
@@ -21,6 +21,7 @@ import static android.graphics.Matrix.MSCALE_Y;
|
||||
import static android.graphics.Matrix.MSKEW_X;
|
||||
import static android.graphics.Matrix.MSKEW_Y;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_VISIBLE;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
|
||||
|
||||
import android.annotation.FloatRange;
|
||||
import android.annotation.NonNull;
|
||||
@@ -1218,7 +1219,9 @@ public abstract class WallpaperService extends Service {
|
||||
mIWallpaperEngine.mDisplayManager.registerDisplayListener(mDisplayListener,
|
||||
mCaller.getHandler());
|
||||
mDisplay = mIWallpaperEngine.mDisplay;
|
||||
mDisplayContext = createDisplayContext(mDisplay);
|
||||
// Use window context of TYPE_WALLPAPER so client can access UI resources correctly.
|
||||
mDisplayContext = createDisplayContext(mDisplay)
|
||||
.createWindowContext(TYPE_WALLPAPER, null /* options */);
|
||||
mDisplayState = mDisplay.getState();
|
||||
|
||||
if (DEBUG) Log.v(TAG, "onCreate(): " + this);
|
||||
|
||||
Reference in New Issue
Block a user