Merge changes I037517d9,Ic603b271,I47fe530f into sc-qpr1-dev

* changes:
  Update task transition animations
  Show color layer in task animations when requested
  Add color layer to TaskDisplayArea for animations
This commit is contained in:
Pablo Gamito
2021-09-21 22:30:21 +00:00
committed by Android (Google) Code Review
18 changed files with 262 additions and 483 deletions

View File

@@ -18,19 +18,10 @@
--> -->
<!-- This should be kept in sync with task_open_enter.xml --> <!-- This should be kept in sync with task_open_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:hasRoundedCorners="true"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top"> android:zAdjustment="top"
android:hasRoundedCorners="true"
<alpha android:background="@color/overview_background">
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="-105%" android:fromXDelta="-105%"
@@ -38,36 +29,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
<!-- To keep the thumbnail around longer and fade out the thumbnail --> <!-- To keep the thumbnail around longer and fade out the thumbnail -->
<alpha android:fromAlpha="1.0" android:toAlpha="0" <alpha android:fromAlpha="1.0" android:toAlpha="0"

View File

@@ -14,20 +14,10 @@
~ limitations under the License ~ limitations under the License
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="105%" android:fromXDelta="105%"
@@ -35,34 +25,7 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
</set> </set>

View File

@@ -15,19 +15,9 @@
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1.0"
android:toAlpha="1"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="283"/>
<translate <translate
android:fromXDelta="0" android:fromXDelta="0"
@@ -35,22 +25,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0"
android:toXScale="0.95"
android:fromYScale="1.0"
android:toYScale="0.95"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<!-- This is needed to keep the animation running while task_open_enter completes --> <!-- This is needed to keep the animation running while task_open_enter completes -->
<alpha <alpha

View File

@@ -16,20 +16,10 @@
<!-- This should in sync with task_open_enter_cross_profile_apps.xml --> <!-- This should in sync with task_open_enter_cross_profile_apps.xml -->
<!-- This should in sync with cross_profile_apps_thumbnail_enter.xml --> <!-- This should in sync with cross_profile_apps_thumbnail_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="-105%" android:fromXDelta="-105%"
@@ -37,34 +27,7 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
</set>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
</set>

View File

@@ -16,20 +16,10 @@
--> -->
<!-- This should in sync with task_open_enter.xml --> <!-- This should in sync with task_open_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="-105%" android:fromXDelta="-105%"
@@ -37,36 +27,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
<!-- To keep the transition around longer for the thumbnail, should be kept in sync with <!-- To keep the transition around longer for the thumbnail, should be kept in sync with
cross_profile_apps_thumbmail.xml --> cross_profile_apps_thumbmail.xml -->
@@ -75,4 +38,4 @@
android:toAlpha="1.0" android:toAlpha="1.0"
android:startOffset="717" android:startOffset="717"
android:duration="200"/> android:duration="200"/>
</set> </set>

View File

@@ -15,19 +15,9 @@
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1.0"
android:toAlpha="1"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="283"/>
<translate <translate
android:fromXDelta="0" android:fromXDelta="0"
@@ -35,22 +25,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0"
android:toXScale="0.95"
android:fromYScale="1.0"
android:toYScale="0.95"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<!-- This is needed to keep the animation running while task_open_enter completes --> <!-- This is needed to keep the animation running while task_open_enter completes -->
<alpha <alpha

View File

@@ -19,18 +19,9 @@
<!-- This should be kept in sync with task_open_enter.xml --> <!-- This should be kept in sync with task_open_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:zAdjustment="top"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="105%" android:fromXDelta="105%"
@@ -38,36 +29,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
<!-- To keep the thumbnail around longer and fade out the thumbnail --> <!-- To keep the thumbnail around longer and fade out the thumbnail -->
<alpha android:fromAlpha="1.0" android:toAlpha="0" <alpha android:fromAlpha="1.0" android:toAlpha="0"

View File

@@ -16,20 +16,10 @@
*/ */
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="-105%" android:fromXDelta="-105%"
@@ -37,34 +27,7 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
</set> </set>

View File

@@ -17,19 +17,9 @@
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1.0"
android:toAlpha="1"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="283"/>
<translate <translate
android:fromXDelta="0" android:fromXDelta="0"
@@ -37,22 +27,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0"
android:toXScale="0.95"
android:fromYScale="1.0"
android:toYScale="0.95"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<!-- This is needed to keep the animation running while task_open_enter completes --> <!-- This is needed to keep the animation running while task_open_enter completes -->
<alpha <alpha

View File

@@ -15,23 +15,13 @@
** limitations under the License. ** limitations under the License.
*/ */
--> -->
<!-- This should in sync with task_open_enter_cross_profile_apps.xml --> <!-- This should be kept in sync with task_open_enter_cross_profile_apps.xml -->
<!-- This should in sync with cross_profile_apps_thumbnail_enter.xml --> <!-- This should be kept in sync with cross_profile_apps_thumbnail_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="105%" android:fromXDelta="105%"
@@ -39,34 +29,7 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
</set> </set>

View File

@@ -18,20 +18,10 @@
--> -->
<!-- This should in sync with task_open_enter.xml --> <!-- This should in sync with task_open_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:zAdjustment="top" android:zAdjustment="top"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="217"/>
<translate <translate
android:fromXDelta="105%" android:fromXDelta="105%"
@@ -39,36 +29,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0526"
android:toXScale="1"
android:fromYScale="1.0526"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<scale
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/fast_out_slow_in"
android:startOffset="283"
android:duration="317"/>
<!-- To keep the transition around longer for the thumbnail, should be kept in sync with <!-- To keep the transition around longer for the thumbnail, should be kept in sync with
cross_profile_apps_thumbmail.xml --> cross_profile_apps_thumbmail.xml -->

View File

@@ -17,19 +17,9 @@
--> -->
<set xmlns:android="http://schemas.android.com/apk/res/android" <set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" android:shareInterpolator="false"
android:hasRoundedCorners="true" android:hasRoundedCorners="true"
android:showWallpaper="true"> android:background="@color/overview_background">
<alpha
android:fromAlpha="1.0"
android:toAlpha="1"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@interpolator/linear"
android:startOffset="67"
android:duration="283"/>
<translate <translate
android:fromXDelta="0" android:fromXDelta="0"
@@ -37,22 +27,9 @@
android:fillEnabled="true" android:fillEnabled="true"
android:fillBefore="true" android:fillBefore="true"
android:fillAfter="true" android:fillAfter="true"
android:interpolator="@interpolator/aggressive_ease" android:interpolator="@interpolator/fast_out_extra_slow_in"
android:startOffset="50" android:startOffset="0"
android:duration="383"/> android:duration="500"/>
<scale
android:fromXScale="1.0"
android:toXScale="0.95"
android:fromYScale="1.0"
android:toYScale="0.95"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@interpolator/fast_out_slow_in"
android:duration="283"/>
<!-- This is needed to keep the animation running while task_open_enter completes --> <!-- This is needed to keep the animation running while task_open_enter completes -->
<alpha <alpha

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 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:color="@android:color/system_neutral2_500" android:lStar="87" />
</selector>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2021 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:color="@android:color/system_neutral2_500" android:lStar="35" />
</selector>

View File

@@ -33,4 +33,6 @@
<color name="call_notification_answer_color">#5DBA80</color> <color name="call_notification_answer_color">#5DBA80</color>
<color name="personal_apps_suspension_notification_color">#8AB4F8</color> <color name="personal_apps_suspension_notification_color">#8AB4F8</color>
<color name="overview_background">@color/overview_background_dark</color>
</resources> </resources>

View File

@@ -59,11 +59,30 @@ class SurfaceAnimator {
@VisibleForTesting @VisibleForTesting
final Animatable mAnimatable; final Animatable mAnimatable;
private final OnAnimationFinishedCallback mInnerAnimationFinishedCallback; private final OnAnimationFinishedCallback mInnerAnimationFinishedCallback;
/**
* Static callback to run on all animations started through this SurfaceAnimator
* when an animation on a Surface is finished or cancelled without restart.
*/
@VisibleForTesting @VisibleForTesting
@Nullable @Nullable
final OnAnimationFinishedCallback mStaticAnimationFinishedCallback; final OnAnimationFinishedCallback mStaticAnimationFinishedCallback;
/**
* Callback unique to each animation (i.e. AnimationAdapter). To be run when an animation on a
* Surface is finished or cancelled without restart.
*/
@Nullable @Nullable
private OnAnimationFinishedCallback mAnimationFinishedCallback; private OnAnimationFinishedCallback mSurfaceAnimationFinishedCallback;
/**
* The callback is triggered after the SurfaceAnimator sends a cancel call to the underlying
* AnimationAdapter.
* NOTE: Must be called wherever we call onAnimationCancelled on mAnimation.
*/
@Nullable
private Runnable mAnimationCancelledCallback;
private boolean mAnimationStartDelayed; private boolean mAnimationStartDelayed;
/** /**
@@ -100,7 +119,7 @@ class SurfaceAnimator {
return; return;
} }
final OnAnimationFinishedCallback animationFinishCallback = final OnAnimationFinishedCallback animationFinishCallback =
mAnimationFinishedCallback; mSurfaceAnimationFinishedCallback;
reset(mAnimatable.getPendingTransaction(), true /* destroyLeash */); reset(mAnimatable.getPendingTransaction(), true /* destroyLeash */);
if (staticAnimationFinishedCallback != null) { if (staticAnimationFinishedCallback != null) {
staticAnimationFinishedCallback.onAnimationFinished(type, anim); staticAnimationFinishedCallback.onAnimationFinished(type, anim);
@@ -130,15 +149,19 @@ class SurfaceAnimator {
* This is important as it will start with the leash hidden or visible before * This is important as it will start with the leash hidden or visible before
* handing it to the component that is responsible to run the animation. * handing it to the component that is responsible to run the animation.
* @param animationFinishedCallback The callback being triggered when the animation finishes. * @param animationFinishedCallback The callback being triggered when the animation finishes.
* @param animationCancelledCallback The callback is triggered after the SurfaceAnimator sends a
* cancel call to the underlying AnimationAdapter.
*/ */
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden, void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@AnimationType int type, @AnimationType int type,
@Nullable OnAnimationFinishedCallback animationFinishedCallback, @Nullable OnAnimationFinishedCallback animationFinishedCallback,
@Nullable Runnable animationCancelledCallback,
@Nullable SurfaceFreezer freezer) { @Nullable SurfaceFreezer freezer) {
cancelAnimation(t, true /* restarting */, true /* forwardCancel */); cancelAnimation(t, true /* restarting */, true /* forwardCancel */);
mAnimation = anim; mAnimation = anim;
mAnimationType = type; mAnimationType = type;
mAnimationFinishedCallback = animationFinishedCallback; mSurfaceAnimationFinishedCallback = animationFinishedCallback;
mAnimationCancelledCallback = animationCancelledCallback;
final SurfaceControl surface = mAnimatable.getSurfaceControl(); final SurfaceControl surface = mAnimatable.getSurfaceControl();
if (surface == null) { if (surface == null) {
Slog.w(TAG, "Unable to start animation, surface is null or no children."); Slog.w(TAG, "Unable to start animation, surface is null or no children.");
@@ -160,15 +183,10 @@ class SurfaceAnimator {
mAnimation.startAnimation(mLeash, t, type, mInnerAnimationFinishedCallback); mAnimation.startAnimation(mLeash, t, type, mInnerAnimationFinishedCallback);
} }
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@AnimationType int type,
@Nullable OnAnimationFinishedCallback animationFinishedCallback) {
startAnimation(t, anim, hidden, type, animationFinishedCallback, null /* freezer */);
}
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden, void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@AnimationType int type) { @AnimationType int type) {
startAnimation(t, anim, hidden, type, null /* animationFinishedCallback */); startAnimation(t, anim, hidden, type, null /* animationFinishedCallback */,
null /* animationCancelledCallback */, null /* freezer */);
} }
/** /**
@@ -278,7 +296,8 @@ class SurfaceAnimator {
mLeash = from.mLeash; mLeash = from.mLeash;
mAnimation = from.mAnimation; mAnimation = from.mAnimation;
mAnimationType = from.mAnimationType; mAnimationType = from.mAnimationType;
mAnimationFinishedCallback = from.mAnimationFinishedCallback; mSurfaceAnimationFinishedCallback = from.mSurfaceAnimationFinishedCallback;
mAnimationCancelledCallback = from.mAnimationCancelledCallback;
// Cancel source animation, but don't let animation runner cancel the animation. // Cancel source animation, but don't let animation runner cancel the animation.
from.cancelAnimation(t, false /* restarting */, false /* forwardCancel */); from.cancelAnimation(t, false /* restarting */, false /* forwardCancel */);
@@ -306,11 +325,16 @@ class SurfaceAnimator {
final SurfaceControl leash = mLeash; final SurfaceControl leash = mLeash;
final AnimationAdapter animation = mAnimation; final AnimationAdapter animation = mAnimation;
final @AnimationType int animationType = mAnimationType; final @AnimationType int animationType = mAnimationType;
final OnAnimationFinishedCallback animationFinishedCallback = mAnimationFinishedCallback; final OnAnimationFinishedCallback animationFinishedCallback =
mSurfaceAnimationFinishedCallback;
final Runnable animationCancelledCallback = mAnimationCancelledCallback;
reset(t, false); reset(t, false);
if (animation != null) { if (animation != null) {
if (!mAnimationStartDelayed && forwardCancel) { if (!mAnimationStartDelayed && forwardCancel) {
animation.onAnimationCancelled(leash); animation.onAnimationCancelled(leash);
if (animationCancelledCallback != null) {
animationCancelledCallback.run();
}
} }
if (!restarting) { if (!restarting) {
if (mStaticAnimationFinishedCallback != null) { if (mStaticAnimationFinishedCallback != null) {
@@ -335,7 +359,7 @@ class SurfaceAnimator {
private void reset(Transaction t, boolean destroyLeash) { private void reset(Transaction t, boolean destroyLeash) {
mService.mAnimationTransferMap.remove(mAnimation); mService.mAnimationTransferMap.remove(mAnimation);
mAnimation = null; mAnimation = null;
mAnimationFinishedCallback = null; mSurfaceAnimationFinishedCallback = null;
mAnimationType = ANIMATION_TYPE_NONE; mAnimationType = ANIMATION_TYPE_NONE;
if (mLeash == null) { if (mLeash == null) {
return; return;

View File

@@ -42,6 +42,9 @@ import static com.android.server.wm.Task.TASK_VISIBILITY_VISIBLE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ROOT_TASK; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ROOT_TASK;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static java.lang.Integer.MIN_VALUE;
import android.annotation.ColorInt;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.ActivityOptions; import android.app.ActivityOptions;
import android.app.WindowConfiguration; import android.app.WindowConfiguration;
@@ -79,6 +82,22 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
DisplayContent mDisplayContent; DisplayContent mDisplayContent;
/**
* A color layer that serves as a solid color background to certain animations.
*/
private SurfaceControl mColorBackgroundLayer;
/**
* This counter is used to make sure we don't prematurely clear the background color in the
* case that background color animations are interleaved.
* NOTE: The last set color will remain until the counter is reset to 0, which means that an
* animation background color may sometime remain after the animation has finished through an
* animation with a different background color if an animation starts after and ends before
* another where both set different background colors. However, this is not a concern as
* currently all task animation backgrounds are the same color.
*/
private int mColorLayerCounter = 0;
/** /**
* A control placed at the appropriate level for transitions to occur. * A control placed at the appropriate level for transitions to occur.
*/ */
@@ -961,6 +980,11 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) { void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
if (getParent() != null) { if (getParent() != null) {
super.onParentChanged(newParent, oldParent, () -> { super.onParentChanged(newParent, oldParent, () -> {
mColorBackgroundLayer = makeChildSurface(null)
.setColorLayer()
.setName("colorBackgroundLayer")
.setCallsite("TaskDisplayArea.onParentChanged")
.build();
mAppAnimationLayer = makeChildSurface(null) mAppAnimationLayer = makeChildSurface(null)
.setName("animationLayer") .setName("animationLayer")
.setCallsite("TaskDisplayArea.onParentChanged") .setCallsite("TaskDisplayArea.onParentChanged")
@@ -977,6 +1001,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
.setName("splitScreenDividerAnchor") .setName("splitScreenDividerAnchor")
.setCallsite("TaskDisplayArea.onParentChanged") .setCallsite("TaskDisplayArea.onParentChanged")
.build(); .build();
getSyncTransaction() getSyncTransaction()
.show(mAppAnimationLayer) .show(mAppAnimationLayer)
.show(mBoostedAppAnimationLayer) .show(mBoostedAppAnimationLayer)
@@ -986,11 +1011,13 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
} else { } else {
super.onParentChanged(newParent, oldParent); super.onParentChanged(newParent, oldParent);
mWmService.mTransactionFactory.get() mWmService.mTransactionFactory.get()
.remove(mColorBackgroundLayer)
.remove(mAppAnimationLayer) .remove(mAppAnimationLayer)
.remove(mBoostedAppAnimationLayer) .remove(mBoostedAppAnimationLayer)
.remove(mHomeAppAnimationLayer) .remove(mHomeAppAnimationLayer)
.remove(mSplitScreenDividerAnchor) .remove(mSplitScreenDividerAnchor)
.apply(); .apply();
mColorBackgroundLayer = null;
mAppAnimationLayer = null; mAppAnimationLayer = null;
mBoostedAppAnimationLayer = null; mBoostedAppAnimationLayer = null;
mHomeAppAnimationLayer = null; mHomeAppAnimationLayer = null;
@@ -998,6 +1025,39 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
} }
} }
void setBackgroundColor(@ColorInt int color) {
if (mColorBackgroundLayer == null) {
return;
}
float r = ((color >> 16) & 0xff) / 255.0f;
float g = ((color >> 8) & 0xff) / 255.0f;
float b = ((color >> 0) & 0xff) / 255.0f;
float a = ((color >> 24) & 0xff) / 255.0f;
mColorLayerCounter++;
getPendingTransaction().setLayer(mColorBackgroundLayer, MIN_VALUE)
.setColor(mColorBackgroundLayer, new float[]{r, g, b})
.setAlpha(mColorBackgroundLayer, a)
.setWindowCrop(mColorBackgroundLayer, getSurfaceWidth(), getSurfaceHeight())
.setPosition(mColorBackgroundLayer, 0, 0)
.show(mColorBackgroundLayer);
scheduleAnimation();
}
void clearBackgroundColor() {
mColorLayerCounter--;
// Only clear the color layer if we have received the same amounts of clear as set
// requests.
if (mColorLayerCounter == 0) {
getPendingTransaction().hide(mColorBackgroundLayer);
scheduleAnimation();
}
}
@Override @Override
void migrateToNewSurfaceControl(SurfaceControl.Transaction t) { void migrateToNewSurfaceControl(SurfaceControl.Transaction t) {
super.migrateToNewSurfaceControl(t); super.migrateToNewSurfaceControl(t);
@@ -1006,6 +1066,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
} }
// As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces. // As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
t.reparent(mColorBackgroundLayer, mSurfaceControl);
t.reparent(mAppAnimationLayer, mSurfaceControl); t.reparent(mAppAnimationLayer, mSurfaceControl);
t.reparent(mBoostedAppAnimationLayer, mSurfaceControl); t.reparent(mBoostedAppAnimationLayer, mSurfaceControl);
t.reparent(mHomeAppAnimationLayer, mSurfaceControl); t.reparent(mHomeAppAnimationLayer, mSurfaceControl);
@@ -2148,6 +2209,11 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
mPreferredTopFocusableRootTask = null; mPreferredTopFocusableRootTask = null;
} }
@Override
TaskDisplayArea getTaskDisplayArea() {
return this;
}
@Override @Override
boolean isTaskDisplayArea() { boolean isTaskDisplayArea() {
return true; return true;

View File

@@ -850,6 +850,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return parent != null ? parent.getRootDisplayArea() : null; return parent != null ? parent.getRootDisplayArea() : null;
} }
@Nullable
TaskDisplayArea getTaskDisplayArea() {
WindowContainer parent = getParent();
return parent != null ? parent.getTaskDisplayArea() : null;
}
boolean isAttached() { boolean isAttached() {
return getDisplayArea() != null; return getDisplayArea() != null;
} }
@@ -2495,10 +2501,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
* some point but the meaning is too weird to work for all containers. * some point but the meaning is too weird to work for all containers.
* @param type The type of animation defined as {@link AnimationType}. * @param type The type of animation defined as {@link AnimationType}.
* @param animationFinishedCallback The callback being triggered when the animation finishes. * @param animationFinishedCallback The callback being triggered when the animation finishes.
* @param animationCancelledCallback The callback is triggered after the SurfaceAnimator sends a
* cancel call to the underlying AnimationAdapter.
*/ */
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden, void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@AnimationType int type, @AnimationType int type,
@Nullable OnAnimationFinishedCallback animationFinishedCallback) { @Nullable OnAnimationFinishedCallback animationFinishedCallback,
@Nullable Runnable animationCancelledCallback) {
if (DEBUG_ANIM) { if (DEBUG_ANIM) {
Slog.v(TAG, "Starting animation on " + this + ": type=" + type + ", anim=" + anim); Slog.v(TAG, "Starting animation on " + this + ": type=" + type + ", anim=" + anim);
} }
@@ -2506,7 +2515,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// TODO: This should use isVisible() but because isVisible has a really weird meaning at // TODO: This should use isVisible() but because isVisible has a really weird meaning at
// the moment this doesn't work for all animatable window containers. // the moment this doesn't work for all animatable window containers.
mSurfaceAnimator.startAnimation(t, anim, hidden, type, animationFinishedCallback, mSurfaceAnimator.startAnimation(t, anim, hidden, type, animationFinishedCallback,
mSurfaceFreezer); animationCancelledCallback, mSurfaceFreezer);
}
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@AnimationType int type,
@Nullable OnAnimationFinishedCallback animationFinishedCallback) {
startAnimation(t, anim, hidden, type, animationFinishedCallback,
null /* adapterAnimationCancelledCallback */);
} }
void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden, void startAnimation(Transaction t, AnimationAdapter anim, boolean hidden,
@@ -2714,8 +2730,27 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
if (sources != null) { if (sources != null) {
mSurfaceAnimationSources.addAll(sources); mSurfaceAnimationSources.addAll(sources);
} }
TaskDisplayArea taskDisplayArea = getTaskDisplayArea();
int backgroundColor = adapter.getBackgroundColor();
boolean shouldSetBackgroundColor = taskDisplayArea != null && backgroundColor != 0;
if (shouldSetBackgroundColor) {
taskDisplayArea.setBackgroundColor(backgroundColor);
}
Runnable clearColorBackground = () -> {
if (shouldSetBackgroundColor) {
taskDisplayArea.clearBackgroundColor();
}
};
startAnimation(getPendingTransaction(), adapter, !isVisible(), startAnimation(getPendingTransaction(), adapter, !isVisible(),
ANIMATION_TYPE_APP_TRANSITION); ANIMATION_TYPE_APP_TRANSITION,
(type, anim) -> clearColorBackground.run(),
clearColorBackground);
if (adapter.getShowWallpaper()) { if (adapter.getShowWallpaper()) {
getDisplayContent().pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; getDisplayContent().pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
} }