| Chunk |
|---|
| Conflicting content |
|---|
"getDisplayMagnificationMediator()")) {
throw new SecurityException("Requires RETRIEVE_WINDOW_INFO permission.");
}
<<<<<<< HEAD
if (mMagnificationMediator == null) {
mMagnificationMediator = new DisplayMagnificationMediator(this);
=======
synchronized (mWindowMap) {
DisplayContent displayContent = getDisplayContentLocked(displayId);
if (displayContent == null) {
return;
}
WindowList windows = displayContent.getWindowList();
final int windowCount = windows.size();
for (int i = 0; i < windowCount; i++) {
WindowState window = windows.get(i);
if (window.isVisibleLw() || window.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
WindowInfo info = getWindowInfoForWindowStateLocked(window);
outInfos.add(info);
}
}
}
}
@Override
public void magnifyDisplay(int displayId, float scale, float offsetX, float offsetY) {
if (!checkCallingPermission(
android.Manifest.permission.MAGNIFY_DISPLAY, "magnifyDisplay()")) {
throw new SecurityException("Requires MAGNIFY_DISPLAY permission");
}
synchronized (mWindowMap) {
MagnificationSpec spec = getDisplayMagnificationSpecLocked(displayId);
if (spec != null) {
final boolean scaleChanged = spec.mScale != scale;
final boolean offsetChanged = spec.mOffsetX != offsetX || spec.mOffsetY != offsetY;
if (!scaleChanged && !offsetChanged) {
return;
}
spec.initialize(scale, offsetX, offsetY);
// If the offset has changed we need to re-add the input windows
// since the offsets have to be propagated to the input system.
if (offsetChanged) {
// TODO(multidisplay): Input only occurs on the default display.
if (displayId == Display.DEFAULT_DISPLAY) {
mInputMonitor.updateInputWindowsLw(true);
}
}
scheduleAnimationLocked();
}
}
}
MagnificationSpec getDisplayMagnificationSpecLocked(int displayId) {
DisplayContent displayContent = getDisplayContentLocked(displayId);
if (displayContent != null) {
if (displayContent.mMagnificationSpec == null) {
displayContent.mMagnificationSpec = new MagnificationSpec();
}
return displayContent.mMagnificationSpec;
}
return null;
}
private WindowInfo getWindowInfoForWindowStateLocked(WindowState window) {
WindowInfo info = WindowInfo.obtain();
info.token = window.mToken.token;
info.frame.set(window.mFrame);
info.type = window.mAttrs.type;
info.displayId = window.getDisplayId();
info.compatibilityScale = window.mGlobalScale;
info.visible = window.isVisibleLw() || info.type == TYPE_UNIVERSE_BACKGROUND;
info.layer = window.mLayer;
window.getTouchableRegion(mTempRegion);
mTempRegion.getBounds(info.touchableRegion);
return info;
}
private AttributeCache.Entry getCachedAnimations(int userId, WindowManager.LayoutParams lp) {
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
+ (lp != null ? lp.packageName : null)
+ " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
if (lp != null && lp.windowAnimations != 0) {
// If this is a system resource, don't try to load it from the
// application resources. It is nice to avoid loading application
// resources if we can.
String packageName = lp.packageName != null ? lp.packageName : "android";
int resId = lp.windowAnimations;
if ((resId&0xFF000000) == 0x01000000) {
packageName = "android";
}
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName);
return AttributeCache.instance().get(userId, packageName, resId,
com.android.internal.R.styleable.WindowAnimation);
}
return null;
}
private AttributeCache.Entry getCachedAnimations(int userId, String packageName, int resId) {
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
+ packageName + " resId=0x" + Integer.toHexString(resId));
if (packageName != null) {
if ((resId&0xFF000000) == 0x01000000) {
packageName = "android";
}
if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
+ packageName);
return AttributeCache.instance().get(userId, packageName, resId,
com.android.internal.R.styleable.WindowAnimation);
}
return null;
}
Animation loadAnimation(int userId, WindowManager.LayoutParams lp, int animAttr) {
int anim = 0;
Context context = mContext;
if (animAttr >= 0) {
AttributeCache.Entry ent = getCachedAnimations(userId, lp);
if (ent != null) {
context = ent.context;
anim = ent.array.getResourceId(animAttr, 0);
}
}
if (anim != 0) {
return AnimationUtils.loadAnimation(context, anim);
}
return null;
}
private Animation loadAnimation(int userId, String packageName, int resId) {
int anim = 0;
Context context = mContext;
if (resId >= 0) {
AttributeCache.Entry ent = getCachedAnimations(userId, packageName, resId);
if (ent != null) {
context = ent.context;
anim = resId;
}
}
if (anim != 0) {
return AnimationUtils.loadAnimation(context, anim);
}
return null;
}
private Animation createExitAnimationLocked(int transit, int duration) {
if (transit == WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN ||
transit == WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE) {
// If we are on top of the wallpaper, we need an animation that
// correctly handles the wallpaper staying static behind all of
// the animated elements. To do this, will just have the existing
// element fade out.
Animation a = new AlphaAnimation(1, 0);
a.setDetachWallpaper(true);
a.setDuration(duration);
return a;
}
// For normal animations, the exiting element just holds in place.
Animation a = new AlphaAnimation(1, 1);
a.setDuration(duration);
return a;
}
/**
* Compute the pivot point for an animation that is scaling from a small
* rect on screen to a larger rect. The pivot point varies depending on
* the distance between the inner and outer edges on both sides. This
* function computes the pivot point for one dimension.
* @param startPos Offset from left/top edge of outer rectangle to
* left/top edge of inner rectangle.
* @param finalScale The scaling factor between the size of the outer
* and inner rectangles.
*/
private static float computePivot(int startPos, float finalScale) {
final float denom = finalScale-1;
if (Math.abs(denom) < .0001f) {
return startPos;
}
return -startPos / denom;
}
private Animation createScaleUpAnimationLocked(int transit, boolean enter) {
Animation a;
// Pick the desired duration. If this is an inter-activity transition,
// it is the standard duration for that. Otherwise we use the longer
// task transition duration.
int duration;
switch (transit) {
case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
duration = mContext.getResources().getInteger(
com.android.internal.R.integer.config_shortAnimTime);
break;
default:
duration = 300;
break;
}
// TODO(multidisplay): For now assume all app animation is on main display.
final DisplayInfo displayInfo = getDefaultDisplayInfoLocked();
if (enter) {
// Entering app zooms out from the center of the initial rect.
float scaleW = mNextAppTransitionStartWidth / (float) displayInfo.appWidth;
float scaleH = mNextAppTransitionStartHeight / (float) displayInfo.appHeight;
Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1,
computePivot(mNextAppTransitionStartX, scaleW),
computePivot(mNextAppTransitionStartY, scaleH));
scale.setDuration(duration);
AnimationSet set = new AnimationSet(true);
Animation alpha = new AlphaAnimation(0, 1);
scale.setDuration(duration);
set.addAnimation(scale);
alpha.setDuration(duration);
set.addAnimation(alpha);
set.setDetachWallpaper(true);
a = set;
} else {
a = createExitAnimationLocked(transit, duration);
}
a.setFillAfter(true);
final Interpolator interpolator = AnimationUtils.loadInterpolator(mContext,
com.android.internal.R.interpolator.decelerate_cubic);
a.setInterpolator(interpolator);
a.initialize(displayInfo.appWidth, displayInfo.appHeight,
displayInfo.appWidth, displayInfo.appHeight);
return a;
}
private Animation createThumbnailAnimationLocked(int transit,
boolean enter, boolean thumb, boolean scaleUp) {
Animation a;
final int thumbWidthI = mNextAppTransitionThumbnail.getWidth();
final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
final int thumbHeightI = mNextAppTransitionThumbnail.getHeight();
final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
// Pick the desired duration. If this is an inter-activity transition,
// it is the standard duration for that. Otherwise we use the longer
// task transition duration.
int duration;
switch (transit) {
case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
duration = mContext.getResources().getInteger(
com.android.internal.R.integer.config_shortAnimTime);
break;
default:
duration = 250;
break;
>>>>>>> f9ae5f75af259437391e41dac7f3c4461c495dd9
}
return mMagnificationMediator;
} |
| Solution content |
|---|
"getDisplayMagnificationMediator()")) {
throw new SecurityException("Requires RETRIEVE_WINDOW_INFO permission.");
}
if (mMagnificationMediator == null) {
mMagnificationMediator = new DisplayMagnificationMediator(this);
}
return mMagnificationMediator;
} |
| File |
|---|
| WindowManagerService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Attribute |
| Break statement |
| Case statement |
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Switch statement |
| Synchronized statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
=======
Animation a;
boolean initialized = false;
// artifacts when we unfreeze the display if some different animation
// is running.
if (okToDisplay()) {
<<<<<<< HEAD
DisplayInfo displayInfo = getDefaultDisplayInfoLocked();
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG, "applyAnimation: atoken="
+ atoken);
Animation a = mAppTransition.loadAnimation(lp, transit, enter,
displayInfo.appWidth, displayInfo.appHeight);
if (mNextAppTransitionType == ActivityOptions.ANIM_CUSTOM) {
a = loadAnimation(atoken.userId, mNextAppTransitionPackage, enter ?
mNextAppTransitionEnter : mNextAppTransitionExit);
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
"applyAnimation: atoken=" + atoken
+ " anim=" + a + " nextAppTransition=ANIM_CUSTOM"
+ " transit=" + transit + " isEntrance=" + enter
+ " Callers=" + Debug.getCallers(3));
} else if (mNextAppTransitionType == ActivityOptions.ANIM_SCALE_UP) {
a = createScaleUpAnimationLocked(transit, enter);
initialized = true;
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
"applyAnimation: atoken=" + atoken
+ " anim=" + a + " nextAppTransition=ANIM_SCALE_UP"
+ " transit=" + transit + " isEntrance=" + enter
+ " Callers=" + Debug.getCallers(3));
} else if (mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_UP ||
mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_DOWN) {
boolean scaleUp = (mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_UP);
a = createThumbnailAnimationLocked(transit, enter, false, scaleUp);
initialized = true;
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
String animName = scaleUp ? "ANIM_THUMBNAIL_SCALE_UP" : "ANIM_THUMBNAIL_SCALE_DOWN";
Slog.v(TAG, "applyAnimation: atoken=" + atoken
+ " anim=" + a + " nextAppTransition=" + animName
+ " transit=" + transit + " isEntrance=" + enter
+ " Callers=" + Debug.getCallers(3));
}
} else {
int animAttr = 0;
switch (transit) {
case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_TASK_OPEN:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_TASK_CLOSE:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_TASK_TO_FRONT:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_TASK_TO_BACK:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_OPEN:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
break;
case WindowManagerPolicy.TRANSIT_WALLPAPER_INTRA_CLOSE:
animAttr = enter
? com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation
: com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
break;
}
a = animAttr != 0 ? loadAnimation(atoken.userId, lp, animAttr) : null;
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
"applyAnimation: atoken=" + atoken
+ " anim=" + a
+ " animAttr=0x" + Integer.toHexString(animAttr)
+ " transit=" + transit + " isEntrance=" + enter
+ " Callers=" + Debug.getCallers(3));
}
>>>>>>> f9ae5f75af259437391e41dac7f3c4461c495dd9
if (a != null) {
if (DEBUG_ANIM) {
RuntimeException e = null; |
| Solution content |
|---|
// artifacts when we unfreeze the display if some different animation
// is running.
if (okToDisplay()) {
DisplayInfo displayInfo = getDefaultDisplayInfoLocked();
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG, "applyAnimation: atoken="
+ atoken);
Animation a = mAppTransition.loadAnimation(lp, transit, enter,
displayInfo.appWidth, displayInfo.appHeight);
if (a != null) {
if (DEBUG_ANIM) {
RuntimeException e = null; |
| File |
|---|
| WindowManagerService.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
break;
}
if (attr >= 0) {
<<<<<<< HEAD
a = mService.mAppTransition.loadAnimation(mWin.mAttrs, attr);
=======
a = mService.loadAnimation(UserHandle.getUserId(mWin.mOwnerUid),
mWin.mAttrs, attr);
>>>>>>> f9ae5f75af259437391e41dac7f3c4461c495dd9
}
}
if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| Solution content |
|---|
break;
}
if (attr >= 0) {
a = mService.mAppTransition.loadAnimation(mWin.mAttrs, attr);
}
}
if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| File |
|---|
| WindowStateAnimator.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |