1、退出程序返回到主界面
//back home to disable as video,games etc.
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addCategory(Intent.CATEGORY_HOME);
context.startActivity(intent);
========================================================================================
2、关机动画时在代码里锁定竖屏
代码位置:frameworks/base/services/java/com/android/server/power/ShutdownThread.java
在beginShutdownSequence里
//gsensor tmp
private static boolean mUpdateRotation = false;
private static int mSensorState = 0;
private static IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
private static int mUserRotation = Surface.ROTATION_0;
private static int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_LOCKED;
.
.
.
/*Add by Xandy*/
/*Configure rotation lock.*/