summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2011-11-14 10:49:01 -0800
committerWei Huang <weih@google.com>2011-11-14 10:55:49 -0800
commit34238165cfdf04584587360dfcf21109bf09e144 (patch)
tree534dca18f9fd8369898083c62334df6ed38f4e3e /src
parentdae264eca3e139d73c1b45c511243ef94fc4d9d5 (diff)
downloadLegacyCamera-34238165cfdf04584587360dfcf21109bf09e144.zip
LegacyCamera-34238165cfdf04584587360dfcf21109bf09e144.tar.gz
LegacyCamera-34238165cfdf04584587360dfcf21109bf09e144.tar.bz2
bug #5612744: guard against NPE found by Monkey.
cl https://android-git.corp.google.com/g/#/c/149421/5 removed the null pointer checking. This leads to Monkey crashes. It seems that we either need to call initOnScreenIndicator() in onCreate(), or check for null in the updateXXXIndicator() methods. I thought about moving initOnScreenIndicator() to onCreate(), but didn't want to introduce any latency for starting up the camera app. Change-Id: I8b9fecb5eb77dc1afef9725fd3d3d4dbe5048c9d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index bb0c0e0..0da0095 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -606,6 +606,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
@Override
public void showGpsOnScreenIndicator(boolean hasSignal) {
+ if (mGpsIndicator == null) {
+ return;
+ }
if (hasSignal) {
mGpsIndicator.setImageResource(R.drawable.ic_viewfinder_gps_on);
} else {
@@ -616,10 +619,16 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
@Override
public void hideGpsOnScreenIndicator() {
+ if (mGpsIndicator == null) {
+ return;
+ }
mGpsIndicator.setVisibility(View.GONE);
}
private void updateExposureOnScreenIndicator(int value) {
+ if (mExposureIndicator == null) {
+ return;
+ }
if (value == 0) {
mExposureIndicator.setText("");
mExposureIndicator.setVisibility(View.GONE);
@@ -635,6 +644,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
private void updateFlashOnScreenIndicator(String value) {
+ if (mFlashIndicator == null) {
+ return;
+ }
if (Parameters.FLASH_MODE_AUTO.equals(value)) {
mFlashIndicator.setImageResource(R.drawable.ic_indicators_landscape_flash_auto);
} else if (Parameters.FLASH_MODE_ON.equals(value)) {
@@ -645,10 +657,16 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
private void updateSceneOnScreenIndicator(boolean isVisible) {
+ if (mSceneIndicator == null) {
+ return;
+ }
mSceneIndicator.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
private void updateWhiteBalanceOnScreenIndicator(String value) {
+ if (mWhiteBalanceIndicator == null) {
+ return;
+ }
if (Parameters.WHITE_BALANCE_AUTO.equals(value)) {
mWhiteBalanceIndicator.setVisibility(View.GONE);
} else {
@@ -666,6 +684,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
private void updateFocusOnScreenIndicator(String value) {
+ if (mFocusIndicator == null) {
+ return;
+ }
if (Parameters.FOCUS_MODE_INFINITY.equals(value)) {
mFocusIndicator.setImageResource(R.drawable.ic_indicators_landscape);
mFocusIndicator.setVisibility(View.VISIBLE);