summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java20
-rw-r--r--src/com/android/camera/Util.java17
-rw-r--r--src/com/android/camera/VideoCamera.java13
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java7
4 files changed, 24 insertions, 33 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 1fe15ed..ffd2137 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -105,10 +105,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
// needed to be updated in mUpdateSet.
private int mUpdateSet;
- // The brightness settings used when it is set to automatic in the system.
- // The reason why it is set to 0.7 is just because 1.0 is too bright.
- private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f;
-
private static final int SCREEN_DELAY = 2 * 60 * 1000;
private static final int ZOOM_STOPPED = 0;
@@ -366,7 +362,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mFocusIndicator = (RotateLayout) findViewById(R.id.focus_indicator_rotate_layout);
mFocusManager.initialize(mFocusIndicator, mPreviewFrame, mFaceView, this);
mFocusManager.initializeToneGenerator();
- initializeScreenBrightness();
+ Util.initializeScreenBrightness(getWindow(), getContentResolver());
installIntentFilter();
initializeZoom();
// Show the tap to focus toast if this is the first start.
@@ -1193,20 +1189,6 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mDidRegister = true;
}
- private void initializeScreenBrightness() {
- Window win = getWindow();
- // Overright the brightness settings if it is automatic
- int mode = Settings.System.getInt(
- getContentResolver(),
- Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
- if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
- WindowManager.LayoutParams winParams = win.getAttributes();
- winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS;
- win.setAttributes(winParams);
- }
- }
-
@Override
protected void onResume() {
super.onResume();
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 906dc1e..c5bc79d 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -35,6 +35,7 @@ import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.ParcelFileDescriptor;
+import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -65,6 +66,11 @@ public class Util {
private static final int DIRECTION_UP = 2;
private static final int DIRECTION_DOWN = 3;
+ // The brightness setting used when it is set to automatic in the system.
+ // The reason why it is set to 0.7 is just because 1.0 is too bright.
+ // Use the same setting among the Camera, VideoCamera and Panorama modes.
+ private static final float DEFAULT_CAMERA_BRIGHTNESS = 0.7f;
+
public static final String REVIEW_ACTION = "com.android.camera.action.REVIEW";
// Private intent extras. Test only.
@@ -593,4 +599,15 @@ public class Util {
params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE;
window.setAttributes(params);
}
+
+ public static void initializeScreenBrightness(Window win, ContentResolver resolver) {
+ // Overright the brightness settings if it is automatic
+ int mode = Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
+ Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
+ if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+ WindowManager.LayoutParams winParams = win.getAttributes();
+ winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS;
+ win.setAttributes(winParams);
+ }
+ }
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 3143eb9..5c3e160 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -336,18 +336,7 @@ public class VideoCamera extends ActivityBase
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- Window win = getWindow();
-
- // Overright the brightness settings if it is automatic
- int mode = Settings.System.getInt(
- getContentResolver(),
- Settings.System.SCREEN_BRIGHTNESS_MODE,
- Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
- if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
- WindowManager.LayoutParams winParams = win.getAttributes();
- winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS;
- win.setAttributes(winParams);
- }
+ Util.initializeScreenBrightness(getWindow(), getContentResolver());
mPreferences = new ComboPreferences(this);
CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal());
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index d459740..2bb9f6c 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -62,6 +62,7 @@ import android.util.Log;
import android.view.Gravity;
import android.view.OrientationEventListener;
import android.view.View;
+import android.view.Window;
import android.view.WindowManager;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
@@ -211,9 +212,11 @@ public class PanoramaActivity extends Activity implements
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
+ Window window = getWindow();
+ window.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- Util.enterLightsOutMode(getWindow());
+ Util.enterLightsOutMode(window);
+ Util.initializeScreenBrightness(window, getContentResolver());
createContentView();