Android中Camera的Wake Lock

给Camera添加Wake Lock。


packages/apps/Camera/AndroidManifest.xml

<uses-permission android:name="android.permission.WAKE_LOCK" />

omxcamera.cpp

void NvOmxCamera::release()

添加Wake Lock的方法:
在packages/apps/Camera中,

private WakeLock mWakeLock;

打开时:

            PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
            mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, this.getClass().getName());
            mWakeLock.setReferenceCounted(false);
            mWakeLock.acquire();

关闭时:

           mWakeLock.release();

你可能感兴趣的:(Android中Camera的Wake Lock)