mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
fix: added fallback for lsof
background sync didn't work reliably with `android:debuggable`. AOSP `su` binary also behaved weirdly, and didn't want to work properly, so I've opted into using MagiskSU - which also didn't work reliably but it's much better than alternatives (and is somewhat standard). lsof will fallback to using `su` when output without it is empty usually when app lacks `android:debuggable`, this change makes checking which PID hold access to files during initializeAppConfigs.
This commit is contained in:
parent
308a196fc6
commit
e1216f8774
4 changed files with 62 additions and 41 deletions
|
@ -30,6 +30,7 @@ import 'package:cake_wallet/themes/utils/theme_provider.dart';
|
|||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/utils/feature_flag.dart';
|
||||
import 'package:cake_wallet/view_model/dev/lsof_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/link_view_model.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cw_core/address_info.dart';
|
||||
|
@ -207,29 +208,9 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
final trades = await CakeHive.openBox<Trade>(Trade.boxName, encryptionKey: tradesBoxKey);
|
||||
final orders = await CakeHive.openBox<Order>(Order.boxName, encryptionKey: ordersBoxKey);
|
||||
|
||||
var lsofProcess = await Process.start(
|
||||
"/system/bin/lsof",
|
||||
["walletinfo.hive", "walletinfo.lock"],
|
||||
workingDirectory: (await getAppDir()).path,
|
||||
runInShell: true,
|
||||
);
|
||||
|
||||
printV("exitcode: ${await lsofProcess.exitCode}");
|
||||
printV("__stderr: ${await lsofProcess.stderr.transform(utf8.decoder).join()}", separateMultiline: true);
|
||||
printV("__stdout: ${await lsofProcess.stdout.transform(utf8.decoder).join()}", separateMultiline: true);
|
||||
|
||||
printV("lsof (before): ${await LsofViewModelBase.fetchLsof()}", separateMultiline: true);
|
||||
final walletInfoSource = await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||
printV("WalletInfoSource length (initializeAppConfigs): ${walletInfoSource.length}");
|
||||
|
||||
lsofProcess = await Process.start(
|
||||
"/system/bin/lsof",
|
||||
["walletinfo.hive", "walletinfo.lock"],
|
||||
workingDirectory: (await getAppDir()).path,
|
||||
runInShell: true,
|
||||
);
|
||||
printV("exitcode: ${await lsofProcess.exitCode}");
|
||||
printV("__stderr: ${await lsofProcess.stderr.transform(utf8.decoder).join()}", separateMultiline: true);
|
||||
printV("__stdout: ${await lsofProcess.stdout.transform(utf8.decoder).join()}", separateMultiline: true);
|
||||
printV("lsof ( after): ${await LsofViewModelBase.fetchLsof()}",separateMultiline: true);
|
||||
|
||||
final templates = await CakeHive.openBox<Template>(Template.boxName);
|
||||
final exchangeTemplates = await CakeHive.openBox<ExchangeTemplate>(ExchangeTemplate.boxName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue