Skip to content

Commit e2ac520

Browse files
author
John Spurlock
committed
Disable lockscreen window anim when launching camera.
Prevent the exit animation from running when exiting the lockscreen due to launching the camera from the camera widget. Bug:7429770 Change-Id: I2a0148d84158fca11dda4c4a563fe5ab3236be81
1 parent cf69c56 commit e2ac520

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

policy/src/com/android/internal/policy/impl/keyguard/CameraWidgetFrame.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.view.LayoutInflater;
2828
import android.view.MotionEvent;
2929
import android.view.View;
30+
import android.view.WindowManager;
3031
import android.widget.FrameLayout;
3132
import android.widget.ImageView;
3233
import android.widget.ImageView.ScaleType;
@@ -47,6 +48,7 @@ interface Callbacks {
4748
private final Handler mHandler = new Handler();
4849
private final KeyguardActivityLauncher mActivityLauncher;
4950
private final Callbacks mCallbacks;
51+
private final WindowManager mWindowManager;
5052

5153
private View mWidgetView;
5254
private long mLaunchCameraStart;
@@ -81,6 +83,7 @@ private CameraWidgetFrame(Context context, Callbacks callbacks,
8183

8284
mCallbacks = callbacks;
8385
mActivityLauncher = activityLauncher;
86+
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
8487
}
8588

8689
public static CameraWidgetFrame create(Context context, Callbacks callbacks,
@@ -200,6 +203,7 @@ private void transitionToCamera() {
200203
scaleX, scaleY,
201204
startCenter, finishCenter));
202205

206+
enableWindowExitAnimation(false);
203207
animate()
204208
.scaleX(scale)
205209
.scaleY(scale)
@@ -305,11 +309,22 @@ private void reset() {
305309
setScaleX(1);
306310
setScaleY(1);
307311
setTranslationY(0);
312+
enableWindowExitAnimation(true);
308313
}
309314

310315
@Override
311316
protected void onAttachedToWindow() {
312317
super.onAttachedToWindow();
313318
mHandler.post(mRenderRunnable);
314319
}
320+
321+
private void enableWindowExitAnimation(boolean isEnabled) {
322+
View root = getRootView();
323+
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) root.getLayoutParams();
324+
int newWindowAnimations = isEnabled ? com.android.internal.R.style.Animation_LockScreen : 0;
325+
if (newWindowAnimations != lp.windowAnimations) {
326+
lp.windowAnimations = newWindowAnimations;
327+
mWindowManager.updateViewLayout(root, lp);
328+
}
329+
}
315330
}

0 commit comments

Comments
 (0)