diff --git a/.gitignore b/.gitignore
index f4f05ec62d1cbe2bf74ed1ea4a0b21c8b084f225..20eb2f448e8dd601b583d7da2d6849d80ef080c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,8 @@ local.properties
 !.idea/runConfigurations/
 !.idea/codeStyleSettings.xml
 !.idea/codeStyles
+!.idea/scopes/
+!.idea/copyright/
 .gradle
 build/
 captures
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 5e93ee9f93baff6f72ea3ddb05efbf6ad4b8d61b..aedeec4d413db8a361220286391be1d47180e7c4 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -75,7 +75,6 @@
     <codeStyleSettings language="XML">
       <indentOptions>
         <option name="CONTINUATION_INDENT_SIZE" value="4" />
-        <option name="USE_TAB_CHARACTER" value="true" />
         <option name="SMART_TABS" value="true" />
       </indentOptions>
       <arrangement>
diff --git a/.idea/copyright/AGPL_3_0_or_later.xml b/.idea/copyright/AGPL_3_0_or_later.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0fda58c4e19edd41aa1ea87472effd561455b550
--- /dev/null
+++ b/.idea/copyright/AGPL_3_0_or_later.xml
@@ -0,0 +1,6 @@
+<component name="CopyrightManager">
+  <copyright>
+    <option name="notice" value="    Briar Mailbox&#10;    Copyright (C) 2021-2022  The Briar Project&#10;&#10;    This program is free software: you can redistribute it and/or modify&#10;    it under the terms of the GNU Affero General Public License as&#10;    published by the Free Software Foundation, either version 3 of the&#10;    License, or (at your option) any later version.&#10;&#10;    This program is distributed in the hope that it will be useful,&#10;    but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&#10;    GNU Affero General Public License for more details.&#10;&#10;    You should have received a copy of the GNU Affero General Public License&#10;    along with this program.  If not, see &lt;https://www.gnu.org/licenses/&gt;.&#10;    " />
+    <option name="myName" value="AGPL-3.0-or-later" />
+  </copyright>
+</component>
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..05e8e18d12d3d4b74bc620b09603056e72665e6c
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,7 @@
+<component name="CopyrightManager">
+  <settings>
+    <module2copyright>
+      <element module="src/main/java" copyright="AGPL-3.0-or-later" />
+    </module2copyright>
+  </settings>
+</component>
\ No newline at end of file
diff --git a/.idea/scopes/src_main_java.xml b/.idea/scopes/src_main_java.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cbc6ea1ab6a6d5586a799471371a4d0e9337f4e1
--- /dev/null
+++ b/.idea/scopes/src_main_java.xml
@@ -0,0 +1,3 @@
+<component name="DependencyValidationManager">
+  <scope name="src/main/java" pattern="file[*]:src/main/java//*" />
+</component>
\ No newline at end of file
diff --git a/.reuse/dep5 b/.reuse/dep5
new file mode 100644
index 0000000000000000000000000000000000000000..b53888b8efbfd8bbdaf8cc196ec9953f2f8a39c2
--- /dev/null
+++ b/.reuse/dep5
@@ -0,0 +1,24 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Briar Mailbox
+Upstream-Contact: Torsten Grote <torsten at briarproject.org>
+Source: https://code.briarproject.org/briar/briar-mailbox
+
+# do not kill me library
+Files: dont-kill-me-lib/*
+Copyright: 2021 The Briar Project <contact at briarproject.org>
+License: AGPL-3.0-or-later
+
+# Mailbox
+Files: mailbox-android/* mailbox-cli/* mailbox-core/* .gitlab-ci.yml *.gradle .run/* *.md artwork/*
+Copyright: 2021 The Briar Project <contact at briarproject.org>
+License: AGPL-3.0-or-later
+
+# Gradle files
+Files: gradlew gradlew.bat gradle/wrapper/*
+Copyright: 2015-2021 the original authors
+License: Apache-2.0
+
+# Insignificant files
+Files: .gitignore gradle.properties .idea/* config/checkstyle/checkstyle.xml
+Copyright: 2015-2021 the original authors
+License: CC0-1.0
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 0000000000000000000000000000000000000000..d2385e4193354c8108b6f10304b047f8d924ebf6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSES/AGPL-3.0-or-later.txt
\ No newline at end of file
diff --git a/LICENSES/AGPL-3.0-or-later.txt b/LICENSES/AGPL-3.0-or-later.txt
new file mode 100644
index 0000000000000000000000000000000000000000..be3f7b28e564e7dd05eaf59d64adba1a4065ac0e
--- /dev/null
+++ b/LICENSES/AGPL-3.0-or-later.txt
@@ -0,0 +1,661 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<https://www.gnu.org/licenses/>.
diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt
new file mode 100644
index 0000000000000000000000000000000000000000..137069b823873b8bcf42979bcf8e9371052d26a2
--- /dev/null
+++ b/LICENSES/Apache-2.0.txt
@@ -0,0 +1,73 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+     (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+     (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+     (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+     (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+     You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!)  The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0e259d42c996742e9e3cba14c677129b2c1b6311
--- /dev/null
+++ b/LICENSES/CC0-1.0.txt
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+    HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+  i. the right to reproduce, adapt, distribute, perform, display,
+     communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+     likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+     subject to the limitations in paragraph 4(a), below;
+  v. rights protecting the extraction, dissemination, use and reuse of data
+     in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+     European Parliament and of the Council of 11 March 1996 on the legal
+     protection of databases, and under any national implementation
+     thereof, including any amended or successor version of such
+     directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+     world based on applicable law or treaty, and any national
+     implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+    surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+    warranties of any kind concerning the Work, express, implied,
+    statutory or otherwise, including without limitation warranties of
+    title, merchantability, fitness for a particular purpose, non
+    infringement, or the absence of latent or other defects, accuracy, or
+    the present or absence of errors, whether or not discoverable, all to
+    the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+    that may apply to the Work or any use thereof, including without
+    limitation any person's Copyright and Related Rights in the Work.
+    Further, Affirmer disclaims responsibility for obtaining any necessary
+    consents, permissions or other rights required for any use of the
+    Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+    party to this document and has no duty or obligation with respect to
+    this CC0 or use of the Work.
diff --git a/README.md b/README.md
index ac5557c87412f8fffd889064e17780282057759f..4b1317f06d677de4da99e0e42f35c8788aecb0a1 100644
--- a/README.md
+++ b/README.md
@@ -93,5 +93,11 @@ any hardware supporting Java (e.g. unix server, raspberry pi) could be added.
 [![Donate using Liberapay](https://briarproject.org/img/liberapay.svg)](https://liberapay.com/Briar/donate) [![Flattr this](https://briarproject.org/img/flattr-badge-large.png "Flattr this")](https://flattr.com/t/592836/)   
 Bitcoin and BCH: 1NZCKkUCtJV2U2Y9hDb9uq8S7ksFCFGR6K
 
+## License
 
+This program is free software: you can redistribute it and/or modify it
+under the terms of the [GNU Affero General Public License](LICENSES/AGPL-3.0-or-later.txt)
+as published by the Free Software Foundation, either version 3 of the License,
+or (at your option) any later version.
 
+Compliant with version 3.0 of the [REUSE Specification](https://reuse.software).
diff --git a/dont-kill-me-lib/src/main/res/layout/fragment_dont_kill_me.xml b/dont-kill-me-lib/src/main/res/layout/fragment_dont_kill_me.xml
index 248b6af2a9c4573a62d33cd75c7815d7c1ebad9e..9e04975d6fe6c15bbddc3714ce90aa79abdfb740 100644
--- a/dont-kill-me-lib/src/main/res/layout/fragment_dont_kill_me.xml
+++ b/dont-kill-me-lib/src/main/res/layout/fragment_dont_kill_me.xml
@@ -1,77 +1,77 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-	xmlns:app="http://schemas.android.com/apk/res-auto"
-	xmlns:tools="http://schemas.android.com/tools"
-	android:layout_width="match_parent"
-	android:layout_height="match_parent"
-	android:fillViewport="true">
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:fillViewport="true">
 
-	<androidx.constraintlayout.widget.ConstraintLayout
-		android:layout_width="match_parent"
-		android:layout_height="wrap_content"
-		android:padding="16dp">
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="16dp">
 
-		<org.briarproject.android.dontkillmelib.DozeView
-			android:id="@+id/dozeView"
-			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:paddingBottom="16dp"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toTopOf="parent" />
+        <org.briarproject.android.dontkillmelib.DozeView
+            android:id="@+id/dozeView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingBottom="16dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
 
-		<org.briarproject.android.dontkillmelib.HuaweiProtectedAppsView
-			android:id="@+id/huaweiProtectedAppsView"
-			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:paddingBottom="16dp"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/dozeView" />
+        <org.briarproject.android.dontkillmelib.HuaweiProtectedAppsView
+            android:id="@+id/huaweiProtectedAppsView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingBottom="16dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/dozeView" />
 
-		<org.briarproject.android.dontkillmelib.HuaweiAppLaunchView
-			android:id="@+id/huaweiAppLaunchView"
-			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:paddingBottom="16dp"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/huaweiProtectedAppsView" />
+        <org.briarproject.android.dontkillmelib.HuaweiAppLaunchView
+            android:id="@+id/huaweiAppLaunchView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingBottom="16dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/huaweiProtectedAppsView" />
 
-		<org.briarproject.android.dontkillmelib.XiaomiView
-			android:id="@+id/xiaomiView"
-			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:paddingBottom="16dp"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/huaweiAppLaunchView" />
+        <org.briarproject.android.dontkillmelib.XiaomiView
+            android:id="@+id/xiaomiView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingBottom="16dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/huaweiAppLaunchView" />
 
-		<Button
-			android:id="@+id/next"
-			style="@style/DoNotKillMeButton"
-			android:layout_width="match_parent"
-			android:layout_height="wrap_content"
-			android:enabled="false"
-			android:text="@string/create_account_button"
-			app:layout_constraintBottom_toBottomOf="parent"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toBottomOf="@+id/xiaomiView"
-			app:layout_constraintVertical_bias="1.0"
-			tools:enabled="true" />
+        <Button
+            android:id="@+id/next"
+            style="@style/DoNotKillMeButton"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:enabled="false"
+            android:text="@string/create_account_button"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/xiaomiView"
+            app:layout_constraintVertical_bias="1.0"
+            tools:enabled="true" />
 
-		<ProgressBar
-			android:id="@+id/progress"
-			style="?android:attr/progressBarStyle"
-			android:layout_width="wrap_content"
-			android:layout_height="wrap_content"
-			android:visibility="invisible"
-			app:layout_constraintBottom_toBottomOf="@+id/next"
-			app:layout_constraintEnd_toEndOf="parent"
-			app:layout_constraintStart_toStartOf="parent"
-			app:layout_constraintTop_toTopOf="@+id/next" />
+        <ProgressBar
+            android:id="@+id/progress"
+            style="?android:attr/progressBarStyle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:visibility="invisible"
+            app:layout_constraintBottom_toBottomOf="@+id/next"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="@+id/next" />
 
-	</androidx.constraintlayout.widget.ConstraintLayout>
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
 </ScrollView>
diff --git a/dont-kill-me-lib/src/main/res/layout/power_view.xml b/dont-kill-me-lib/src/main/res/layout/power_view.xml
index f78feff380f997b86430f09b5e892d2997d9be35..11a95e95569bbde6e673b5acf2349a75c5a01c7f 100644
--- a/dont-kill-me-lib/src/main/res/layout/power_view.xml
+++ b/dont-kill-me-lib/src/main/res/layout/power_view.xml
@@ -1,60 +1,60 @@
 <?xml version="1.0" encoding="utf-8"?>
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
-	xmlns:app="http://schemas.android.com/apk/res-auto"
-	xmlns:tools="http://schemas.android.com/tools"
-	android:layout_width="match_parent"
-	android:layout_height="wrap_content"
-	tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
 
-	<TextView
-		android:id="@+id/textView"
-		android:layout_width="0dp"
-		android:layout_height="wrap_content"
-		android:layout_marginStart="16dp"
-		android:layout_marginLeft="16dp"
-		android:layout_marginTop="16dp"
-		android:layout_marginEnd="16dp"
-		android:layout_marginRight="16dp"
-		android:textSize="16sp"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintStart_toStartOf="parent"
-		app:layout_constraintTop_toTopOf="parent"
-		tools:text="@string/setup_huawei_text" />
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginRight="16dp"
+        android:textSize="16sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="@string/setup_huawei_text" />
 
-	<androidx.appcompat.widget.AppCompatImageView
-		android:id="@+id/checkImage"
-		android:layout_width="24dp"
-		android:layout_height="24dp"
-		android:layout_margin="8dp"
-		android:visibility="invisible"
-		app:layout_constraintBottom_toBottomOf="@+id/button"
-		app:layout_constraintStart_toStartOf="parent"
-		app:layout_constraintTop_toTopOf="@+id/button"
-		app:srcCompat="@drawable/ic_check_white"
-		app:tint="?attr/colorControlNormal"
-		tools:ignore="ContentDescription" />
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/checkImage"
+        android:layout_width="24dp"
+        android:layout_height="24dp"
+        android:layout_margin="8dp"
+        android:visibility="invisible"
+        app:layout_constraintBottom_toBottomOf="@+id/button"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/button"
+        app:srcCompat="@drawable/ic_check_white"
+        app:tint="?attr/colorControlNormal"
+        tools:ignore="ContentDescription" />
 
-	<Button
-		android:id="@+id/button"
-		style="@style/DoNotKillMeButton"
-		android:layout_width="0dp"
-		android:layout_height="wrap_content"
-		android:layout_margin="8dp"
-		app:layout_constraintEnd_toStartOf="@+id/helpButton"
-		app:layout_constraintStart_toEndOf="@+id/checkImage"
-		app:layout_constraintTop_toBottomOf="@+id/textView"
-		tools:text="@string/setup_huawei_button" />
+    <Button
+        android:id="@+id/button"
+        style="@style/DoNotKillMeButton"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_margin="8dp"
+        app:layout_constraintEnd_toStartOf="@+id/helpButton"
+        app:layout_constraintStart_toEndOf="@+id/checkImage"
+        app:layout_constraintTop_toBottomOf="@+id/textView"
+        tools:text="@string/setup_huawei_button" />
 
-	<ImageButton
-		android:id="@+id/helpButton"
-		style="@style/HelpButton"
-		android:layout_width="48dp"
-		android:layout_height="48dp"
-		android:background="?attr/selectableItemBackgroundBorderless"
-		android:contentDescription="@string/help"
-		app:layout_constraintBottom_toBottomOf="@+id/button"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintTop_toTopOf="@+id/button"
-		app:srcCompat="@drawable/ic_help_outline_white" />
+    <ImageButton
+        android:id="@+id/helpButton"
+        style="@style/HelpButton"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        android:background="?attr/selectableItemBackgroundBorderless"
+        android:contentDescription="@string/help"
+        app:layout_constraintBottom_toBottomOf="@+id/button"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/button"
+        app:srcCompat="@drawable/ic_help_outline_white" />
 
 </merge>
diff --git a/mailbox-android/build.gradle b/mailbox-android/build.gradle
index 3f05d842718448e51919a8c40a858f594660cdcd..5c8c200ed187f4d5d463576f01675d1038a7fc76 100644
--- a/mailbox-android/build.gradle
+++ b/mailbox-android/build.gradle
@@ -59,7 +59,7 @@ dependencies {
     implementation "androidx.activity:activity-ktx:1.3.1"
     implementation "androidx.fragment:fragment-ktx:$androidx_fragment_version"
 
-	def lifecycle_version = "2.4.0-rc01"
+    def lifecycle_version = "2.4.0-rc01"
     implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
     implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
     implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
diff --git a/mailbox-android/src/debug/assets/logback.xml b/mailbox-android/src/debug/assets/logback.xml
index 1a02b7406f7062e53c39d5863db66020025c6cee..58a3a18c919a95f1a72e1a9c9d8f6052832d74a1 100644
--- a/mailbox-android/src/debug/assets/logback.xml
+++ b/mailbox-android/src/debug/assets/logback.xml
@@ -1,15 +1,15 @@
 <configuration>
-	<appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
-		<tagEncoder>
-			<pattern>%logger{12}</pattern>
-		</tagEncoder>
-		<encoder>
-			<pattern>%msg</pattern>
-		</encoder>
-	</appender>
-	<root level="ALL">
-		<appender-ref ref="logcat" />
-	</root>
-	<!-- hide all Netty debug logs -->
-	<logger name="io.netty" level="INFO" />
+    <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
+        <tagEncoder>
+            <pattern>%logger{12}</pattern>
+        </tagEncoder>
+        <encoder>
+            <pattern>%msg</pattern>
+        </encoder>
+    </appender>
+    <root level="ALL">
+        <appender-ref ref="logcat" />
+    </root>
+    <!-- hide all Netty debug logs -->
+    <logger name="io.netty" level="INFO" />
 </configuration>
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/AppModule.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/AppModule.kt
index 0b2c3252676594e277629d24d4f47e8455f72cc1..fce42c9512b07a41dac70fab0c703f8c3a69999e 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/AppModule.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/AppModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.app.Application
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/ApplicationComponent.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/ApplicationComponent.kt
index c5689ed260bf21589ea5500521cb2000633035f4..b03d4581b6a129cc44ce68d41b13263e6faac2ba 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/ApplicationComponent.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/ApplicationComponent.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import dagger.Component
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/DoNotKillMeFragment.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/DoNotKillMeFragment.kt
index 9adda59f21476695c14f1bc489a6d26b965d434a..c9ab6d2dc439ca28b551714f2ce3533f5c86b1f6 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/DoNotKillMeFragment.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/DoNotKillMeFragment.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import androidx.fragment.app.activityViewModels
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxApplication.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxApplication.kt
index fcc52e4bb31b5d0bd926b045235cdfe80b2b1a56..b8e2d743c924e18d8bf1d92d5defc54f10d1979d 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxApplication.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxApplication.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import androidx.multidex.MultiDexApplication
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxNotificationManager.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxNotificationManager.kt
index 942b7bb700d9b05809d8da8a9cd0fb32788890c3..a259a3028f52f1c68ef15b1baca609495eb53eda 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxNotificationManager.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxNotificationManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.app.Notification
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxService.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxService.kt
index 8b4a690adb4ee5451f60cf4650accd4338880f4e..c13b1a5a0307fc9b256d17fe74c3ed37a5d7b2ed 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxService.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxService.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.app.Service
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxViewModel.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxViewModel.kt
index 72433090a790f17ccfdb390e2c2002382c37f192..6730309c147abdb859c35a6ebd52057170b17d56 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxViewModel.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MailboxViewModel.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.app.Application
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainActivity.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainActivity.kt
index 9e926f3e2bf10e07f7a914d41a09fb7ce121bf06..11932673a90c7c8fa643eaf4c379f5ebb0ccdd15 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainActivity.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainActivity.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.os.Bundle
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainFragment.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainFragment.kt
index 93eaea88bdc8075b073663ba7e9facaaf8e319c5..6b5dab13b79a37f93aa46363e5f9f922b30209e4 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainFragment.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/android/MainFragment.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.android
 
 import android.os.Bundle
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/AndroidEagerSingletons.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/core/AndroidEagerSingletons.kt
index d07cae6f72ed74958392e83bdc3c2b733cfb61ea..513cba76b99d3adc2a7de2710dfa4ff1319ca655 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/AndroidEagerSingletons.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/AndroidEagerSingletons.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core
 
 import org.briarproject.mailbox.core.system.AndroidTaskScheduler
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmConstants.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmConstants.java
index 6338e44f82cc3eb3c47db8701855c6ac7984191a..0af51334e8d140fcfbca0119cbdaa60a93a62c49 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmConstants.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmConstants.java
@@ -1,15 +1,34 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 interface AlarmConstants {
 
-    /**
-     * Request code for the broadcast intent attached to the periodic alarm.
-     */
-    int REQUEST_ALARM = 1;
+	/**
+	 * Request code for the broadcast intent attached to the periodic alarm.
+	 */
+	int REQUEST_ALARM = 1;
 
-    /**
-     * Key for storing the process ID in the extras of the periodic alarm's
-     * intent. This allows us to ignore alarms scheduled by dead processes.
-     */
-    String EXTRA_PID = "org.briarproject.bramble.EXTRA_PID";
+	/**
+	 * Key for storing the process ID in the extras of the periodic alarm's
+	 * intent. This allows us to ignore alarms scheduled by dead processes.
+	 */
+	String EXTRA_PID = "org.briarproject.bramble.EXTRA_PID";
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmReceiver.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmReceiver.java
index 8a099905582428c82eb3febd1f5ecb048c7a124d..d238d8245a9fc84408499c02be590c36acad72ce 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmReceiver.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AlarmReceiver.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.content.BroadcastReceiver;
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutor.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutor.java
index a97d710516acd20efa7948574f42da058076a6ad..b1c760a2cab728c46b59ae2f0b0d5f93c3608d1a 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutor.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutor.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.util.concurrent.Callable;
@@ -9,25 +28,25 @@ import java.util.concurrent.Future;
  */
 public interface AndroidExecutor {
 
-    /**
-     * Runs the given task on a background thread with a message queue and
-     * returns a Future for getting the result.
-     */
-    <V> Future<V> runOnBackgroundThread(Callable<V> c);
+	/**
+	 * Runs the given task on a background thread with a message queue and
+	 * returns a Future for getting the result.
+	 */
+	<V> Future<V> runOnBackgroundThread(Callable<V> c);
 
-    /**
-     * Runs the given task on a background thread with a message queue.
-     */
-    void runOnBackgroundThread(Runnable r);
+	/**
+	 * Runs the given task on a background thread with a message queue.
+	 */
+	void runOnBackgroundThread(Runnable r);
 
-    /**
-     * Runs the given task on the main UI thread and returns a Future for
-     * getting the result.
-     */
-    <V> Future<V> runOnUiThread(Callable<V> c);
+	/**
+	 * Runs the given task on the main UI thread and returns a Future for
+	 * getting the result.
+	 */
+	<V> Future<V> runOnUiThread(Callable<V> c);
 
-    /**
-     * Runs the given task on the main UI thread.
-     */
-    void runOnUiThread(Runnable r);
+	/**
+	 * Runs the given task on the main UI thread.
+	 */
+	void runOnUiThread(Runnable r);
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutorImpl.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutorImpl.java
index 3544757c604beb91832a6f6bb3931ba9d80baeab..fb4b2c7af23f91169af2748c691f3df799c862c4 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutorImpl.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidExecutorImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.app.Application;
@@ -15,59 +34,59 @@ import javax.inject.Inject;
 
 class AndroidExecutorImpl implements AndroidExecutor {
 
-    private final Handler uiHandler;
-    private final Runnable loop;
-    private final AtomicBoolean started = new AtomicBoolean(false);
-    private final CountDownLatch startLatch = new CountDownLatch(1);
+	private final Handler uiHandler;
+	private final Runnable loop;
+	private final AtomicBoolean started = new AtomicBoolean(false);
+	private final CountDownLatch startLatch = new CountDownLatch(1);
 
-    private volatile Handler backgroundHandler = null;
+	private volatile Handler backgroundHandler = null;
 
-    @Inject
-    AndroidExecutorImpl(Application app) {
-        uiHandler = new Handler(app.getApplicationContext().getMainLooper());
-        loop = () -> {
-            Looper.prepare();
-            backgroundHandler = new Handler();
-            startLatch.countDown();
-            Looper.loop();
-        };
-    }
+	@Inject
+	AndroidExecutorImpl(Application app) {
+		uiHandler = new Handler(app.getApplicationContext().getMainLooper());
+		loop = () -> {
+			Looper.prepare();
+			backgroundHandler = new Handler();
+			startLatch.countDown();
+			Looper.loop();
+		};
+	}
 
-    private void startIfNecessary() {
-        if (!started.getAndSet(true)) {
-            Thread t = new Thread(loop, "AndroidExecutor");
-            t.setDaemon(true);
-            t.start();
-        }
-        try {
-            startLatch.await();
-        } catch (InterruptedException e) {
-            throw new RejectedExecutionException(e);
-        }
-    }
+	private void startIfNecessary() {
+		if (!started.getAndSet(true)) {
+			Thread t = new Thread(loop, "AndroidExecutor");
+			t.setDaemon(true);
+			t.start();
+		}
+		try {
+			startLatch.await();
+		} catch (InterruptedException e) {
+			throw new RejectedExecutionException(e);
+		}
+	}
 
-    @Override
-    public <V> Future<V> runOnBackgroundThread(Callable<V> c) {
-        FutureTask<V> f = new FutureTask<>(c);
-        runOnBackgroundThread(f);
-        return f;
-    }
+	@Override
+	public <V> Future<V> runOnBackgroundThread(Callable<V> c) {
+		FutureTask<V> f = new FutureTask<>(c);
+		runOnBackgroundThread(f);
+		return f;
+	}
 
-    @Override
-    public void runOnBackgroundThread(Runnable r) {
-        startIfNecessary();
-        backgroundHandler.post(r);
-    }
+	@Override
+	public void runOnBackgroundThread(Runnable r) {
+		startIfNecessary();
+		backgroundHandler.post(r);
+	}
 
-    @Override
-    public <V> Future<V> runOnUiThread(Callable<V> c) {
-        FutureTask<V> f = new FutureTask<>(c);
-        runOnUiThread(f);
-        return f;
-    }
+	@Override
+	public <V> Future<V> runOnUiThread(Callable<V> c) {
+		FutureTask<V> f = new FutureTask<>(c);
+		runOnUiThread(f);
+		return f;
+	}
 
-    @Override
-    public void runOnUiThread(Runnable r) {
-        uiHandler.post(r);
-    }
+	@Override
+	public void runOnUiThread(Runnable r) {
+		uiHandler.post(r);
+	}
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidSystemModule.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidSystemModule.java
index 7e348623bbb388690e8b27bb4120329dfd2b5a8f..55c3773453db0862d894478815e3b72721ff1907 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidSystemModule.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidSystemModule.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import org.briarproject.mailbox.core.event.EventExecutor;
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskScheduler.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskScheduler.java
index 770b9ef7f806547bf61a99fff0080ecc4df6f4a8..56df13486773ef9d0b0916a54723b972b1f51e20 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskScheduler.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskScheduler.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.annotation.TargetApi;
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskSchedulerModule.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskSchedulerModule.java
index 18074c14205d79d87a07c252347c2de356b9e422..72733855e7bc5bef9cc55de6bf4d304826469179 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskSchedulerModule.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidTaskSchedulerModule.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.app.Application;
@@ -17,21 +36,21 @@ import dagger.hilt.components.SingletonComponent;
 @InstallIn(SingletonComponent.class)
 public class AndroidTaskSchedulerModule {
 
-    @Provides
-    @Singleton
-    AndroidTaskScheduler provideAndroidTaskScheduler(
-            LifecycleManager lifecycleManager, Application app,
-            AndroidWakeLockManager wakeLockManager,
-            ScheduledExecutorService scheduledExecutorService) {
-        AndroidTaskScheduler scheduler = new AndroidTaskScheduler(app,
-                wakeLockManager, scheduledExecutorService);
-        lifecycleManager.registerService(scheduler);
-        return scheduler;
-    }
-
-    @Provides
-    @Singleton
-    TaskScheduler provideTaskScheduler(AndroidTaskScheduler scheduler) {
-        return scheduler;
-    }
+	@Provides
+	@Singleton
+	AndroidTaskScheduler provideAndroidTaskScheduler(
+			LifecycleManager lifecycleManager, Application app,
+			AndroidWakeLockManager wakeLockManager,
+			ScheduledExecutorService scheduledExecutorService) {
+		AndroidTaskScheduler scheduler = new AndroidTaskScheduler(app,
+				wakeLockManager, scheduledExecutorService);
+		lifecycleManager.registerService(scheduler);
+		return scheduler;
+	}
+
+	@Provides
+	@Singleton
+	TaskScheduler provideTaskScheduler(AndroidTaskScheduler scheduler) {
+		return scheduler;
+	}
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLock.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLock.java
index dd0c8f8fffc910279d50e0e7caa0a9dd750e0b30..76f9dd7fde9c9a529e16a09f38623821623eed36 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLock.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLock.java
@@ -1,16 +1,35 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 public interface AndroidWakeLock {
 
-    /**
-     * Acquires the wake lock. This has no effect if the wake lock has already
-     * been acquired.
-     */
-    void acquire();
+	/**
+	 * Acquires the wake lock. This has no effect if the wake lock has already
+	 * been acquired.
+	 */
+	void acquire();
 
-    /**
-     * Releases the wake lock. This has no effect if the wake lock has already
-     * been released.
-     */
-    void release();
+	/**
+	 * Releases the wake lock. This has no effect if the wake lock has already
+	 * been released.
+	 */
+	void release();
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockImpl.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockImpl.java
index 32b67fc62c955005a172217fac729d6c9d722cc3..b56534715e94dd7075d119e30065fecde974b236 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockImpl.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import org.slf4j.Logger;
@@ -18,45 +37,45 @@ import static org.slf4j.LoggerFactory.getLogger;
 @ThreadSafe
 class AndroidWakeLockImpl implements AndroidWakeLock {
 
-    private static final Logger LOG = getLogger(AndroidWakeLockImpl.class);
-
-    private static final AtomicInteger INSTANCE_ID = new AtomicInteger(0);
-
-    private final SharedWakeLock sharedWakeLock;
-    private final String tag;
-
-    private final Object lock = new Object();
-    @GuardedBy("lock")
-    private boolean held = false;
-
-    AndroidWakeLockImpl(SharedWakeLock sharedWakeLock, String tag) {
-        this.sharedWakeLock = sharedWakeLock;
-        this.tag = tag + "_" + INSTANCE_ID.getAndIncrement();
-    }
-
-    @Override
-    public void acquire() {
-        synchronized (lock) {
-            if (held) {
-                trace(LOG, () -> tag + " already acquired");
-            } else {
-                trace(LOG, () -> tag + " acquiring shared wake lock");
-                held = true;
-                sharedWakeLock.acquire();
-            }
-        }
-    }
-
-    @Override
-    public void release() {
-        synchronized (lock) {
-            if (held) {
-                trace(LOG, () -> tag + " releasing shared wake lock");
-                held = false;
-                sharedWakeLock.release();
-            } else {
-                trace(LOG, () -> tag + " already released");
-            }
-        }
-    }
+	private static final Logger LOG = getLogger(AndroidWakeLockImpl.class);
+
+	private static final AtomicInteger INSTANCE_ID = new AtomicInteger(0);
+
+	private final SharedWakeLock sharedWakeLock;
+	private final String tag;
+
+	private final Object lock = new Object();
+	@GuardedBy("lock")
+	private boolean held = false;
+
+	AndroidWakeLockImpl(SharedWakeLock sharedWakeLock, String tag) {
+		this.sharedWakeLock = sharedWakeLock;
+		this.tag = tag + "_" + INSTANCE_ID.getAndIncrement();
+	}
+
+	@Override
+	public void acquire() {
+		synchronized (lock) {
+			if (held) {
+				trace(LOG, () -> tag + " already acquired");
+			} else {
+				trace(LOG, () -> tag + " acquiring shared wake lock");
+				held = true;
+				sharedWakeLock.acquire();
+			}
+		}
+	}
+
+	@Override
+	public void release() {
+		synchronized (lock) {
+			if (held) {
+				trace(LOG, () -> tag + " releasing shared wake lock");
+				held = false;
+				sharedWakeLock.release();
+			} else {
+				trace(LOG, () -> tag + " already released");
+			}
+		}
+	}
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManager.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManager.java
index 7b2cd233b9d0044b8b93b81184f0321ecd279a03..449828b396ee77a736ba5c2950d0ce5d153c22c4 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManager.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManager.java
@@ -1,35 +1,54 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.util.concurrent.Executor;
 
 public interface AndroidWakeLockManager {
 
-    /**
-     * Creates a wake lock with the given tag. The tag is only used for
-     * logging; the underlying OS wake lock will use its own tag.
-     */
-    AndroidWakeLock createWakeLock(String tag);
+	/**
+	 * Creates a wake lock with the given tag. The tag is only used for
+	 * logging; the underlying OS wake lock will use its own tag.
+	 */
+	AndroidWakeLock createWakeLock(String tag);
 
-    /**
-     * Runs the given task while holding a wake lock.
-     */
-    void runWakefully(Runnable r, String tag);
+	/**
+	 * Runs the given task while holding a wake lock.
+	 */
+	void runWakefully(Runnable r, String tag);
 
-    /**
-     * Submits the given task to the given executor while holding a wake lock.
-     * The lock is released when the task completes, or if an exception is
-     * thrown while submitting or running the task.
-     */
-    void executeWakefully(Runnable r, Executor executor, String tag);
+	/**
+	 * Submits the given task to the given executor while holding a wake lock.
+	 * The lock is released when the task completes, or if an exception is
+	 * thrown while submitting or running the task.
+	 */
+	void executeWakefully(Runnable r, Executor executor, String tag);
 
-    /**
-     * Starts a dedicated thread to run the given task asynchronously. A wake
-     * lock is acquired before starting the thread and released when the task
-     * completes, or if an exception is thrown while starting the thread or
-     * running the task.
-     * <p>
-     * This method should only be used for lifecycle management tasks that
-     * can't be run on an executor.
-     */
-    void executeWakefully(Runnable r, String tag);
+	/**
+	 * Starts a dedicated thread to run the given task asynchronously. A wake
+	 * lock is acquired before starting the thread and released when the task
+	 * completes, or if an exception is thrown while starting the thread or
+	 * running the task.
+	 * <p>
+	 * This method should only be used for lifecycle management tasks that
+	 * can't be run on an executor.
+	 */
+	void executeWakefully(Runnable r, String tag);
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManagerImpl.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManagerImpl.java
index 0cbd9a087b454789a7727d6c20f945f96d4782a5..13bbfbe4a44c7694a78b60247bbd8d3ae1b354f4 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManagerImpl.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/AndroidWakeLockManagerImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.app.Application;
@@ -18,103 +37,103 @@ import static java.util.concurrent.TimeUnit.SECONDS;
 
 class AndroidWakeLockManagerImpl implements AndroidWakeLockManager {
 
-    /**
-     * How often to replace the wake lock.
-     */
-    private static final long LOCK_DURATION_MS = MINUTES.toMillis(1);
-
-    /**
-     * Automatically release the lock this many milliseconds after it's due
-     * to have been replaced and released.
-     */
-    private static final long SAFETY_MARGIN_MS = SECONDS.toMillis(30);
-
-    private final SharedWakeLock sharedWakeLock;
-
-    @Inject
-    AndroidWakeLockManagerImpl(Application app,
-                               ScheduledExecutorService scheduledExecutorService) {
-        PowerManager powerManager = (PowerManager)
-                requireNonNull(app.getSystemService(POWER_SERVICE));
-        String tag = getWakeLockTag(app);
-        sharedWakeLock = new RenewableWakeLock(powerManager,
-                scheduledExecutorService, PARTIAL_WAKE_LOCK, tag,
-                LOCK_DURATION_MS, SAFETY_MARGIN_MS);
-    }
-
-    @Override
-    public AndroidWakeLock createWakeLock(String tag) {
-        return new AndroidWakeLockImpl(sharedWakeLock, tag);
-    }
-
-    @Override
-    public void runWakefully(Runnable r, String tag) {
-        AndroidWakeLock wakeLock = createWakeLock(tag);
-        wakeLock.acquire();
-        try {
-            r.run();
-        } finally {
-            wakeLock.release();
-        }
-    }
-
-    @Override
-    public void executeWakefully(Runnable r, Executor executor, String tag) {
-        AndroidWakeLock wakeLock = createWakeLock(tag);
-        wakeLock.acquire();
-        try {
-            executor.execute(() -> {
-                try {
-                    r.run();
-                } finally {
-                    // Release the wake lock if the task throws an exception
-                    wakeLock.release();
-                }
-            });
-        } catch (Exception e) {
-            // Release the wake lock if the executor throws an exception when
-            // we submit the task (in which case the release() call above won't
-            // happen)
-            wakeLock.release();
-            throw e;
-        }
-    }
-
-    @Override
-    public void executeWakefully(Runnable r, String tag) {
-        AndroidWakeLock wakeLock = createWakeLock(tag);
-        wakeLock.acquire();
-        try {
-            new Thread(() -> {
-                try {
-                    r.run();
-                } finally {
-                    wakeLock.release();
-                }
-            }).start();
-        } catch (Exception e) {
-            wakeLock.release();
-            throw e;
-        }
-    }
-
-    private String getWakeLockTag(Context ctx) {
-        PackageManager pm = ctx.getPackageManager();
-        if (isInstalled(pm, "com.huawei.powergenie")) {
-            return "LocationManagerService";
-        } else if (isInstalled(pm, "com.evenwell.PowerMonitor")) {
-            return "AudioIn";
-        }
-        return ctx.getPackageName();
-    }
-
-    private boolean isInstalled(PackageManager pm, String packageName) {
-        try {
-            pm.getPackageInfo(packageName, 0);
-            return true;
-        } catch (PackageManager.NameNotFoundException e) {
-            return false;
-        }
-    }
+	/**
+	 * How often to replace the wake lock.
+	 */
+	private static final long LOCK_DURATION_MS = MINUTES.toMillis(1);
+
+	/**
+	 * Automatically release the lock this many milliseconds after it's due
+	 * to have been replaced and released.
+	 */
+	private static final long SAFETY_MARGIN_MS = SECONDS.toMillis(30);
+
+	private final SharedWakeLock sharedWakeLock;
+
+	@Inject
+	AndroidWakeLockManagerImpl(Application app,
+			ScheduledExecutorService scheduledExecutorService) {
+		PowerManager powerManager = (PowerManager)
+				requireNonNull(app.getSystemService(POWER_SERVICE));
+		String tag = getWakeLockTag(app);
+		sharedWakeLock = new RenewableWakeLock(powerManager,
+				scheduledExecutorService, PARTIAL_WAKE_LOCK, tag,
+				LOCK_DURATION_MS, SAFETY_MARGIN_MS);
+	}
+
+	@Override
+	public AndroidWakeLock createWakeLock(String tag) {
+		return new AndroidWakeLockImpl(sharedWakeLock, tag);
+	}
+
+	@Override
+	public void runWakefully(Runnable r, String tag) {
+		AndroidWakeLock wakeLock = createWakeLock(tag);
+		wakeLock.acquire();
+		try {
+			r.run();
+		} finally {
+			wakeLock.release();
+		}
+	}
+
+	@Override
+	public void executeWakefully(Runnable r, Executor executor, String tag) {
+		AndroidWakeLock wakeLock = createWakeLock(tag);
+		wakeLock.acquire();
+		try {
+			executor.execute(() -> {
+				try {
+					r.run();
+				} finally {
+					// Release the wake lock if the task throws an exception
+					wakeLock.release();
+				}
+			});
+		} catch (Exception e) {
+			// Release the wake lock if the executor throws an exception when
+			// we submit the task (in which case the release() call above won't
+			// happen)
+			wakeLock.release();
+			throw e;
+		}
+	}
+
+	@Override
+	public void executeWakefully(Runnable r, String tag) {
+		AndroidWakeLock wakeLock = createWakeLock(tag);
+		wakeLock.acquire();
+		try {
+			new Thread(() -> {
+				try {
+					r.run();
+				} finally {
+					wakeLock.release();
+				}
+			}).start();
+		} catch (Exception e) {
+			wakeLock.release();
+			throw e;
+		}
+	}
+
+	private String getWakeLockTag(Context ctx) {
+		PackageManager pm = ctx.getPackageManager();
+		if (isInstalled(pm, "com.huawei.powergenie")) {
+			return "LocationManagerService";
+		} else if (isInstalled(pm, "com.evenwell.PowerMonitor")) {
+			return "AudioIn";
+		}
+		return ctx.getPackageName();
+	}
+
+	private boolean isInstalled(PackageManager pm, String packageName) {
+		try {
+			pm.getPackageInfo(packageName, 0);
+			return true;
+		} catch (PackageManager.NameNotFoundException e) {
+			return false;
+		}
+	}
 
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/DozeWatchdog.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/DozeWatchdog.kt
index 34754d7571de6a261b5389b33241b67130e2d3fd..de30b474826037f203c14f2733c8cba4e5fd2b3a 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/DozeWatchdog.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/DozeWatchdog.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system
 
 import android.content.Context
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/RenewableWakeLock.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/RenewableWakeLock.java
index 0cd45bc6de686534a1c3b0e3d28d2a419bb35618..87d9647aa1cb781e4af0b70819f38ebb89ac33d8 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/RenewableWakeLock.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/RenewableWakeLock.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import android.os.PowerManager;
@@ -22,100 +41,104 @@ import static org.slf4j.LoggerFactory.getLogger;
 @ThreadSafe
 class RenewableWakeLock implements SharedWakeLock {
 
-    private static final Logger LOG = getLogger(RenewableWakeLock.class);
+	private static final Logger LOG = getLogger(RenewableWakeLock.class);
 
-    private final PowerManager powerManager;
-    private final ScheduledExecutorService scheduledExecutorService;
-    private final int levelAndFlags;
-    private final String tag;
-    private final long durationMs, safetyMarginMs;
+	private final PowerManager powerManager;
+	private final ScheduledExecutorService scheduledExecutorService;
+	private final int levelAndFlags;
+	private final String tag;
+	private final long durationMs, safetyMarginMs;
 
-    private final Object lock = new Object();
-    @GuardedBy("lock")
-    @Nullable
-    private WakeLock wakeLock;
-    @GuardedBy("lock")
-    @Nullable
-    private Future<?> future;
-    @GuardedBy("lock")
-    private int refCount = 0;
-    @GuardedBy("lock")
-    private long acquired = 0;
+	private final Object lock = new Object();
+	@GuardedBy("lock")
+	@Nullable
+	private WakeLock wakeLock;
+	@GuardedBy("lock")
+	@Nullable
+	private Future<?> future;
+	@GuardedBy("lock")
+	private int refCount = 0;
+	@GuardedBy("lock")
+	private long acquired = 0;
 
-    RenewableWakeLock(PowerManager powerManager,
-                      ScheduledExecutorService scheduledExecutorService,
-                      int levelAndFlags,
-                      String tag,
-                      long durationMs,
-                      long safetyMarginMs) {
-        this.powerManager = powerManager;
-        this.scheduledExecutorService = scheduledExecutorService;
-        this.levelAndFlags = levelAndFlags;
-        this.tag = tag;
-        this.durationMs = durationMs;
-        this.safetyMarginMs = safetyMarginMs;
-    }
+	RenewableWakeLock(PowerManager powerManager,
+			ScheduledExecutorService scheduledExecutorService,
+			int levelAndFlags,
+			String tag,
+			long durationMs,
+			long safetyMarginMs) {
+		this.powerManager = powerManager;
+		this.scheduledExecutorService = scheduledExecutorService;
+		this.levelAndFlags = levelAndFlags;
+		this.tag = tag;
+		this.durationMs = durationMs;
+		this.safetyMarginMs = safetyMarginMs;
+	}
 
-    @Override
-    public void acquire() {
-        synchronized (lock) {
-            refCount++;
-            if (refCount == 1) {
-                info(LOG, () -> "Acquiring wake lock " + tag);
-                wakeLock = powerManager.newWakeLock(levelAndFlags, tag);
-                // We do our own reference counting so we can replace the lock
-                // TODO: Check whether using a ref-counted wake lock affects
-                //  power management apps
-                wakeLock.setReferenceCounted(false);
-                wakeLock.acquire(durationMs + safetyMarginMs);
-                future = scheduledExecutorService.schedule(this::renew,
-                        durationMs, MILLISECONDS);
-                acquired = android.os.SystemClock.elapsedRealtime();
-            } else {
-                trace(LOG, () -> "Wake lock " + tag + " has " + refCount + " holders");
-            }
-        }
-    }
+	@Override
+	public void acquire() {
+		synchronized (lock) {
+			refCount++;
+			if (refCount == 1) {
+				info(LOG, () -> "Acquiring wake lock " + tag);
+				wakeLock = powerManager.newWakeLock(levelAndFlags, tag);
+				// We do our own reference counting so we can replace the lock
+				// TODO: Check whether using a ref-counted wake lock affects
+				//  power management apps
+				wakeLock.setReferenceCounted(false);
+				wakeLock.acquire(durationMs + safetyMarginMs);
+				future = scheduledExecutorService.schedule(this::renew,
+						durationMs, MILLISECONDS);
+				acquired = android.os.SystemClock.elapsedRealtime();
+			} else {
+				trace(LOG, () -> "Wake lock " + tag + " has " + refCount +
+						" holders");
+			}
+		}
+	}
 
-    private void renew() {
-        info(LOG, () -> "Renewing wake lock " + tag);
-        synchronized (lock) {
-            if (wakeLock == null) {
-                LOG.info("Already released");
-                return;
-            }
-            trace(LOG, () -> "Wake lock " + tag + " has " + refCount + " holders");
-            long now = android.os.SystemClock.elapsedRealtime();
-            long expiry = acquired + durationMs + safetyMarginMs;
-            if (now > expiry) {
-                warn(LOG, () -> "Wake lock expired " + (now - expiry) + " ms ago");
-            }
-            WakeLock oldWakeLock = wakeLock;
-            wakeLock = powerManager.newWakeLock(levelAndFlags, tag);
-            wakeLock.setReferenceCounted(false);
-            wakeLock.acquire(durationMs + safetyMarginMs);
-            oldWakeLock.release();
-            future = scheduledExecutorService.schedule(this::renew, durationMs,
-                    MILLISECONDS);
-            acquired = now;
-        }
-    }
+	private void renew() {
+		info(LOG, () -> "Renewing wake lock " + tag);
+		synchronized (lock) {
+			if (wakeLock == null) {
+				LOG.info("Already released");
+				return;
+			}
+			trace(LOG,
+					() -> "Wake lock " + tag + " has " + refCount + " holders");
+			long now = android.os.SystemClock.elapsedRealtime();
+			long expiry = acquired + durationMs + safetyMarginMs;
+			if (now > expiry) {
+				warn(LOG, () -> "Wake lock expired " + (now - expiry) +
+						" ms ago");
+			}
+			WakeLock oldWakeLock = wakeLock;
+			wakeLock = powerManager.newWakeLock(levelAndFlags, tag);
+			wakeLock.setReferenceCounted(false);
+			wakeLock.acquire(durationMs + safetyMarginMs);
+			oldWakeLock.release();
+			future = scheduledExecutorService.schedule(this::renew, durationMs,
+					MILLISECONDS);
+			acquired = now;
+		}
+	}
 
-    @Override
-    public void release() {
-        synchronized (lock) {
-            refCount--;
-            if (refCount == 0) {
-                info(LOG, () -> "Releasing wake lock " + tag);
-                requireNonNull(future).cancel(false);
-                future = null;
-                requireNonNull(wakeLock).release();
-                wakeLock = null;
-                acquired = 0;
-            } else {
-                trace(LOG, () -> "Wake lock " + tag + " has " + refCount + " holders");
-            }
-        }
-    }
+	@Override
+	public void release() {
+		synchronized (lock) {
+			refCount--;
+			if (refCount == 0) {
+				info(LOG, () -> "Releasing wake lock " + tag);
+				requireNonNull(future).cancel(false);
+				future = null;
+				requireNonNull(wakeLock).release();
+				wakeLock = null;
+				acquired = 0;
+			} else {
+				trace(LOG, () -> "Wake lock " + tag + " has " + refCount +
+						" holders");
+			}
+		}
+	}
 }
 
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/SharedWakeLock.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/SharedWakeLock.java
index d193a7806cbe6a0974eae6cb44fb848bfeda4031..92613288c4ab3ec2bd5ba2b990a4a5b49c813922 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/SharedWakeLock.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/system/SharedWakeLock.java
@@ -1,19 +1,38 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 interface SharedWakeLock {
 
-    /**
-     * Acquires the wake lock. This increments the wake lock's reference count,
-     * so unlike {@link AndroidWakeLock#acquire()} every call to this method
-     * must be followed by a balancing call to {@link #release()}.
-     */
-    void acquire();
+	/**
+	 * Acquires the wake lock. This increments the wake lock's reference count,
+	 * so unlike {@link AndroidWakeLock#acquire()} every call to this method
+	 * must be followed by a balancing call to {@link #release()}.
+	 */
+	void acquire();
 
-    /**
-     * Releases the wake lock. This decrements the wake lock's reference count,
-     * so unlike {@link AndroidWakeLock#release()} every call to this method
-     * must follow a balancing call to {@link #acquire()}.
-     */
-    void release();
+	/**
+	 * Releases the wake lock. This decrements the wake lock's reference count,
+	 * so unlike {@link AndroidWakeLock#release()} every call to this method
+	 * must follow a balancing call to {@link #acquire()}.
+	 */
+	void release();
 
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidLocationUtils.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidLocationUtils.java
index b189c3d43f20b0cafeba86d04c93e096e16d9ad3..ceee943eac0c7cae773923ca1fba611fb4a3c113 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidLocationUtils.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidLocationUtils.java
@@ -1,6 +1,23 @@
-package org.briarproject.mailbox.core.tor;
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
-import static android.content.Context.TELEPHONY_SERVICE;
+package org.briarproject.mailbox.core.tor;
 
 import android.annotation.SuppressLint;
 import android.app.Application;
@@ -15,56 +32,58 @@ import java.util.logging.Logger;
 
 import javax.inject.Inject;
 
+import static android.content.Context.TELEPHONY_SERVICE;
+
 class AndroidLocationUtils implements LocationUtils {
 
-    private static final Logger LOG =
-            Logger.getLogger(AndroidLocationUtils.class.getName());
+	private static final Logger LOG =
+			Logger.getLogger(AndroidLocationUtils.class.getName());
 
-    private final Context appContext;
+	private final Context appContext;
 
-    @Inject
-    AndroidLocationUtils(Application app) {
-        appContext = app.getApplicationContext();
-    }
+	@Inject
+	AndroidLocationUtils(Application app) {
+		appContext = app.getApplicationContext();
+	}
 
-    /**
-     * This guesses the current country from the first of these sources that
-     * succeeds (also in order of likelihood of being correct):
-     *
-     * <ul>
-     * <li>Phone network. This works even when no SIM card is inserted, or a
-     *     foreign SIM card is inserted.</li>
-     * <li>SIM card. This is only an heuristic and assumes the user is not
-     *     roaming.</li>
-     * <li>User locale. This is an even worse heuristic.</li>
-     * </ul>
-     * <p>
-     * Note: this is very similar to <a href="https://android.googlesource.com/platform/frameworks/base/+/cd92588%5E/location/java/android/location/CountryDetector.java">
-     * this API</a> except it seems that Google doesn't want us to use it for
-     * some reason - both that class and {@code Context.COUNTRY_CODE} are
-     * annotated {@code @hide}.
-     */
-    @Override
-    @SuppressLint("DefaultLocale")
-    public String getCurrentCountry() {
-        String countryCode = getCountryFromPhoneNetwork();
-        if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
-        LOG.info("Falling back to SIM card country");
-        countryCode = getCountryFromSimCard();
-        if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
-        LOG.info("Falling back to user-defined locale");
-        return Locale.getDefault().getCountry();
-    }
+	/**
+	 * This guesses the current country from the first of these sources that
+	 * succeeds (also in order of likelihood of being correct):
+	 *
+	 * <ul>
+	 * <li>Phone network. This works even when no SIM card is inserted, or a
+	 *     foreign SIM card is inserted.</li>
+	 * <li>SIM card. This is only an heuristic and assumes the user is not
+	 *     roaming.</li>
+	 * <li>User locale. This is an even worse heuristic.</li>
+	 * </ul>
+	 * <p>
+	 * Note: this is very similar to <a href="https://android.googlesource.com/platform/frameworks/base/+/cd92588%5E/location/java/android/location/CountryDetector.java">
+	 * this API</a> except it seems that Google doesn't want us to use it for
+	 * some reason - both that class and {@code Context.COUNTRY_CODE} are
+	 * annotated {@code @hide}.
+	 */
+	@Override
+	@SuppressLint("DefaultLocale")
+	public String getCurrentCountry() {
+		String countryCode = getCountryFromPhoneNetwork();
+		if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
+		LOG.info("Falling back to SIM card country");
+		countryCode = getCountryFromSimCard();
+		if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
+		LOG.info("Falling back to user-defined locale");
+		return Locale.getDefault().getCountry();
+	}
 
-    private String getCountryFromPhoneNetwork() {
-        Object o = appContext.getSystemService(TELEPHONY_SERVICE);
-        TelephonyManager tm = (TelephonyManager) o;
-        return tm == null ? "" : tm.getNetworkCountryIso();
-    }
+	private String getCountryFromPhoneNetwork() {
+		Object o = appContext.getSystemService(TELEPHONY_SERVICE);
+		TelephonyManager tm = (TelephonyManager) o;
+		return tm == null ? "" : tm.getNetworkCountryIso();
+	}
 
-    private String getCountryFromSimCard() {
-        Object o = appContext.getSystemService(TELEPHONY_SERVICE);
-        TelephonyManager tm = (TelephonyManager) o;
-        return tm == null ? "" : tm.getSimCountryIso();
-    }
+	private String getCountryFromSimCard() {
+		Object o = appContext.getSystemService(TELEPHONY_SERVICE);
+		TelephonyManager tm = (TelephonyManager) o;
+		return tm == null ? "" : tm.getSimCountryIso();
+	}
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidNetworkManager.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidNetworkManager.java
index 1743c3c477f40bb4dd90bf6003fc800fe9cd1a74..290a62ab63983177a38e2c02cde8e047874df88f 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidNetworkManager.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidNetworkManager.java
@@ -1,21 +1,23 @@
-package org.briarproject.mailbox.core.tor;
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
-import static android.content.Context.CONNECTIVITY_SERVICE;
-import static android.content.Intent.ACTION_SCREEN_OFF;
-import static android.content.Intent.ACTION_SCREEN_ON;
-import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
-import static android.net.ConnectivityManager.TYPE_WIFI;
-import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION;
-import static android.os.Build.VERSION.SDK_INT;
-import static android.os.PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED;
-import static org.briarproject.mailbox.core.util.LogUtils.info;
-import static org.briarproject.mailbox.core.util.LogUtils.logException;
-import static org.slf4j.LoggerFactory.getLogger;
-import static java.net.NetworkInterface.getNetworkInterfaces;
-import static java.util.Collections.list;
-import static java.util.Objects.requireNonNull;
-import static java.util.concurrent.TimeUnit.MINUTES;
-import static java.util.concurrent.TimeUnit.SECONDS;
+package org.briarproject.mailbox.core.tor;
 
 import android.annotation.TargetApi;
 import android.app.Application;
@@ -49,167 +51,184 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.Nullable;
 import javax.inject.Inject;
 
+import static android.content.Context.CONNECTIVITY_SERVICE;
+import static android.content.Intent.ACTION_SCREEN_OFF;
+import static android.content.Intent.ACTION_SCREEN_ON;
+import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
+import static android.net.ConnectivityManager.TYPE_WIFI;
+import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION;
+import static android.os.Build.VERSION.SDK_INT;
+import static android.os.PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED;
+import static java.net.NetworkInterface.getNetworkInterfaces;
+import static java.util.Collections.list;
+import static java.util.Objects.requireNonNull;
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.briarproject.mailbox.core.util.LogUtils.info;
+import static org.briarproject.mailbox.core.util.LogUtils.logException;
+import static org.slf4j.LoggerFactory.getLogger;
+
 public class AndroidNetworkManager implements NetworkManager, Service {
 
-    private static final Logger LOG = getLogger(AndroidNetworkManager.class);
-
-    // See android.net.wifi.WifiManager
-    private static final String WIFI_AP_STATE_CHANGED_ACTION =
-            "android.net.wifi.WIFI_AP_STATE_CHANGED";
-
-    private final TaskScheduler scheduler;
-    private final EventBus eventBus;
-    private final Executor eventExecutor;
-    private final Application app;
-    private final ConnectivityManager connectivityManager;
-    private final AtomicReference<Cancellable> connectivityCheck =
-            new AtomicReference<>();
-    private final AtomicBoolean used = new AtomicBoolean(false);
-
-    private volatile BroadcastReceiver networkStateReceiver = null;
-
-    @Inject
-    AndroidNetworkManager(TaskScheduler scheduler, EventBus eventBus,
-                          @EventExecutor Executor eventExecutor, Application app) {
-        this.scheduler = scheduler;
-        this.eventBus = eventBus;
-        this.eventExecutor = eventExecutor;
-        this.app = app;
-        connectivityManager = (ConnectivityManager)
-                requireNonNull(app.getSystemService(CONNECTIVITY_SERVICE));
-    }
-
-    @Override
-    public void startService() {
-        if (used.getAndSet(true)) throw new IllegalStateException();
-        // Register to receive network status events
-        networkStateReceiver = new NetworkStateReceiver();
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(CONNECTIVITY_ACTION);
-        filter.addAction(ACTION_SCREEN_ON);
-        filter.addAction(ACTION_SCREEN_OFF);
-        filter.addAction(WIFI_AP_STATE_CHANGED_ACTION);
-        filter.addAction(WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
-        if (SDK_INT >= 23) filter.addAction(ACTION_DEVICE_IDLE_MODE_CHANGED);
-        app.registerReceiver(networkStateReceiver, filter);
-    }
-
-    @Override
-    public void stopService() {
-        if (networkStateReceiver != null)
-            app.unregisterReceiver(networkStateReceiver);
-    }
-
-    @Override
-    public NetworkStatus getNetworkStatus() {
-        NetworkInfo net = connectivityManager.getActiveNetworkInfo();
-        boolean connected = net != null && net.isConnected();
-        boolean wifi = false, ipv6Only = false;
-        if (connected) {
-            wifi = net.getType() == TYPE_WIFI;
-            if (SDK_INT >= 23) ipv6Only = isActiveNetworkIpv6Only();
-            else ipv6Only = areAllAvailableNetworksIpv6Only();
-        }
-        return new NetworkStatus(connected, wifi, ipv6Only);
-    }
-
-    /**
-     * Returns true if the
-     * {@link ConnectivityManager#getActiveNetwork() active network} has an
-     * IPv6 unicast address and no IPv4 addresses. The active network is
-     * assumed not to be a loopback interface.
-     */
-    @TargetApi(23)
-    private boolean isActiveNetworkIpv6Only() {
-        Network net = connectivityManager.getActiveNetwork();
-        if (net == null) {
-            LOG.info("No active network");
-            return false;
-        }
-        LinkProperties props = connectivityManager.getLinkProperties(net);
-        if (props == null) {
-            LOG.info("No link properties for active network");
-            return false;
-        }
-        boolean hasIpv6Unicast = false;
-        for (LinkAddress linkAddress : props.getLinkAddresses()) {
-            InetAddress addr = linkAddress.getAddress();
-            if (addr instanceof Inet4Address) return false;
-            if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
-        }
-        return hasIpv6Unicast;
-    }
-
-    /**
-     * Returns true if the device has at least one network interface with an
-     * IPv6 unicast address and no interfaces with IPv4 addresses, excluding
-     * loopback interfaces and interfaces that are
-     * {@link NetworkInterface#isUp() down}. If this method returns true and
-     * the device has internet access then it's via IPv6 only.
-     */
-    private boolean areAllAvailableNetworksIpv6Only() {
-        try {
-            Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
-            if (interfaces == null) {
-                LOG.info("No network interfaces");
-                return false;
-            }
-            boolean hasIpv6Unicast = false;
-            for (NetworkInterface i : list(interfaces)) {
-                if (i.isLoopback() || !i.isUp()) continue;
-                for (InetAddress addr : list(i.getInetAddresses())) {
-                    if (addr instanceof Inet4Address) return false;
-                    if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
-                }
-            }
-            return hasIpv6Unicast;
-        } catch (SocketException e) {
-            logException(LOG, e);
-            return false;
-        }
-    }
-
-    private void updateConnectionStatus() {
-        eventBus.broadcast(new NetworkStatusEvent(getNetworkStatus()));
-    }
-
-    private void scheduleConnectionStatusUpdate(int delay, TimeUnit unit) {
-        Cancellable newConnectivityCheck =
-                scheduler.schedule(this::updateConnectionStatus, eventExecutor,
-                        delay, unit);
-        Cancellable oldConnectivityCheck =
-                connectivityCheck.getAndSet(newConnectivityCheck);
-        if (oldConnectivityCheck != null) oldConnectivityCheck.cancel();
-    }
-
-    private class NetworkStateReceiver extends BroadcastReceiver {
-
-        @Override
-        public void onReceive(Context ctx, Intent i) {
-            String action = i.getAction();
-            info(LOG, () -> "Received broadcast " + action);
-            updateConnectionStatus();
-            if (isSleepOrDozeEvent(action)) {
-                // Allow time for the network to be enabled or disabled
-                scheduleConnectionStatusUpdate(1, MINUTES);
-            } else if (isApEvent(action)) {
-                // The state change may be broadcast before the AP address is
-                // visible, so delay handling the event
-                scheduleConnectionStatusUpdate(5, SECONDS);
-            }
-        }
-
-        private boolean isSleepOrDozeEvent(@Nullable String action) {
-            boolean isSleep = ACTION_SCREEN_ON.equals(action) ||
-                    ACTION_SCREEN_OFF.equals(action);
-            boolean isDoze = SDK_INT >= 23 &&
-                    ACTION_DEVICE_IDLE_MODE_CHANGED.equals(action);
-            return isSleep || isDoze;
-        }
-
-        private boolean isApEvent(@Nullable String action) {
-            return WIFI_AP_STATE_CHANGED_ACTION.equals(action) ||
-                    WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action);
-        }
-    }
+	private static final Logger LOG = getLogger(AndroidNetworkManager.class);
+
+	// See android.net.wifi.WifiManager
+	private static final String WIFI_AP_STATE_CHANGED_ACTION =
+			"android.net.wifi.WIFI_AP_STATE_CHANGED";
+
+	private final TaskScheduler scheduler;
+	private final EventBus eventBus;
+	private final Executor eventExecutor;
+	private final Application app;
+	private final ConnectivityManager connectivityManager;
+	private final AtomicReference<Cancellable> connectivityCheck =
+			new AtomicReference<>();
+	private final AtomicBoolean used = new AtomicBoolean(false);
+
+	private volatile BroadcastReceiver networkStateReceiver = null;
+
+	@Inject
+	AndroidNetworkManager(TaskScheduler scheduler, EventBus eventBus,
+			@EventExecutor Executor eventExecutor, Application app) {
+		this.scheduler = scheduler;
+		this.eventBus = eventBus;
+		this.eventExecutor = eventExecutor;
+		this.app = app;
+		connectivityManager = (ConnectivityManager)
+				requireNonNull(app.getSystemService(CONNECTIVITY_SERVICE));
+	}
+
+	@Override
+	public void startService() {
+		if (used.getAndSet(true)) throw new IllegalStateException();
+		// Register to receive network status events
+		networkStateReceiver = new NetworkStateReceiver();
+		IntentFilter filter = new IntentFilter();
+		filter.addAction(CONNECTIVITY_ACTION);
+		filter.addAction(ACTION_SCREEN_ON);
+		filter.addAction(ACTION_SCREEN_OFF);
+		filter.addAction(WIFI_AP_STATE_CHANGED_ACTION);
+		filter.addAction(WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
+		if (SDK_INT >= 23) filter.addAction(ACTION_DEVICE_IDLE_MODE_CHANGED);
+		app.registerReceiver(networkStateReceiver, filter);
+	}
+
+	@Override
+	public void stopService() {
+		if (networkStateReceiver != null)
+			app.unregisterReceiver(networkStateReceiver);
+	}
+
+	@Override
+	public NetworkStatus getNetworkStatus() {
+		NetworkInfo net = connectivityManager.getActiveNetworkInfo();
+		boolean connected = net != null && net.isConnected();
+		boolean wifi = false, ipv6Only = false;
+		if (connected) {
+			wifi = net.getType() == TYPE_WIFI;
+			if (SDK_INT >= 23) ipv6Only = isActiveNetworkIpv6Only();
+			else ipv6Only = areAllAvailableNetworksIpv6Only();
+		}
+		return new NetworkStatus(connected, wifi, ipv6Only);
+	}
+
+	/**
+	 * Returns true if the
+	 * {@link ConnectivityManager#getActiveNetwork() active network} has an
+	 * IPv6 unicast address and no IPv4 addresses. The active network is
+	 * assumed not to be a loopback interface.
+	 */
+	@TargetApi(23)
+	private boolean isActiveNetworkIpv6Only() {
+		Network net = connectivityManager.getActiveNetwork();
+		if (net == null) {
+			LOG.info("No active network");
+			return false;
+		}
+		LinkProperties props = connectivityManager.getLinkProperties(net);
+		if (props == null) {
+			LOG.info("No link properties for active network");
+			return false;
+		}
+		boolean hasIpv6Unicast = false;
+		for (LinkAddress linkAddress : props.getLinkAddresses()) {
+			InetAddress addr = linkAddress.getAddress();
+			if (addr instanceof Inet4Address) return false;
+			if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
+		}
+		return hasIpv6Unicast;
+	}
+
+	/**
+	 * Returns true if the device has at least one network interface with an
+	 * IPv6 unicast address and no interfaces with IPv4 addresses, excluding
+	 * loopback interfaces and interfaces that are
+	 * {@link NetworkInterface#isUp() down}. If this method returns true and
+	 * the device has internet access then it's via IPv6 only.
+	 */
+	private boolean areAllAvailableNetworksIpv6Only() {
+		try {
+			Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
+			if (interfaces == null) {
+				LOG.info("No network interfaces");
+				return false;
+			}
+			boolean hasIpv6Unicast = false;
+			for (NetworkInterface i : list(interfaces)) {
+				if (i.isLoopback() || !i.isUp()) continue;
+				for (InetAddress addr : list(i.getInetAddresses())) {
+					if (addr instanceof Inet4Address) return false;
+					if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
+				}
+			}
+			return hasIpv6Unicast;
+		} catch (SocketException e) {
+			logException(LOG, e);
+			return false;
+		}
+	}
+
+	private void updateConnectionStatus() {
+		eventBus.broadcast(new NetworkStatusEvent(getNetworkStatus()));
+	}
+
+	private void scheduleConnectionStatusUpdate(int delay, TimeUnit unit) {
+		Cancellable newConnectivityCheck =
+				scheduler.schedule(this::updateConnectionStatus, eventExecutor,
+						delay, unit);
+		Cancellable oldConnectivityCheck =
+				connectivityCheck.getAndSet(newConnectivityCheck);
+		if (oldConnectivityCheck != null) oldConnectivityCheck.cancel();
+	}
+
+	private class NetworkStateReceiver extends BroadcastReceiver {
+
+		@Override
+		public void onReceive(Context ctx, Intent i) {
+			String action = i.getAction();
+			info(LOG, () -> "Received broadcast " + action);
+			updateConnectionStatus();
+			if (isSleepOrDozeEvent(action)) {
+				// Allow time for the network to be enabled or disabled
+				scheduleConnectionStatusUpdate(1, MINUTES);
+			} else if (isApEvent(action)) {
+				// The state change may be broadcast before the AP address is
+				// visible, so delay handling the event
+				scheduleConnectionStatusUpdate(5, SECONDS);
+			}
+		}
+
+		private boolean isSleepOrDozeEvent(@Nullable String action) {
+			boolean isSleep = ACTION_SCREEN_ON.equals(action) ||
+					ACTION_SCREEN_OFF.equals(action);
+			boolean isDoze = SDK_INT >= 23 &&
+					ACTION_DEVICE_IDLE_MODE_CHANGED.equals(action);
+			return isSleep || isDoze;
+		}
+
+		private boolean isApEvent(@Nullable String action) {
+			return WIFI_AP_STATE_CHANGED_ACTION.equals(action) ||
+					WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action);
+		}
+	}
 }
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorModule.kt b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorModule.kt
index b750cf91afd42a1c830a51205b9d0c329d00135a..460bec355310776554ac14d2c4bd8ac477f632cc 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorModule.kt
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor
 
 import android.content.Context
diff --git a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorPlugin.java b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorPlugin.java
index a29caa9372e1af4fb007e33fc55fde66a5bf67f6..bf8fd82740905a31496d89e9a0e3fb8f6108b06c 100644
--- a/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorPlugin.java
+++ b/mailbox-android/src/main/java/org/briarproject/mailbox/core/tor/AndroidTorPlugin.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import android.content.Context;
@@ -34,181 +53,184 @@ import static org.slf4j.LoggerFactory.getLogger;
 
 public class AndroidTorPlugin extends TorPlugin {
 
-    private static final List<String> LIBRARY_ARCHITECTURES =
-            asList("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
-
-    private static final String TOR_LIB_NAME = "libtor.so";
-    private static final String OBFS4_LIB_NAME = "libobfs4proxy.so";
-
-    private static final Logger LOG = getLogger(AndroidTorPlugin.class);
-
-    private final Context ctx;
-    private final AndroidWakeLock wakeLock;
-    private final File torLib, obfs4Lib;
-
-    AndroidTorPlugin(Executor ioExecutor,
-                     Context ctx,
-                     SettingsManager settingsManager,
-                     NetworkManager networkManager,
-                     LocationUtils locationUtils,
-                     Clock clock,
-                     ResourceProvider resourceProvider,
-                     CircumventionProvider circumventionProvider,
-                     AndroidWakeLockManager wakeLockManager,
-                     Backoff backoff,
-                     @Nullable String architecture,
-                     File torDirectory) {
-        super(ioExecutor, settingsManager, networkManager, locationUtils, clock, resourceProvider, circumventionProvider, backoff, architecture, torDirectory);
-        this.ctx = ctx;
-        wakeLock = wakeLockManager.createWakeLock("TorPlugin");
-        String nativeLibDir = ctx.getApplicationInfo().nativeLibraryDir;
-        torLib = new File(nativeLibDir, TOR_LIB_NAME);
-        obfs4Lib = new File(nativeLibDir, OBFS4_LIB_NAME);
-    }
-
-    @Override
-    protected int getProcessId() {
-        return android.os.Process.myPid();
-    }
-
-    @Override
-    protected long getLastUpdateTime() {
-        try {
-            PackageManager pm = ctx.getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), 0);
-            return pi.lastUpdateTime;
-        } catch (NameNotFoundException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    @Override
-    protected void enableNetwork(boolean enable) throws IOException {
-        if (enable) wakeLock.acquire();
-        super.enableNetwork(enable);
-        if (!enable) wakeLock.release();
-    }
-
-    @Override
-    public void stopService() {
-        super.stopService();
-        wakeLock.release();
-    }
-
-    @Override
-    protected File getTorExecutableFile() {
-        return torLib.exists() ? torLib : super.getTorExecutableFile();
-    }
-
-    @Override
-    protected File getObfs4ExecutableFile() {
-        return obfs4Lib.exists() ? obfs4Lib : super.getObfs4ExecutableFile();
-    }
-
-    @Override
-    protected void installTorExecutable() throws IOException {
-        File extracted = super.getTorExecutableFile();
-        if (torLib.exists()) {
-            // If an older version left behind a Tor binary, delete it
-            if (extracted.exists()) {
-                if (extracted.delete()) LOG.info("Deleted Tor binary");
-                else LOG.info("Failed to delete Tor binary");
-            }
-        } else if (SDK_INT < 29) {
-            // The binary wasn't extracted at install time. Try to extract it
-            extractLibraryFromApk(TOR_LIB_NAME, extracted);
-        } else {
-            // No point extracting the binary, we won't be allowed to execute it
-            throw new FileNotFoundException(torLib.getAbsolutePath());
-        }
-    }
-
-    @Override
-    protected void installObfs4Executable() throws IOException {
-        File extracted = super.getObfs4ExecutableFile();
-        if (obfs4Lib.exists()) {
-            // If an older version left behind an obfs4 binary, delete it
-            if (extracted.exists()) {
-                if (extracted.delete()) LOG.info("Deleted obfs4 binary");
-                else LOG.info("Failed to delete obfs4 binary");
-            }
-        } else if (SDK_INT < 29) {
-            // The binary wasn't extracted at install time. Try to extract it
-            extractLibraryFromApk(OBFS4_LIB_NAME, extracted);
-        } else {
-            // No point extracting the binary, we won't be allowed to execute it
-            throw new FileNotFoundException(obfs4Lib.getAbsolutePath());
-        }
-    }
-
-    private void extractLibraryFromApk(String libName, File dest)
-            throws IOException {
-        File sourceDir = new File(ctx.getApplicationInfo().sourceDir);
-        if (sourceDir.isFile()) {
-            // Look for other APK files in the same directory, if we're allowed
-            File parent = sourceDir.getParentFile();
-            if (parent != null) sourceDir = parent;
-        }
-        List<String> libPaths = getSupportedLibraryPaths(libName);
-        for (File apk : findApkFiles(sourceDir)) {
-            ZipInputStream zin = new ZipInputStream(new FileInputStream(apk));
-            for (ZipEntry e = zin.getNextEntry(); e != null;
-                 e = zin.getNextEntry()) {
-                if (libPaths.contains(e.getName())) {
-                    String ex = e.getName();
-                    info(LOG, () -> "Extracting " + ex + " from " + apk.getAbsolutePath());
-                    extract(zin, dest); // Zip input stream will be closed
-                    return;
-                }
-            }
-            zin.close();
-        }
-        throw new FileNotFoundException(libName);
-    }
-
-    /**
-     * Returns all files with the extension .apk or .APK under the given root.
-     */
-    private List<File> findApkFiles(File root) {
-        List<File> files = new ArrayList<>();
-        findApkFiles(root, files);
-        return files;
-    }
-
-    private void findApkFiles(File f, List<File> files) {
-        if (f.isFile() && f.getName().toLowerCase().endsWith(".apk")) {
-            files.add(f);
-        } else if (f.isDirectory()) {
-            File[] children = f.listFiles();
-            if (children != null) {
-                for (File child : children) findApkFiles(child, files);
-            }
-        }
-    }
-
-    /**
-     * Returns the paths at which libraries with the given name would be found
-     * inside an APK file, for all architectures supported by the device, in
-     * order of preference.
-     */
-    private List<String> getSupportedLibraryPaths(String libName) {
-        List<String> architectures = new ArrayList<>();
-        for (String abi : getSupportedArchitectures()) {
-            if (LIBRARY_ARCHITECTURES.contains(abi)) {
-                architectures.add("lib/" + abi + "/" + libName);
-            }
-        }
-        return architectures;
-    }
-
-    static Collection<String> getSupportedArchitectures() {
-        List<String> abis = new ArrayList<>();
-        if (SDK_INT >= 21) {
-            abis.addAll(asList(Build.SUPPORTED_ABIS));
-        } else {
-            abis.add(Build.CPU_ABI);
-            if (Build.CPU_ABI2 != null) abis.add(Build.CPU_ABI2);
-        }
-        return abis;
-    }
+	private static final List<String> LIBRARY_ARCHITECTURES =
+			asList("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
+
+	private static final String TOR_LIB_NAME = "libtor.so";
+	private static final String OBFS4_LIB_NAME = "libobfs4proxy.so";
+
+	private static final Logger LOG = getLogger(AndroidTorPlugin.class);
+
+	private final Context ctx;
+	private final AndroidWakeLock wakeLock;
+	private final File torLib, obfs4Lib;
+
+	AndroidTorPlugin(Executor ioExecutor,
+			Context ctx,
+			SettingsManager settingsManager,
+			NetworkManager networkManager,
+			LocationUtils locationUtils,
+			Clock clock,
+			ResourceProvider resourceProvider,
+			CircumventionProvider circumventionProvider,
+			AndroidWakeLockManager wakeLockManager,
+			Backoff backoff,
+			@Nullable String architecture,
+			File torDirectory) {
+		super(ioExecutor, settingsManager, networkManager, locationUtils, clock,
+				resourceProvider, circumventionProvider, backoff, architecture,
+				torDirectory);
+		this.ctx = ctx;
+		wakeLock = wakeLockManager.createWakeLock("TorPlugin");
+		String nativeLibDir = ctx.getApplicationInfo().nativeLibraryDir;
+		torLib = new File(nativeLibDir, TOR_LIB_NAME);
+		obfs4Lib = new File(nativeLibDir, OBFS4_LIB_NAME);
+	}
+
+	@Override
+	protected int getProcessId() {
+		return android.os.Process.myPid();
+	}
+
+	@Override
+	protected long getLastUpdateTime() {
+		try {
+			PackageManager pm = ctx.getPackageManager();
+			PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), 0);
+			return pi.lastUpdateTime;
+		} catch (NameNotFoundException e) {
+			throw new AssertionError(e);
+		}
+	}
+
+	@Override
+	protected void enableNetwork(boolean enable) throws IOException {
+		if (enable) wakeLock.acquire();
+		super.enableNetwork(enable);
+		if (!enable) wakeLock.release();
+	}
+
+	@Override
+	public void stopService() {
+		super.stopService();
+		wakeLock.release();
+	}
+
+	@Override
+	protected File getTorExecutableFile() {
+		return torLib.exists() ? torLib : super.getTorExecutableFile();
+	}
+
+	@Override
+	protected File getObfs4ExecutableFile() {
+		return obfs4Lib.exists() ? obfs4Lib : super.getObfs4ExecutableFile();
+	}
+
+	@Override
+	protected void installTorExecutable() throws IOException {
+		File extracted = super.getTorExecutableFile();
+		if (torLib.exists()) {
+			// If an older version left behind a Tor binary, delete it
+			if (extracted.exists()) {
+				if (extracted.delete()) LOG.info("Deleted Tor binary");
+				else LOG.info("Failed to delete Tor binary");
+			}
+		} else if (SDK_INT < 29) {
+			// The binary wasn't extracted at install time. Try to extract it
+			extractLibraryFromApk(TOR_LIB_NAME, extracted);
+		} else {
+			// No point extracting the binary, we won't be allowed to execute it
+			throw new FileNotFoundException(torLib.getAbsolutePath());
+		}
+	}
+
+	@Override
+	protected void installObfs4Executable() throws IOException {
+		File extracted = super.getObfs4ExecutableFile();
+		if (obfs4Lib.exists()) {
+			// If an older version left behind an obfs4 binary, delete it
+			if (extracted.exists()) {
+				if (extracted.delete()) LOG.info("Deleted obfs4 binary");
+				else LOG.info("Failed to delete obfs4 binary");
+			}
+		} else if (SDK_INT < 29) {
+			// The binary wasn't extracted at install time. Try to extract it
+			extractLibraryFromApk(OBFS4_LIB_NAME, extracted);
+		} else {
+			// No point extracting the binary, we won't be allowed to execute it
+			throw new FileNotFoundException(obfs4Lib.getAbsolutePath());
+		}
+	}
+
+	private void extractLibraryFromApk(String libName, File dest)
+			throws IOException {
+		File sourceDir = new File(ctx.getApplicationInfo().sourceDir);
+		if (sourceDir.isFile()) {
+			// Look for other APK files in the same directory, if we're allowed
+			File parent = sourceDir.getParentFile();
+			if (parent != null) sourceDir = parent;
+		}
+		List<String> libPaths = getSupportedLibraryPaths(libName);
+		for (File apk : findApkFiles(sourceDir)) {
+			ZipInputStream zin = new ZipInputStream(new FileInputStream(apk));
+			for (ZipEntry e = zin.getNextEntry(); e != null;
+					e = zin.getNextEntry()) {
+				if (libPaths.contains(e.getName())) {
+					String ex = e.getName();
+					info(LOG, () -> "Extracting " + ex + " from " +
+							apk.getAbsolutePath());
+					extract(zin, dest); // Zip input stream will be closed
+					return;
+				}
+			}
+			zin.close();
+		}
+		throw new FileNotFoundException(libName);
+	}
+
+	/**
+	 * Returns all files with the extension .apk or .APK under the given root.
+	 */
+	private List<File> findApkFiles(File root) {
+		List<File> files = new ArrayList<>();
+		findApkFiles(root, files);
+		return files;
+	}
+
+	private void findApkFiles(File f, List<File> files) {
+		if (f.isFile() && f.getName().toLowerCase().endsWith(".apk")) {
+			files.add(f);
+		} else if (f.isDirectory()) {
+			File[] children = f.listFiles();
+			if (children != null) {
+				for (File child : children) findApkFiles(child, files);
+			}
+		}
+	}
+
+	/**
+	 * Returns the paths at which libraries with the given name would be found
+	 * inside an APK file, for all architectures supported by the device, in
+	 * order of preference.
+	 */
+	private List<String> getSupportedLibraryPaths(String libName) {
+		List<String> architectures = new ArrayList<>();
+		for (String abi : getSupportedArchitectures()) {
+			if (LIBRARY_ARCHITECTURES.contains(abi)) {
+				architectures.add("lib/" + abi + "/" + libName);
+			}
+		}
+		return architectures;
+	}
+
+	static Collection<String> getSupportedArchitectures() {
+		List<String> abis = new ArrayList<>();
+		if (SDK_INT >= 21) {
+			abis.addAll(asList(Build.SUPPORTED_ABIS));
+		} else {
+			abis.add(Build.CPU_ABI);
+			if (Build.CPU_ABI2 != null) abis.add(Build.CPU_ABI2);
+		}
+		return abis;
+	}
 }
diff --git a/mailbox-android/src/main/res/drawable/ic_launcher_foreground.xml b/mailbox-android/src/main/res/drawable/ic_launcher_foreground.xml
index bb10bd83e5013c0012fb2a31e4b8885a3c3ce792..6e98bdf9874b8bba11f98ce6cba0992027614645 100644
--- a/mailbox-android/src/main/res/drawable/ic_launcher_foreground.xml
+++ b/mailbox-android/src/main/res/drawable/ic_launcher_foreground.xml
@@ -3,12 +3,13 @@
     android:height="108dp"
     android:viewportWidth="108"
     android:viewportHeight="108">
-  <group android:scaleX="1.3341177"
-      android:scaleY="1.3341177"
-      android:translateX="33.988235"
-      android:translateY="31.32">
-    <path
-        android:pathData="M3.334,0C2.4499,-0 1.6017,0.3579 0.9766,0.9941C0.3514,1.6304 0,2.4928 0,3.3926L0,25.1055C0,26.0053 0.3514,26.8696 0.9766,27.5059C1.6017,28.1421 2.4499,28.498 3.334,28.498L21.4902,28.498L27.5391,33.6426C28.5157,34.4732 30,33.766 30,32.4707L30,3.3926C30,2.4928 29.6485,1.6304 29.0234,0.9941C28.3983,0.3579 27.55,0 26.666,0L3.334,0zM5.334,5.4277L24.666,5.4277L24.666,15.0332L17.9121,15.0332L17.9121,18.3555L20.3828,18.3555C20.8283,18.3555 21.0512,18.904 20.7363,19.2246L15.4102,24.6445C15.2149,24.8432 14.8984,24.8432 14.7031,24.6445L9.377,19.2246C9.062,18.904 9.285,18.3555 9.7305,18.3555L12.2012,18.3555L12.2012,15.0332L5.334,15.0332L5.334,5.4277z"
-        android:fillColor="#ffffff"/>
-  </group>
+    <group
+        android:scaleX="1.3341177"
+        android:scaleY="1.3341177"
+        android:translateX="33.988235"
+        android:translateY="31.32">
+        <path
+            android:fillColor="#ffffff"
+            android:pathData="M3.334,0C2.4499,-0 1.6017,0.3579 0.9766,0.9941C0.3514,1.6304 0,2.4928 0,3.3926L0,25.1055C0,26.0053 0.3514,26.8696 0.9766,27.5059C1.6017,28.1421 2.4499,28.498 3.334,28.498L21.4902,28.498L27.5391,33.6426C28.5157,34.4732 30,33.766 30,32.4707L30,3.3926C30,2.4928 29.6485,1.6304 29.0234,0.9941C28.3983,0.3579 27.55,0 26.666,0L3.334,0zM5.334,5.4277L24.666,5.4277L24.666,15.0332L17.9121,15.0332L17.9121,18.3555L20.3828,18.3555C20.8283,18.3555 21.0512,18.904 20.7363,19.2246L15.4102,24.6445C15.2149,24.8432 14.8984,24.8432 14.7031,24.6445L9.377,19.2246C9.062,18.904 9.285,18.3555 9.7305,18.3555L12.2012,18.3555L12.2012,15.0332L5.334,15.0332L5.334,5.4277z" />
+    </group>
 </vector>
diff --git a/mailbox-android/src/main/res/layout/activity_main.xml b/mailbox-android/src/main/res/layout/activity_main.xml
index 16a344d6137121a9d0b483179277223268ce6e72..0e985efea7541f7fc4564c0403128f4b0d668dbe 100644
--- a/mailbox-android/src/main/res/layout/activity_main.xml
+++ b/mailbox-android/src/main/res/layout/activity_main.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
-	xmlns:tools="http://schemas.android.com/tools"
-	android:id="@+id/fragmentContainer"
-	android:layout_width="match_parent"
-	android:layout_height="match_parent"
-	tools:context=".android.MainActivity" />
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/fragmentContainer"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".android.MainActivity" />
diff --git a/mailbox-android/src/main/res/layout/fragment_main.xml b/mailbox-android/src/main/res/layout/fragment_main.xml
index 845336747fb79bc98b8524532c0a03c0db9ceb6b..b931cb7101102808ebe76d929eb5a70c41df5910 100644
--- a/mailbox-android/src/main/res/layout/fragment_main.xml
+++ b/mailbox-android/src/main/res/layout/fragment_main.xml
@@ -1,64 +1,64 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	xmlns:app="http://schemas.android.com/apk/res-auto"
-	xmlns:tools="http://schemas.android.com/tools"
-	android:layout_width="match_parent"
-	android:layout_height="match_parent"
-	tools:context=".android.MainActivity">
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".android.MainActivity">
 
-	<TextView
-		android:id="@+id/text"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:text="Hello World!"
-		app:layout_constraintBottom_toBottomOf="parent"
-		app:layout_constraintLeft_toLeftOf="parent"
-		app:layout_constraintRight_toRightOf="parent"
-		app:layout_constraintTop_toTopOf="parent" />
+    <TextView
+        android:id="@+id/text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Hello World!"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
-	<Button
-		android:id="@+id/button"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:layout_marginTop="16dp"
-		android:text="Test"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintStart_toStartOf="parent"
-		app:layout_constraintTop_toBottomOf="@+id/text" />
+    <Button
+        android:id="@+id/button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="Test"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/text" />
 
-	<TextView
-		android:id="@+id/statusTextView"
-		android:layout_width="0dp"
-		android:layout_height="wrap_content"
-		android:layout_margin="16dp"
-		android:gravity="center"
-		app:layout_constraintBottom_toTopOf="@+id/startStopButton"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintStart_toStartOf="parent"
-		app:layout_constraintTop_toBottomOf="@+id/button"
-		app:layout_constraintVertical_bias="1.0"
-		tools:text="STOPPED" />
+    <TextView
+        android:id="@+id/statusTextView"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dp"
+        android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@+id/startStopButton"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/button"
+        app:layout_constraintVertical_bias="1.0"
+        tools:text="STOPPED" />
 
-	<Button
-		android:id="@+id/startStopButton"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:layout_margin="16dp"
-		android:text="@string/start"
-		app:layout_constraintBottom_toBottomOf="parent"
-		app:layout_constraintBottom_toTopOf="@+id/wipeButton"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintStart_toStartOf="parent" />
+    <Button
+        android:id="@+id/startStopButton"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dp"
+        android:text="@string/start"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintBottom_toTopOf="@+id/wipeButton"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
 
-	<Button
-		android:id="@+id/wipeButton"
-		android:layout_width="wrap_content"
-		android:layout_height="wrap_content"
-		android:layout_margin="16dp"
-		android:enabled="false"
-		android:text="@string/wipe"
-		app:layout_constraintBottom_toBottomOf="parent"
-		app:layout_constraintEnd_toEndOf="parent"
-		app:layout_constraintStart_toStartOf="parent" />
+    <Button
+        android:id="@+id/wipeButton"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dp"
+        android:enabled="false"
+        android:text="@string/wipe"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 7353dbd1fd82487df2d06121f85f7994728f1070..ac94b34f54e396eb7aa0f59dc834ac07f4741db5 100644
--- a/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
-    <background android:drawable="@color/ic_launcher_background"/>
-    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
+    <background android:drawable="@color/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
 </adaptive-icon>
\ No newline at end of file
diff --git a/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 7353dbd1fd82487df2d06121f85f7994728f1070..ac94b34f54e396eb7aa0f59dc834ac07f4741db5 100644
--- a/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/mailbox-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
-    <background android:drawable="@color/ic_launcher_background"/>
-    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
+    <background android:drawable="@color/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
 </adaptive-icon>
\ No newline at end of file
diff --git a/mailbox-android/src/main/res/values/strings.xml b/mailbox-android/src/main/res/values/strings.xml
index b5c7cfce62e900edbc85fda8471af2741b47c631..3622cbb1e26cd8a1e3057fbae1e02afedf0c257c 100644
--- a/mailbox-android/src/main/res/values/strings.xml
+++ b/mailbox-android/src/main/res/values/strings.xml
@@ -1,15 +1,15 @@
 <resources>
-	<string name="app_name">Briar Mailbox</string>
-	<string name="notification_channel_name">Briar Mailbox Channel</string>
-	<string name="notification_mailbox_title">Briar Mailbox running</string>
-	<string name="notification_mailbox_content">Waiting for messages…</string>
-	<string name="start">Start mailbox</string>
-	<string name="stop">Stop mailbox</string>
-	<string name="wipe">Wipe mailbox</string>
+    <string name="app_name">Briar Mailbox</string>
+    <string name="notification_channel_name">Briar Mailbox Channel</string>
+    <string name="notification_mailbox_title">Briar Mailbox running</string>
+    <string name="notification_mailbox_content">Waiting for messages…</string>
+    <string name="start">Start mailbox</string>
+    <string name="stop">Stop mailbox</string>
+    <string name="wipe">Wipe mailbox</string>
 
-	<!-- TODO: We might want to copy string from don't kill me lib,
-	      so translation memory can auto-translate most of them. -->
-	<string name="warning_dozed">Briar Mailbox was unable to run in the background</string>
-	<string name="fix">Fix</string>
-	<string name="cancel">Cancel</string>
+    <!-- TODO: We might want to copy string from don't kill me lib,
+          so translation memory can auto-translate most of them. -->
+    <string name="warning_dozed">Briar Mailbox was unable to run in the background</string>
+    <string name="fix">Fix</string>
+    <string name="cancel">Cancel</string>
 </resources>
diff --git a/mailbox-android/src/release/assets/logback.xml b/mailbox-android/src/release/assets/logback.xml
index 5f520cf71a4231c68476f7ca45e16a5f5138e3a8..895de00dd5512b6a7827b25c9745a9a890bd7bb1 100644
--- a/mailbox-android/src/release/assets/logback.xml
+++ b/mailbox-android/src/release/assets/logback.xml
@@ -1,15 +1,15 @@
 <configuration>
-	<appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
-		<tagEncoder>
-			<pattern>%logger{12}</pattern>
-		</tagEncoder>
-		<encoder>
-			<pattern>%msg</pattern>
-		</encoder>
-	</appender>
-	<root level="DEBUG">
-		<appender-ref ref="logcat" />
-	</root>
-	<!-- hide all Netty debug logs -->
-	<logger name="io.netty" level="INFO" />
+    <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
+        <tagEncoder>
+            <pattern>%logger{12}</pattern>
+        </tagEncoder>
+        <encoder>
+            <pattern>%msg</pattern>
+        </encoder>
+    </appender>
+    <root level="DEBUG">
+        <appender-ref ref="logcat" />
+    </root>
+    <!-- hide all Netty debug logs -->
+    <logger name="io.netty" level="INFO" />
 </configuration>
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliComponent.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliComponent.kt
index f35b13191373058110df60b79e1fb9561d51a2be..34a4cb42feaa370f761dcc85c892e29bf251afd6 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliComponent.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliComponent.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.cli
 
 import dagger.Component
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliModule.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliModule.kt
index e9d7cb747c13f828a8a8e7fe751d6129cf12276a..58774946a9b32cbb472412908c022c1fc6a0d32b 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliModule.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/JavaCliModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.cli
 
 import dagger.Module
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/Main.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/Main.kt
index 0a00e4f5685d68d48d6489a23e0a6557cfd1d415..a0019fd56c18bc0ed2a53b4c3920e8356f5d08c5 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/Main.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/Main.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.cli
 
 import ch.qos.logback.classic.Level
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/QrCodeRenderer.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/QrCodeRenderer.kt
index c96f6123b021fb36a270a23d9d587e5f22bf7e5e..a31f70747b100ce7543b953c2951637b3c7c6326 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/QrCodeRenderer.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/cli/QrCodeRenderer.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.cli
 
 import com.google.zxing.common.BitMatrix
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/JavaCliEagerSingletons.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/JavaCliEagerSingletons.kt
index 8e1830fdd027270ab403c91053973ef59ccc5933..dc966ced536574f6c6b4c8aa4514288525ae06c6 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/JavaCliEagerSingletons.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/JavaCliEagerSingletons.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core
 
 import org.briarproject.mailbox.core.system.TaskScheduler
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaCliNetworkManager.java b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaCliNetworkManager.java
index 26d619d5c73679f494802f19ac6a127cd2d6a8af..eed4dcddaa065eeb69f58d2756bccbee8a8a8376 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaCliNetworkManager.java
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaCliNetworkManager.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import org.slf4j.Logger;
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorModule.kt b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorModule.kt
index d281a492bc79c740e49180ecfe8124376722ab36..7933f9ffa410b8074475cd4c4a2073e44c00e491 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorModule.kt
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor
 
 import dagger.Module
diff --git a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorPlugin.java b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorPlugin.java
index 6056de6a0c9796fdd81dc82c5345ab175d755afd..7e18cd5f91bf6d9f85d252bf33c18a9aa02a18d2 100644
--- a/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorPlugin.java
+++ b/mailbox-cli/src/main/java/org/briarproject/mailbox/core/tor/JavaTorPlugin.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import com.sun.jna.Library;
diff --git a/mailbox-cli/src/main/resources/logback.xml b/mailbox-cli/src/main/resources/logback.xml
index 945c218bb1ab715b006497a8900d0954aeb3a5a4..2693dcc4b722ef1e36170866d3fbaf4d662639c9 100644
--- a/mailbox-cli/src/main/resources/logback.xml
+++ b/mailbox-cli/src/main/resources/logback.xml
@@ -5,8 +5,8 @@
         </encoder>
     </appender>
     <root level="trace">
-        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="STDOUT" />
     </root>
-    <logger name="org.eclipse.jetty" level="INFO"/>
-    <logger name="io.netty" level="INFO"/>
+    <logger name="org.eclipse.jetty" level="INFO" />
+    <logger name="io.netty" level="INFO" />
 </configuration>
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreEagerSingletons.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreEagerSingletons.kt
index d6e046bd0406496e3c36fce4a191fe41fb2d093b..d8e1224bc780ad62e3334c4a2b3c782664214696 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreEagerSingletons.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreEagerSingletons.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core
 
 import org.briarproject.mailbox.core.server.WebServerManager
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreModule.kt
index 740fbdc0fdadbdae5fa5f936a7db26d808b86519..31dce9ca6947a43adfccaa3d6a91619ba62da8af 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/CoreModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/PoliteExecutor.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/PoliteExecutor.java
index fc547da66694700999b4ffda1a0133b99b123982..af5393ae9cca1a284184f6eec38a8d927a862bdc 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/PoliteExecutor.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/PoliteExecutor.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core;
 
 import java.util.LinkedList;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/Contact.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/Contact.kt
index 2565668dfab29e2636dc4d8d96c990820769df09..da79847ccbafbca9833352e3fd6820a9919955d9 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/Contact.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/Contact.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.contacts
 
 data class Contact(
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/ContactsManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/ContactsManager.kt
index e511899e0f511a66483af0d8ea15737fe9c08c5a..619d66deca435b3b7062fb84562792ec3bd78994 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/ContactsManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/contacts/ContactsManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.contacts
 
 import com.fasterxml.jackson.core.JacksonException
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooNewException.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooNewException.kt
index c6120d1880c2bc6ebe708835a407aafb90c514e7..b465df1239344214c4783902d9976b65079fcdbc 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooNewException.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooNewException.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooOldException.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooOldException.kt
index 02d23760f8a89f3c1fd89a3dc1138c4f5538218a..ff6b79a1967d9b3fbda18478149230e0ae9db264 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooOldException.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DataTooOldException.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt
index 2036c4cfea515dc625ccffc74bf03f90fe577256..8e14a9f934948bf727a9d3934c4b71149451c40e 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Database.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import org.briarproject.mailbox.core.contacts.Contact
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConfig.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConfig.kt
index 50101bbad976246f74b5e1b6d8acc07f7cfba2f2..4c77b7462c51154674fae9010969c68df950f691 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConfig.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConfig.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import java.io.File
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConstants.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConstants.kt
index 5fd4c94faa81fbbbda7184a6dda80990c1559f38..7f35840fb66a3d5a66b6d288b147a4c7ca2b1da6 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConstants.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseConstants.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import org.briarproject.mailbox.core.settings.Settings
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseModule.kt
index 31cf523063750485c5663c5a8f3678203d529051..d709690732cbf9433d87eae9ccef2d92ce46e4c5 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseTypes.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseTypes.kt
index 1536ac2f602473c58937a74d56bda2d07a88abc5..1fea7b4c183c4a36cd0b8eb0e4940b2a1ede1f44 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseTypes.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DatabaseTypes.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 class DatabaseTypes(
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbClosedException.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbClosedException.kt
index 283fc17a4a3b4a6b0fe77283d19762080f9efd3e..2cbd012c4c0cc9942d7ef2c10752c12e77ee9658 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbClosedException.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbClosedException.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 class DbClosedException : DbException()
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbException.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbException.kt
index 263669dd1a22a762f9bf237ca05e1de94243662f..d5122383b211aaab039f66a9a919dc154c3ef5be 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbException.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbException.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 open class DbException : Exception {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbStateException.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbStateException.kt
index 05c4985ce8cfb7ffbb3133e265623b40ad6c1801..058c94bea4b2217a2314d093c3ab2bebeec8bfd5 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbStateException.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/DbStateException.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import java.sql.SQLException
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/H2Database.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/H2Database.kt
index f04bf4168906687fb48abdb23dd62c6b3849ee71..45e3b718530438473780abb3ccb9ce25e0aa6c2e 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/H2Database.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/H2Database.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import org.briarproject.mailbox.core.db.JdbcUtils.tryToClose
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt
index e7c7ec23dc09f7ab4fdd209b0803665eae8df41e..50db543863776013d2ebf05d56ba22ea7753ce08 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcDatabase.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import org.briarproject.mailbox.core.contacts.Contact
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcUtils.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcUtils.kt
index 8f123e79c2a0fd84e07e6616d0f8910cb8a8c54e..ac9e1b7d7b2f6ceef9f8b1670604f97ae84a2c8f 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcUtils.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/JdbcUtils.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import org.briarproject.mailbox.core.util.LogUtils.logException
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Migration.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Migration.kt
index 0f4f49972036b08aed1bf2eb820fcf36e4310f64..8dc2eca97845434c42fb3ba0a7c412826663baef 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Migration.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Migration.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 interface Migration<T> {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/MigrationListener.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/MigrationListener.java
index 05bb1d011a48e990b0454edbcec51ced37a50174..7fdc572ef4886bfa167de2dc405ddbc69c4ee8ed 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/MigrationListener.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/MigrationListener.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db;
 
 public interface MigrationListener {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Transaction.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Transaction.kt
index 45c17a37548bffb69b021824c54213bfb69356e1..ced572cec5f60074d4f25436a241ea1c47fb8bc5 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Transaction.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/Transaction.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 import java.sql.Connection
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/TransactionManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/TransactionManager.kt
index 679457c94b193551dc9ec755be7c6cc4b8e77baf..04a047a56b0aedda9ddc6da139f00e5b30268da7 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/TransactionManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/db/TransactionManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.db
 
 interface TransactionManager {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/DefaultEventExecutorModule.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/DefaultEventExecutorModule.java
index 675d81de60b0ed93ef4d2d75bb18324f669e7060..e9d2936a23c28ce7de88dc9f00e27e8d3bb87dd4 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/DefaultEventExecutorModule.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/DefaultEventExecutorModule.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 import java.util.concurrent.Executor;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/Event.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/Event.java
index 8faa67ecb985885402ab5db6deadede77323d915..2c40d3aa1dc494f4fa34563e58b72ebcaad64efe 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/Event.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/Event.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBus.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBus.java
index b5fe6a10b12309a4440105236bdbe83fe0b84177..8f548993347ecd1e30c41c4f9e9cad4c121b08b2 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBus.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBus.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 public interface EventBus {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBusImpl.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBusImpl.java
index ae357248b7584837ebbfb510904eff82855ef20d..67536ee9eb55a1aa74794d64d4f6952b2bc9bade 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBusImpl.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventBusImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 import java.util.Collection;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventExecutor.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventExecutor.java
index b8c03f18042207133dff78c52c0468cb4ba3d000..31140f1402fbeec5372b9edd4904080ad5d07047 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventExecutor.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventExecutor.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 import java.lang.annotation.Retention;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventListener.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventListener.java
index 97b423852d54752cccc5115beaa2020870427385..4bd61f525dbf9bae8d8f53483cdf7b8f9a85d0cd 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventListener.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventListener.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventModule.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventModule.java
index 8319a16cea839335a6af057cda49490bc50809b8..a4097b0314f5bd2dcb119a53af64d0d9ce66ebfc 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventModule.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/event/EventModule.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.event;
 
 import javax.inject.Singleton;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileManager.kt
index 04f52a233148173c32bdecd81d0e121978fa1377..dc113ea23a3d4c46047d6147f2b2bc426b377e5e 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.files
 
 import io.ktor.application.ApplicationCall
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileProvider.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileProvider.kt
index 58ff7c0d9958c593e15bbf118bcb9499fc286b2d..b8a10f5ca19268d10b931580cd80f9d12ca3ac32 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileProvider.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/files/FileProvider.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.files
 
 import java.io.File
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/IoExecutor.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/IoExecutor.java
index 6008a696a0998255dede80e994415ce93a380bf5..c7f003b9e24df495a9c14797c2a492433a82b6de 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/IoExecutor.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/IoExecutor.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle;
 
 import java.lang.annotation.Retention;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManager.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManager.java
index f79710f7559ab2d681468d483b57e71457ae6eac..af614491e37b9624e60829d67e776e1f50e33e93 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManager.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManager.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle;
 
 import org.briarproject.mailbox.core.db.Database;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManagerImpl.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManagerImpl.kt
index 60616eed08d93b64397e0ebaa7af55684c0a6c40..2e4781ed23032f3e6a7fcc1deec6717d0f5096f7 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManagerImpl.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleManagerImpl.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle
 
 import kotlinx.coroutines.flow.MutableStateFlow
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleModule.kt
index 781ef6a21f0e630c95f935d2cdd18a25f4283b73..a8c3e67a8d9b386e7ff069135c3dc18c79be9a57 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/LifecycleModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/Service.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/Service.kt
index 0c185c92469c1acbe4c3cc40abbfd65ed9b09984..243f0df2171d4d1d527487b338ee81c5bc3cd29f 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/Service.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/Service.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle
 
 import org.briarproject.mailbox.core.system.Wakeful
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/ServiceException.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/ServiceException.java
index fae8cd2ccfb34d28dc831b7d736d47f16b3952d4..aff4d840c5328053104e20404f66850a147c49e6 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/ServiceException.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/lifecycle/ServiceException.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.lifecycle;
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/AuthManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/AuthManager.kt
index 16baaf81c145f8115381e173b9dbd41f38665b41..6b8aa036db3b1f8c4d4a3a552bc7ba1c427c1a04 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/AuthManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/AuthManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.server
 
 import io.ktor.auth.Principal
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/BearerAuthenticationProvider.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/BearerAuthenticationProvider.kt
index 808f764838e74bb6b399b6830aa638a50497cf30..c6d2b685606c11ee15e53db3475265cc4f18bd7f 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/BearerAuthenticationProvider.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/BearerAuthenticationProvider.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.server
 
 import io.ktor.application.ApplicationCall
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
index d9d92a47aecfdbdf6164e583d8ce2eff2a429c1b..c48258330501f85298458c4f63396617ff12b5fa 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/Routing.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.server
 
 import io.ktor.application.Application
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt
index 2ee5f0095b353ead8fc228249b38ed5227311f2c..85422c415a98896ed207d0a176600fb7137423fe 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.server
 
 import com.fasterxml.jackson.databind.MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerModule.kt
index be2c92aa2bde8e1495fa490b75971aed979c18b6..1cc496f5cdf4c5c8d5f6c48752ea8bb3467acf23 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.server
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/MetadataManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/MetadataManager.kt
index b24da7ed4fd769a0478136b2ba74235e03346686..933de19ae2bb45db1baa14abe0c5f5ccb6e05260 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/MetadataManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/MetadataManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.settings
 
 import io.ktor.application.ApplicationCall
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt
index bd64f02c504c0bc3d105758159cf88d3b3bbf99a..c69b4e5833b2879c9f5119e71b6e43bf8be7e3a2 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/Settings.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.settings
 
 import java.util.Hashtable
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManager.kt
index 691517279963a38a37f96fc82337859ae76e34b4..d7ab1ea2c916015a349fbe2f4759e825d9794d11 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.settings
 
 import org.briarproject.mailbox.core.db.DbException
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManagerImpl.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManagerImpl.kt
index 830e05f05a0d10646100c5b3be67a3dc0bf1cdc4..49930785522aae6c61dbfc03482a462b0221bdea 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManagerImpl.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsManagerImpl.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.settings
 
 import org.briarproject.mailbox.core.db.Database
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsModule.kt
index e936c6d823455c5c709794a0a4f824be531979d5..4533fda9d40bb843926479f880b3a54eb9c7be05 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/settings/SettingsModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.settings
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/QrCodeEncoder.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/QrCodeEncoder.kt
index 29a47061d7a362064edeaea70155ce69c39b4efe..b56acdd44501285db58925613f371c605769f1ff 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/QrCodeEncoder.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/QrCodeEncoder.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.setup
 
 import com.google.zxing.BarcodeFormat.QR_CODE
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/SetupManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/SetupManager.kt
index 052ec7880077eff1fa9e809ae0fe9fbb9447c139..72ed35abed28f93629bf02e6cbbb17445162cffa 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/SetupManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/SetupManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.setup
 
 import io.ktor.application.ApplicationCall
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/WipeManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/WipeManager.kt
index 1c0d648588decbe62a4111bed4628503a5b24cd0..68250a4a1fd9b947503a25c4097b42f7724edabd 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/WipeManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/setup/WipeManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.setup
 
 import io.ktor.application.ApplicationCall
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Clock.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Clock.java
index c3d8f0e3959ec6a496f8ae6a8d30c3f72bbec94b..43aacdcbf4700173a6b41db51ca04ce9d86c91b7 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Clock.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Clock.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 public interface Clock {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/DefaultTaskSchedulerModule.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/DefaultTaskSchedulerModule.java
index 1bbb56cf51559bd09ec9a40a2bfa5ac720e06dda..256d2e201893827fd517816a9ae0e905865e6fb4 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/DefaultTaskSchedulerModule.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/DefaultTaskSchedulerModule.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import org.briarproject.mailbox.core.lifecycle.LifecycleManager;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/LocationUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/LocationUtils.java
index 9ce3cd09eae570fbb00a79d0fb27329611284c5f..96440876eb6e48685641c2b2fc5e18bdee47f535 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/LocationUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/LocationUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 public interface LocationUtils {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/RandomIdManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/RandomIdManager.kt
index 66c89d17ca66c261845310241a16d4034abab19c..448af505ea6a7120aa55cc03495799b90b9086ad 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/RandomIdManager.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/RandomIdManager.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system
 
 import java.security.SecureRandom
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/ResourceProvider.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/ResourceProvider.java
index 8a3d0387460799adba97776bad4523ba490702ad..dad5768b0ce7f5d98ae80c5d20e6b4e91baa1d20 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/ResourceProvider.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/ResourceProvider.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.io.InputStream;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskScheduler.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskScheduler.java
index be1f59c73e31521c449b4cb6dc4976faed125733..080c315b7e9a8b58ac1040c9072048382e632654 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskScheduler.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskScheduler.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.util.concurrent.Executor;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskSchedulerImpl.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskSchedulerImpl.java
index aaa5b6f390840d54adbb8897695ae96edf6b7e5a..ef4ce1d4c738b634b2c6831a19a6311df6cb9b30 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskSchedulerImpl.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/TaskSchedulerImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.util.concurrent.Executor;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Wakeful.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Wakeful.java
index 02a0218b984089454fb8e7a8a6a7211c02873684..7f260aea47f68475d38bf00f3546ad84a2d28a55 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Wakeful.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/system/Wakeful.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.system;
 
 import java.lang.annotation.Retention;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/Backoff.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/Backoff.java
index 33aa5f9ee079a4e843bdc15d76ea652995680553..eff1637bb8406a6ea8e25b1a09eaa769c50ac5cb 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/Backoff.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/Backoff.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 /**
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/BackoffImpl.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/BackoffImpl.java
index 60f420fc69ca6547351dcf799c321b71750bf3bb..3b82b3ea6fcf2439dc492e6ccc8e93b9dc59185e 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/BackoffImpl.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/BackoffImpl.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import java.util.concurrent.atomic.AtomicInteger;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/CircumventionProvider.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/CircumventionProvider.java
index ff6a32100449e9e054cad315828f9c61dc6f6968..4794b49040a41047a6987b0f901ee3452eec544d 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/CircumventionProvider.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/CircumventionProvider.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import java.util.List;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkManager.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkManager.java
index fb0428ae86f9bef0461b047eb44884aa9a022e73..de5974daedfb30785f6a28923b547eb7d00d1ae9 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkManager.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkManager.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 public interface NetworkManager {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatus.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatus.java
index 8176351ac4b8591051b2a228c297c721c39c0406..1e7c93fd7cfaf4503e3b2e608fa0fe60c9a1de0b 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatus.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatus.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import javax.annotation.concurrent.Immutable;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatusEvent.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatusEvent.java
index 9d722cf39f8cbfea9ef888994432b047f995a6c2..3ff523935518b689bdaf1e605c0150531119cb5a 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatusEvent.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/NetworkStatusEvent.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import org.briarproject.mailbox.core.event.Event;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorConstants.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorConstants.java
index 6b0e8afdfe13f5fd0b531c03be086f91e52c8165..ef1ffd649c86e183bff5f317d989aa9288cae8d8 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorConstants.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorConstants.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 public interface TorConstants {
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorModule.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorModule.kt
index c1afee5d4b9cadbeabb5f68f61360e5fffdac7ca..720e4e6e7ade01ad5734e47e411c6180f48650c2 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorModule.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorModule.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor
 
 import dagger.Module
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java
index 59b63c9e8c92e1c089b1aa25453225591f7683ef..ab2bbd79673fdc25445e7dbae238bd415e5d5426 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.tor;
 
 import net.freehaven.tor.control.EventHandler;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/IoUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/IoUtils.java
index b6cd2117c141babd94ef53fa5ca789a05c486284..27b35f45aa597ea4e7ea6f29d272d76a9197100b 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/IoUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/IoUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util;
 
 import org.slf4j.Logger;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt
index fc4368b83a695946a4bc2103025a602178156092..7adf285c8aa598a7a6746914218c7d9b9f9c97f5 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util
 
 import org.slf4j.Logger
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/NetworkUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/NetworkUtils.java
index d7029007c9bce376cbbcd3415b8d802ed4d9900a..1fdaf259e54d2574f3135787333445a23122b905 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/NetworkUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/NetworkUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util;
 
 import org.slf4j.Logger;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/OsUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/OsUtils.java
index 52698ab2aad08cd1ea9a1efab26713b15c97550c..4cc42dacd19e12b4c3cecd66a1e27add90f1e6d1 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/OsUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/OsUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util;
 
 import javax.annotation.Nullable;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/PrivacyUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/PrivacyUtils.java
index f0451e1bc53a1011cecc21bd2e6f9844cd14740e..8e94b6b36a1f5969f219bf6e9b18d111f89c7cde 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/PrivacyUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/PrivacyUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util;
 
 import java.net.Inet4Address;
diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/StringUtils.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/StringUtils.java
index 5198a75d4c32a02ca46956351d8372754111a8ed..3c7538bc05d6b154b24c7215d4f5787689be8d3d 100644
--- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/StringUtils.java
+++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/StringUtils.java
@@ -1,3 +1,22 @@
+/*
+ *     Briar Mailbox
+ *     Copyright (C) 2021-2022  The Briar Project
+ *
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU Affero General Public License as
+ *     published by the Free Software Foundation, either version 3 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU Affero General Public License for more details.
+ *
+ *     You should have received a copy of the GNU Affero General Public License
+ *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
 package org.briarproject.mailbox.core.util;
 
 import java.io.UnsupportedEncodingException;
diff --git a/mailbox-core/src/test/resources/logback.xml b/mailbox-core/src/test/resources/logback.xml
index f53439b24f525bb17fe9029f307b4bee40e8e35c..cd7cac14b9c3a1ce8ea28471983afcf408c4af42 100644
--- a/mailbox-core/src/test/resources/logback.xml
+++ b/mailbox-core/src/test/resources/logback.xml
@@ -5,9 +5,9 @@
         </encoder>
     </appender>
     <root level="trace">
-        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="STDOUT" />
     </root>
-    <logger name="org.eclipse.jetty" level="INFO"/>
-    <logger name="io.netty" level="INFO"/>
+    <logger name="org.eclipse.jetty" level="INFO" />
+    <logger name="io.netty" level="INFO" />
     <logger name="io.mockk" level="INFO" />
 </configuration>