split device statuses too before broadcast
This commit is contained in:
parent
f0c9ce5a00
commit
51b01a0993
|
@ -31,15 +31,18 @@ public class BroadcastDeviceStatus {
|
|||
log.debug("DEVICESTATUS " + x.size() + " receivers");
|
||||
}
|
||||
public static void handleNewDeviceStatus(JSONArray statuses, Context context, boolean isDelta) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("devicestatuses", statuses.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> x = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
List<JSONArray> splitted = BroadcastTreatment.splitArray(statuses);
|
||||
for (JSONArray part: splitted) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("devicestatuses", part.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> x = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
|
||||
log.debug("DEVICESTATUS " + x.size() + " receivers");
|
||||
log.debug("DEVICESTATUS " + part.length() + " records " + x.size() + " receivers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class BroadcastTreatment {
|
|||
}
|
||||
|
||||
|
||||
private static List<JSONArray> splitArray(JSONArray array) {
|
||||
public static List<JSONArray> splitArray(JSONArray array) {
|
||||
List<JSONArray> ret = new ArrayList<>();
|
||||
try {
|
||||
int size = array.length();
|
||||
|
|
Loading…
Reference in a new issue