summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-09-19 10:14:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-19 10:14:18 -0700
commit5be37a20b9086be505ebd424a4b92967800038c8 (patch)
tree24ccc4ea27b55ab49ba239e4b298c22068ba2bb2 /src/com
parent6e48f6c9ef082b2beb0145ebc28189c3d1a4f072 (diff)
parenta959d05b52ac4b27dcdfe3d3a4e72220cf69d47a (diff)
downloadLegacyCamera-5be37a20b9086be505ebd424a4b92967800038c8.zip
LegacyCamera-5be37a20b9086be505ebd424a4b92967800038c8.tar.gz
LegacyCamera-5be37a20b9086be505ebd424a4b92967800038c8.tar.bz2
Merge "Adjust the screen brightness in the panorama mode." into ics-factoryrom
Diffstat (limited to 'src/com')
-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();