Merge "Don't apply some custom animation cases from app in WindowStateAnimator" into qt-dev
am: 5e2e01e982
Change-Id: If89b18ab90e024bd4b4e7edd0bcd9b268a771760
This commit is contained in:
@@ -87,6 +87,7 @@ import android.content.res.Configuration;
|
|||||||
import android.content.res.ResourceId;
|
import android.content.res.ResourceId;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.Resources.NotFoundException;
|
import android.content.res.Resources.NotFoundException;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@@ -258,6 +259,8 @@ public class AppTransition implements Dump {
|
|||||||
private final boolean mGridLayoutRecentsEnabled;
|
private final boolean mGridLayoutRecentsEnabled;
|
||||||
private final boolean mLowRamRecentsEnabled;
|
private final boolean mLowRamRecentsEnabled;
|
||||||
|
|
||||||
|
private final int mDefaultWindowAnimationStyleResId;
|
||||||
|
|
||||||
private RemoteAnimationController mRemoteAnimationController;
|
private RemoteAnimationController mRemoteAnimationController;
|
||||||
|
|
||||||
final Handler mHandler;
|
final Handler mHandler;
|
||||||
@@ -305,6 +308,12 @@ public class AppTransition implements Dump {
|
|||||||
* mContext.getResources().getDisplayMetrics().density);
|
* mContext.getResources().getDisplayMetrics().density);
|
||||||
mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
|
mGridLayoutRecentsEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
|
||||||
mLowRamRecentsEnabled = ActivityManager.isLowRamDeviceStatic();
|
mLowRamRecentsEnabled = ActivityManager.isLowRamDeviceStatic();
|
||||||
|
|
||||||
|
final TypedArray windowStyle = mContext.getTheme().obtainStyledAttributes(
|
||||||
|
com.android.internal.R.styleable.Window);
|
||||||
|
mDefaultWindowAnimationStyleResId = windowStyle.getResourceId(
|
||||||
|
com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
|
||||||
|
windowStyle.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isTransitionSet() {
|
boolean isTransitionSet() {
|
||||||
@@ -523,6 +532,25 @@ public class AppTransition implements Dump {
|
|||||||
return redoLayout;
|
return redoLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
int getDefaultWindowAnimationStyleResId() {
|
||||||
|
return mDefaultWindowAnimationStyleResId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns window animation style ID from {@link LayoutParams} or from system in some cases */
|
||||||
|
@VisibleForTesting
|
||||||
|
int getAnimationStyleResId(@NonNull LayoutParams lp) {
|
||||||
|
int resId = lp.windowAnimations;
|
||||||
|
if (lp.type == LayoutParams.TYPE_APPLICATION_STARTING) {
|
||||||
|
// Note that we don't want application to customize starting window animation.
|
||||||
|
// Since this window is specific for displaying while app starting,
|
||||||
|
// application should not change its animation directly.
|
||||||
|
// In this case, it will use system resource to get default animation.
|
||||||
|
resId = mDefaultWindowAnimationStyleResId;
|
||||||
|
}
|
||||||
|
return resId;
|
||||||
|
}
|
||||||
|
|
||||||
private AttributeCache.Entry getCachedAnimations(LayoutParams lp) {
|
private AttributeCache.Entry getCachedAnimations(LayoutParams lp) {
|
||||||
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
|
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
|
||||||
+ (lp != null ? lp.packageName : null)
|
+ (lp != null ? lp.packageName : null)
|
||||||
@@ -532,7 +560,7 @@ public class AppTransition implements Dump {
|
|||||||
// application resources. It is nice to avoid loading application
|
// application resources. It is nice to avoid loading application
|
||||||
// resources if we can.
|
// resources if we can.
|
||||||
String packageName = lp.packageName != null ? lp.packageName : "android";
|
String packageName = lp.packageName != null ? lp.packageName : "android";
|
||||||
int resId = lp.windowAnimations;
|
int resId = getAnimationStyleResId(lp);
|
||||||
if ((resId&0xFF000000) == 0x01000000) {
|
if ((resId&0xFF000000) == 0x01000000) {
|
||||||
packageName = "android";
|
packageName = "android";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
|
|||||||
import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
|
import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
|
||||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
|
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
||||||
|
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
|
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
|
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
|
||||||
import static android.view.WindowManager.TRANSIT_NONE;
|
import static android.view.WindowManager.TRANSIT_NONE;
|
||||||
@@ -1294,6 +1295,13 @@ class WindowStateAnimator {
|
|||||||
if (mWin.mSkipEnterAnimationForSeamlessReplacement) {
|
if (mWin.mSkipEnterAnimationForSeamlessReplacement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We don't apply animation for application main window here since this window type
|
||||||
|
// should be controlled by AppWindowToken in general.
|
||||||
|
if (mAttrType == TYPE_BASE_APPLICATION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int transit;
|
final int transit;
|
||||||
if (mEnterAnimationPending) {
|
if (mEnterAnimationPending) {
|
||||||
mEnterAnimationPending = false;
|
mEnterAnimationPending = false;
|
||||||
@@ -1365,6 +1373,7 @@ class WindowStateAnimator {
|
|||||||
+ " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
|
+ " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
|
||||||
+ " a=" + a
|
+ " a=" + a
|
||||||
+ " transit=" + transit
|
+ " transit=" + transit
|
||||||
|
+ " type=" + mAttrType
|
||||||
+ " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
|
+ " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
if (DEBUG_ANIM) logWithStack(TAG, "Loaded animation " + a + " for " + this);
|
if (DEBUG_ANIM) logWithStack(TAG, "Loaded animation " + a + " for " + this);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.server.wm;
|
|||||||
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||||
import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE;
|
import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
|
import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN;
|
||||||
@@ -45,6 +46,7 @@ import android.view.IRemoteAnimationFinishedCallback;
|
|||||||
import android.view.IRemoteAnimationRunner;
|
import android.view.IRemoteAnimationRunner;
|
||||||
import android.view.RemoteAnimationAdapter;
|
import android.view.RemoteAnimationAdapter;
|
||||||
import android.view.RemoteAnimationTarget;
|
import android.view.RemoteAnimationTarget;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import androidx.test.filters.FlakyTest;
|
import androidx.test.filters.FlakyTest;
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -224,6 +226,21 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertTrue(runner.mCancelled);
|
assertTrue(runner.mCancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAnimationStyleResId() {
|
||||||
|
// Verify getAnimationStyleResId will return as LayoutParams.windowAnimations when without
|
||||||
|
// specifying window type.
|
||||||
|
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams();
|
||||||
|
attrs.windowAnimations = 0x12345678;
|
||||||
|
assertEquals(attrs.windowAnimations, mDc.mAppTransition.getAnimationStyleResId(attrs));
|
||||||
|
|
||||||
|
// Verify getAnimationStyleResId will return system resource Id when the window type is
|
||||||
|
// starting window.
|
||||||
|
attrs.type = TYPE_APPLICATION_STARTING;
|
||||||
|
assertEquals(mDc.mAppTransition.getDefaultWindowAnimationStyleResId(),
|
||||||
|
mDc.mAppTransition.getAnimationStyleResId(attrs));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestRemoteAnimationRunner implements IRemoteAnimationRunner {
|
private class TestRemoteAnimationRunner implements IRemoteAnimationRunner {
|
||||||
boolean mCancelled = false;
|
boolean mCancelled = false;
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user