Loading libs/WindowManager/Shell/res/values-watch/dimen.xml 0 → 100644 +22 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 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. --> <resources> <!-- The acceptable area ratio of fg icon area/bg icon area, i.e. (48 X 48) / (72 x 72) --> <item type="dimen" format="float" name="splash_icon_enlarge_foreground_threshold">0.44</item> <!-- Scaling factor applied to splash icons without provided background i.e. (60 / 48) --> <item type="dimen" format="float" name="splash_icon_no_background_scale_factor">1.25</item> </resources> libs/WindowManager/Shell/res/values/dimen.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -421,4 +421,9 @@ <!-- The height of the area at the top of the screen where a freeform task will transition to <!-- The height of the area at the top of the screen where a freeform task will transition to fullscreen if dragged until the top bound of the task is within the area. --> fullscreen if dragged until the top bound of the task is within the area. --> <dimen name="desktop_mode_transition_area_height">16dp</dimen> <dimen name="desktop_mode_transition_area_height">16dp</dimen> <!-- The acceptable area ratio of fg icon area/bg icon area, i.e. (72 x 72) / (108 x 108) --> <item type="dimen" format="float" name="splash_icon_enlarge_foreground_threshold">0.44</item> <!-- Scaling factor applied to splash icons without provided background i.e. (192 / 160) --> <item type="dimen" format="float" name="splash_icon_no_background_scale_factor">1.2</item> </resources> </resources> libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +10 −19 Original line number Original line Diff line number Diff line Loading @@ -112,28 +112,15 @@ public class SplashscreenContentDrawer { */ */ static final long MAX_ANIMATION_DURATION = MINIMAL_ANIMATION_DURATION + TIME_WINDOW_DURATION; static final long MAX_ANIMATION_DURATION = MINIMAL_ANIMATION_DURATION + TIME_WINDOW_DURATION; // The acceptable area ratio of foreground_icon_area/background_icon_area, if there is an // icon which it's non-transparent foreground area is similar to it's background area, then // do not enlarge the foreground drawable. // For example, an icon with the foreground 108*108 opaque pixels and it's background // also 108*108 pixels, then do not enlarge this icon if only need to show foreground icon. private static final float ENLARGE_FOREGROUND_ICON_THRESHOLD = (72f * 72f) / (108f * 108f); /** * If the developer doesn't specify a background for the icon, we slightly scale it up. * * The background is either manually specified in the theme or the Adaptive Icon * background is used if it's different from the window background. */ private static final float NO_BACKGROUND_SCALE = 192f / 160; private final Context mContext; private final Context mContext; private final HighResIconProvider mHighResIconProvider; private final HighResIconProvider mHighResIconProvider; private int mIconSize; private int mIconSize; private int mDefaultIconSize; private int mDefaultIconSize; private int mBrandingImageWidth; private int mBrandingImageWidth; private int mBrandingImageHeight; private int mBrandingImageHeight; private int mMainWindowShiftLength; private int mMainWindowShiftLength; private float mEnlargeForegroundIconThreshold; private float mNoBackgroundScale; private int mLastPackageContextConfigHash; private int mLastPackageContextConfigHash; private final TransactionPool mTransactionPool; private final TransactionPool mTransactionPool; private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); Loading Loading @@ -336,6 +323,10 @@ public class SplashscreenContentDrawer { com.android.wm.shell.R.dimen.starting_surface_brand_image_height); com.android.wm.shell.R.dimen.starting_surface_brand_image_height); mMainWindowShiftLength = mContext.getResources().getDimensionPixelSize( mMainWindowShiftLength = mContext.getResources().getDimensionPixelSize( com.android.wm.shell.R.dimen.starting_surface_exit_animation_window_shift_length); com.android.wm.shell.R.dimen.starting_surface_exit_animation_window_shift_length); mEnlargeForegroundIconThreshold = mContext.getResources().getFloat( com.android.wm.shell.R.dimen.splash_icon_enlarge_foreground_threshold); mNoBackgroundScale = mContext.getResources().getFloat( com.android.wm.shell.R.dimen.splash_icon_no_background_scale_factor); } } /** /** Loading Loading @@ -604,14 +595,14 @@ public class SplashscreenContentDrawer { // There is no background below the icon, so scale the icon up // There is no background below the icon, so scale the icon up if (mTmpAttrs.mIconBgColor == Color.TRANSPARENT if (mTmpAttrs.mIconBgColor == Color.TRANSPARENT || mTmpAttrs.mIconBgColor == mThemeColor) { || mTmpAttrs.mIconBgColor == mThemeColor) { mFinalIconSize *= NO_BACKGROUND_SCALE; mFinalIconSize *= mNoBackgroundScale; } } createIconDrawable(iconDrawable, false /* legacy */, false /* loadInDetail */); createIconDrawable(iconDrawable, false /* legacy */, false /* loadInDetail */); } else { } else { final float iconScale = (float) mIconSize / (float) mDefaultIconSize; final float iconScale = (float) mIconSize / (float) mDefaultIconSize; final int densityDpi = mContext.getResources().getConfiguration().densityDpi; final int densityDpi = mContext.getResources().getConfiguration().densityDpi; final int scaledIconDpi = final int scaledIconDpi = (int) (0.5f + iconScale * densityDpi * NO_BACKGROUND_SCALE); (int) (0.5f + iconScale * densityDpi * mNoBackgroundScale); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getIcon"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getIcon"); iconDrawable = mHighResIconProvider.getIcon( iconDrawable = mHighResIconProvider.getIcon( mActivityInfo, densityDpi, scaledIconDpi); mActivityInfo, densityDpi, scaledIconDpi); Loading Loading @@ -693,8 +684,8 @@ public class SplashscreenContentDrawer { // Reference AdaptiveIcon description, outer is 108 and inner is 72, so we // Reference AdaptiveIcon description, outer is 108 and inner is 72, so we // scale by 192/160 if we only draw adaptiveIcon's foreground. // scale by 192/160 if we only draw adaptiveIcon's foreground. final float noBgScale = final float noBgScale = iconColor.mFgNonTranslucentRatio < ENLARGE_FOREGROUND_ICON_THRESHOLD iconColor.mFgNonTranslucentRatio < mEnlargeForegroundIconThreshold ? NO_BACKGROUND_SCALE : 1f; ? mNoBackgroundScale : 1f; // Using AdaptiveIconDrawable here can help keep the shape consistent with the // Using AdaptiveIconDrawable here can help keep the shape consistent with the // current settings. // current settings. mFinalIconSize = (int) (0.5f + mIconSize * noBgScale); mFinalIconSize = (int) (0.5f + mIconSize * noBgScale); Loading Loading
libs/WindowManager/Shell/res/values-watch/dimen.xml 0 → 100644 +22 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 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. --> <resources> <!-- The acceptable area ratio of fg icon area/bg icon area, i.e. (48 X 48) / (72 x 72) --> <item type="dimen" format="float" name="splash_icon_enlarge_foreground_threshold">0.44</item> <!-- Scaling factor applied to splash icons without provided background i.e. (60 / 48) --> <item type="dimen" format="float" name="splash_icon_no_background_scale_factor">1.25</item> </resources>
libs/WindowManager/Shell/res/values/dimen.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -421,4 +421,9 @@ <!-- The height of the area at the top of the screen where a freeform task will transition to <!-- The height of the area at the top of the screen where a freeform task will transition to fullscreen if dragged until the top bound of the task is within the area. --> fullscreen if dragged until the top bound of the task is within the area. --> <dimen name="desktop_mode_transition_area_height">16dp</dimen> <dimen name="desktop_mode_transition_area_height">16dp</dimen> <!-- The acceptable area ratio of fg icon area/bg icon area, i.e. (72 x 72) / (108 x 108) --> <item type="dimen" format="float" name="splash_icon_enlarge_foreground_threshold">0.44</item> <!-- Scaling factor applied to splash icons without provided background i.e. (192 / 160) --> <item type="dimen" format="float" name="splash_icon_no_background_scale_factor">1.2</item> </resources> </resources>
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +10 −19 Original line number Original line Diff line number Diff line Loading @@ -112,28 +112,15 @@ public class SplashscreenContentDrawer { */ */ static final long MAX_ANIMATION_DURATION = MINIMAL_ANIMATION_DURATION + TIME_WINDOW_DURATION; static final long MAX_ANIMATION_DURATION = MINIMAL_ANIMATION_DURATION + TIME_WINDOW_DURATION; // The acceptable area ratio of foreground_icon_area/background_icon_area, if there is an // icon which it's non-transparent foreground area is similar to it's background area, then // do not enlarge the foreground drawable. // For example, an icon with the foreground 108*108 opaque pixels and it's background // also 108*108 pixels, then do not enlarge this icon if only need to show foreground icon. private static final float ENLARGE_FOREGROUND_ICON_THRESHOLD = (72f * 72f) / (108f * 108f); /** * If the developer doesn't specify a background for the icon, we slightly scale it up. * * The background is either manually specified in the theme or the Adaptive Icon * background is used if it's different from the window background. */ private static final float NO_BACKGROUND_SCALE = 192f / 160; private final Context mContext; private final Context mContext; private final HighResIconProvider mHighResIconProvider; private final HighResIconProvider mHighResIconProvider; private int mIconSize; private int mIconSize; private int mDefaultIconSize; private int mDefaultIconSize; private int mBrandingImageWidth; private int mBrandingImageWidth; private int mBrandingImageHeight; private int mBrandingImageHeight; private int mMainWindowShiftLength; private int mMainWindowShiftLength; private float mEnlargeForegroundIconThreshold; private float mNoBackgroundScale; private int mLastPackageContextConfigHash; private int mLastPackageContextConfigHash; private final TransactionPool mTransactionPool; private final TransactionPool mTransactionPool; private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); Loading Loading @@ -336,6 +323,10 @@ public class SplashscreenContentDrawer { com.android.wm.shell.R.dimen.starting_surface_brand_image_height); com.android.wm.shell.R.dimen.starting_surface_brand_image_height); mMainWindowShiftLength = mContext.getResources().getDimensionPixelSize( mMainWindowShiftLength = mContext.getResources().getDimensionPixelSize( com.android.wm.shell.R.dimen.starting_surface_exit_animation_window_shift_length); com.android.wm.shell.R.dimen.starting_surface_exit_animation_window_shift_length); mEnlargeForegroundIconThreshold = mContext.getResources().getFloat( com.android.wm.shell.R.dimen.splash_icon_enlarge_foreground_threshold); mNoBackgroundScale = mContext.getResources().getFloat( com.android.wm.shell.R.dimen.splash_icon_no_background_scale_factor); } } /** /** Loading Loading @@ -604,14 +595,14 @@ public class SplashscreenContentDrawer { // There is no background below the icon, so scale the icon up // There is no background below the icon, so scale the icon up if (mTmpAttrs.mIconBgColor == Color.TRANSPARENT if (mTmpAttrs.mIconBgColor == Color.TRANSPARENT || mTmpAttrs.mIconBgColor == mThemeColor) { || mTmpAttrs.mIconBgColor == mThemeColor) { mFinalIconSize *= NO_BACKGROUND_SCALE; mFinalIconSize *= mNoBackgroundScale; } } createIconDrawable(iconDrawable, false /* legacy */, false /* loadInDetail */); createIconDrawable(iconDrawable, false /* legacy */, false /* loadInDetail */); } else { } else { final float iconScale = (float) mIconSize / (float) mDefaultIconSize; final float iconScale = (float) mIconSize / (float) mDefaultIconSize; final int densityDpi = mContext.getResources().getConfiguration().densityDpi; final int densityDpi = mContext.getResources().getConfiguration().densityDpi; final int scaledIconDpi = final int scaledIconDpi = (int) (0.5f + iconScale * densityDpi * NO_BACKGROUND_SCALE); (int) (0.5f + iconScale * densityDpi * mNoBackgroundScale); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getIcon"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getIcon"); iconDrawable = mHighResIconProvider.getIcon( iconDrawable = mHighResIconProvider.getIcon( mActivityInfo, densityDpi, scaledIconDpi); mActivityInfo, densityDpi, scaledIconDpi); Loading Loading @@ -693,8 +684,8 @@ public class SplashscreenContentDrawer { // Reference AdaptiveIcon description, outer is 108 and inner is 72, so we // Reference AdaptiveIcon description, outer is 108 and inner is 72, so we // scale by 192/160 if we only draw adaptiveIcon's foreground. // scale by 192/160 if we only draw adaptiveIcon's foreground. final float noBgScale = final float noBgScale = iconColor.mFgNonTranslucentRatio < ENLARGE_FOREGROUND_ICON_THRESHOLD iconColor.mFgNonTranslucentRatio < mEnlargeForegroundIconThreshold ? NO_BACKGROUND_SCALE : 1f; ? mNoBackgroundScale : 1f; // Using AdaptiveIconDrawable here can help keep the shape consistent with the // Using AdaptiveIconDrawable here can help keep the shape consistent with the // current settings. // current settings. mFinalIconSize = (int) (0.5f + mIconSize * noBgScale); mFinalIconSize = (int) (0.5f + mIconSize * noBgScale); Loading