How does android light up the screen when it receives a bluetooth pairing request

  • 2020-05-10 18:47:47
  • OfStack

file: BluetoothEventLoop java
GB/GB2/GB3:
1. import android.os.PowerManager;
2. Variable declaration: private PowerManager. WakeLock mWakeLock;
3. Add definition in BluetoothEventLoop(){} constructor:
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, TAG);
mWakeLock.setReferenceCounted(false);
4. onRequestPairingConsent(){
...
mWakeLock. acquire (5000); // xintong, bright screen 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
5. onRequestPasskeyConfirmation(){
...
mWakeLock. acquire (5000); // xintong, bright screen 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
6. onRequestPasskey(){
...
mWakeLock. acquire (5000); // xintong, bright screen 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
7. onRequestPinCode(){
...
mWakeLock. acquire (5000); // xintong bright screen 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
8. onDisplayPasskey(){
...
mWakeLock. acquire (5000); // xintong, bright screen 5s
Intent intent = new Intent(BluetoothDevice.ACTION_PAIRING_REQUEST);
...
}
ICS/ICS2/JB/JB2/JB3:
Omit the modified steps 1, 2, and 3 in GB;
For function modified in 4, 5, 6, 7, 8: native mWakeLock.acquire (); mWakeLock.acquire (5000), delete mWakeLock.release ();
After the modification, the module will be compiled into framework.jar

Related articles: