diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-02-12 19:17:24 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-12 19:17:24 -0800 |
commit | f2e911a3b847715ca7f98f127c17088246cfcb92 (patch) | |
tree | 734d2e0c5e956a309c5662a4f8df38aabe9f25dd /src | |
parent | 8e56f4dea558e7e293fd5b011c19c117249eb2be (diff) | |
parent | 158aedbe1b27f92b201ec3dbacf0b3be6f7699cf (diff) | |
download | android_packages_apps_Snap-f2e911a3b847715ca7f98f127c17088246cfcb92.tar.gz android_packages_apps_Snap-f2e911a3b847715ca7f98f127c17088246cfcb92.tar.bz2 android_packages_apps_Snap-f2e911a3b847715ca7f98f127c17088246cfcb92.zip |
Merge "SnapdragonCamera: Wake up screen when invoke camera by gesture"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 300975845..b3a7680a9 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -49,6 +49,8 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.provider.MediaStore; @@ -217,6 +219,7 @@ public class CameraActivity extends Activity private AudioManager mAudioManager; private int mShutterVol; private int mOriginalMasterVol; + private WakeLock mWakeLock; private class MyOrientationEventListener extends OrientationEventListener { @@ -1176,25 +1179,6 @@ public class CameraActivity extends Activity @Override public void onCreate(Bundle state) { super.onCreate(state); - GcamHelper.init(getContentResolver()); - - mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); - mOriginalMasterVol = mAudioManager.getMasterVolume(); - mShutterVol = SystemProperties.getInt("persist.camera.snapshot.volume", -1); - if (mShutterVol >= 0 && mShutterVol <= 100 ) - mAudioManager.setMasterVolume(mShutterVol,0); - - getWindow().requestFeature(Window.FEATURE_ACTION_BAR); - setContentView(R.layout.camera_filmstrip); - - mActionBar = getActionBar(); - mActionBar.addOnMenuVisibilityListener(this); - - if (ApiHelper.HAS_ROTATION_ANIMATION) { - setRotationAnimation(); - } - - mMainHandler = new MainHandler(getMainLooper()); // Check if this is in the secure camera mode. Intent intent = getIntent(); String action = intent.getAction(); @@ -1213,6 +1197,10 @@ public class CameraActivity extends Activity params.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; if (intent.getComponent().getClassName().equals(GESTURE_CAMERA_NAME)) { params.flags |= WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; + PowerManager pm = ((PowerManager) getSystemService(POWER_SERVICE)); + mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); + mWakeLock.acquire(); + Log.d(TAG, "acquire wake lock"); } win.setAttributes(params); @@ -1228,6 +1216,26 @@ public class CameraActivity extends Activity registerReceiver(sScreenOffReceiver, filter); } } + GcamHelper.init(getContentResolver()); + + mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + mOriginalMasterVol = mAudioManager.getMasterVolume(); + mShutterVol = SystemProperties.getInt("persist.camera.snapshot.volume", -1); + if (mShutterVol >= 0 && mShutterVol <= 100 ) + mAudioManager.setMasterVolume(mShutterVol,0); + + getWindow().requestFeature(Window.FEATURE_ACTION_BAR); + setContentView(R.layout.camera_filmstrip); + + mActionBar = getActionBar(); + mActionBar.addOnMenuVisibilityListener(this); + + if (ApiHelper.HAS_ROTATION_ANIMATION) { + setRotationAnimation(); + } + + mMainHandler = new MainHandler(getMainLooper()); + mAboveFilmstripControlLayout = (FrameLayout) findViewById(R.id.camera_above_filmstrip_layout); mAboveFilmstripControlLayout.setFitsSystemWindows(true); @@ -1478,6 +1486,10 @@ public class CameraActivity extends Activity @Override public void onDestroy() { + if (mWakeLock != null && mWakeLock.isHeld()) { + mWakeLock.release(); + Log.d(TAG, "wake lock release"); + } if (mShutterVol >= 0 && mShutterVol <= 100) mAudioManager.setMasterVolume(mOriginalMasterVol,0); if (mSecureCamera) { |