送分的帖子。简略易答

送分的帖子。简单易答
我现在想实现,当按关机键,点完确定后,直接使背光的值为零。

初来乍到,想请教,该在哪个文件中改动?

如果乐于助人的话。可以贴点相关代码。谢谢啦

------解决方案--------------------
public void goToSleep (long time)

Added in API level 1
Forces the device to go to sleep.

Overrides all the wake locks that are held. This is what happens when the power key is pressed to turn off the screen.

Requires the DEVICE_POWER permission.


PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

------解决方案--------------------
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
这句不是改哪个系统里面的文件 ,是你自己开发个安卓应用程序里面的 代码, 这段代码可以实现你的要求。
------解决方案--------------------
framework/base/core/java/com/internal/app/ShutdownThread.java

if (confirm) {
            final CloseDialogReceiver closer = new CloseDialogReceiver(context);
            final AlertDialog dialog = new AlertDialog.Builder(context)
            ......
            public void onClick(DialogInterface dialog, int which) {
                            //此处加入灭屏代码
                            beginShutdownSequence(context);
                        }
            ......
   dialog.show();
        } else {
            beginShutdownSequence(context);
        }
------解决方案--------------------
public void goToSleep (long time)

Added in API level 1
Forces the device to go to sleep.

Overrides all the wake locks that are held. This is what happens when the power key is pressed to turn off the screen.

Requires the DEVICE_POWER permission.