Flutter, DevDrive and Windows Defender

Like many SDKs, Dart/Flutter consist of hundreds of thousands of files. This easily becomes a performance problem on Windows, especially with AV solutions like Windows Defender, and results on slow code completion, analysis and generally sluggish performance of tools, e.g. in Visual Studio Code.

One solution to this problem is to disable the AV solution or just exclude the directories containing the SDKs. We will skip the explanation why this is generally a bad idea, but there is an alternative solution, namely Windows 11’s new Dev Drives, basically a VHDX using ReFs. Windows Defender does use a different mode of scanning files for all DevDrives, so this is a neat solution.

We just need to move all the Flutter/Dart SDK files to the newly created DevDrive (e.g. D:\Flutter), but that still does not yield the expected results. This is because the analyzer and public cache are still by default stored in the user’s home directories.

Moving these to the DevDrive significantly speeds up the analyzer, compilation, and all other tasks. These Environment Variables can be used to specify the new location of the folders:

ANALYZER_STATE_LOCATION_OVERRIDED:\.dart-Server
PUB_CACHED:\.pub-cache
GRADLE_USER_HOMED:\.gradle

Flutter, DevDrive and Windows Defender Read More »

F(x)tec Pro1-X

If you are a keyboard afficionado, you may have heard about the F(x)tec Pro1 and Pro1-X phones with integrated keyboards. Together with some peers of the LineageOS team, I have ported LineageOS over to the Pro1-X. It is still early stages, but eventually, LineageOS will be available as a shipping option for the phone!

Head over to my XDA thread, Github or the LineageOS Gerrit review if you would like to check out progress and/or help out.

F(x)tec Pro1-X Read More »

LineageOS 20

Some more good news for the end of 2022: LineageOS 20 has just been released. And I have had a hand at it, as the main maintainer for:

Sadly, of course, the Sony devices will not be updated beyond Lineage 18.1, but still! You may now enjoy a whole slew of improvements if you own a OnePlus 5/5T: better GPS locking, improved audio quality, faster UI performance just to name a few.

We poured a lot of hard work and blood, sweat and tears into this, so please do enjoy. This is also a great opportunity to thank all the people who donated equipment for this effort, please have a look at the hall of fame!

There are some exciting things coming up, so keep watching… and have a happy new year everyone!

LineageOS 20 Read More »

LineageOS for dumpling, onyx and castor

After software support for OnePlus 5T ran out 2 years ago, we spent a LOT of time getting OnePlus 5 and 5T up to speed on LineageOS. By now it is safe to say that LineageOS on these devices is superior to OxygenOS, especially in terms of performance and battery usage. We ported over EAS (energy aware scheduling), fixed tons of big and small errors so now everything is working smoothly. The latest official version is based on Android 12, but the version for Android 13 is in an even better state already, so it will be released rather soon!

Also, some legacy devices got some much needed love, such as Sony Xperia Tablet Z2 WiFi and LTE variants. Both of them are now running LineageOS 18.1 based on Android 11 just fine.

Go check it all out at the LineageOS Download Center.

I would like to take this opportunity to thank all the donors who donated money and in some cases even devices for me to help improve the situation. Your help is very much appreciated, and you guys are all in the Hall of Fame!

LineageOS for dumpling, onyx and castor Read More »

Android Storage Access Framework woes after reboot

There seems to be a lot of confusion amongst developers how to get persistible permissions when using the SAF. Wasted some hours on this, so it is worth a note here.

To get the average file open dialog using the SAF, one could do this:

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(i, 0);

That works perfectly fine, but after a reboot, the permissions are gone, and opening the same file (without opening the dialog again) will fail. There are lots of resources on the Internet that tell developers to add some arguments when calling the Intent. This is wrong! Passing these to the intent is completely useless:

intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Don't do this
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Also no!
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); // NO!

Instead, a single call to takePersistableUriPermission will retain permissions even after a reboot:

protected void onPropertyRequestResult(int propertyRequestCode, int resultCode, Intent data) {
    getContentResolver().takePersistableUriPermission(data.getData(), Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
}

Android Storage Access Framework woes after reboot Read More »

Scroll to Top