Merge "Fixing background jump when closing a widget" into tm-qpr-dev
This commit is contained in:
commit
031ee4cbcb
5 files changed
+105
-40
No files matched your search
@@ -364,13 +364,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
// before our internal listeners.
|
// before our internal listeners.
|
||||||
mLauncher.getStateManager().setCurrentAnimation(anim);
|
mLauncher.getStateManager().setCurrentAnimation(anim);
|
||||||
|
|
||||||
final int rotationChange = getRotationChange(appTargets);
|
|
||||||
// Note: the targetBounds are relative to the launcher
|
// Note: the targetBounds are relative to the launcher
|
||||||
int startDelay = getSingleFrameMs(mLauncher);
|
int startDelay = getSingleFrameMs(mLauncher);
|
||||||
Rect windowTargetBounds = getWindowTargetBounds(appTargets, rotationChange);
|
Animator windowAnimator = getOpeningWindowAnimators(
|
||||||
Animator windowAnimator = getOpeningWindowAnimators(v, appTargets, wallpaperTargets,
|
v, appTargets, wallpaperTargets, nonAppTargets, launcherClosing);
|
||||||
nonAppTargets, windowTargetBounds, areAllTargetsTranslucent(appTargets),
|
|
||||||
rotationChange);
|
|
||||||
windowAnimator.setStartDelay(startDelay);
|
windowAnimator.setStartDelay(startDelay);
|
||||||
anim.play(windowAnimator);
|
anim.play(windowAnimator);
|
||||||
if (launcherClosing) {
|
if (launcherClosing) {
|
||||||
@@ -384,17 +381,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
launcherContentAnimator.second.run();
|
launcherContentAnimator.second.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
anim.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animator animation) {
|
|
||||||
mLauncher.addOnResumeCallback(() ->
|
|
||||||
ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
|
|
||||||
MULTI_PROPERTY_VALUE,
|
|
||||||
mLauncher.getStateManager().getState().getDepth(
|
|
||||||
mLauncher)).start());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,23 +389,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
@NonNull LauncherAppWidgetHostView v,
|
@NonNull LauncherAppWidgetHostView v,
|
||||||
@NonNull RemoteAnimationTarget[] appTargets,
|
@NonNull RemoteAnimationTarget[] appTargets,
|
||||||
@NonNull RemoteAnimationTarget[] wallpaperTargets,
|
@NonNull RemoteAnimationTarget[] wallpaperTargets,
|
||||||
@NonNull RemoteAnimationTarget[] nonAppTargets) {
|
@NonNull RemoteAnimationTarget[] nonAppTargets,
|
||||||
|
boolean launcherClosing) {
|
||||||
mLauncher.getStateManager().setCurrentAnimation(anim);
|
mLauncher.getStateManager().setCurrentAnimation(anim);
|
||||||
|
anim.play(getOpeningWindowAnimatorsForWidget(
|
||||||
Rect windowTargetBounds = getWindowTargetBounds(appTargets, getRotationChange(appTargets));
|
v, appTargets, wallpaperTargets, nonAppTargets, launcherClosing));
|
||||||
anim.play(getOpeningWindowAnimatorsForWidget(v, appTargets, wallpaperTargets, nonAppTargets,
|
|
||||||
windowTargetBounds, areAllTargetsTranslucent(appTargets)));
|
|
||||||
|
|
||||||
anim.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
|
||||||
public void onAnimationStart(Animator animation) {
|
|
||||||
mLauncher.addOnResumeCallback(() ->
|
|
||||||
ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
|
|
||||||
MULTI_PROPERTY_VALUE,
|
|
||||||
mLauncher.getStateManager().getState().getDepth(
|
|
||||||
mLauncher)).start());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -657,7 +631,11 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
RemoteAnimationTarget[] appTargets,
|
RemoteAnimationTarget[] appTargets,
|
||||||
RemoteAnimationTarget[] wallpaperTargets,
|
RemoteAnimationTarget[] wallpaperTargets,
|
||||||
RemoteAnimationTarget[] nonAppTargets,
|
RemoteAnimationTarget[] nonAppTargets,
|
||||||
Rect windowTargetBounds, boolean appTargetsAreTranslucent, int rotationChange) {
|
boolean launcherClosing) {
|
||||||
|
int rotationChange = getRotationChange(appTargets);
|
||||||
|
Rect windowTargetBounds = getWindowTargetBounds(appTargets, rotationChange);
|
||||||
|
boolean appTargetsAreTranslucent = areAllTargetsTranslucent(appTargets);
|
||||||
|
|
||||||
RectF launcherIconBounds = new RectF();
|
RectF launcherIconBounds = new RectF();
|
||||||
FloatingIconView floatingView = FloatingIconView.getFloatingIconView(mLauncher, v,
|
FloatingIconView floatingView = FloatingIconView.getFloatingIconView(mLauncher, v,
|
||||||
!appTargetsAreTranslucent, launcherIconBounds, true /* isOpening */);
|
!appTargetsAreTranslucent, launcherIconBounds, true /* isOpening */);
|
||||||
@@ -853,7 +831,6 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
.setShadowRadius(mShadowRadius.value);
|
.setShadowRadius(mShadowRadius.value);
|
||||||
} else if (target.mode == MODE_CLOSING) {
|
} else if (target.mode == MODE_CLOSING) {
|
||||||
if (target.localBounds != null) {
|
if (target.localBounds != null) {
|
||||||
final Rect localBounds = target.localBounds;
|
|
||||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||||
} else {
|
} else {
|
||||||
tmpPos.set(target.position.x, target.position.y);
|
tmpPos.set(target.position.x, target.position.y);
|
||||||
@@ -898,7 +875,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
|
|
||||||
// If app targets are translucent, do not animate the background as it causes a visible
|
// If app targets are translucent, do not animate the background as it causes a visible
|
||||||
// flicker when it resets itself at the end of its animation.
|
// flicker when it resets itself at the end of its animation.
|
||||||
if (appTargetsAreTranslucent) {
|
if (appTargetsAreTranslucent || !launcherClosing) {
|
||||||
animatorSet.play(appAnimator);
|
animatorSet.play(appAnimator);
|
||||||
} else {
|
} else {
|
||||||
animatorSet.playTogether(appAnimator, getBackgroundAnimator());
|
animatorSet.playTogether(appAnimator, getBackgroundAnimator());
|
||||||
@@ -909,8 +886,10 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
private Animator getOpeningWindowAnimatorsForWidget(LauncherAppWidgetHostView v,
|
private Animator getOpeningWindowAnimatorsForWidget(LauncherAppWidgetHostView v,
|
||||||
RemoteAnimationTarget[] appTargets,
|
RemoteAnimationTarget[] appTargets,
|
||||||
RemoteAnimationTarget[] wallpaperTargets,
|
RemoteAnimationTarget[] wallpaperTargets,
|
||||||
RemoteAnimationTarget[] nonAppTargets, Rect windowTargetBounds,
|
RemoteAnimationTarget[] nonAppTargets, boolean launcherClosing) {
|
||||||
boolean appTargetsAreTranslucent) {
|
Rect windowTargetBounds = getWindowTargetBounds(appTargets, getRotationChange(appTargets));
|
||||||
|
boolean appTargetsAreTranslucent = areAllTargetsTranslucent(appTargets);
|
||||||
|
|
||||||
final RectF widgetBackgroundBounds = new RectF();
|
final RectF widgetBackgroundBounds = new RectF();
|
||||||
final Rect appWindowCrop = new Rect();
|
final Rect appWindowCrop = new Rect();
|
||||||
final Matrix matrix = new Matrix();
|
final Matrix matrix = new Matrix();
|
||||||
@@ -1037,7 +1016,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
|
|
||||||
// If app targets are translucent, do not animate the background as it causes a visible
|
// If app targets are translucent, do not animate the background as it causes a visible
|
||||||
// flicker when it resets itself at the end of its animation.
|
// flicker when it resets itself at the end of its animation.
|
||||||
if (appTargetsAreTranslucent) {
|
if (appTargetsAreTranslucent || !launcherClosing) {
|
||||||
animatorSet.play(appAnimator);
|
animatorSet.play(appAnimator);
|
||||||
} else {
|
} else {
|
||||||
animatorSet.playTogether(appAnimator, getBackgroundAnimator());
|
animatorSet.playTogether(appAnimator, getBackgroundAnimator());
|
||||||
@@ -1717,7 +1696,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
|||||||
final boolean skipFirstFrame;
|
final boolean skipFirstFrame;
|
||||||
if (launchingFromWidget) {
|
if (launchingFromWidget) {
|
||||||
composeWidgetLaunchAnimator(anim, (LauncherAppWidgetHostView) mV, appTargets,
|
composeWidgetLaunchAnimator(anim, (LauncherAppWidgetHostView) mV, appTargets,
|
||||||
wallpaperTargets, nonAppTargets);
|
wallpaperTargets, nonAppTargets, launcherClosing);
|
||||||
addCujInstrumentation(
|
addCujInstrumentation(
|
||||||
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_WIDGET);
|
anim, InteractionJankMonitorWrapper.CUJ_APP_LAUNCH_FROM_WIDGET);
|
||||||
skipFirstFrame = true;
|
skipFirstFrame = true;
|
||||||
|
|||||||
@@ -61,6 +61,17 @@
|
|||||||
android:resource="@xml/appwidget_with_config"/>
|
android:resource="@xml/appwidget_with_config"/>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="com.android.launcher3.testcomponent.AppWidgetWithDialog"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="With Dialog">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/appwidget_no_config"/>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.android.launcher3.testcomponent.AppWidgetDynamicColors"
|
android:name="com.android.launcher3.testcomponent.AppWidgetDynamicColors"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
@@ -276,7 +287,17 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
<activity
|
||||||
|
android:name="com.android.launcher3.testcomponent.DialogTestActivity"
|
||||||
|
android:label="Dialog Activity"
|
||||||
|
android:theme="@android:style/Theme.Dialog"
|
||||||
|
android:exported="true"
|
||||||
|
android:taskAffinity="com.android.launcher3.testcomponent.Affinity2">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
|
<activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
|
||||||
android:label="ImeTestActivity"
|
android:label="ImeTestActivity"
|
||||||
android:icon="@drawable/test_theme_icon"
|
android:icon="@drawable/test_theme_icon"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#FF0000FF"
|
android:background="#FF0000FF"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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.launcher3.testcomponent;
|
||||||
|
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.appwidget.AppWidgetManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple app widget with shows a dialog on clicking.
|
||||||
|
*/
|
||||||
|
public class AppWidgetWithDialog extends AppWidgetNoConfig {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||||
|
int layoutId = context.getResources().getIdentifier(
|
||||||
|
"test_layout_appwidget_blue", "layout", context.getPackageName());
|
||||||
|
RemoteViews views = new RemoteViews(context.getPackageName(), layoutId);
|
||||||
|
|
||||||
|
PendingIntent pi = PendingIntent.getActivity(context, 0,
|
||||||
|
new Intent(context, DialogTestActivity.class), PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
views.setOnClickPendingIntent(android.R.id.content, pi);
|
||||||
|
AppWidgetManager.getInstance(context).updateAppWidget(appWidgetIds, views);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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.launcher3.testcomponent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension of BaseTestingActivity with a Dialog theme
|
||||||
|
*/
|
||||||
|
public class DialogTestActivity extends BaseTestingActivity {}
|
||||||
Reference in new issue
Block a user