Merge change 7613 into donut
* changes: * Use Fede In/Out animation if one of opening/closing apps is in compatibility mode. * preserve compatibility window flag when the app updates window's layout params. * Added assertion in DEFAULT_COMPATIBILITY_INFO object to prevent unintentional modification. * A few minor updates * log/dump message improvement * Removed unnecessary method in FadeInOutAnimator * Fixed 100 char issue in WindwoManagerServer.java
This commit is contained in:
@@ -38,7 +38,12 @@ public class CompatibilityInfo {
|
|||||||
private static final String TAG = "CompatibilityInfo";
|
private static final String TAG = "CompatibilityInfo";
|
||||||
|
|
||||||
/** default compatibility info object for compatible applications */
|
/** default compatibility info object for compatible applications */
|
||||||
public static final CompatibilityInfo DEFAULT_COMPATIBILITY_INFO = new CompatibilityInfo();
|
public static final CompatibilityInfo DEFAULT_COMPATIBILITY_INFO = new CompatibilityInfo() {
|
||||||
|
@Override
|
||||||
|
public void setExpandable(boolean expandable) {
|
||||||
|
throw new UnsupportedOperationException("trying to change default compatibility info");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default width of the screen in portrait mode.
|
* The default width of the screen in portrait mode.
|
||||||
@@ -191,7 +196,7 @@ public class CompatibilityInfo {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CompatibilityInfo{scale=" + applicationScale +
|
return "CompatibilityInfo{scale=" + applicationScale +
|
||||||
", compatibility flag=" + mCompatibilityFlags + "}";
|
", supports screen=" + supportsScreen() + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -497,7 +497,11 @@ public final class ViewRoot extends Handler implements ViewParent,
|
|||||||
void setLayoutParams(WindowManager.LayoutParams attrs, boolean newView) {
|
void setLayoutParams(WindowManager.LayoutParams attrs, boolean newView) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
int oldSoftInputMode = mWindowAttributes.softInputMode;
|
int oldSoftInputMode = mWindowAttributes.softInputMode;
|
||||||
|
// preserve compatible window flag if exists.
|
||||||
|
int compatibleWindowFlag =
|
||||||
|
mWindowAttributes.flags & WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
|
||||||
mWindowAttributes.copyFrom(attrs);
|
mWindowAttributes.copyFrom(attrs);
|
||||||
|
mWindowAttributes.flags |= compatibleWindowFlag;
|
||||||
|
|
||||||
if (newView) {
|
if (newView) {
|
||||||
mSoftInputMode = attrs.softInputMode;
|
mSoftInputMode = attrs.softInputMode;
|
||||||
@@ -1301,7 +1305,8 @@ public final class ViewRoot extends Handler implements ViewParent,
|
|||||||
if (DEBUG_DRAW) {
|
if (DEBUG_DRAW) {
|
||||||
Context cxt = mView.getContext();
|
Context cxt = mView.getContext();
|
||||||
Log.i(TAG, "Drawing: package:" + cxt.getPackageName() +
|
Log.i(TAG, "Drawing: package:" + cxt.getPackageName() +
|
||||||
", metrics=" + mView.getContext().getResources().getDisplayMetrics());
|
", metrics=" + cxt.getResources().getDisplayMetrics() +
|
||||||
|
", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo());
|
||||||
}
|
}
|
||||||
int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG);
|
int saveCount = canvas.save(Canvas.MATRIX_SAVE_FLAG);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -986,6 +986,9 @@ public interface WindowManager extends ViewManager {
|
|||||||
sb.append(" or=");
|
sb.append(" or=");
|
||||||
sb.append(screenOrientation);
|
sb.append(screenOrientation);
|
||||||
}
|
}
|
||||||
|
if ((flags & FLAG_COMPATIBLE_WINDOW) != 0) {
|
||||||
|
sb.append(" compatible=true");
|
||||||
|
}
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1891,7 +1891,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
|
|||||||
break;
|
break;
|
||||||
case WindowManagerPolicy.TRANSIT_TASK_TO_BACK:
|
case WindowManagerPolicy.TRANSIT_TASK_TO_BACK:
|
||||||
animAttr = enter
|
animAttr = enter
|
||||||
? com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation
|
? com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation
|
||||||
: com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
|
: com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -7232,17 +7232,27 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
|
|||||||
|
|
||||||
public static WindowManager.LayoutParams findAnimations(
|
public static WindowManager.LayoutParams findAnimations(
|
||||||
ArrayList<AppWindowToken> order,
|
ArrayList<AppWindowToken> order,
|
||||||
ArrayList<AppWindowToken> tokenList1,
|
ArrayList<AppWindowToken> openingTokenList1,
|
||||||
ArrayList<AppWindowToken> tokenList2) {
|
ArrayList<AppWindowToken> closingTokenList2) {
|
||||||
// We need to figure out which animation to use...
|
// We need to figure out which animation to use...
|
||||||
|
|
||||||
|
// First, check if there is a compatible window in opening/closing
|
||||||
|
// apps, and use it if exists.
|
||||||
WindowManager.LayoutParams animParams = null;
|
WindowManager.LayoutParams animParams = null;
|
||||||
int animSrc = 0;
|
int animSrc = 0;
|
||||||
|
animParams = findCompatibleWindowParams(openingTokenList1);
|
||||||
|
if (animParams == null) {
|
||||||
|
animParams = findCompatibleWindowParams(closingTokenList2);
|
||||||
|
}
|
||||||
|
if (animParams != null) {
|
||||||
|
return animParams;
|
||||||
|
}
|
||||||
|
|
||||||
//Log.i(TAG, "Looking for animations...");
|
//Log.i(TAG, "Looking for animations...");
|
||||||
for (int i=order.size()-1; i>=0; i--) {
|
for (int i=order.size()-1; i>=0; i--) {
|
||||||
AppWindowToken wtoken = order.get(i);
|
AppWindowToken wtoken = order.get(i);
|
||||||
//Log.i(TAG, "Token " + wtoken + " with " + wtoken.windows.size() + " windows");
|
//Log.i(TAG, "Token " + wtoken + " with " + wtoken.windows.size() + " windows");
|
||||||
if (tokenList1.contains(wtoken) || tokenList2.contains(wtoken)) {
|
if (openingTokenList1.contains(wtoken) || closingTokenList2.contains(wtoken)) {
|
||||||
int j = wtoken.windows.size();
|
int j = wtoken.windows.size();
|
||||||
while (j > 0) {
|
while (j > 0) {
|
||||||
j--;
|
j--;
|
||||||
@@ -7270,6 +7280,21 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
|
|||||||
return animParams;
|
return animParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static LayoutParams findCompatibleWindowParams(ArrayList<AppWindowToken> tokenList) {
|
||||||
|
for (int appCount = tokenList.size() - 1; appCount >= 0; appCount--) {
|
||||||
|
AppWindowToken wtoken = tokenList.get(appCount);
|
||||||
|
// Just checking one window is sufficient as all windows have the compatible flag
|
||||||
|
// if the application is in compatibility mode.
|
||||||
|
if (wtoken.windows.size() > 0) {
|
||||||
|
WindowManager.LayoutParams params = wtoken.windows.get(0).mAttrs;
|
||||||
|
if ((params.flags & FLAG_COMPATIBLE_WINDOW) != 0) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// DummyAnimation
|
// DummyAnimation
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
@@ -9279,14 +9304,8 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean willChangeTransformationMatrix() {
|
public int getZAdjustment() {
|
||||||
return true;
|
return Animation.ZORDER_TOP;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean willChangeBounds() {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user