diff options
| author | 2024-05-28 18:29:10 +0000 | |
|---|---|---|
| committer | 2024-05-28 18:29:10 +0000 | |
| commit | 6ed86daab6e111ea3b878c7185e9a647c4fb19a8 (patch) | |
| tree | b4a0eb417fa48fe293db5dfbd6c4a5797df1ad64 | |
| parent | f513290792961bfd294b16771a03061d1c22f8f2 (diff) | |
| parent | 8947d4948abe98cffafb09c2500d014bd4cb031f (diff) | |
Merge "Continue to remove code around legacy captions" into main
| -rw-r--r-- | core/java/android/content/pm/PackageManager.java | 1 | ||||
| -rw-r--r-- | core/java/android/content/res/Resources.java | 11 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/BackdropFrameRenderer.java | 398 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/DecorView.java | 187 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 3 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_caption_title.xml | 21 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_caption_title_focused.xml | 23 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_caption_title_unfocused.xml | 23 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_close_button_dark.xml | 31 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_close_button_light.xml | 31 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_maximize_button_dark.xml | 37 | ||||
| -rw-r--r-- | core/res/res/drawable/decor_maximize_button_light.xml | 35 | ||||
| -rw-r--r-- | core/res/res/layout/decor_caption.xml | 52 | ||||
| -rw-r--r-- | core/res/res/values/arrays.xml | 5 | ||||
| -rw-r--r-- | core/res/res/values/config.xml | 7 | ||||
| -rw-r--r-- | core/res/res/values/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 14 |
17 files changed, 20 insertions, 861 deletions
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 2d9881abc4a5..9d2a8ee49591 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -4398,7 +4398,6 @@ public abstract class PackageManager { * Windows have title bars and can be moved and resized. */ // If this feature is present, you also need to set - // com.android.internal.R.config_freeformWindowManagement to true in your configuration overlay. @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT = "android.software.freeform_window_management"; diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index a720b6473be5..248ef1d4d9c4 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -2745,17 +2745,6 @@ public class Resources { ar.recycle(); Log.i(TAG, "...preloaded " + numberOfEntries + " resources in " + (SystemClock.uptimeMillis() - startTime) + "ms."); - - if (sysRes.getBoolean( - com.android.internal.R.bool.config_freeformWindowManagement)) { - startTime = SystemClock.uptimeMillis(); - ar = sysRes.obtainTypedArray( - com.android.internal.R.array.preloaded_freeform_multi_window_drawables); - numberOfEntries = preloadDrawables(sysRes, ar); - ar.recycle(); - Log.i(TAG, "...preloaded " + numberOfEntries + " resource in " - + (SystemClock.uptimeMillis() - startTime) + "ms."); - } } sysRes.finishPreloading(); } catch (RuntimeException e) { diff --git a/core/java/com/android/internal/policy/BackdropFrameRenderer.java b/core/java/com/android/internal/policy/BackdropFrameRenderer.java deleted file mode 100644 index c6e8bf75dbcd..000000000000 --- a/core/java/com/android/internal/policy/BackdropFrameRenderer.java +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.internal.policy; - -import android.graphics.Insets; -import android.graphics.RecordingCanvas; -import android.graphics.Rect; -import android.graphics.RenderNode; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.os.Looper; -import android.view.Choreographer; -import android.view.ThreadedRenderer; - -/** - * The thread which draws a fill in background while the app is resizing in areas where the app - * content draw is lagging behind the resize operation. - * It starts with the creation and it ends once someone calls destroy(). - * Any size changes can be passed by a call to setTargetRect will passed to the thread and - * executed via the Choreographer. - * @hide - */ -public class BackdropFrameRenderer extends Thread implements Choreographer.FrameCallback { - - private DecorView mDecorView; - - // This is containing the last requested size by a resize command. Note that this size might - // or might not have been applied to the output already. - private final Rect mTargetRect = new Rect(); - - // The render nodes for the multi threaded renderer. - private ThreadedRenderer mRenderer; - private RenderNode mFrameAndBackdropNode; - private RenderNode mSystemBarBackgroundNode; - - private final Rect mOldTargetRect = new Rect(); - private final Rect mNewTargetRect = new Rect(); - - private Choreographer mChoreographer; - - // Cached size values from the last render for the case that the view hierarchy is gone - // during a configuration change. - private int mLastContentWidth; - private int mLastContentHeight; - private int mLastXOffset; - private int mLastYOffset; - - // Whether to report when next frame is drawn or not. - private boolean mReportNextDraw; - - private Drawable mCaptionBackgroundDrawable; - private Drawable mUserCaptionBackgroundDrawable; - private Drawable mResizingBackgroundDrawable; - private ColorDrawable mStatusBarColor; - private ColorDrawable mNavigationBarColor; - private boolean mOldFullscreen; - private boolean mFullscreen; - private final Rect mOldSystemBarInsets = new Rect(); - private final Rect mSystemBarInsets = new Rect(); - private final Rect mTmpRect = new Rect(); - - public BackdropFrameRenderer(DecorView decorView, ThreadedRenderer renderer, Rect initialBounds, - Drawable resizingBackgroundDrawable, Drawable captionBackgroundDrawable, - Drawable userCaptionBackgroundDrawable, int statusBarColor, int navigationBarColor, - boolean fullscreen, Insets systemBarInsets) { - setName("ResizeFrame"); - - mRenderer = renderer; - onResourcesLoaded(decorView, resizingBackgroundDrawable, captionBackgroundDrawable, - userCaptionBackgroundDrawable, statusBarColor, navigationBarColor); - - // Create a render node for the content and frame backdrop - // which can be resized independently from the content. - mFrameAndBackdropNode = RenderNode.create("FrameAndBackdropNode", null); - - mRenderer.addRenderNode(mFrameAndBackdropNode, true); - - // Set the initial bounds and draw once so that we do not get a broken frame. - mTargetRect.set(initialBounds); - mFullscreen = fullscreen; - mOldFullscreen = fullscreen; - mSystemBarInsets.set(systemBarInsets.toRect()); - mOldSystemBarInsets.set(systemBarInsets.toRect()); - - // Kick off our draw thread. - start(); - } - - void onResourcesLoaded(DecorView decorView, Drawable resizingBackgroundDrawable, - Drawable captionBackgroundDrawableDrawable, Drawable userCaptionBackgroundDrawable, - int statusBarColor, int navigationBarColor) { - synchronized (this) { - mDecorView = decorView; - mResizingBackgroundDrawable = resizingBackgroundDrawable != null - && resizingBackgroundDrawable.getConstantState() != null - ? resizingBackgroundDrawable.getConstantState().newDrawable() - : null; - mCaptionBackgroundDrawable = captionBackgroundDrawableDrawable != null - && captionBackgroundDrawableDrawable.getConstantState() != null - ? captionBackgroundDrawableDrawable.getConstantState().newDrawable() - : null; - mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable != null - && userCaptionBackgroundDrawable.getConstantState() != null - ? userCaptionBackgroundDrawable.getConstantState().newDrawable() - : null; - if (mCaptionBackgroundDrawable == null) { - mCaptionBackgroundDrawable = mResizingBackgroundDrawable; - } - if (statusBarColor != 0) { - mStatusBarColor = new ColorDrawable(statusBarColor); - addSystemBarNodeIfNeeded(); - } else { - mStatusBarColor = null; - } - if (navigationBarColor != 0) { - mNavigationBarColor = new ColorDrawable(navigationBarColor); - addSystemBarNodeIfNeeded(); - } else { - mNavigationBarColor = null; - } - } - } - - private void addSystemBarNodeIfNeeded() { - if (mSystemBarBackgroundNode != null) { - return; - } - mSystemBarBackgroundNode = RenderNode.create("SystemBarBackgroundNode", null); - mRenderer.addRenderNode(mSystemBarBackgroundNode, false); - } - - /** - * Call this function asynchronously when the window size has been changed or when the insets - * have changed or whether window switched between a fullscreen or non-fullscreen layout. - * The change will be picked up once per frame and the frame will be re-rendered accordingly. - * - * @param newTargetBounds The new target bounds. - * @param fullscreen Whether the window is currently drawing in fullscreen. - * @param systemBarInsets The current visible system insets for the window. - */ - public void setTargetRect(Rect newTargetBounds, boolean fullscreen, Rect systemBarInsets) { - synchronized (this) { - mFullscreen = fullscreen; - mTargetRect.set(newTargetBounds); - mSystemBarInsets.set(systemBarInsets); - // Notify of a bounds change. - pingRenderLocked(false /* drawImmediate */); - } - } - - /** - * The window got replaced due to a configuration change. - */ - public void onConfigurationChange() { - synchronized (this) { - if (mRenderer != null) { - // Enforce a window redraw. - mOldTargetRect.set(0, 0, 0, 0); - pingRenderLocked(false /* drawImmediate */); - } - } - } - - /** - * All resources of the renderer will be released. This function can be called from the - * the UI thread as well as the renderer thread. - */ - void releaseRenderer() { - synchronized (this) { - if (mRenderer != null) { - // Invalidate the current content bounds. - mRenderer.setContentDrawBounds(0, 0, 0, 0); - - // Remove the render node again - // (see comment above - better to do that only once). - mRenderer.removeRenderNode(mFrameAndBackdropNode); - if (mSystemBarBackgroundNode != null) { - mRenderer.removeRenderNode(mSystemBarBackgroundNode); - } - - mRenderer = null; - - // Exit the renderer loop. - pingRenderLocked(false /* drawImmediate */); - } - } - } - - @Override - public void run() { - try { - Looper.prepare(); - synchronized (this) { - if (mRenderer == null) { - // This can happen if 'releaseRenderer' is called immediately after 'start'. - return; - } - mChoreographer = Choreographer.getInstance(); - } - Looper.loop(); - } finally { - releaseRenderer(); - } - synchronized (this) { - // Make sure no more messages are being sent. - mChoreographer = null; - Choreographer.releaseInstance(); - } - } - - /** - * The implementation of the FrameCallback. - * @param frameTimeNanos The time in nanoseconds when the frame started being rendered, - * in the {@link System#nanoTime()} timebase. Divide this value by {@code 1000000} - */ - @Override - public void doFrame(long frameTimeNanos) { - synchronized (this) { - if (mRenderer == null) { - reportDrawIfNeeded(); - // Tell the looper to stop. We are done. - Looper.myLooper().quit(); - return; - } - doFrameUncheckedLocked(); - } - } - - private void doFrameUncheckedLocked() { - mNewTargetRect.set(mTargetRect); - if (!mNewTargetRect.equals(mOldTargetRect) - || mOldFullscreen != mFullscreen - || !mSystemBarInsets.equals(mOldSystemBarInsets) - || mReportNextDraw) { - mOldFullscreen = mFullscreen; - mOldTargetRect.set(mNewTargetRect); - mOldSystemBarInsets.set(mSystemBarInsets); - redrawLocked(mNewTargetRect, mFullscreen); - } - } - - /** - * The content is about to be drawn and we got the location of where it will be shown. - * If a "redrawLocked" call has already been processed, we will re-issue the call - * if the previous call was ignored since the size was unknown. - * @param xOffset The x offset where the content is drawn to. - * @param yOffset The y offset where the content is drawn to. - * @param xSize The width size of the content. This should not be 0. - * @param ySize The height of the content. - * @return true if a frame should be requested after the content is drawn; false otherwise. - */ - boolean onContentDrawn(int xOffset, int yOffset, int xSize, int ySize) { - synchronized (this) { - final boolean firstCall = mLastContentWidth == 0; - // The current content buffer is drawn here. - mLastContentWidth = xSize; - mLastContentHeight = ySize; - mLastXOffset = xOffset; - mLastYOffset = yOffset; - - // Inform the renderer of the content's new bounds - mRenderer.setContentDrawBounds( - mLastXOffset, - mLastYOffset, - mLastXOffset + mLastContentWidth, - mLastYOffset + mLastContentHeight); - - // If this was the first call and redrawLocked got already called prior - // to us, we should re-issue a redrawLocked now. - return firstCall; - } - } - - void onRequestDraw(boolean reportNextDraw) { - synchronized (this) { - mReportNextDraw = reportNextDraw; - mOldTargetRect.set(0, 0, 0, 0); - pingRenderLocked(true /* drawImmediate */); - } - } - - /** - * Redraws the background, the caption and the system inset backgrounds if something changed. - * - * @param newBounds The window bounds which needs to be drawn. - * @param fullscreen Whether the window is currently drawing in fullscreen. - */ - private void redrawLocked(Rect newBounds, boolean fullscreen) { - - // Make sure that the other thread has already prepared the render draw calls for the - // content. If any size is 0, we have to wait for it to be drawn first. - if (mLastContentWidth == 0 || mLastContentHeight == 0) { - return; - } - - // Content may not be drawn at the surface origin, so we want to keep the offset when we're - // resizing it. - final int left = mLastXOffset + newBounds.left; - final int top = mLastYOffset + newBounds.top; - final int width = newBounds.width(); - final int height = newBounds.height(); - - mFrameAndBackdropNode.setLeftTopRightBottom(left, top, left + width, top + height); - - // Draw the caption and content backdrops in to our render node. - RecordingCanvas canvas = mFrameAndBackdropNode.beginRecording(width, height); - final Drawable drawable = mUserCaptionBackgroundDrawable != null - ? mUserCaptionBackgroundDrawable : mCaptionBackgroundDrawable; - - if (drawable != null) { - drawable.setBounds(0, 0, left + width, top); - drawable.draw(canvas); - } - - // The backdrop: clear everything with the background. Clipping is done elsewhere. - if (mResizingBackgroundDrawable != null) { - mResizingBackgroundDrawable.setBounds(0, 0, left + width, top + height); - mResizingBackgroundDrawable.draw(canvas); - } - mFrameAndBackdropNode.endRecording(); - - drawColorViews(left, top, width, height, fullscreen); - - // We need to render the node explicitly - mRenderer.drawRenderNode(mFrameAndBackdropNode); - - reportDrawIfNeeded(); - } - - private void drawColorViews(int left, int top, int width, int height, boolean fullscreen) { - if (mSystemBarBackgroundNode == null) { - return; - } - RecordingCanvas canvas = mSystemBarBackgroundNode.beginRecording(width, height); - mSystemBarBackgroundNode.setLeftTopRightBottom(left, top, left + width, top + height); - final int topInset = mSystemBarInsets.top; - if (mStatusBarColor != null) { - mStatusBarColor.setBounds(0, 0, left + width, topInset); - mStatusBarColor.draw(canvas); - } - - // We only want to draw the navigation bar if our window is currently fullscreen because we - // don't want the navigation bar background be moving around when resizing in docked mode. - // However, we need it for the transitions into/out of docked mode. - if (mNavigationBarColor != null && fullscreen) { - DecorView.getNavigationBarRect(width, height, mSystemBarInsets, mTmpRect, 1f); - mNavigationBarColor.setBounds(mTmpRect); - mNavigationBarColor.draw(canvas); - } - mSystemBarBackgroundNode.endRecording(); - mRenderer.drawRenderNode(mSystemBarBackgroundNode); - } - - /** Notify view root that a frame has been drawn by us, if it has requested so. */ - private void reportDrawIfNeeded() { - if (mReportNextDraw) { - if (mDecorView.isAttachedToWindow()) { - mDecorView.getViewRootImpl().reportDrawFinish(); - } - mReportNextDraw = false; - } - } - - /** - * Sends a message to the renderer to wake up and perform the next action which can be - * either the next rendering or the self destruction if mRenderer is null. - * Note: This call must be synchronized. - * - * @param drawImmediate if we should draw immediately instead of scheduling a frame - */ - private void pingRenderLocked(boolean drawImmediate) { - if (mChoreographer != null && !drawImmediate) { - mChoreographer.postFrameCallback(this); - } else { - doFrameUncheckedLocked(); - } - } - - void setUserCaptionBackgroundDrawable(Drawable userCaptionBackgroundDrawable) { - synchronized (this) { - mUserCaptionBackgroundDrawable = userCaptionBackgroundDrawable; - } - } -} diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 74c2325d45a2..55c6ad1d0581 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -57,7 +57,6 @@ import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.RecordingCanvas; import android.graphics.Rect; -import android.graphics.Region; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; @@ -238,11 +237,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private Rect mTempRect; private boolean mWindowResizeCallbacksAdded = false; - private Drawable.Callback mLastBackgroundDrawableCb = null; - private BackdropFrameRenderer mBackdropFrameRenderer = null; private Drawable mOriginalBackgroundDrawable; private Drawable mLastOriginalBackgroundDrawable; - private Drawable mResizingBackgroundDrawable; private BackgroundBlurDrawable mBackgroundBlurDrawable; private BackgroundBlurDrawable mLastBackgroundBlurDrawable; @@ -253,8 +249,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind */ @Nullable private Drawable mPendingWindowBackground; - private Drawable mCaptionBackgroundDrawable; - private Drawable mUserCaptionBackgroundDrawable; String mLogTag = TAG; private final Rect mFloatingInsets = new Rect(); @@ -329,26 +323,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } @Override - public boolean gatherTransparentRegion(Region region) { - boolean statusOpaque = gatherTransparentRegion(mStatusColorViewState, region); - boolean navOpaque = gatherTransparentRegion(mNavigationColorViewState, region); - boolean decorOpaque = super.gatherTransparentRegion(region); - - // combine bools after computation, so each method above always executes - return statusOpaque || navOpaque || decorOpaque; - } - - boolean gatherTransparentRegion(ColorViewState colorViewState, Region region) { - if (colorViewState.view != null && colorViewState.visible && isResizing()) { - // If a visible ColorViewState is in a resizing host DecorView, forcibly register its - // opaque area, since it's drawn by a different root RenderNode. It would otherwise be - // rejected by ViewGroup#gatherTransparentRegion() for the view not being VISIBLE. - return colorViewState.view.gatherTransparentRegion(region); - } - return false; // no opaque area added - } - - @Override public void onDraw(Canvas c) { super.onDraw(c); @@ -977,15 +951,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind updateColorViews(null /* insets */, false /* animate */); } if (drawable != null) { - mResizingBackgroundDrawable = enforceNonTranslucentBackground(drawable, - mWindow.isTranslucent() || mWindow.isShowingWallpaper()); - } else { - mResizingBackgroundDrawable = getResizingBackgroundDrawable( - mWindow.mBackgroundDrawable, mWindow.mBackgroundFallbackDrawable, - mWindow.isTranslucent() || mWindow.isShowingWallpaper()); - } - if (mResizingBackgroundDrawable != null) { - mResizingBackgroundDrawable.getPadding(mBackgroundPadding); + drawable.getPadding(mBackgroundPadding); + } else if (mWindow.mBackgroundDrawable != null) { + mWindow.mBackgroundDrawable.getPadding(mBackgroundPadding); + } else if (mWindow.mBackgroundFallbackDrawable != null) { + mWindow.mBackgroundFallbackDrawable.getPadding(mBackgroundPadding); } else { mBackgroundPadding.setEmpty(); } @@ -1451,7 +1421,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mWindow.getAttributes().flags, force); boolean show = state.attributes.isVisible(state.present, color, mWindow.getAttributes().flags, force); - boolean showView = show && !isResizing() && size > 0; + boolean showView = show && size > 0; boolean visibilityChanged = false; View view = state.view; @@ -1505,7 +1475,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } if (visibilityChanged) { view.animate().cancel(); - if (animate && !isResizing()) { + if (animate) { if (showView) { if (view.getVisibility() != VISIBLE) { view.setVisibility(VISIBLE); @@ -1834,10 +1804,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind // Note that our ViewRootImpl object will not change. getViewRootImpl().addWindowCallbacks(this); mWindowResizeCallbacksAdded = true; - } else if (mBackdropFrameRenderer != null) { - // We are resizing and this call happened due to a configuration change. Tell the - // renderer about it. - mBackdropFrameRenderer.onConfigurationChange(); } updateBackgroundBlurRadius(); @@ -1877,8 +1843,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind st.menu.close(); } - releaseThreadedRenderer(); - if (mWindowResizeCallbacksAdded) { getViewRootImpl().removeWindowCallbacks(this); mWindowResizeCallbacksAdded = false; @@ -2158,14 +2122,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } void onResourcesLoaded(LayoutInflater inflater, int layoutResource) { - if (mBackdropFrameRenderer != null) { - loadBackgroundDrawablesIfNeeded(); - mBackdropFrameRenderer.onResourcesLoaded( - this, mResizingBackgroundDrawable, mCaptionBackgroundDrawable, - mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState), - getCurrentColor(mNavigationColorViewState)); - } - final View root = inflater.inflate(layoutResource, null); // Put it below the color views. @@ -2174,63 +2130,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind initializeElevation(); } - private void loadBackgroundDrawablesIfNeeded() { - if (mResizingBackgroundDrawable == null) { - mResizingBackgroundDrawable = getResizingBackgroundDrawable(mWindow.mBackgroundDrawable, - mWindow.mBackgroundFallbackDrawable, mWindow.isTranslucent() - || mWindow.isShowingWallpaper()); - if (mResizingBackgroundDrawable == null) { - // We shouldn't really get here as the background fallback should be always - // available since it is defaulted by the system. - Log.w(mLogTag, "Failed to find background drawable for PhoneWindow=" + mWindow); - } - } - if (mCaptionBackgroundDrawable == null) { - mCaptionBackgroundDrawable = getContext().getDrawable( - R.drawable.decor_caption_title_focused); - } - if (mResizingBackgroundDrawable != null) { - mLastBackgroundDrawableCb = mResizingBackgroundDrawable.getCallback(); - mResizingBackgroundDrawable.setCallback(null); - } - } - - /** - * Returns the color used to fill areas the app has not rendered content to yet when the - * user is resizing the window of an activity in multi-window mode. - */ - public static Drawable getResizingBackgroundDrawable(@Nullable Drawable backgroundDrawable, - @Nullable Drawable fallbackDrawable, boolean windowTranslucent) { - if (backgroundDrawable != null) { - return enforceNonTranslucentBackground(backgroundDrawable, windowTranslucent); - } - - if (fallbackDrawable != null) { - return enforceNonTranslucentBackground(fallbackDrawable, windowTranslucent); - } - return new ColorDrawable(Color.BLACK); - } - - /** - * Enforces a drawable to be non-translucent to act as a background if needed, i.e. if the - * window is not translucent. - */ - private static Drawable enforceNonTranslucentBackground(Drawable drawable, - boolean windowTranslucent) { - if (!windowTranslucent && drawable instanceof ColorDrawable) { - ColorDrawable colorDrawable = (ColorDrawable) drawable; - int color = colorDrawable.getColor(); - if (Color.alpha(color) != 255) { - ColorDrawable copy = (ColorDrawable) colorDrawable.getConstantState().newDrawable() - .mutate(); - copy.setColor( - Color.argb(255, Color.red(color), Color.green(color), Color.blue(color))); - return copy; - } - } - return drawable; - } - void clearContentView() { for (int i = getChildCount() - 1; i >= 0; i--) { View v = getChildAt(i); @@ -2243,21 +2142,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void onWindowSizeIsChanging(Rect newBounds, boolean fullscreen, Rect systemInsets, - Rect stableInsets) { - if (mBackdropFrameRenderer != null) { - mBackdropFrameRenderer.setTargetRect(newBounds, fullscreen, systemInsets); - } - } + Rect stableInsets) {} @Override public void onWindowDragResizeStart(Rect initialBounds, boolean fullscreen, Rect systemInsets, Rect stableInsets) { if (mWindow.isDestroyed()) { // If the owner's window is gone, we should not be able to come here anymore. - releaseThreadedRenderer(); - return; - } - if (mBackdropFrameRenderer != null) { return; } getViewRootImpl().requestInvalidateRootRenderNode(); @@ -2265,28 +2156,23 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void onWindowDragResizeEnd() { - releaseThreadedRenderer(); updateColorViews(null /* insets */, false); getViewRootImpl().requestInvalidateRootRenderNode(); } @Override public boolean onContentDrawn(int offsetX, int offsetY, int sizeX, int sizeY) { - if (mBackdropFrameRenderer == null) { - return false; - } - return mBackdropFrameRenderer.onContentDrawn(offsetX, offsetY, sizeX, sizeY); + return false; } @Override public void onRequestDraw(boolean reportNextDraw) { - if (mBackdropFrameRenderer != null) { - mBackdropFrameRenderer.onRequestDraw(reportNextDraw); - } else if (reportNextDraw) { - // If render thread is gone, just report immediately. - if (isAttachedToWindow()) { - getViewRootImpl().reportDrawFinish(); - } + if (!reportNextDraw) { + return; + } + // If render thread is gone, just report immediately. + if (isAttachedToWindow()) { + getViewRootImpl().reportDrawFinish(); } } @@ -2307,25 +2193,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mLegacyNavigationBarBackgroundPaint); } - /** Release the renderer thread which is usually done when the user stops resizing. */ - private void releaseThreadedRenderer() { - if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) { - mResizingBackgroundDrawable.setCallback(mLastBackgroundDrawableCb); - mLastBackgroundDrawableCb = null; - } - - if (mBackdropFrameRenderer != null) { - mBackdropFrameRenderer.releaseRenderer(); - mBackdropFrameRenderer = null; - // Bring the shadow back. - updateElevation(); - } - } - - private boolean isResizing() { - return mBackdropFrameRenderer != null; - } - /** * The elevation gets set for the first time and the framework needs to be informed that * the surface layer gets created with the shadow size in mind. @@ -2348,7 +2215,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind final boolean wasAdjustedForStack = mElevationAdjustedForStack; // Do not use a shadow when we are in resizing mode (mBackdropFrameRenderer not null) // since the shadow is bound to the content size and not the target size. - if ((windowingMode == WINDOWING_MODE_FREEFORM) && !isResizing()) { + if (windowingMode == WINDOWING_MODE_FREEFORM) { elevation = hasWindowFocus() ? DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP : DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP; // Add a maximum shadow height value to the top level view. @@ -2367,16 +2234,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind // Don't change the elevation if we didn't previously adjust it for the stack it was in // or it didn't change. - if ((wasAdjustedForStack || mElevationAdjustedForStack) - && getElevation() != elevation) { - if (!isResizing()) { - mWindow.setElevation(elevation); - } else { - // Just suppress the shadow when resizing, don't adjust surface insets because it'll - // cause a flicker when drag resize for freeform window starts. #onContentDrawn() - // will compensate the offset when passing to BackdropFrameRenderer. - setElevation(elevation); - } + if ((wasAdjustedForStack || mElevationAdjustedForStack) && getElevation() != elevation) { + mWindow.setElevation(elevation); } } @@ -2390,16 +2249,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind getResources().getDisplayMetrics()); } - /** - * Provide an override of the caption background drawable. - */ - void setUserCaptionBackgroundDrawable(Drawable drawable) { - mUserCaptionBackgroundDrawable = drawable; - if (mBackdropFrameRenderer != null) { - mBackdropFrameRenderer.setUserCaptionBackgroundDrawable(drawable); - } - } - private static String getTitleSuffix(WindowManager.LayoutParams params) { if (params == null) { return ""; diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index a091e19e1985..2194c897ff0d 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -4055,7 +4055,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public void setResizingCaptionDrawable(Drawable drawable) { - mDecor.setUserCaptionBackgroundDrawable(drawable); + // TODO(b/333724879): Deprecate this public API. The new caption in WM shell allows the app + // content to draw behind it directly if requested. } @Override diff --git a/core/res/res/drawable/decor_caption_title.xml b/core/res/res/drawable/decor_caption_title.xml deleted file mode 100644 index 591605d33fae..000000000000 --- a/core/res/res/drawable/decor_caption_title.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_window_focused="true" - android:drawable="@drawable/decor_caption_title_focused" /> - <item android:drawable="@drawable/decor_caption_title_unfocused" /> -</selector> diff --git a/core/res/res/drawable/decor_caption_title_focused.xml b/core/res/res/drawable/decor_caption_title_focused.xml deleted file mode 100644 index 7d1c23052bdb..000000000000 --- a/core/res/res/drawable/decor_caption_title_focused.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<shape android:shape="rectangle" - android:tintMode="multiply" - android:tint="#D8D8D8" - xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Fading the primary color to 85% blackness --> - <solid android:color="?android:attr/colorPrimary" /> -</shape> diff --git a/core/res/res/drawable/decor_caption_title_unfocused.xml b/core/res/res/drawable/decor_caption_title_unfocused.xml deleted file mode 100644 index 2846d8ca6baa..000000000000 --- a/core/res/res/drawable/decor_caption_title_unfocused.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<shape android:shape="rectangle" - android:tintMode="multiply" - android:tint="#F2F2F2" - xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Fading the primary color to 95% blackness --> - <solid android:color="?android:attr/colorPrimary"/> -</shape> diff --git a/core/res/res/drawable/decor_close_button_dark.xml b/core/res/res/drawable/decor_close_button_dark.xml deleted file mode 100644 index 950e4fdaba0b..000000000000 --- a/core/res/res/drawable/decor_close_button_dark.xml +++ /dev/null @@ -1,31 +0,0 @@ -<!-- -Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="32.0dp" - android:height="32.0dp" - android:viewportWidth="32.0" - android:viewportHeight="32.0" - android:tint="@color/decor_button_dark_color" - > - <group android:scaleX="0.5" - android:scaleY="0.5" - android:translateX="8.0" - android:translateY="8.0" > - <path - android:fillColor="@color/white" - android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/> - </group> -</vector> diff --git a/core/res/res/drawable/decor_close_button_light.xml b/core/res/res/drawable/decor_close_button_light.xml deleted file mode 100644 index d75cd25b23ee..000000000000 --- a/core/res/res/drawable/decor_close_button_light.xml +++ /dev/null @@ -1,31 +0,0 @@ -<!-- -Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="32.0dp" - android:height="32.0dp" - android:viewportWidth="32.0" - android:viewportHeight="32.0" - android:tint="@color/decor_button_light_color" - > - <group android:scaleX="0.5" - android:scaleY="0.5" - android:translateX="8.0" - android:translateY="8.0" > - <path - android:fillColor="@color/white" - android:pathData="M6.9,4.0l-2.9,2.9 9.1,9.1 -9.1,9.200001 2.9,2.799999 9.1,-9.1 9.1,9.1 2.9,-2.799999 -9.1,-9.200001 9.1,-9.1 -2.9,-2.9 -9.1,9.2z"/> - </group> -</vector> diff --git a/core/res/res/drawable/decor_maximize_button_dark.xml b/core/res/res/drawable/decor_maximize_button_dark.xml deleted file mode 100644 index 619b460ce787..000000000000 --- a/core/res/res/drawable/decor_maximize_button_dark.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="32.0dp" - android:height="32.0dp" - android:viewportWidth="32.0" - android:viewportHeight="32.0" - android:tint="@color/decor_button_dark_color" - > - <group android:scaleX="0.5" - android:scaleY="0.5" - android:translateX="8.0" - android:translateY="8.0" > - <path - android:fillColor="@color/white" - android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/> - <path - android:fillColor="@color/white" - android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/> - </group> -</vector> - - diff --git a/core/res/res/drawable/decor_maximize_button_light.xml b/core/res/res/drawable/decor_maximize_button_light.xml deleted file mode 100644 index 5b55fd20ee87..000000000000 --- a/core/res/res/drawable/decor_maximize_button_light.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!-- -Copyright (C) 2015 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="32.0dp" - android:height="32.0dp" - android:viewportWidth="32.0" - android:viewportHeight="32.0" - android:tint="@color/decor_button_light_color" - > - <group android:scaleX="0.5" - android:scaleY="0.5" - android:translateX="8.0" - android:translateY="8.0" > - <path - android:fillColor="@color/white" - android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/> - <path - android:fillColor="@color/white" - android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/> - </group> -</vector> diff --git a/core/res/res/layout/decor_caption.xml b/core/res/res/layout/decor_caption.xml deleted file mode 100644 index 02467369825d..000000000000 --- a/core/res/res/layout/decor_caption.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -** -** Copyright 2015, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<com.android.internal.widget.DecorCaptionView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:descendantFocusability="beforeDescendants" > - <LinearLayout - android:id="@+id/caption" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="end" - android:background="@drawable/decor_caption_title" - android:focusable="false" - android:descendantFocusability="blocksDescendants" > - <Button - android:id="@+id/maximize_window" - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_margin="5dp" - android:padding="4dp" - android:layout_gravity="center_vertical|end" - android:contentDescription="@string/maximize_button_text" - android:background="@drawable/decor_maximize_button_dark" /> - <Button - android:id="@+id/close_window" - android:layout_width="32dp" - android:layout_height="32dp" - android:layout_margin="5dp" - android:padding="4dp" - android:layout_gravity="center_vertical|end" - android:contentDescription="@string/close_button_text" - android:background="@drawable/decor_close_button_dark" /> - </LinearLayout> -</com.android.internal.widget.DecorCaptionView> diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml index 97e753e2bdeb..575573cb0ffb 100644 --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -136,11 +136,6 @@ <item>@color/search_url_text_material_light</item> </array> - <array name="preloaded_freeform_multi_window_drawables"> - <item>@drawable/decor_maximize_button_dark</item> - <item>@drawable/decor_maximize_button_light</item> - </array> - <!-- Used in LocalePicker --> <string-array translatable="false" name="special_locale_codes"> <!-- http://b/17150708 - ensure that the list of languages says "Arabic" diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 1112e6587961..0706b32dfbb5 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4200,13 +4200,6 @@ automatically try to pair with it when the device exits tablet mode. --> <string translatable="false" name="config_packagedKeyboardName"></string> - <!-- The device supports freeform window management. Windows have title bars and can be moved - and resized. If you set this to true, you also need to add - PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT feature to your device specification. - The duplication is necessary, because this information is used before the features are - available to the system.--> - <bool name="config_freeformWindowManagement">false</bool> - <!-- If set, this will force all windows to draw the status bar background, including the apps that have not requested doing so (via the WindowManager.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag). --> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index a956a43b0441..87141c790f0c 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -5991,8 +5991,6 @@ <string name="accessibility_system_action_dpad_right_label">Dpad Right</string> <!-- Label for Dpad center action [CHAR LIMIT=NONE] --> <string name="accessibility_system_action_dpad_center_label">Dpad Center</string> - <!-- Accessibility description of caption view --> - <string name="accessibility_freeform_caption">Caption bar of <xliff:g id="app_name">%1$s</xliff:g>.</string> <!-- Text to tell the user that a package has been forced by themselves in the RESTRICTED bucket. [CHAR LIMIT=NONE] --> <string name="as_app_forced_to_restricted_bucket"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 0d2fd1ca8bf6..bb73934450c9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -402,7 +402,6 @@ <java-symbol type="bool" name="config_supportMicNearUltrasound" /> <java-symbol type="bool" name="config_supportSpeakerNearUltrasound" /> <java-symbol type="bool" name="config_supportAudioSourceUnprocessed" /> - <java-symbol type="bool" name="config_freeformWindowManagement" /> <java-symbol type="bool" name="config_supportsBubble" /> <java-symbol type="bool" name="config_supportsMultiWindow" /> <java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" /> @@ -1266,7 +1265,6 @@ <java-symbol type="array" name="networkAttributes" /> <java-symbol type="array" name="preloaded_color_state_lists" /> <java-symbol type="array" name="preloaded_drawables" /> - <java-symbol type="array" name="preloaded_freeform_multi_window_drawables" /> <java-symbol type="array" name="sim_colors" /> <java-symbol type="array" name="special_locale_codes" /> <java-symbol type="array" name="special_locale_names" /> @@ -2470,16 +2468,6 @@ <!-- From Phone --> <java-symbol type="bool" name="config_built_in_sip_phone" /> - <java-symbol type="id" name="maximize_window" /> - <java-symbol type="id" name="close_window" /> - <java-symbol type="layout" name="decor_caption" /> - <java-symbol type="drawable" name="decor_caption_title_focused" /> - <java-symbol type="drawable" name="decor_close_button_dark" /> - <java-symbol type="drawable" name="decor_close_button_light" /> - <java-symbol type="drawable" name="decor_maximize_button_dark" /> - <java-symbol type="drawable" name="decor_maximize_button_light" /> - <java-symbol type="color" name="decor_button_dark_color" /> - <java-symbol type="color" name="decor_button_light_color" /> <java-symbol type="array" name="unloggable_phone_numbers" /> <!-- From TelephonyProvider --> @@ -4470,8 +4458,6 @@ <java-symbol type="string" name="accessibility_system_action_dpad_right_label" /> <java-symbol type="string" name="accessibility_system_action_dpad_center_label" /> - <java-symbol type="string" name="accessibility_freeform_caption" /> - <!-- For Wide Color Gamut --> <java-symbol type="bool" name="config_enableWcgMode" /> |