mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-12 21:06:43 +02:00
More logs to troubleshoot BG task (#1550)
This commit is contained in:
@ -2272,7 +2272,7 @@ class _APKOriginWarningDialogState extends State<APKOriginWarningDialog> {
|
|||||||
///
|
///
|
||||||
Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
print('Started $taskId: ${params.toString()}');
|
print('BG task started $taskId: ${params.toString()}');
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await EasyLocalization.ensureInitialized();
|
await EasyLocalization.ensureInitialized();
|
||||||
await loadTranslations();
|
await loadTranslations();
|
||||||
@ -2441,10 +2441,14 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
|
|
||||||
// Filter out updates that will be installed silently (the rest go into toNotify)
|
// Filter out updates that will be installed silently (the rest go into toNotify)
|
||||||
for (var i = 0; i < updates.length; i++) {
|
for (var i = 0; i < updates.length; i++) {
|
||||||
if (networkRestricted ||
|
var canInstallSilently = await appsProvider.canInstallSilently(
|
||||||
chargingRestricted ||
|
updates[i],
|
||||||
!(await appsProvider.canInstallSilently(updates[i]))) {
|
);
|
||||||
|
if (networkRestricted || chargingRestricted || !canInstallSilently) {
|
||||||
if (updates[i].additionalSettings['skipUpdateNotifications'] != true) {
|
if (updates[i].additionalSettings['skipUpdateNotifications'] != true) {
|
||||||
|
logs.add(
|
||||||
|
'BG update task notifying for ${updates[i].id} (networkRestricted $networkRestricted, chargingRestricted: $chargingRestricted, canInstallSilently: $canInstallSilently).',
|
||||||
|
);
|
||||||
toNotify.add(updates[i]);
|
toNotify.add(updates[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2470,7 +2474,7 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
logs.add('BG update task: Done checking for updates.');
|
logs.add('BG update task: Done checking for updates.');
|
||||||
if (toRetry.isNotEmpty) {
|
if (toRetry.isNotEmpty) {
|
||||||
logs.add(
|
logs.add(
|
||||||
'BG update task $taskId: Will retry in $retryAfterXSeconds seconds.',
|
'BG update task $taskId: Will retry in $retryAfterXSeconds seconds (${toRetry.length} to retry, ${toInstall.length} to install).',
|
||||||
);
|
);
|
||||||
return await bgUpdateCheck(taskId, {
|
return await bgUpdateCheck(taskId, {
|
||||||
'toCheck': toRetry
|
'toCheck': toRetry
|
||||||
@ -2482,7 +2486,9 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// If there are no more update checks, call the function in install mode
|
// If there are no more update checks, call the function in install mode
|
||||||
logs.add('BG update task: Done checking for updates.');
|
logs.add(
|
||||||
|
'BG update task: Done checking for updates (${toRetry.length} to retry, ${toInstall.length} to install).',
|
||||||
|
);
|
||||||
return await bgUpdateCheck(taskId, {
|
return await bgUpdateCheck(taskId, {
|
||||||
'toCheck': [],
|
'toCheck': [],
|
||||||
'toInstall': toInstall
|
'toInstall': toInstall
|
||||||
@ -2493,6 +2499,7 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
} else {
|
} else {
|
||||||
// In install mode...
|
// In install mode...
|
||||||
// If you haven't explicitly been given updates to install, grab all available silent updates
|
// If you haven't explicitly been given updates to install, grab all available silent updates
|
||||||
|
logs.add('BG install task: Started (${toInstall.length}).');
|
||||||
if (toInstall.isEmpty && !networkRestricted && !chargingRestricted) {
|
if (toInstall.isEmpty && !networkRestricted && !chargingRestricted) {
|
||||||
var temp = appsProvider.findExistingUpdates(installedOnly: true);
|
var temp = appsProvider.findExistingUpdates(installedOnly: true);
|
||||||
for (var i = 0; i < temp.length; i++) {
|
for (var i = 0; i < temp.length; i++) {
|
||||||
@ -2504,7 +2511,6 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toInstall.isNotEmpty) {
|
if (toInstall.isNotEmpty) {
|
||||||
logs.add('BG install task: Started (${toInstall.length}).');
|
|
||||||
var tempObtArr = toInstall.where((element) => element.key == obtainiumId);
|
var tempObtArr = toInstall.where((element) => element.key == obtainiumId);
|
||||||
if (tempObtArr.isNotEmpty) {
|
if (tempObtArr.isNotEmpty) {
|
||||||
// Move obtainium to the end of the list as it must always install last
|
// Move obtainium to the end of the list as it must always install last
|
||||||
|
Reference in New Issue
Block a user