应用程序在android中运行时,屏幕解锁后出现黑屏

时间:2014-11-14 10:04:09

标签: android

我想在锁定屏幕时保持屏幕方向和应用程序。

但是当我在应用程序运行时锁定屏幕后解锁屏幕时, 然后设备只显示黑屏。它通过触摸作出反应(通过日志检查)但没有显示任何内容。 我正在使用全屏大小的TextureView。

我使用三星Galaxy Note 4进行开发,其Android版本为4.4.4。

  1. 启动应用程序(由我开发)。
  2. 锁屏。
  3. 解锁屏幕。
  4. 显示黑屏。< ==我的问题
  5. 关于WindowManager的启动应用程序,屏幕锁定,屏幕解锁的日志正在跟随。

    11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:26.132: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    11-14 18:55:26.142: D/SamsungWindowManager(3409): setRotationLw() : rotation=1
    11-14 18:55:26.187: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:26.217: D/CenterBarWindow(21578): onConfigurationChanged point = Point(1280, 720)
    11-14 18:55:26.217: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:26.477: I/WindowManager(3409): Screen frozen for +337ms due to Window{452f1008 u0 Starting net.herit.iotwm.smartphone}
    11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:27.062: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:30.532: V/WindowManager(3409): rotationForOrientationLw(orient=1, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    11-14 18:55:30.547: D/SamsungWindowManager(3409): setRotationLw() : rotation=0
    11-14 18:55:30.567: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:30.587: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:30.597: D/CenterBarWindow(21578): onConfigurationChanged point = Point(720, 1280)
    11-14 18:55:30.807: I/WindowManager(3409): Screen frozen for +257ms due to Window{43593a68 u0 Keyguard}
    11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:31.287: V/WindowManager(3409): rotationForOrientationLw(orient=1, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    11-14 18:55:32.472: E/SamsungWindowManager(3409): mCoreNumLockHelper.acquire
    11-14 18:55:32.517: I/WindowManager(3409): Lock screen displayed!
    11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:34.717: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    11-14 18:55:34.727: D/SamsungWindowManager(3409): setRotationLw() : rotation=1
    11-14 18:55:34.747: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:34.757: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
    11-14 18:55:34.797: D/CenterBarWindow(21578): onConfigurationChanged point = Point(1280, 720)
    11-14 18:55:34.902: I/WindowManager(3409): Screen frozen for +169ms due to Window{446612a8 u0 MultiWindowTrayService/AppListWindow 0}
    11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
    11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
    11-14 18:55:35.337: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    

    Manifest.xml如下所示。

    
    ...
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:screenOrientation="landscape"
    ...
    

    我很抱歉我的英语不好。我真的想解决这个问题。 有人帮助我!

1 个答案:

答案 0 :(得分:1)

然后解决方案很简单:

把它放在你的清单

<android:screenOrientation="landscape">