7.0 灭屏接收蓝牙到文件唤醒屏幕

来源:互联网 发布:centos arm 编辑:程序博客网 时间:2024/04/28 14:54

packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppService.java

private Handler mHandler = new Handler() {
…………………………

case BluetoothOppRfcommListener.MSG_INCOMING_BTOPP_CONNECTION:    if (D) Log.d(TAG, "Get incoming connection");    ObexTransport transport = (ObexTransport)msg.obj;    /*     * Strategy for incoming connections:     * 1. If there is no ongoing transfer, no on-hold connection, start it     * 2. If there is ongoing transfer, hold it for 20 seconds(1 seconds * 20 times)     * 3. If there is on-hold connection, reject directly     */    if (mBatchs.size() == 0 && mPendingConnection == null) {        Log.i(TAG, "Start Obex Server");        createServerSession(transport);        //add ========================= start        PowerManager powerManager =                (PowerManager)getSystemService(Context.POWER_SERVICE);        if(powerManager != null) {            PowerManager.WakeLock mWakeLock = powerManager                    .newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP                                    | PowerManager.SCREEN_BRIGHT_WAKE_LOCK                            , "BtOppService");            mWakeLock.acquire(500);            mWakeLock.release();        }        //add ======================= end

0 0