summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Util.java
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-09-16 17:58:19 -0700
committerWei-Ta Chen <weita@google.com>2011-09-16 17:58:19 -0700
commita959d05b52ac4b27dcdfe3d3a4e72220cf69d47a (patch)
tree5cf65d59a722299de31d36208411be8b982647d3 /src/com/android/camera/Util.java
parent6c5b20113ba9f91352f32e5a53df66aec0ec761a (diff)
downloadLegacyCamera-a959d05b52ac4b27dcdfe3d3a4e72220cf69d47a.tar.gz
LegacyCamera-a959d05b52ac4b27dcdfe3d3a4e72220cf69d47a.tar.bz2
LegacyCamera-a959d05b52ac4b27dcdfe3d3a4e72220cf69d47a.zip
Adjust the screen brightness in the panorama mode.
Adjust the screen brightness in the case of automatic brightness. Make the screen brightness in the panorama mode consistent with that in the Camera mode and VideoCamera mode. Change-Id: I1600bcabcdf0d5f3840a347cce10c329d2db100b
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r--src/com/android/camera/Util.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index aacf0ec0..24ae1b7a 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.
@@ -582,4 +588,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);
+ }
+ }
}