Skip to content

Commit eb82c9b

Browse files
committed
Procesing PowerInfo broadcast async
1 parent ced3b3d commit eb82c9b

File tree

1 file changed

+9
-7
lines changed
  • lib/android_build/maesdk/src/main/java/com/microsoft/applications/events

1 file changed

+9
-7
lines changed

lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/HttpClient.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ class PowerInfoReceiver extends android.content.BroadcastReceiver {
5151
}
5252

5353
public final void onReceive(android.content.Context context, android.content.Intent intent) {
54-
final int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
55-
final boolean isCharging =
54+
m_parent.executeTask(new FutureTask<>(() -> {
55+
final int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
56+
final boolean isCharging =
5657
status == BatteryManager.BATTERY_STATUS_CHARGING
5758
|| status == BatteryManager.BATTERY_STATUS_FULL;
58-
boolean isLow = false;
59-
if (Build.VERSION.SDK_INT >= 28) {
60-
isLow = intent.getBooleanExtra(BatteryManager.EXTRA_BATTERY_LOW, false);
61-
}
62-
m_parent.onPowerChange(isCharging, isLow);
59+
boolean isLow = false;
60+
if (Build.VERSION.SDK_INT >= 28) {
61+
isLow = intent.getBooleanExtra(BatteryManager.EXTRA_BATTERY_LOW, false);
62+
}
63+
m_parent.onPowerChange(isCharging, isLow);
64+
}, true));
6365
}
6466
}
6567

0 commit comments

Comments
 (0)