diff options
author | Owen Lin <owenlin@google.com> | 2009-12-25 12:50:27 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2010-01-15 08:40:45 +0800 |
commit | ed32015f4a0536e842306a207d620ec5e3f665c0 (patch) | |
tree | 9582acf3da58b56de15ed2703ac6a41fcca513c7 /src | |
parent | 2ca4f7cd4bcc12dc70e394b4372072b61c32a215 (diff) | |
download | LegacyCamera-ed32015f4a0536e842306a207d620ec5e3f665c0.zip LegacyCamera-ed32015f4a0536e842306a207d620ec5e3f665c0.tar.gz LegacyCamera-ed32015f4a0536e842306a207d620ec5e3f665c0.tar.bz2 |
Set the brightness to a fixed value.
Bug: 2318682
Change-Id: I367fde55fab1102019accd69e69dc516c583c153
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Camera.java | 17 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 18 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index bb4fb99..a95c2b2 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -48,6 +48,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.provider.MediaStore; +import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.Display; @@ -98,6 +99,10 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private static final int RESTART_PREVIEW = 3; private static final int CLEAR_SCREEN_DELAY = 4; + // 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 String GPS_MODE_ON = "on"; private static final String GPS_MODE_OFF = "off"; @@ -913,6 +918,18 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, 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); + } + win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.camera); mSurfaceView = (SurfaceView) findViewById(R.id.camera_preview); diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 6dbbc23..c48e0f7 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -45,6 +45,7 @@ import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.provider.MediaStore; import android.provider.MediaStore.Video; +import android.provider.Settings; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -96,6 +97,10 @@ public class VideoCamera extends NoSearchActivity private static final int SCREEN_DELAY = 2 * 60 * 1000; + // 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 long NO_STORAGE_ERROR = -1L; private static final long CANNOT_STAT_ERROR = -2L; private static final long LOW_STORAGE_THRESHOLD = 512L * 1024L; @@ -240,6 +245,19 @@ public class VideoCamera extends NoSearchActivity 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); + } + mPreferences = PreferenceManager.getDefaultSharedPreferences(this); CameraSettings.upgradePreferences(mPreferences); |