diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 39 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 20 |
2 files changed, 15 insertions, 44 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 9496b53..d46b6f5 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -17,15 +17,12 @@ package android.service.wallpaper; import android.content.res.TypedArray; -import android.os.Build; import android.os.SystemProperties; -import android.util.DisplayMetrics; -import android.util.TypedValue; -import android.view.ViewRootImpl; import android.view.WindowInsets; import com.android.internal.R; import com.android.internal.os.HandlerCaller; +import com.android.internal.util.ScreenShapeHelper; import com.android.internal.view.BaseIWindow; import com.android.internal.view.BaseSurfaceHolder; @@ -64,8 +61,6 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; -import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; - /** * A wallpaper service is responsible for showing a live wallpaper behind * applications that would like to sit on top of it. This service object @@ -160,7 +155,7 @@ public abstract class WallpaperService extends Service { WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS; int mCurWindowFlags = mWindowFlags; int mCurWindowPrivateFlags = mWindowPrivateFlags; - TypedValue mOutsetBottom; + int mOutsetBottomPx; final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); final Rect mOverscanInsets = new Rect(); @@ -173,8 +168,6 @@ public abstract class WallpaperService extends Service { final Rect mFinalStableInsets = new Rect(); final Configuration mConfiguration = new Configuration(); - private boolean mIsEmulator; - private boolean mIsCircularEmulator; private boolean mWindowIsRound; final WindowManager.LayoutParams mLayout @@ -639,23 +632,13 @@ public abstract class WallpaperService extends Service { final Display display = windowService.getDefaultDisplay(); final boolean shouldUseBottomOutset = display.getDisplayId() == Display.DEFAULT_DISPLAY; - if (shouldUseBottomOutset && windowStyle.hasValue( - R.styleable.Window_windowOutsetBottom)) { - if (mOutsetBottom == null) mOutsetBottom = new TypedValue(); - windowStyle.getValue(R.styleable.Window_windowOutsetBottom, - mOutsetBottom); - } else { - mOutsetBottom = null; + if (shouldUseBottomOutset) { + mOutsetBottomPx = ScreenShapeHelper.getWindowOutsetBottomPx( + getResources().getDisplayMetrics(), windowStyle); } - mWindowIsRound = getResources().getBoolean( - com.android.internal.R.bool.config_windowIsRound); + mWindowIsRound = ScreenShapeHelper.getWindowIsRound(getResources()); windowStyle.recycle(); - // detect emulator - mIsEmulator = Build.HARDWARE.contains("goldfish"); - mIsCircularEmulator = SystemProperties.getBoolean( - ViewRootImpl.PROPERTY_EMULATOR_CIRCULAR, false); - // Add window mLayout.type = mIWallpaperEngine.mWindowType; mLayout.gravity = Gravity.START|Gravity.TOP; @@ -785,18 +768,14 @@ public abstract class WallpaperService extends Service { mDispatchedOverscanInsets.set(mOverscanInsets); mDispatchedContentInsets.set(mContentInsets); mDispatchedStableInsets.set(mStableInsets); - final boolean isRound = (mIsEmulator && mIsCircularEmulator) - || mWindowIsRound; mFinalSystemInsets.set(mDispatchedOverscanInsets); mFinalStableInsets.set(mDispatchedStableInsets); - if (mOutsetBottom != null) { - final DisplayMetrics metrics = getResources().getDisplayMetrics(); + if (mOutsetBottomPx != 0) { mFinalSystemInsets.bottom = - ( (int) mOutsetBottom.getDimension(metrics) ) - + mIWallpaperEngine.mDisplayPadding.bottom; + mIWallpaperEngine.mDisplayPadding.bottom + mOutsetBottomPx; } WindowInsets insets = new WindowInsets(mFinalSystemInsets, - null, mFinalStableInsets, isRound); + null, mFinalStableInsets, mWindowIsRound); onApplyWindowInsets(insets); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 90c2bd1..113ad8d 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -40,14 +40,12 @@ import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.DisplayListener; import android.media.AudioManager; import android.os.Binder; -import android.os.Build; import android.os.Bundle; import android.os.Debug; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; -import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.SystemClock; @@ -78,6 +76,7 @@ import android.widget.Scroller; import com.android.internal.R; import com.android.internal.os.SomeArgs; import com.android.internal.policy.PolicyManager; +import com.android.internal.util.ScreenShapeHelper; import com.android.internal.view.BaseSurfaceHolder; import com.android.internal.view.RootViewSurfaceTaker; @@ -121,8 +120,10 @@ public final class ViewRootImpl implements ViewParent, private static final String PROPERTY_PROFILE_RENDERING = "viewroot.profile_rendering"; private static final String PROPERTY_MEDIA_DISABLED = "config.disable_media"; - // property used by emulator to determine display shape + // properties used by emulator to determine display shape public static final String PROPERTY_EMULATOR_CIRCULAR = "ro.emulator.circular"; + public static final String PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX = + "ro.emu.win_outset_bottom_px"; /** * Maximum time we allow the user to roll the trackball enough to generate @@ -333,8 +334,6 @@ public final class ViewRootImpl implements ViewParent, /** Set to true once doDie() has been called. */ private boolean mRemoved; - private boolean mIsEmulator; - private boolean mIsCircularEmulator; private final boolean mWindowIsRound; /** @@ -391,8 +390,7 @@ public final class ViewRootImpl implements ViewParent, mChoreographer = Choreographer.getInstance(); mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); loadSystemProperties(); - mWindowIsRound = context.getResources().getBoolean( - com.android.internal.R.bool.config_windowIsRound); + mWindowIsRound = ScreenShapeHelper.getWindowIsRound(context.getResources()); } public static void addFirstDrawHandler(Runnable callback) { @@ -1224,10 +1222,9 @@ public final class ViewRootImpl implements ViewParent, void dispatchApplyInsets(View host) { mDispatchContentInsets.set(mAttachInfo.mContentInsets); mDispatchStableInsets.set(mAttachInfo.mStableInsets); - final boolean isRound = (mIsEmulator && mIsCircularEmulator) || mWindowIsRound; host.dispatchApplyWindowInsets(new WindowInsets( mDispatchContentInsets, null /* windowDecorInsets */, - mDispatchStableInsets, isRound)); + mDispatchStableInsets, mWindowIsRound)); } private void performTraversals() { @@ -5571,11 +5568,6 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendEmptyMessageDelayed(MSG_INVALIDATE_WORLD, 200); } } - - // detect emulator - mIsEmulator = Build.HARDWARE.contains("goldfish"); - mIsCircularEmulator = - SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false); } }); } |
