Merge "Override DreamActivity enter and exit animations" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1255a2d20b
@@ -21,6 +21,8 @@ import android.app.Activity;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Activity used by the {@link DreamService} to draw screensaver content
|
* The Activity used by the {@link DreamService} to draw screensaver content
|
||||||
* on the screen. This activity runs in dream application's process, but is started by a
|
* on the screen. This activity runs in dream application's process, but is started by a
|
||||||
@@ -56,8 +58,20 @@ public class DreamActivity extends Activity {
|
|||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onActivityCreated(this);
|
callback.onActivityCreated(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
// Hide all insets (nav bar, status bar, etc) when the dream is showing
|
// Hide all insets (nav bar, status bar, etc) when the dream is showing
|
||||||
getWindow().getInsetsController().hide(WindowInsets.Type.systemBars());
|
getWindow().getInsetsController().hide(WindowInsets.Type.systemBars());
|
||||||
|
overridePendingTransition(R.anim.dream_activity_open_enter,
|
||||||
|
R.anim.dream_activity_open_exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishAndRemoveTask() {
|
||||||
|
super.finishAndRemoveTask();
|
||||||
|
overridePendingTransition(0, R.anim.dream_activity_close_exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1052,7 +1052,6 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
mWindow.requestFeature(Window.FEATURE_NO_TITLE);
|
mWindow.requestFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
WindowManager.LayoutParams lp = mWindow.getAttributes();
|
WindowManager.LayoutParams lp = mWindow.getAttributes();
|
||||||
lp.windowAnimations = com.android.internal.R.style.Animation_Dream;
|
|
||||||
lp.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
lp.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||||
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
|
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
|
||||||
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||||
|
|||||||
23
core/res/res/anim/dream_activity_close_exit.xml
Normal file
23
core/res/res/anim/dream_activity_close_exit.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:duration="100" />
|
||||||
|
|
||||||
26
core/res/res/anim/dream_activity_open_enter.xml
Normal file
26
core/res/res/anim/dream_activity_open_enter.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- During this animation we keep the previous activity on the screen
|
||||||
|
using a noop animation for it (dream_activity_open_exit). The duration of
|
||||||
|
those two has to be the same. -->
|
||||||
|
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromAlpha="0.0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="1000" />
|
||||||
|
|
||||||
25
core/res/res/anim/dream_activity_open_exit.xml
Normal file
25
core/res/res/anim/dream_activity_open_exit.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/* Copyright 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- A noop animation to keep the previous activity alive during the dream
|
||||||
|
enter animation. The duration should match the duration of the
|
||||||
|
dream_activity_open_enter animation. -->
|
||||||
|
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="1000" />
|
||||||
@@ -248,12 +248,6 @@ please see styles_device_defaults.xml.
|
|||||||
<item name="windowExitAnimation">@anim/fast_fade_out</item>
|
<item name="windowExitAnimation">@anim/fast_fade_out</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Window animations for screen savers. {@hide} -->
|
|
||||||
<style name="Animation.Dream">
|
|
||||||
<item name="windowEnterAnimation">@anim/slow_fade_in</item>
|
|
||||||
<item name="windowExitAnimation">@anim/fast_fade_out</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- Status Bar Styles -->
|
<!-- Status Bar Styles -->
|
||||||
<style name="TextAppearance.StatusBar">
|
<style name="TextAppearance.StatusBar">
|
||||||
<item name="textAppearance">?attr/textAppearanceSmall</item>
|
<item name="textAppearance">?attr/textAppearanceSmall</item>
|
||||||
|
|||||||
@@ -1580,7 +1580,6 @@
|
|||||||
<java-symbol type="style" name="Animation.Tooltip" />
|
<java-symbol type="style" name="Animation.Tooltip" />
|
||||||
<java-symbol type="style" name="Animation.TypingFilter" />
|
<java-symbol type="style" name="Animation.TypingFilter" />
|
||||||
<java-symbol type="style" name="Animation.TypingFilterRestore" />
|
<java-symbol type="style" name="Animation.TypingFilterRestore" />
|
||||||
<java-symbol type="style" name="Animation.Dream" />
|
|
||||||
<java-symbol type="style" name="Theme.DeviceDefault.Dialog.Alert" />
|
<java-symbol type="style" name="Theme.DeviceDefault.Dialog.Alert" />
|
||||||
<java-symbol type="style" name="Theme.DeviceDefault.Light.Dialog.Alert" />
|
<java-symbol type="style" name="Theme.DeviceDefault.Light.Dialog.Alert" />
|
||||||
<java-symbol type="style" name="Theme.Dialog.Alert" />
|
<java-symbol type="style" name="Theme.Dialog.Alert" />
|
||||||
@@ -1825,6 +1824,9 @@
|
|||||||
<java-symbol type="anim" name="rotation_animation_jump_exit" />
|
<java-symbol type="anim" name="rotation_animation_jump_exit" />
|
||||||
<java-symbol type="anim" name="rotation_animation_xfade_exit" />
|
<java-symbol type="anim" name="rotation_animation_xfade_exit" />
|
||||||
<java-symbol type="anim" name="rotation_animation_enter" />
|
<java-symbol type="anim" name="rotation_animation_enter" />
|
||||||
|
<java-symbol type="anim" name="dream_activity_open_exit" />
|
||||||
|
<java-symbol type="anim" name="dream_activity_open_enter" />
|
||||||
|
<java-symbol type="anim" name="dream_activity_close_exit" />
|
||||||
<java-symbol type="array" name="config_autoBrightnessButtonBacklightValues" />
|
<java-symbol type="array" name="config_autoBrightnessButtonBacklightValues" />
|
||||||
<java-symbol type="array" name="config_autoBrightnessKeyboardBacklightValues" />
|
<java-symbol type="array" name="config_autoBrightnessKeyboardBacklightValues" />
|
||||||
<java-symbol type="array" name="config_autoBrightnessLcdBacklightValues" />
|
<java-symbol type="array" name="config_autoBrightnessLcdBacklightValues" />
|
||||||
|
|||||||
@@ -704,6 +704,7 @@ please see themes_device_defaults.xml.
|
|||||||
<style name="Theme.Dream">
|
<style name="Theme.Dream">
|
||||||
<item name="windowBackground">@color/black</item>
|
<item name="windowBackground">@color/black</item>
|
||||||
<item name="windowDisablePreview">true</item>
|
<item name="windowDisablePreview">true</item>
|
||||||
|
<item name="windowActivityTransitions">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Default theme for dialog windows and activities (on API level 10 and lower),
|
<!-- Default theme for dialog windows and activities (on API level 10 and lower),
|
||||||
|
|||||||
@@ -166,19 +166,13 @@ public class AppTransitionController {
|
|||||||
// done behind a dream window.
|
// done behind a dream window.
|
||||||
final ArraySet<Integer> activityTypes = collectActivityTypes(mDisplayContent.mOpeningApps,
|
final ArraySet<Integer> activityTypes = collectActivityTypes(mDisplayContent.mOpeningApps,
|
||||||
mDisplayContent.mClosingApps, mDisplayContent.mChangingContainers);
|
mDisplayContent.mClosingApps, mDisplayContent.mChangingContainers);
|
||||||
final boolean allowAnimations = mDisplayContent.getDisplayPolicy().allowAppAnimationsLw();
|
final ActivityRecord animLpActivity = findAnimLayoutParamsToken(transit, activityTypes);
|
||||||
final ActivityRecord animLpActivity = allowAnimations
|
final ActivityRecord topOpeningApp =
|
||||||
? findAnimLayoutParamsToken(transit, activityTypes)
|
getTopApp(mDisplayContent.mOpeningApps, false /* ignoreHidden */);
|
||||||
: null;
|
final ActivityRecord topClosingApp =
|
||||||
final ActivityRecord topOpeningApp = allowAnimations
|
getTopApp(mDisplayContent.mClosingApps, false /* ignoreHidden */);
|
||||||
? getTopApp(mDisplayContent.mOpeningApps, false /* ignoreHidden */)
|
final ActivityRecord topChangingApp =
|
||||||
: null;
|
getTopApp(mDisplayContent.mChangingContainers, false /* ignoreHidden */);
|
||||||
final ActivityRecord topClosingApp = allowAnimations
|
|
||||||
? getTopApp(mDisplayContent.mClosingApps, false /* ignoreHidden */)
|
|
||||||
: null;
|
|
||||||
final ActivityRecord topChangingApp = allowAnimations
|
|
||||||
? getTopApp(mDisplayContent.mChangingContainers, false /* ignoreHidden */)
|
|
||||||
: null;
|
|
||||||
final WindowManager.LayoutParams animLp = getAnimLp(animLpActivity);
|
final WindowManager.LayoutParams animLp = getAnimLp(animLpActivity);
|
||||||
overrideWithRemoteAnimationIfSet(animLpActivity, transit, activityTypes);
|
overrideWithRemoteAnimationIfSet(animLpActivity, transit, activityTypes);
|
||||||
|
|
||||||
|
|||||||
@@ -3154,16 +3154,6 @@ public class DisplayPolicy {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if it is okay to perform animations for an app transition
|
|
||||||
* that is about to occur. You may return false for this if, for example,
|
|
||||||
* the dream window is currently displayed so the switch should happen
|
|
||||||
* immediately.
|
|
||||||
*/
|
|
||||||
public boolean allowAppAnimationsLw() {
|
|
||||||
return !mShowingDream;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void requestTransientBars(WindowState swipeTarget) {
|
private void requestTransientBars(WindowState swipeTarget) {
|
||||||
if (!mService.mPolicy.isUserSetupComplete()) {
|
if (!mService.mPolicy.isUserSetupComplete()) {
|
||||||
// Swipe-up for navigation bar is disabled during setup
|
// Swipe-up for navigation bar is disabled during setup
|
||||||
|
|||||||
Reference in New Issue
Block a user