Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arithmeticException crash of com.android.camera2 #2787

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 1a74d37d02a17acdf0ee1820f829a03174dd31a4 Mon Sep 17 00:00:00 2001
From: Xu Bing <[email protected]>
Date: Thu, 9 Jan 2025 13:33:58 +0800
Subject: [PATCH] Fix arithmeticException crash of com.android.camera2

Preview video with camera, app will animate bar to a single stop
button, but the canvas of button does not exist or not intialized,
ignore animation action.

Tracked-On: OAM-129041
Signed-off-by: Xu Bing <[email protected]>
---
src/com/android/camera/ui/AnimatedCircleDrawable.java | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/com/android/camera/ui/AnimatedCircleDrawable.java b/src/com/android/camera/ui/AnimatedCircleDrawable.java
index ebf89c935..cd88b42f5 100644
--- a/src/com/android/camera/ui/AnimatedCircleDrawable.java
+++ b/src/com/android/camera/ui/AnimatedCircleDrawable.java
@@ -83,6 +83,10 @@ public class AnimatedCircleDrawable extends Drawable {
}

public void animateToSmallRadius() {
+ //no canvas, don't need to animate
+ if (mCanvasWidth == 0 && mCanvasHeight == 0) {
+ return;
+ }
int smallLevel = map(mSmallRadiusTarget,
0, diagonalLength(mCanvasWidth, mCanvasHeight)/2,
0, DRAWABLE_MAX_LEVEL);
--
2.34.1

Loading