[
  {
    "path": ".github/stale.yml",
    "content": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 15\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 7\n# Issues with these labels will never be considered stale\nexemptLabels:\n  - 'Status: Confirmed'\n  - 'Status: In Progress'\n  - 'Status: Unplanned'\n  - 'Status: Needs review'\n  - 'Type: Pinned'\n# Label to use when marking an issue as stale\nstaleLabel: 'Status: Archived'\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n  This issue has been automatically marked as stale because it has not had\n  recent activity. It will be closed if no further activity occurs. Thank you\n  for your contributions.\n# Comment to post when closing a stale issue. Set to `false` to disable\ncloseComment: false\n"
  },
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea/caches\n/.idea/libraries\n/.idea/modules.xml\n/.idea/workspace.xml\n/.idea/navEditor.xml\n/.idea/assetWizardSettings.xml\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n.cxx\nlocal.properties\n/.idea/\n/app/release/\n*.apk\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>."
  },
  {
    "path": "README.md",
    "content": "# DG-Lab Unlocker\n某APP的奇怪xposed模块\n\n![](https://img.shields.io/badge/Module-Xposed-green?style=for-the-badge&logo=Android&logoColor=white) ![](https://img.shields.io/github/license/SakuraKoi/DgLabUnlocker?style=for-the-badge) ![](https://img.shields.io/github/languages/top/SakuraKoi/DgLabUnlocker?style=for-the-badge) ![](https://img.shields.io/github/downloads/SakuraKoi/DgLabUnlocker/total?style=for-the-badge) ![](https://img.shields.io/github/v/release/SakuraKoi/DgLabUnlocker?style=for-the-badge)\n\n## 暂停更新\n官方APP的新功能整挺好\\\n强度上限什么的安全功能都安排上了\\\n~~波形导入导出. 远程协议之类的也被官方抄走了~~\n\n目前来看这个模块应该暂时没有继续开发的必要\\\n(主要是...想不出来还有什么脑洞可以整活了x\n\n所以, **暂时停止模块开发**\n> ~~除非咱想到了什么新活, 但是只靠官方又整不出来~~\n---\n \n### 说明\n> 当前适配版本: `1.2.6` `1.3.1` `1.3.2`\\\n> 项目开发将以当前支持的最新版本为目标, 在老版本中不保证所有功能可用\n\n### 功能\n\n- **解锁远程控制最大强度到276**\\\n最高100完全不够用好吧\\\n`再也不用担心high到一半自己起来调强度了 (超小声`\n\n- **暴力锁死基础强度**\\\n理论上拦截所有远程加基础强度的BUG, 有效避免突然惨遭弹射起飞\\\n`有坏蛋试了半小时翻倍bug, 咱不说是谁`\n\n- **无视远程最大强度限制**\\\n字面意思, 想拉多高拉多高 (坏.jpg\\\n`不要拿去干坏事qwq`\n\n- **强制确保远程强度不超过限制**\\\n  避免魔改客户端搞事情\\\n  `上面那个功能的防御`\n  \n- **导入/导出波形**\\\n  以JSON格式从文件导入波形/导出波形到文件\\\n  <strike>`用别人的波形算不算也是一种NTR`</strike>\n\n- **开放强度调整接口**\\\n  对外开放[Websocket RPC服务](https://github.com/SakuraKoi/DgLabUnlocker/wiki/Websocket-RPC-Spec)端口, 便于程序员整点花活 #8\\\n  <strike>`此功能最终解释权归永仪所有`</strike>\\\n  `咱不对小可爱被玩坏承担任何责任`\n\n<!-- 反CSDN非授权搬运爬虫 / Anti gitcode.com spider -->\n<!-- 8964天安门习近平小熊维尼 -->\n<!-- Fuck you CSDN and gitcode.com -->\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n/pos\n"
  },
  {
    "path": "app/build.gradle",
    "content": "plugins {\n    id 'com.android.application'\n}\n\nandroid {\n    compileSdk 31\n\n    defaultConfig {\n        applicationId \"sakura.kooi.dglabunlocker\"\n        minSdk 26\n        targetSdk 31\n        versionCode 9\n        versionName \"1.9\"\n\n        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled true\n            shrinkResources true\n            proguardFiles 'proguard-rules.pro'\n        }\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_11\n        targetCompatibility JavaVersion.VERSION_11\n    }\n}\n\ndependencies {\n    implementation 'org.java-websocket:Java-WebSocket:1.5.3'\n    implementation 'com.google.code.gson:gson:2.9.0'\n    \n    compileOnly 'de.robv.android.xposed:api:82'\n\n    compileOnly \"org.projectlombok:lombok:1.18.24\"\n    annotationProcessor 'org.projectlombok:lombok:1.18.24'\n\n    compileOnly 'androidx.annotation:annotation:1.3.0'\n\n    testImplementation 'junit:junit:4.13.2'\n    androidTestImplementation 'androidx.test.ext:junit:1.1.3'\n    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'\n}"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "-keep class sakura.kooi.dglabunlocker.XposedModuleInit\n\n-repackageclasses\n-allowaccessmodification\n-overloadaggressively\n-keepattributes SourceFile,LineNumberTable\n-renamesourcefileattribute SourceFile"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"dev.sakurakooi.dglabunlocker\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:roundIcon=\"@mipmap/ic_launcher\"\n        android:supportsRtl=\"true\">\n\n        <meta-data android:name=\"xposedmodule\" android:value=\"true\" />\n        <meta-data android:name=\"xposeddescription\" android:value=\"DG-Lab 奇奇怪怪的补丁\\nPowered By.SakuraKooi\" />\n        <meta-data android:name=\"xposedminversion\" android:value=\"82\" />\n        <meta-data android:name=\"xposedscope\" android:resource=\"@array/module_scope\" />\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/assets/xposed_init",
    "content": "dev.sakurakooi.dglabunlocker.XposedModuleInit"
  },
  {
    "path": "app/src/main/java/dev/sakurakooi/dglabunlocker/XposedModuleInit.java",
    "content": "package dev.sakurakooi.dglabunlocker;\n\nimport de.robv.android.xposed.IXposedHookInitPackageResources;\nimport de.robv.android.xposed.IXposedHookLoadPackage;\nimport de.robv.android.xposed.IXposedHookZygoteInit;\nimport de.robv.android.xposed.callbacks.XC_InitPackageResources;\nimport de.robv.android.xposed.callbacks.XC_LoadPackage;\n\npublic class XposedModuleInit implements IXposedHookLoadPackage, IXposedHookZygoteInit, IXposedHookInitPackageResources {\n    @Override\n    public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {\n\n    }\n\n    @Override\n    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {\n\n    }\n\n    @Override\n    public void initZygote(StartupParam startupParam) throws Throwable {\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/XposedModuleInit.java",
    "content": "package sakura.kooi.dglabunlocker;\n\nimport static sakura.kooi.dglabunlocker.utils.DgLabVersion.*;\n\nimport android.content.Context;\nimport android.util.Log;\nimport android.widget.Toast;\n\nimport androidx.annotation.NonNull;\n\nimport java.util.HashSet;\n\nimport de.robv.android.xposed.IXposedHookInitPackageResources;\nimport de.robv.android.xposed.IXposedHookLoadPackage;\nimport de.robv.android.xposed.IXposedHookZygoteInit;\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport de.robv.android.xposed.callbacks.XC_InitPackageResources;\nimport de.robv.android.xposed.callbacks.XC_LoadPackage;\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.preload.HookSettingsDialog;\nimport sakura.kooi.dglabunlocker.ui.StatusDialog;\nimport sakura.kooi.dglabunlocker.utils.ModuleException;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\nimport sakura.kooi.dglabunlocker.variables.ModuleSettings;\nimport sakura.kooi.dglabunlocker.variables.ResourceInject;\nimport sakura.kooi.dglabunlocker.ver.AbstractVersionedCompatibilityProvider;\nimport sakura.kooi.dglabunlocker.ver.Version126;\nimport sakura.kooi.dglabunlocker.ver.Version131;\nimport sakura.kooi.dglabunlocker.ver.Version132;\n\npublic class XposedModuleInit implements IXposedHookLoadPackage, IXposedHookZygoteInit, IXposedHookInitPackageResources {\n    @NonNull\n    private static AbstractVersionedCompatibilityProvider detectAppVersion(Context context) {\n        AbstractVersionedCompatibilityProvider versionedFieldInitializer;\n        int versionCode = ModuleUtils.getAppVersion(context);\n        HookRegistry.versionCode = versionCode;\n        switch (versionCode) {\n            case V_1_3_3:\n                versionedFieldInitializer = new Version132(); // FIXME\n                StatusDialog.currentLoadedVersion = \"1.3.3\";\n                break;\n            case V_1_3_2:\n                versionedFieldInitializer = new Version132();\n                StatusDialog.currentLoadedVersion = \"1.3.2\";\n                break;\n            case V_1_3_1:\n                versionedFieldInitializer = new Version131();\n                StatusDialog.currentLoadedVersion = \"1.3.1\";\n                break;\n            case V_1_2_6:\n                versionedFieldInitializer = new Version126();\n                StatusDialog.currentLoadedVersion = \"1.2.6\";\n                break;\n            default:\n                versionedFieldInitializer = new Version126();\n                StatusDialog.currentLoadedVersion = null;\n        }\n        return versionedFieldInitializer;\n    }\n\n    @Override\n    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {\n        Log.i(\"DgLabUnlocker\", \"Init Loading: running on app \" + lpparam.packageName);\n        if (!lpparam.packageName.equals(\"com.bjsm.dungeonlab\")) {\n            Log.e(\"DgLabUnlocker\", \"Init Loading: app not match! \" + lpparam.packageName);\n            return;\n        }\n        Log.i(\"DgLabUnlocker\", \"Init Loading: found target app \" + lpparam.packageName);\n\n        try {\n            Class.forName(\"com.netease.nis.wrapper.MyApplication\", false, lpparam.classLoader);\n\n            XposedHelpers.findAndHookMethod(\"com.netease.nis.wrapper.MyApplication\", lpparam.classLoader,\n                    \"attachBaseContext\", Context.class, new XC_MethodHook() {\n                        @Override\n                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                            Context context = (Context) param.args[0];\n                            ClassLoader classLoader = context.getClassLoader();\n                            onAppLoaded(context, classLoader);\n                        }\n                    });\n            return;\n        } catch (ClassNotFoundException e) {\n            Log.i(\"DgLabUnlocker\", \"nesec packer not found, try hook as tencent packed...\");\n        }\n\n        try {\n            Class.forName(\"com.wrapper.proxyapplication.WrapperProxyApplication\", false, lpparam.classLoader);\n\n            XposedHelpers.findAndHookMethod(\"com.wrapper.proxyapplication.WrapperProxyApplication\", lpparam.classLoader,\n                    \"attachBaseContext\", Context.class, new XC_MethodHook() {\n                        @Override\n                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                            Context context = (Context) param.args[0];\n                            ClassLoader classLoader = context.getClassLoader();\n                            onAppLoaded(context, classLoader);\n                        }\n                    });\n            return;\n        } catch (ClassNotFoundException e) {\n            Log.i(\"DgLabUnlocker\", \"tencent packer not found, try hook as unpacked app...\");\n        }\n\n        try {\n            XposedHelpers.findAndHookMethod(\"com.bjsm.dungeonlab.global.BaseLocalApplication\", lpparam.classLoader, \"onCreate\", new XC_MethodHook() {\n                @Override\n                protected void afterHookedMethod(MethodHookParam param) {\n                    Context context = (Context) param.thisObject;\n                    ClassLoader classLoader = context.getClassLoader();\n                    onAppLoaded(context, classLoader);\n                }\n            });\n        } catch (Exception e) {\n\n        }\n    }\n\n    private void onAppLoaded(Context context, ClassLoader classLoader) {\n        Log.i(\"DgLabUnlocker\", \"Hook Loading: App loaded! Trying to take over the world...\");\n        ModuleUtils.applicationContext = context;\n\n        // region load configuration\n        Log.i(\"DgLabUnlocker\", \"Hook Loading: Injecting settings dialog...\");\n        try {\n            HookSettingsDialog.apply(context, classLoader);\n            StatusDialog.moduleSettingsDialogInject = true;\n        } catch (Exception e) {\n            ModuleUtils.logError(\"DgLabUnlocker\", \"An error occurred while injecting settings dialog\", e);\n            Toast.makeText(context, \"DG-Lab Unlocker 加载失败\", Toast.LENGTH_LONG).show();\n            return;\n        }\n        // endregion\n        // region detect app version and initialize reflection\n        try {\n            detectAppVersion(context).initializeAccessors(classLoader);\n\n            Log.i(\"DgLabUnlocker\", \"Hook Loading: Fields lookup done\");\n            StatusDialog.fieldsLookup = true;\n        } catch (Exception e) {\n            ModuleUtils.logError(\"DgLabUnlocker\", \"An error occurred in initializeAccessors()\", e);\n            Toast.makeText(context, \"DG-Lab Unlocker 加载失败\", Toast.LENGTH_LONG).show();\n            return;\n        }\n        // endregion\n\n        // region load features and collect hook classes\n        HashSet<Class<? extends AbstractHook<?>>> hookClasses = new HashSet<>(HookRegistry.preloadHooks);\n        for (Class<? extends AbstractFeature> featureClass : HookRegistry.features) {\n            try {\n                AbstractFeature feature = featureClass.newInstance();\n                hookClasses.addAll(feature.getRequiredHooks());\n                HookRegistry.featureInstances.put(featureClass, feature);\n            } catch (Exception e) {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"Could not initialize feature \" + featureClass.getName(), e);\n            }\n        }\n        // endregion\n        // region inject hooks\n        for (Class<? extends AbstractHook<?>> hookClass : hookClasses) {\n            try {\n                AbstractHook<?> hook = hookClass.newInstance();\n                if (!hook.isUnsupported()) {\n                    hook.applyHook(context, classLoader);\n                    hook.setHooked(true);\n                    Log.i(\"DgLabUnlocker\", \"Hook \" + hook.getName() + \" loaded\");\n                }\n                HookRegistry.hookInstances.put(hookClass, hook);\n            } catch (Exception e) {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"Could not apply hook \" + hookClass.getName(), e);\n            }\n        }\n        // endregion\n        // region register hook handlers\n        for (Class<? extends AbstractFeature> featureClass : HookRegistry.features) {\n            AbstractFeature feature = null;\n            try {\n                feature = HookRegistry.featureInstances.get(featureClass);\n                if (feature == null)\n                    continue;\n                if (feature.isUnsupported()) {\n                    ModuleUtils.logError(\"DgLabUnlocker\", \"Cannot register feature \" + featureClass.getName() + \": minVersion not match\");\n                    continue;\n                }\n                for (Class<? extends AbstractHook<?>> hookClass : feature.getRequiredHooks()) {\n                    AbstractHook<?> hook = HookRegistry.hookInstances.get(hookClass);\n                    if (hook == null)\n                        throw new ModuleException(\"Cannot register feature \" + featureClass.getName() + \" to hook \" + hookClass.getName() + \": hook not initialized\");\n                    if (!hook.isHooked())\n                        throw new ModuleException(\"Cannot register feature \" + featureClass.getName() + \" to hook \" + hookClass.getName() + \": hook not working\");\n                    hook.registerHandler(feature);\n                }\n                Log.i(\"DgLabUnlocker\", \"Feature \" + feature.getName() + \" registered\");\n            } catch (Exception e) {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"Could not register hook handler for feature \" + featureClass.getName(), e);\n                if (feature != null)\n                    feature.setLoaded(false);\n            }\n        }\n        // endregion\n        // region load configurations\n        Log.i(\"DgLabUnlocker\", \"Hook Loading: Loading configuration...\");\n        try {\n            ModuleSettings.loadConfiguration(context);\n            Log.i(\"DgLabUnlocker\", \"Hook Loading: Configuration loaded\");\n        } catch (Exception e) {\n            ModuleUtils.logError(\"DgLabUnlocker\", \"An error occurred in loadConfiguration()\", e);\n        }\n        // endregion\n        // region test features\n        Log.i(\"DgLabUnlocker\", \"Hook Loading: Testing features...\");\n        for (AbstractFeature feature : HookRegistry.featureInstances.values()) {\n            try {\n                if (feature.isUnsupported())\n                    continue;\n                feature.initialize();\n                feature.setLoaded(true);\n            } catch (Exception e) {\n                feature.setLoaded(false);\n                ModuleUtils.logError(\"DgLabUnlocker\", \"An error occurred while testing feature \" + feature.getClass().getName(), e);\n            }\n        }\n        // endregion\n        Toast.makeText(context, \"DG-Lab Unlocker 注入成功\\nGithub @SakuraKoi/DgLabUnlocker\", Toast.LENGTH_LONG).show();\n    }\n\n    @Override\n    public void initZygote(StartupParam startupParam) {\n        ResourceInject.modulePath = startupParam.modulePath;\n    }\n\n    @Override\n    public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) {\n        if (!resparam.packageName.equals(\"com.bjsm.dungeonlab\"))\n            return;\n        ResourceInject.doResourceInject(resparam);\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/AbstractFeature.java",
    "content": "package sakura.kooi.dglabunlocker.features;\n\nimport java.util.List;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic abstract class AbstractFeature {\n\n    @Getter @Setter\n    private boolean isLoaded = false;\n\n    public abstract String getName();\n\n    public abstract List<Class<? extends AbstractHook<?>>> getRequiredHooks();\n\n    public boolean isUnsupported() {\n        for (Class<? extends AbstractHook<?>> hook : getRequiredHooks()) {\n            AbstractHook<?> hookInstance = HookRegistry.hookInstances.get(hook);\n            // every required hook's instance should has been created\n            if (hookInstance == null)\n                return true;\n            if (hookInstance.isUnsupported())\n                return true;\n        }\n        return false;\n    }\n\n    public abstract ClientSide getSide();\n\n    public void initialize() throws Exception {}\n\n    public enum ClientSide {\n        ALL, CONTROLLER, CONTROLLED;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/ClickableFeature.java",
    "content": "package sakura.kooi.dglabunlocker.features;\n\nimport android.content.Context;\nimport android.widget.LinearLayout;\n\npublic abstract class ClickableFeature extends AbstractFeature {\n    public abstract void inflateFeatureLayout(Context context, LinearLayout layout);\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/ToggleableFeature.java",
    "content": "package sakura.kooi.dglabunlocker.features;\n\nimport lombok.Getter;\n\npublic abstract class ToggleableFeature extends AbstractFeature {\n    @Getter\n    private boolean isEnabled = false;\n\n    @Override\n    public String getName() {\n        return getSettingName();\n    }\n\n    public abstract String getSettingName();\n    public abstract String getSettingDesc();\n    public abstract String getConfigurationKey();\n\n    public void setEnabled(boolean enabled) {\n        updateFeatureStatus(enabled);\n        this.isEnabled = enabled;\n    }\n\n    public abstract void updateFeatureStatus(boolean enabled);\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/WithExtraConfiguration.java",
    "content": "package sakura.kooi.dglabunlocker.features;\n\nimport android.content.Context;\nimport android.view.View;\n\nimport java.lang.annotation.Retention;\n\nimport sakura.kooi.dglabunlocker.ui.ExtraConfigurationDialog;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\n\npublic interface WithExtraConfiguration {\n    default View createSettingButton(Context context) {\n        return UiUtils.createSettingButton(context, e -> {\n            new ExtraConfigurationDialog(context, (AbstractFeature) this).show();\n        });\n    }\n\n    @Retention(java.lang.annotation.RetentionPolicy.RUNTIME)\n    @interface ExtraConfigurationField {\n        String key();\n        String name();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/clickable/FeatureExportWave.java",
    "content": "package sakura.kooi.dglabunlocker.features.clickable;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.net.Uri;\nimport android.os.ParcelFileDescriptor;\nimport android.util.Log;\nimport android.widget.LinearLayout;\nimport android.widget.Toast;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport com.google.gson.JsonArray;\nimport com.google.gson.JsonObject;\nimport com.google.gson.JsonPrimitive;\n\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\n\nimport sakura.kooi.dglabunlocker.features.ClickableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookActivityResult;\nimport sakura.kooi.dglabunlocker.hooks.business.HookCurrentActivity;\nimport sakura.kooi.dglabunlocker.ui.WaveSelectDialog;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.utils.WaveUtils;\n\npublic class FeatureExportWave extends ClickableFeature implements HookActivityResult.IActivityResultInterceptor {\n    private List<Object> pendingWaves;\n\n    @Override\n    public String getName() {\n        return \"导出波形\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookCurrentActivity.class, HookActivityResult.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.ALL;\n    }\n\n    @Override\n    public void inflateFeatureLayout(Context context, LinearLayout layout) {\n        UiUtils.createButton(layout, \"导出波形\", e -> {\n            displayExportWaveDialog();\n        });\n    }\n\n    private void displayExportWaveDialog() {\n        Context context = HookCurrentActivity.getCurrentActivity();\n        Map<String, Object> waveList;\n        try {\n            waveList = WaveUtils.getWaveListWithName(true);\n        } catch (ReflectiveOperationException e) {\n            Log.e(\"DgLabUnlocker\", \"An error occurred while getting wave list\", e);\n            Toast.makeText(context, \"获取波形列表失败\", Toast.LENGTH_LONG).show();\n            return;\n        }\n        new WaveSelectDialog(context, \"选择要导出的波形\", waveList, selectedWaves -> {\n            if (selectedWaves.isEmpty()) {\n                return;\n            }\n            pendingWaves = selectedWaves;\n            Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);\n            intent.addCategory(Intent.CATEGORY_OPENABLE);\n            intent.setType(\"application/json\");\n            intent.putExtra(Intent.EXTRA_TITLE, \"DG-Lab_Unlocker_Wave-Export.json\");\n            Log.i(\"DgLabUnlocker\", \"Sending ACTION_CREATE_DOCUMENT from activity \" + HookCurrentActivity.getCurrentActivity().getClass().getName());\n            HookCurrentActivity.getCurrentActivity().startActivityForResult(intent, 11451);\n        }).show();\n    }\n\n    private JsonArray cleanupWaves(Gson gson, List<Object> selectedWaves) {\n        JsonArray out = new JsonArray();\n        for (Object wave : selectedWaves) {\n            JsonObject element = gson.toJsonTree(wave).getAsJsonObject();\n            element.remove(\"selectedStateA\");\n            element.add(\"selectedStateA\", new JsonPrimitive(3));\n\n            element.remove(\"selectedStateB\");\n            element.add(\"selectedStateB\", new JsonPrimitive(3));\n\n            element.remove(\"stateA\");\n            element.add(\"stateA\", new JsonPrimitive(1));\n\n            element.remove(\"stateB\");\n            element.add(\"stateB\", new JsonPrimitive(1));\n\n            element.remove(\"playOrderA\");\n            element.add(\"playOrderA\", new JsonPrimitive(-1));\n\n            element.remove(\"playOrderB\");\n            element.add(\"playOrderB\", new JsonPrimitive(-1));\n\n            element.remove(\"channel\");\n            out.add(element);\n        }\n        return out;\n    }\n\n    @Override\n    public void onActivityResult(Context context, int requestCode, int resultCode, Intent data) {\n        if (requestCode == 11451 && resultCode == Activity.RESULT_OK) {\n            if (data != null) {\n                Uri uri = data.getData();\n                Gson gson = new GsonBuilder().setPrettyPrinting().create();\n                String pendingJson = gson.toJson(cleanupWaves(gson, pendingWaves));\n                try {\n                    try (ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, \"w\")) {\n                        try (FileOutputStream fileOutputStream = new FileOutputStream(pfd.getFileDescriptor())) {\n                            fileOutputStream.write(pendingJson.getBytes(StandardCharsets.UTF_8));\n                            fileOutputStream.flush();\n                        }\n                    }\n                    Toast.makeText(context, \"成功导出了 \" + pendingWaves.size() + \" 个波形\", Toast.LENGTH_LONG).show();\n                } catch (IOException e) {\n                    Log.e(\"DgLabUnlocker\", \"An error occurred while writing wave list\", e);\n                    Toast.makeText(context, \"导出波形列表失败\", Toast.LENGTH_LONG).show();\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/clickable/FeatureIgnoreBatteryOptimization.java",
    "content": "package sakura.kooi.dglabunlocker.features.clickable;\n\nimport android.Manifest;\nimport android.annotation.SuppressLint;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.net.Uri;\nimport android.os.PowerManager;\nimport android.provider.Settings;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport sakura.kooi.dglabunlocker.features.ClickableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookCurrentActivity;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\n\npublic class FeatureIgnoreBatteryOptimization extends ClickableFeature {\n    @Override\n    public String getName() {\n        return \"忽略电池优化\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookCurrentActivity.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.ALL;\n    }\n\n    @Override\n    public void inflateFeatureLayout(Context context, LinearLayout layout) {\n        TextView btn = UiUtils.createButton(layout, \"忽略电池优化\", e -> {\n            requestIgnoreBatteryOptimization(context);\n        });\n        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);\n        if (pm.isIgnoringBatteryOptimizations(\"com.bjsm.dungeonlab\")) {\n            btn.setEnabled(false);\n            btn.setText(\"忽略电池优化 (已生效)\");\n        }\n    }\n\n    private void requestIgnoreBatteryOptimization(Context context) {\n        if (context.checkSelfPermission(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) == PackageManager.PERMISSION_GRANTED) {\n            @SuppressLint(\"BatteryLife\")\n            Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);\n            intent.setData(Uri.parse(\"package:com.bjsm.dungeonlab\"));\n            context.startActivity(intent);\n        } else {\n            Toast.makeText(context, \"请授予所需权限后重试\", Toast.LENGTH_LONG).show();\n            HookCurrentActivity.getCurrentActivity().requestPermissions(new String[] {Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}, 114513);\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/clickable/FeatureImportWave.java",
    "content": "package sakura.kooi.dglabunlocker.features.clickable;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.net.Uri;\nimport android.os.ParcelFileDescriptor;\nimport android.util.Log;\nimport android.widget.LinearLayout;\nimport android.widget.Toast;\n\nimport com.google.gson.Gson;\nimport com.google.gson.reflect.TypeToken;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\nimport sakura.kooi.dglabunlocker.features.ClickableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookActivityResult;\nimport sakura.kooi.dglabunlocker.hooks.business.HookCurrentActivity;\nimport sakura.kooi.dglabunlocker.hooks.business.HookWaveAdapterCollector;\nimport sakura.kooi.dglabunlocker.ui.WaveSelectDialog;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.utils.WaveUtils;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class FeatureImportWave extends ClickableFeature implements HookActivityResult.IActivityResultInterceptor {\n    @Override\n    public String getName() {\n        return \"导入波形\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookCurrentActivity.class, HookActivityResult.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.ALL;\n    }\n\n    @Override\n    public void inflateFeatureLayout(Context context, LinearLayout layout) {\n        UiUtils.createButton(layout, \"导入波形\", e -> {\n            Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);\n            intent.addCategory(Intent.CATEGORY_OPENABLE);\n            intent.setType(\"application/json\");\n            Log.i(\"DgLabUnlocker\", \"Sending ACTION_OPEN_DOCUMENT from activity \" + HookCurrentActivity.getCurrentActivity().getClass().getName());\n            HookCurrentActivity.getCurrentActivity().startActivityForResult(intent, 11452);\n        });\n    }\n\n    @Override\n    public void onActivityResult(Context context, int requestCode, int resultCode, Intent data) {\n        if (requestCode == 11452 && resultCode == Activity.RESULT_OK) {\n            if (data != null) {\n                Uri uri = data.getData();\n                try {\n                    try (ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, \"r\")) {\n                        try (FileInputStream fileInputStream = new FileInputStream(pfd.getFileDescriptor())) {\n                            ByteArrayOutputStream buffer = new ByteArrayOutputStream();\n                            int nRead;\n                            byte[] block = new byte[16384];\n                            while ((nRead = fileInputStream.read(block, 0, block.length)) != -1) {\n                                buffer.write(block, 0, nRead);\n                            }\n                            handleImportedData(buffer.toByteArray());\n                        }\n                    }\n                } catch (IOException e) {\n                    Log.e(\"DgLabUnlocker\", \"An error occurred while reading wave list\", e);\n                    Toast.makeText(context, \"读取波形列表失败\", Toast.LENGTH_LONG).show();\n                }\n            }\n        }\n    }\n\n    private void handleImportedData(byte[] data) {\n        Gson gson = new Gson();\n        List<Object> waves = gson.fromJson(new String(data), TypeToken.getParameterized(List.class, Accessors.classWaveClassicBean).getType());\n        LinkedHashMap<String, Object> waveList = waves.stream().collect(Collectors.toMap(wave -> {\n            try {\n                return Accessors.waveName.get(wave);\n            } catch (ReflectiveOperationException e) {\n                Log.e(\"DgLabUnlocker\", \"An error occurred while getting wave name\", e);\n                return null;\n            }\n        }, wave -> wave, (o1, o2) -> o1, LinkedHashMap::new));\n\n        Context context = HookCurrentActivity.getCurrentActivity();\n        new WaveSelectDialog(context, \"选择要导入的波形\", waveList, selectedWaves -> {\n            if (selectedWaves.isEmpty()) {\n                return;\n            }\n\n            Set<String> currentWaveNameList = null;\n            try {\n                currentWaveNameList = WaveUtils.getWaveListWithName(true).keySet();\n            } catch (ReflectiveOperationException e) {\n                Log.w(\"DgLabUnlocker\", \"An error occurred while deduplicating wave name\", e);\n            }\n\n            int success = 0;\n            for (Object wave : selectedWaves) {\n                try {\n                    Accessors.funcSaveWave.invoke(8, wave, 1, deduplicateWaveName(currentWaveNameList, Accessors.waveName.get(wave)), 1);\n                    success++;\n                } catch (Throwable e) {\n                    Log.e(\"DgLabUnlocker\", \"An error occurred while importing wave\", e);\n                }\n            }\n            boolean refreshed = false;\n            try {\n                refreshWaveList();\n                refreshed = true;\n            } catch (ReflectiveOperationException e) {\n                Log.e(\"DgLabUnlocker\", \"An error occurred while refreshing wave list\", e);\n            }\n            Toast.makeText(context, \"成功导入\" + success + \" / \" + selectedWaves.size() + \" 个波形\" + (refreshed ? \"\" : \" (可能需要重启APP以生效)\"), Toast.LENGTH_LONG).show();\n        }).show();\n    }\n\n    private String deduplicateWaveName(Set<String> currentWaveNameList, String origName) {\n        if (currentWaveNameList == null) {\n            return origName;\n        }\n\n        int id = 0;\n        String name = origName;\n        while (currentWaveNameList.contains(name)) {\n            name = origName + ++id;\n        }\n        return name;\n    }\n\n    private void refreshWaveList() throws ReflectiveOperationException {\n        List<Object> waveList = WaveUtils.getWaveList(true);\n        for (Object adapter : HookWaveAdapterCollector.getAdapters()) {\n            try {\n                Accessors.funcSaveWave.invoke(adapter, waveList);\n            } catch (Throwable e) {\n                throw new ReflectiveOperationException(e);\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/toggleable/FeatureBypassRemoteMaxStrength.java",
    "content": "package sakura.kooi.dglabunlocker.features.toggleable;\n\n\nimport static sakura.kooi.dglabunlocker.variables.Accessors.localStrengthA;\nimport static sakura.kooi.dglabunlocker.variables.Accessors.localStrengthB;\nimport static sakura.kooi.dglabunlocker.variables.Accessors.maxStrengthA;\nimport static sakura.kooi.dglabunlocker.variables.Accessors.maxStrengthB;\nimport static sakura.kooi.dglabunlocker.variables.Accessors.totalStrengthA;\nimport static sakura.kooi.dglabunlocker.variables.Accessors.totalStrengthB;\n\nimport android.content.Context;\nimport android.widget.TextView;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookBluetoothStrengthSender;\nimport sakura.kooi.dglabunlocker.hooks.business.HookLongPressStrengthHandler;\nimport sakura.kooi.dglabunlocker.hooks.business.HookStrengthButton;\nimport sakura.kooi.dglabunlocker.hooks.business.HookStrengthText;\n\npublic class FeatureBypassRemoteMaxStrength extends ToggleableFeature implements\n        HookBluetoothStrengthSender.IBluetoothStrengthSendInterceptor,\n        HookStrengthButton.IStrengthButtonInterceptor,\n        HookLongPressStrengthHandler.IStrengthButtonInterceptor,\n        HookStrengthText.StrengthTextHandler {\n    private final AtomicInteger realMaxA = new AtomicInteger();\n    private final AtomicInteger realMaxB = new AtomicInteger();\n\n    @Override\n    public String getSettingName() {\n        return \"主控 | 无视强度上限设置\";\n    }\n\n    @Override\n    public String getSettingDesc() {\n        return \"想拉多高拉多高 (坏.jpg\";\n    }\n\n    @Override\n    public String getConfigurationKey() {\n        return \"FeatureBypassRemoteMaxStrength\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookBluetoothStrengthSender.class, HookStrengthButton.class, HookLongPressStrengthHandler.class, HookStrengthText.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.CONTROLLER;\n    }\n\n    @Override\n    public void updateFeatureStatus(boolean enabled) {\n\n    }\n\n    // helper method to prevent desync write (filter spoofed max strength)\n    public void updateRealMax() throws ReflectiveOperationException {\n        int maxA = maxStrengthA.get();\n        if (maxA != 300)\n            realMaxA.set(maxA);\n\n        int maxB = maxStrengthB.get();\n        if (maxB != 300)\n            realMaxB.set(maxB);\n\n        maxStrengthA.set(300);\n        maxStrengthB.set(300);\n    }\n\n    @Override\n    public void interceptBeforeStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) throws ReflectiveOperationException {\n        updateRealMax();\n    }\n\n    @Override\n    public void interceptAfterStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) throws ReflectiveOperationException {\n        maxStrengthA.set(realMaxA.get());\n        maxStrengthB.set(realMaxB.get());\n    }\n\n    @Override\n    public void beforeStrengthChange(Context context) throws ReflectiveOperationException {\n        updateRealMax();\n    }\n\n    @Override\n    public void afterStrengthChange(Context context) throws ReflectiveOperationException {\n        maxStrengthA.set(realMaxA.get());\n        maxStrengthB.set(realMaxB.get());\n    }\n\n    @Override\n    public void interceptStrengthText(TextView textA, TextView textB) throws ReflectiveOperationException {\n        boolean bypassedA = totalStrengthA.get() > localStrengthA.get() + Math.max(1, realMaxA.get());\n        textA.setTextColor(bypassedA ? 0xffffa500 : 0xffffe99d);\n        boolean bypassedB = totalStrengthB.get() > localStrengthB.get() + Math.max(1, realMaxB.get());\n        textB.setTextColor(bypassedB ? 0xffffa500 : 0xffffe99d);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/toggleable/FeatureEnforceLocalStrength.java",
    "content": "package sakura.kooi.dglabunlocker.features.toggleable;\n\nimport android.content.Context;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookLongPressStrengthHandler;\nimport sakura.kooi.dglabunlocker.hooks.business.HookProtocolStrengthDecoder;\nimport sakura.kooi.dglabunlocker.hooks.business.HookStrengthButton;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class FeatureEnforceLocalStrength extends ToggleableFeature implements\n        HookProtocolStrengthDecoder.IProtocolDecoderInterceptor,\n        HookStrengthButton.IStrengthButtonInterceptor,\n        HookLongPressStrengthHandler.IStrengthButtonInterceptor{\n    private AtomicInteger localStrengthA = new AtomicInteger(10);\n    private AtomicInteger localStrengthB = new AtomicInteger(10);\n\n    @Override\n    public String getSettingName() {\n        return \"被控 | 暴力锁死基础强度\";\n    }\n\n    @Override\n    public String getSettingDesc() {\n        return \"有效避免突然惨遭弹射起飞\";\n    }\n\n    @Override\n    public String getConfigurationKey() {\n        return \"FeatureEnforceLocalStrength\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookProtocolStrengthDecoder.class, HookStrengthButton.class, HookLongPressStrengthHandler.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.CONTROLLED;\n    }\n\n    @Override\n    public void updateFeatureStatus(boolean enabled) {\n\n    }\n\n    @Override\n    public void beforeStrengthDecode(Context context) throws ReflectiveOperationException {}\n\n    public void afterStrengthDecode(Context context) throws ReflectiveOperationException {\n        Accessors.localStrengthA.set(localStrengthA.get());\n        Accessors.localStrengthB.set(localStrengthB.get());\n    }\n\n    @Override\n    public void beforeStrengthChange(Context context) throws ReflectiveOperationException {}\n\n    @Override\n    public void afterStrengthChange(Context context) throws ReflectiveOperationException {\n        this.localStrengthA.set(Accessors.localStrengthA.get());\n        this.localStrengthB.set(Accessors.localStrengthB.get());\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/toggleable/FeatureEnforceRemoteMaxStrength.java",
    "content": "package sakura.kooi.dglabunlocker.features.toggleable;\n\nimport android.content.Context;\nimport android.util.Log;\nimport android.widget.Toast;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookBluetoothStrengthSender;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class FeatureEnforceRemoteMaxStrength extends ToggleableFeature implements HookBluetoothStrengthSender.IBluetoothStrengthSendInterceptor {\n    @Override\n    public String getSettingName() {\n        return \"被控 | 强制限制远程强度\";\n    }\n\n    @Override\n    public String getSettingDesc() {\n        return \"下面那个功能的防御\";\n    }\n\n    @Override\n    public String getConfigurationKey() {\n        return \"FeatureEnforceRemoteMaxStrength\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookBluetoothStrengthSender.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.CONTROLLED;\n    }\n\n    @Override\n    public void updateFeatureStatus(boolean enabled) {\n\n    }\n\n    @Override\n    public void interceptBeforeStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) throws ReflectiveOperationException {\n        int maxA = Accessors.maxStrengthA.get() + 30;\n        int maxB = Accessors.maxStrengthB.get() + 30;\n        boolean limited = false;\n        if (strengthA.get() > maxA) {\n            Log.w(\"DgLabUnlocker\", \"Enforced max strength A: \" + strengthA.get() + \" > \" + maxA);\n            strengthA.set(maxA);\n            limited = true;\n        }\n        if (strengthB.get() > maxB) {\n            Log.w(\"DgLabUnlocker\", \"Enforced max strength B: \" + strengthB.get() + \" > \" + maxB);\n            strengthB.set(maxB);\n            limited = true;\n        }\n        if (limited)\n            Toast.makeText(context, \"强制限制了一次远程最大强度\", Toast.LENGTH_SHORT).show();\n    }\n\n    @Override\n    public void interceptAfterStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) {\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/toggleable/FeatureUnlockRemoteMax.java",
    "content": "package sakura.kooi.dglabunlocker.features.toggleable;\n\nimport android.content.Context;\nimport android.util.Log;\nimport android.widget.Toast;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.business.HookRemoteSettingsDialog;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class FeatureUnlockRemoteMax extends ToggleableFeature implements HookRemoteSettingsDialog.IRemoteSettingDialogUiInterceptor {\n    @Override\n    public String getSettingName() {\n        return \"被控 | 解锁远程强度上限\";\n    }\n\n    @Override\n    public String getSettingDesc() {\n        return \"最高100完全不够用好吧\";\n    }\n\n    @Override\n    public String getConfigurationKey() {\n        return \"FeatureUnlockRemoteMax\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Arrays.asList(HookRemoteSettingsDialog.class);\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.ALL;\n    }\n\n    @Override\n    public void updateFeatureStatus(boolean enabled) {\n\n    }\n\n    @Override\n    public void interceptUiElements(Context context, Object thisObject) throws ReflectiveOperationException {\n        Field fieldChannelA = thisObject.getClass().getDeclaredField(InjectPoints.field_RemoteSettingDialog_strengthA);\n        Field fieldChannelB = thisObject.getClass().getDeclaredField(InjectPoints.field_RemoteSettingDialog_strengthB);\n        fieldChannelA.setAccessible(true);\n        fieldChannelB.setAccessible(true);\n\n        Object barChannelA = fieldChannelA.get(thisObject);\n        Object barChannelB = fieldChannelB.get(thisObject);\n        if (barChannelA == null || barChannelB == null) {\n            Log.e(\"DgLabUnlocker\", \"Cannot found progress bar ui\");\n            return;\n        }\n        Method setMax = barChannelA.getClass().getDeclaredMethod(\"setMax\", int.class);\n        setMax.setAccessible(true);\n        setMax.invoke(barChannelA, 276);\n        setMax.invoke(barChannelB, 276);\n        Toast.makeText(context, \"远程最大强度解锁成功\", Toast.LENGTH_SHORT).show();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/features/toggleable/FeatureWebsocketRpc.java",
    "content": "package sakura.kooi.dglabunlocker.features.toggleable;\n\nimport java.util.AbstractMap;\nimport java.util.Collections;\nimport java.util.List;\n\nimport lombok.SneakyThrows;\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.remote.WebsocketRPC;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic class FeatureWebsocketRpc extends ToggleableFeature {\n    private WebsocketRPC service = new WebsocketRPC();\n\n    @Override\n    public String getSettingName() {\n        return \"远程 | 开放RPC服务端口\";\n    }\n\n    @Override\n    public String getSettingDesc() {\n        return service.isRunning ? \"运行于 ws://0.0.0.0:23301\" : \"对外开放Websocket RPC服务端口\";\n    }\n\n    @Override\n    public String getConfigurationKey() {\n        return \"FeatureWebsocketRpc\";\n    }\n\n    @Override\n    public List<Class<? extends AbstractHook<?>>> getRequiredHooks() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public ClientSide getSide() {\n        return ClientSide.ALL;\n    }\n\n    @Override\n    public void initialize() throws Exception {\n        HookRegistry.customStatuses.put(\"[接口] RPC服务连接数\", new AbstractMap.SimpleEntry<>(\n                () -> service.isRunning ? String.valueOf(service.connected) : \"关闭\",\n                () -> service.isRunning ? 0xffc6ff00 : 0xfff44336\n        ));\n    }\n\n    @SneakyThrows(InterruptedException.class)\n    @Override\n    public void updateFeatureStatus(boolean enabled) {\n        if (enabled) {\n            service.start();\n        } else {\n            service.stop();\n            service = new WebsocketRPC();\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/AbstractHook.java",
    "content": "package sakura.kooi.dglabunlocker.hooks;\n\nimport android.content.Context;\nimport android.util.Log;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport lombok.Getter;\nimport lombok.Setter;\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic abstract class AbstractHook<T> {\n    @Getter\n    private Class<T> handlerClass;\n    private List<AbstractFeature> handlers = new ArrayList<>();\n\n    @Getter @Setter\n    private boolean isHooked = false;\n\n    public AbstractHook(Class<T> handlerClass) {\n        this.handlerClass = handlerClass;\n    }\n\n    public void registerHandler(Object handler) {\n        if (!handlerClass.isInstance(handler))\n            throw new IllegalArgumentException(\"Handler \" + handler.getClass().getName() + \" cannot be casted to registered to hook \"\n                    + this.getClass().getName() + \" ( require \" + handlerClass.getName() + \" )\");\n        if (!(handler instanceof AbstractFeature))\n            throw new IllegalArgumentException(\"Handler \" + handler.getClass().getName() + \" is not AbstractFeature and cannot be registered\");\n\n        this.handlers.add((AbstractFeature) handler);\n    }\n\n    public void applyHook(Context context, ClassLoader classLoader) {\n        try {\n            apply(context, classLoader);\n            isHooked = true;\n        } catch (Exception e) {\n            isHooked = false;\n            ModuleUtils.logError(\"DgLabUnlocker\", \"Could not apply \" + this.getClass().getName(), e);\n        }\n    }\n\n    public abstract String getName();\n\n    public abstract int getMinVersion();\n\n    public boolean isUnsupported() {\n        return HookRegistry.versionCode < getMinVersion();\n    }\n\n    protected abstract void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException;\n\n    @SuppressWarnings(\"unchecked\") // is checked\n    protected void callHandlers(ConsumerEx<T> dataPipe) {\n        for (AbstractFeature handler : handlers) {\n            if (handler.isUnsupported())\n                continue;\n            if (handler instanceof ToggleableFeature && !((ToggleableFeature) handler).isEnabled())\n                continue;\n            if (handler.getSide() == AbstractFeature.ClientSide.CONTROLLED && Accessors.isRemote)\n                continue;\n            if (handler.getSide() == AbstractFeature.ClientSide.CONTROLLER && !Accessors.isRemote)\n                continue;\n\n            try {\n                dataPipe.accept((T) handler);\n            } catch (Exception e) {\n                Log.e(\"DgLabUnlocker\", \"An error occurred in \" + handler.getClass().getName(), e);\n            }\n        }\n    }\n\n    protected interface ConsumerEx<T> {\n        void accept(T handler) throws Exception;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookActivityResult.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport static sakura.kooi.dglabunlocker.utils.DgLabVersion.V_1_3_2;\n\nimport android.content.Context;\nimport android.content.Intent;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\n\npublic class HookActivityResult extends AbstractHook<HookActivityResult.IActivityResultInterceptor> {\n    public HookActivityResult() {\n        super(IActivityResultInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"窗口消息回调\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return V_1_3_2;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookMethod(\"android.app.Activity\", classLoader, \"onActivityResult\",\n                int.class, int.class, Intent.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) {\n                        callHandlers(interceptor -> {\n                            interceptor.onActivityResult(context, (int)param.args[0], (int)param.args[1], (Intent) param.args[2]);\n                        });\n                    }\n                });\n    }\n\n    public interface IActivityResultInterceptor {\n        void onActivityResult(Context context, int requestCode, int resultCode, Intent data);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookBluetoothStrengthSender.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport android.content.Context;\nimport android.util.Log;\n\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class HookBluetoothStrengthSender extends AbstractHook<HookBluetoothStrengthSender.IBluetoothStrengthSendInterceptor> {\n    public HookBluetoothStrengthSender() {\n        super(IBluetoothStrengthSendInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"蓝牙强度发送\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    public void apply(Context context, ClassLoader classLoader) {\n        XposedHelpers.findAndHookMethod(InjectPoints.class_BluetoothService, classLoader, InjectPoints.method_BluetoothService_updateStrength, int.class, int.class,\n                new XC_MethodHook() {\n                    @Override\n                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\n                        AtomicInteger strengthA = new AtomicInteger((int) param.args[0]);\n                        AtomicInteger strengthB = new AtomicInteger((int) param.args[1]);\n\n                        callHandlers(handler -> {\n                            handler.interceptBeforeStrength(context, strengthA, strengthB);\n                        });\n\n                        param.args[0] = strengthA.get();\n                        param.args[1] = strengthB.get();\n                    }\n\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        AtomicInteger strengthA = new AtomicInteger((int) param.args[0]);\n                        AtomicInteger strengthB = new AtomicInteger((int) param.args[1]);\n\n                        callHandlers(handler -> {\n                            handler.interceptAfterStrength(context, strengthA, strengthB);\n                        });\n\n                        param.args[0] = strengthA.get();\n                        param.args[1] = strengthB.get();\n                        Log.d(\"DgLabUnlocker\", \"Bluetooth sent strength \" + param.args[0] + \" \" + param.args[1]);\n                    }\n                });\n    }\n\n    public interface IBluetoothStrengthSendInterceptor {\n        void interceptBeforeStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) throws ReflectiveOperationException;\n        void interceptAfterStrength(Context context, AtomicInteger strengthA, AtomicInteger strengthB) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookCurrentActivity.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport static sakura.kooi.dglabunlocker.utils.DgLabVersion.V_ANY;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\n\npublic class HookCurrentActivity extends AbstractHook<Object> {\n    private static volatile Activity _currentActivity = null;\n\n    public HookCurrentActivity() {\n        super(Object.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"当前窗口捕获\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return V_ANY;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookMethod(\"android.app.Instrumentation\", classLoader, \"newActivity\",\n                ClassLoader.class, String.class, Intent.class, new XC_MethodHook() {\n\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) {\n                        _currentActivity = (Activity) param.getResult();\n                    }\n                });\n    }\n\n    public static Activity getCurrentActivity() {\n        return _currentActivity;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookLongPressStrengthHandler.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport android.content.Context;\nimport android.os.Message;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class HookLongPressStrengthHandler extends AbstractHook<HookLongPressStrengthHandler.IStrengthButtonInterceptor> {\n    public HookLongPressStrengthHandler() {\n        super(HookLongPressStrengthHandler.IStrengthButtonInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"长按强度回调\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_1_3_2;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookMethod(InjectPoints.class_StrengthLongPressHandler, classLoader,\n                \"handleMessage\", Message.class, new XC_MethodHook() {\n                    @Override\n                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\n                        Message message = (Message) param.args[0];\n                        int what = message.what;\n                        if (what >= 10 && what <= 13) {\n                            callHandlers(handler -> {\n                                handler.beforeStrengthChange(context);\n                            });\n                        }\n                    }\n\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        Message message = (Message) param.args[0];\n                        int what = message.what;\n                        if (what >= 10 && what <= 13) {\n                            callHandlers(handler -> {\n                                handler.afterStrengthChange(context);\n                            });\n                        }\n                    }\n                });\n    }\n\n    public interface IStrengthButtonInterceptor {\n        void beforeStrengthChange(Context context) throws ReflectiveOperationException;\n\n        void afterStrengthChange(Context context) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookProtocolStrengthDecoder.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport android.content.Context;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class HookProtocolStrengthDecoder extends AbstractHook<HookProtocolStrengthDecoder.IProtocolDecoderInterceptor> {\n    public HookProtocolStrengthDecoder() {\n        super(IProtocolDecoderInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"强度协议解码\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    @Override\n    public void apply(Context context, ClassLoader classLoader) {\n        XposedHelpers.findAndHookMethod(InjectPoints.class_BluetoothServiceDecoder, classLoader, InjectPoints.method_BluetoothServiceDecoder_decode, byte[].class,\n                new XC_MethodHook() {\n                    @Override\n                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\n                        callHandlers(handler -> {\n                            handler.beforeStrengthDecode(context);\n                        });\n                    }\n\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        callHandlers(handler -> {\n                            handler.afterStrengthDecode(context);\n                        });\n                    }\n                });\n    }\n\n    public interface IProtocolDecoderInterceptor {\n        void beforeStrengthDecode(Context context) throws ReflectiveOperationException;\n        void afterStrengthDecode(Context context) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookRemoteSettingsDialog.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport android.content.Context;\nimport android.os.Bundle;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class HookRemoteSettingsDialog extends AbstractHook<HookRemoteSettingsDialog.IRemoteSettingDialogUiInterceptor> {\n    public HookRemoteSettingsDialog() {\n        super(IRemoteSettingDialogUiInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"远程控制设置\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    public void apply(Context context, ClassLoader classLoader) {\n        XposedHelpers.findAndHookMethod(InjectPoints.class_RemoteSettingDialog, classLoader,\n                \"onCreate\", Bundle.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        Object thisObject = param.thisObject;\n                        HookRemoteSettingsDialog.this.callHandlers(interceptor -> {\n                            interceptor.interceptUiElements(context, thisObject);\n                        });\n                    }\n                });\n    }\n\n    public interface IRemoteSettingDialogUiInterceptor {\n        void interceptUiElements(Context context, Object thisObject) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookStrengthButton.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport android.content.Context;\nimport android.view.MotionEvent;\nimport android.view.View;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.InjectPoints;\n\npublic class HookStrengthButton extends AbstractHook<HookStrengthButton.IStrengthButtonInterceptor> {\n    public HookStrengthButton() {\n        super(IStrengthButtonInterceptor.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"强度调整按钮\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    public void apply(Context context, ClassLoader classLoader) {\n        InjectPoints.class_StrengthTouchListeners.forEach(classTouchListener -> {\n            XposedHelpers.findAndHookMethod(classTouchListener, classLoader,\n                \"onTouch\", View.class, MotionEvent.class, new XC_MethodHook() {\n                    @Override\n                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {\n                        callHandlers(handler -> {\n                            handler.beforeStrengthChange(context);\n                        });\n                    }\n\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        callHandlers(handler -> {\n                            handler.afterStrengthChange(context);\n                        });\n                    }\n                });\n        });\n    }\n\n    public interface IStrengthButtonInterceptor {\n        void beforeStrengthChange(Context context) throws ReflectiveOperationException;\n        void afterStrengthChange(Context context) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookStrengthText.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.*;\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.method_HomeActivity_updateStrengthText;\n\nimport android.content.Context;\nimport android.widget.TextView;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class HookStrengthText extends AbstractHook<HookStrengthText.StrengthTextHandler> {\n    public HookStrengthText() {\n        super(StrengthTextHandler.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"强度文字显示\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_1_3_2;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookMethod(class_HomeActivity, classLoader,\n                method_HomeActivity_updateStrengthText, int.class, int.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        callHandlers(handler -> {\n                            handler.interceptStrengthText(\n                                    Accessors.textHomeActivityStrengthA.get(param.thisObject),\n                                    Accessors.textHomeActivityStrengthB.get(param.thisObject)\n                            );\n                        });\n                    }\n                });\n    }\n\n    public interface StrengthTextHandler {\n        void interceptStrengthText(TextView textA, TextView textB) throws ReflectiveOperationException;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/business/HookWaveAdapterCollector.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.business;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.class_MainListCustomizAdapter;\n\nimport android.content.Context;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.WeakHashMap;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\n\npublic class HookWaveAdapterCollector extends AbstractHook<Object> {\n    private static final WeakHashMap<Object, Void> adapters = new WeakHashMap<>();\n    public HookWaveAdapterCollector() {\n        super(Object.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"波形列表收集\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_1_3_2;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookConstructor(class_MainListCustomizAdapter, classLoader, List.class, int.class, new XC_MethodHook() {\n            @Override\n            protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                Object adapter = param.thisObject;\n                adapters.put(adapter, null);\n            }\n        });\n    }\n\n    public static Collection<Object> getAdapters() {\n        return adapters.keySet();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/preload/HookDisableForceUpdate.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.preload;\n\nimport static sakura.kooi.dglabunlocker.utils.ExceptionLogger.withCatch;\n\nimport android.content.Context;\nimport android.util.Log;\n\nimport java.util.Objects;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\n\npublic class HookDisableForceUpdate extends AbstractHook<Object> {\n    public HookDisableForceUpdate() {\n        super(Object.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"屏蔽强制更新\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    // com.bjsm.dungeonlab.widget.UpdateAppDialog.show(String str, String str2, int isForce, String str3)\n    // isForce -> 0\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        withCatch(\"HookDisableForceUpdate findMethod\", () -> {\n            XposedHelpers.findAndHookMethod(\"com.bjsm.dungeonlab.widget.UpdateAppDialog\", classLoader,\n                    \"show\", String.class, String.class, int.class, String.class, new XC_MethodHook() {\n                        @Override\n                        protected void beforeHookedMethod(MethodHookParam param) {\n                            withCatch(\"HookDisableForceUpdate\", () -> {\n                                Log.i(\"DgLabUnlocker\", \"HookDisableForceUpdate: Showing update dialog with param \" + param.args[2]);\n                                StringBuilder message = new StringBuilder();\n                                message.append(\"** [DGLab-Unlocker] 提示: \\n\");\n                                if (Objects.equals(param.args[2], 0)) {\n                                    message.append(\"** 屏蔽强制更新成功\\n** 您现在可以取消本次更新\\n\\n\");\n                                    param.args[2] = 1;\n                                    Log.i(\"DgLabUnlocker\", \"HookDisableForceUpdate: Disabling force update flag\");\n                                }\n                                message.append(\"** 建议先检查模块是否适配新版本\\n** 以免更新APP后模块失效\\n\\n\");\n                                message.append((String) param.args[0]);\n                                param.args[0] = message.toString();\n                            });\n                        }\n                    });\n        });\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/preload/HookSettingsDialog.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.preload;\n\nimport static sakura.kooi.dglabunlocker.utils.ExceptionLogger.withCatch;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.View;\n\nimport java.lang.reflect.Field;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.ui.ModuleDialog;\nimport sakura.kooi.dglabunlocker.variables.ModuleSettings;\n\npublic class HookSettingsDialog {\n    public static void apply(Context context, ClassLoader classLoader) {\n        XposedHelpers.findAndHookMethod(\"com.bjsm.dungeonlab.widget.FuncSelectDialog\", classLoader,\n                \"onCreate\", Bundle.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {\n                        withCatch(\"HookBugReportDialog FuncSelectDialog\", () -> {\n                            Log.i(\"DgLabUnlocker\", \"HookSettingsDialog: replacing onClickListener\");\n                            Dialog dialog = (Dialog) param.thisObject;\n                            Field btnField = dialog.getClass().getDeclaredField(\"safe_button\");\n                            btnField.setAccessible(true);\n                            View btn = (View) btnField.get(dialog);\n                            if (btn == null) {\n                                Log.e(\"DgLabUnlocker\", \"HookSettingsDialog: Inject failed, button is null\");\n                                return;\n                            }\n\n                            btn.setOnClickListener(e -> withCatch(\"SettingDialog open\", () -> ModuleSettings.showSettingsDialog(btn.getContext())));\n                        });\n                    }\n                });\n\n        XposedHelpers.findAndHookMethod(\"com.bjsm.dungeonlab.widget.BugDialog\", classLoader,\n                \"onCreate\", Bundle.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) {\n                        withCatch(\"HookBugReportDialog BugDialog\", () -> {\n                            Log.i(\"DgLabUnlocker\", \"HookSettingsDialog: replacing layout of BugDialog\");\n                            Dialog dialog = (Dialog) param.thisObject;\n                            dialog.setContentView(ModuleDialog.makeLayout(dialog.getContext()));\n                        });\n                    }\n                });\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/hooks/preload/HookUpdateClientSide.java",
    "content": "package sakura.kooi.dglabunlocker.hooks.preload;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.class_BluetoothService;\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.method_BluetoothService_updateClientSide;\n\nimport android.content.Context;\n\nimport java.util.Objects;\n\nimport de.robv.android.xposed.XC_MethodHook;\nimport de.robv.android.xposed.XposedHelpers;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.DgLabVersion;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class HookUpdateClientSide extends AbstractHook<Object> {\n    public HookUpdateClientSide() {\n        super(Object.class);\n    }\n\n    @Override\n    public String getName() {\n        return \"连接状态监听\";\n    }\n\n    @Override\n    public int getMinVersion() {\n        return DgLabVersion.V_ANY;\n    }\n\n    @Override\n    protected void apply(Context context, ClassLoader classLoader) throws ReflectiveOperationException {\n        XposedHelpers.findAndHookMethod(class_BluetoothService, classLoader,\n                method_BluetoothService_updateClientSide, int.class, new XC_MethodHook() {\n                    @Override\n                    protected void afterHookedMethod(MethodHookParam param) {\n                        try {\n                            Accessors.isRemote = Accessors.isRemoteControlling.get() && !Objects.equals(param.args[0], 0);\n                        } catch (ReflectiveOperationException e) {\n                            ModuleUtils.logError(\"DgLabUnlocker\", \"Update isRemoteControlling failed\", e);\n                        }\n                    }\n                });\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/remote/WebsocketRPC.java",
    "content": "package sakura.kooi.dglabunlocker.remote;\n\nimport android.util.Log;\n\nimport androidx.annotation.NonNull;\n\nimport org.java_websocket.WebSocket;\nimport org.java_websocket.handshake.ClientHandshake;\nimport org.java_websocket.server.WebSocketServer;\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\nimport java.net.InetSocketAddress;\nimport java.util.Objects;\n\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureBypassRemoteMaxStrength;\nimport sakura.kooi.dglabunlocker.utils.FieldAccessor;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic class WebsocketRPC extends WebSocketServer {\n    public WebsocketRPC() {\n        super(new InetSocketAddress(\"0.0.0.0\", 23301));\n    }\n\n    public boolean isRunning = false;\n    public int connected = 0;\n\n    public void start() {\n        super.start();\n        isRunning = true;\n        Log.i(\"DgLabUnlocker\", \"RPC: Websocket server started\");\n    }\n\n    public void stop() throws InterruptedException {\n        super.stop();\n        isRunning = false;\n        Log.i(\"DgLabUnlocker\", \"RPC: Websocket server stopped\");\n    }\n\n    @Override\n    public void onOpen(WebSocket conn, ClientHandshake handshake) {\n        connected++;\n        Log.i(\"DgLabUnlocker\", \"RPC: client connected\");\n    }\n\n    @Override\n    public void onClose(WebSocket conn, int code, String reason, boolean remote) {\n        connected--;\n        Log.i(\"DgLabUnlocker\", \"RPC: client disconnected\");\n    }\n\n    @Override\n    public void onMessage(WebSocket conn, String message) {\n        JSONObject req;\n        int id;\n        try {\n            req = new JSONObject(message);\n            id = req.getInt(\"id\");\n        } catch (JSONException e) {\n            conn.send(\"{\\\"id\\\":null,\\\"code\\\":400,\\\"result\\\":\\\"Bad request\\\"}\");\n            return;\n        }\n\n        try {\n            Log.i(\"DgLabUnlocker\", \"RPC: received message \" + message);\n            String method = req.getString(\"method\");\n            Object data = req.has(\"data\") ? req.get(\"data\") : null;\n            dispatchMethods(conn, id, method, data);\n        } catch (Exception e) {\n            try {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"RPC: Internal error\", e);\n                conn.send(makeResponse(id, 500, \"Internal error\", null));\n            } catch (JSONException ex) {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"RPC: Failed write response\", e);\n                conn.send(\"{\\\"id\\\":\" + id + \",\\\"code\\\":500,\\\"result\\\":\\\"Internal server error, see xposed log for details\\\"}\");\n            }\n        }\n    }\n\n    private void dispatchMethods(WebSocket conn, int id, String method, Object payload) throws JSONException, ReflectiveOperationException {\n        switch (method) {\n            case \"queryStrength\": {\n                queryStrength(conn, id);\n                break;\n            }\n            case \"setStrength\": {\n                if (payload instanceof JSONObject) {\n                    setStrength(conn, id, (JSONObject) payload);\n                } else {\n                    conn.send(makeResponse(id, 400, \"Bad request\", null));\n                }\n                break;\n            }\n            case \"addStrength\": {\n                if (payload instanceof JSONObject) {\n                    boolean channel = ((JSONObject) payload).getBoolean(\"channel\");\n                    int strength = ((JSONObject) payload).getInt(\"strength\");\n                    if (channel) {\n                        addStrength(conn, id, true, strength, Accessors.maxStrengthA, Accessors.totalStrengthA);\n                    } else {\n                        addStrength(conn, id, false, strength, Accessors.maxStrengthB, Accessors.totalStrengthB);\n                    }\n                } else {\n                    conn.send(makeResponse(id, 400, \"Bad request\", null));\n                }\n                break;\n            }\n            default: {\n                conn.send(makeResponse(id, 400, \"Unknown command\", null));\n            }\n        }\n    }\n\n    private void addStrength(WebSocket conn, int id, boolean channel, int strength, FieldAccessor<Integer> maxStrength, FieldAccessor<Integer> totalStrength) throws ReflectiveOperationException, JSONException {\n        strength = totalStrength.get() + strength;\n\n        if (Accessors.isRemote && !Objects.requireNonNull((ToggleableFeature)HookRegistry.featureInstances.get(FeatureBypassRemoteMaxStrength.class)).isEnabled()) {\n            int max = maxStrength.get();\n            if (max < strength) {\n                strength = max;\n            }\n        }\n        if (strength < 0) {\n            strength = 0;\n        }\n        totalStrength.set(strength);\n        Log.i(\"DgLabUnlocker\", \"RPC: Strength \" + (channel ? \"A\" : \"B\") + \" set to \" + strength);\n        ModuleUtils.broadcastUiUpdate();\n        conn.send(makeResponse(id, 0, \"ok\", null));\n    }\n\n    private void setStrength(WebSocket conn, int id, JSONObject payload) throws JSONException, ReflectiveOperationException {\n        int strengthA = payload.getInt(\"strengthA\");\n        int strengthB = payload.getInt(\"strengthB\");\n        strengthA = strengthA + Accessors.remoteStrengthA.get();\n        strengthB = strengthB + Accessors.remoteStrengthA.get();\n\n        if (Accessors.isRemote && !Objects.requireNonNull((ToggleableFeature)HookRegistry.featureInstances.get(FeatureBypassRemoteMaxStrength.class)).isEnabled()) {\n            int maxStrengthA = Accessors.maxStrengthA.get();\n            int maxStrengthB = Accessors.maxStrengthB.get();\n            if (maxStrengthA < strengthA) {\n                strengthA = maxStrengthA;\n            }\n            if (maxStrengthB < strengthB) {\n                strengthB = maxStrengthB;\n            }\n        }\n        Accessors.totalStrengthA.set(strengthA);\n        Accessors.totalStrengthB.set(strengthB);\n        Log.i(\"DgLabUnlocker\", \"RPC: Strength set to \" + strengthA + \" | \" + strengthB);\n        ModuleUtils.broadcastUiUpdate();\n        conn.send(makeResponse(id, 0, \"ok\", null));\n    }\n\n    private void queryStrength(WebSocket conn, int id) throws JSONException, ReflectiveOperationException {\n        JSONObject data = new JSONObject();\n        data.put(\"totalStrengthA\", Accessors.totalStrengthA.get());\n        data.put(\"totalStrengthB\", Accessors.totalStrengthB.get());\n        data.put(\"baseStrengthA\", Accessors.localStrengthA.get());\n        data.put(\"baseStrengthB\", Accessors.localStrengthB.get());\n        data.put(\"remoteStrengthA\", Accessors.remoteStrengthA.get());\n        data.put(\"remoteStrengthB\", Accessors.remoteStrengthB.get());\n        data.put(\"maxStrengthA\", Accessors.maxStrengthA.get());\n        data.put(\"maxStrengthB\", Accessors.maxStrengthB.get());\n        data.put(\"isRemote\", Accessors.isRemote);\n        conn.send(makeResponse(id, 0, \"ok\", data));\n    }\n\n    @NonNull\n    private String makeResponse(int id, int code, String result, Object data) throws JSONException {\n        JSONObject resp = new JSONObject();\n        resp.put(\"id\", id);\n        resp.put(\"code\", code);\n        resp.put(\"result\", result);\n        resp.put(\"data\", data);\n        return resp.toString();\n    }\n\n    @Override\n    public void onError(WebSocket conn, Exception ex) {\n\n    }\n\n    @Override\n    public void onStart() {\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/ClickableFeatureDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.widget.LinearLayout;\n\nimport androidx.annotation.NonNull;\n\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.ClickableFeature;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic class ClickableFeatureDialog extends Dialog {\n    public ClickableFeatureDialog(@NonNull Context context) {\n        super(context);\n        this.setContentView(UiUtils.makeDialogLayout(this, \"附加功能\", container -> {\n            for (AbstractFeature feature : HookRegistry.featureInstances.values()) {\n                if (!(feature instanceof ClickableFeature))\n                    continue;\n                if (feature.isUnsupported())\n                    continue;\n                LinearLayout layout = new LinearLayout(context);\n                layout.setOrientation(LinearLayout.VERTICAL);\n                ((ClickableFeature) feature).inflateFeatureLayout(context, layout);\n                layout.setEnabled(feature.isLoaded());\n                container.addView(layout);\n            }\n        }));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/ConfigurationDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.annotation.SuppressLint;\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.util.Log;\nimport android.util.TypedValue;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.LinearLayout;\nimport android.widget.Switch;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\nimport androidx.annotation.NonNull;\n\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.features.WithExtraConfiguration;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\nimport sakura.kooi.dglabunlocker.variables.ModuleSettings;\n\npublic class ConfigurationDialog extends Dialog {\n    public ConfigurationDialog(@NonNull Context context) {\n        super(context);\n        setContentView(UiUtils.makeDialogLayout(this, \"DG-Lab Unlocker 设置\", ConfigurationDialog::createSettingSwitches));\n    }\n\n    private static void createSettingSwitches(LinearLayout container) {\n        for (AbstractFeature feature : HookRegistry.featureInstances.values()) {\n            if (!(feature instanceof ToggleableFeature))\n                continue;\n            if (feature.isUnsupported())\n                continue;\n            createSettingSwitch(container, (ToggleableFeature)feature);\n        }\n    }\n\n    @SuppressLint(\"UseSwitchCompatOrMaterialCode\")\n    private static void createSettingSwitch(LinearLayout container, ToggleableFeature feature) {\n        LinearLayout layout = new LinearLayout(container.getContext());\n        layout.setPadding(0, UiUtils.dpToPx(layout, 6), 0, 0);\n        if (feature instanceof WithExtraConfiguration) {\n            View extraConfigButton = ((WithExtraConfiguration) feature).createSettingButton(container.getContext());\n            layout.addView(extraConfigButton);\n            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) extraConfigButton.getLayoutParams();\n            layoutParams.rightMargin = UiUtils.dpToPx(layout, 6);\n            extraConfigButton.setLayoutParams(layoutParams);\n        }\n        TextView textTitle = UiUtils.createTextView(container.getContext());\n        Switch settingSwitch = UiUtils.createSwitch(container.getContext());\n        TextView textDesc = UiUtils.createTextView(container.getContext(), 0xffdfd2a5);\n        textTitle.setText(feature.getSettingName());\n        textTitle.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1));\n        layout.addView(textTitle);\n\n        settingSwitch.setPadding(UiUtils.dpToPx(layout, 10), 0, 0, 0);\n        settingSwitch.setChecked(feature.isEnabled());\n        settingSwitch.setEnabled(feature.isLoaded());\n        settingSwitch.setOnClickListener(e -> {\n            boolean enabled = settingSwitch.isChecked();\n            try {\n                feature.setEnabled(enabled);\n                ModuleSettings.sharedPref.edit().putBoolean(feature.getConfigurationKey(), enabled).commit();\n                textDesc.setText(feature.getSettingDesc());\n                Log.i(\"DgLabUnlocker\", \"Config \" + feature.getConfigurationKey() + \" set to \" + settingSwitch.isChecked());\n            } catch (Exception ex) {\n                feature.setEnabled(false);\n                settingSwitch.setChecked(!settingSwitch.isChecked());\n                Toast.makeText(container.getContext(),  \"发生异常错误\", Toast.LENGTH_SHORT).show();\n            }\n        });\n        layout.addView(settingSwitch);\n        container.addView(layout);\n\n        textDesc.setText(feature.isLoaded() ? feature.getSettingDesc() : \"加载时发生错误, 功能不可用\");\n        textDesc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);\n        textDesc.setPadding(0, UiUtils.dpToPx(layout, 1), 0, UiUtils.dpToPx(layout, 4));\n        container.addView(textDesc);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/DevTestDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.widget.Toast;\n\nimport androidx.annotation.NonNull;\n\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\n\npublic class DevTestDialog extends Dialog {\n    public DevTestDialog(@NonNull Context context) {\n        super(context);\n        this.setContentView(UiUtils.makeDialogLayout(this, \"实验功能测试\", container -> {\n            UiUtils.createButton(container, \"模拟资源加载错误\", e -> {\n                StatusDialog.resourceInjection = false;\n                Toast.makeText(context, \"成功\", Toast.LENGTH_SHORT).show();\n            });\n        }));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/ExtraConfigurationDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.widget.TableLayout;\n\nimport java.lang.reflect.Field;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\n\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.WithExtraConfiguration;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\n\npublic class ExtraConfigurationDialog extends Dialog {\n    public ExtraConfigurationDialog(Context context, AbstractFeature feature) {\n        super(context);\n        this.setContentView(UiUtils.makeDialogLayout(this, feature.getName() + \" 配置\", container -> {\n            LinkedHashMap<WithExtraConfiguration.ExtraConfigurationField, Field> configs = new LinkedHashMap<>();\n            for (Field field : feature.getClass().getDeclaredFields()) {\n                if (field.isAnnotationPresent(WithExtraConfiguration.ExtraConfigurationField.class)) {\n                    WithExtraConfiguration.ExtraConfigurationField extraConfigurationField = field.getAnnotation(WithExtraConfiguration.ExtraConfigurationField.class);\n                    if (extraConfigurationField == null || extraConfigurationField.key() == null)\n                        throw new IllegalArgumentException(\"Illegal extra config with null key in feature \" + feature.getName());\n                    field.setAccessible(true);\n                    if (field.getType() == int.class || (field.getType() == String.class || field.getType() == boolean.class)) {\n                        configs.put(extraConfigurationField, field);\n                    } else throw new IllegalArgumentException(\"Illegal extra config \" + extraConfigurationField.key() + \" in feature \" + feature.getName());\n                }\n            }\n\n            // TODO create setting input from configs\n            TableLayout table = new TableLayout(context);\n            container.addView(table);\n\n            for (Map.Entry<WithExtraConfiguration.ExtraConfigurationField, Field> entry : configs.entrySet()) {\n                var config = entry.getKey();\n                var field = entry.getValue();\n            }\n\n            // TODO add confirm and cancel button\n            // TODO register actionListener -> save data on confirm\n        }));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/ModuleDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.util.TypedValue;\nimport android.view.View;\nimport android.view.Window;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport androidx.annotation.NonNull;\n\nimport sakura.kooi.dglabunlocker.BuildConfig;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic class ModuleDialog extends Dialog {\n    public ModuleDialog(@NonNull Context context) {\n        super(context);\n        if (StatusDialog.resourceInjection) {\n            getWindow().setBackgroundDrawableResource(android.R.color.transparent);\n        } else {\n            requestWindowFeature(Window.FEATURE_NO_TITLE);\n        }\n        this.setContentView(makeLayout(context));\n    }\n\n    public static LinearLayout makeLayout(@NonNull Context context) {\n        LinearLayout container = UiUtils.makeDialogContainer(context, \"DG-Lab 魔改模块\");\n\n        container.addView(UiUtils.createTextView(context, \"应用版本: \" +\n                (StatusDialog.currentLoadedVersion == null ? \"未知\" : StatusDialog.currentLoadedVersion) + \" - \" + HookRegistry.versionCode\n        ));\n        container.addView(UiUtils.createTextView(context, \"模块版本: \" + BuildConfig.VERSION_NAME));\n\n        if (StatusDialog.fieldsLookup) {\n            UiUtils.createButton(container, \"功能设置\", e -> new ConfigurationDialog(context).show());\n            UiUtils.createButton(container, \"附加功能\", e -> new ClickableFeatureDialog(context).show());\n        } else {\n            TextView textView = UiUtils.createTextView(context, \"严重错误: 模块加载失败, 请检查日志\");\n            textView.setTextColor(0xfff44336);\n            container.addView(textView);\n            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textView.getLayoutParams();\n            params.topMargin = UiUtils.dpToPx(textView, 6);\n            textView.setLayoutParams(params);\n        }\n        UiUtils.createButton(container, \"模块运行状态\", e -> new StatusDialog(context).show());\n        if (HookRegistry.ENABLE_DEV_FEATURE) {\n            UiUtils.createButton(container, \"实验功能测试\", e -> new DevTestDialog(context).show());\n        }\n\n        TextView textAuthor = new TextView(context);\n        textAuthor.setText(\"Github @SakuraKoi/DgLabUnlocker\");\n        textAuthor.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);\n        textAuthor.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);\n        container.addView(textAuthor);\n        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textAuthor.getLayoutParams();\n        layoutParams.topMargin = UiUtils.dpToPx(textAuthor, 24);\n        textAuthor.setLayoutParams(layoutParams);\n\n        return container;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/StatusDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.annotation.SuppressLint;\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.LinearLayout;\nimport android.widget.TextView;\n\nimport androidx.annotation.NonNull;\n\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\nimport sakura.kooi.dglabunlocker.variables.HookRegistry;\n\npublic class StatusDialog extends Dialog {\n    public static String currentLoadedVersion = null;\n    public static boolean resourceInjection = false;\n    public static boolean fieldsLookup = false;\n    public static boolean moduleSettingsDialogInject = false;\n\n    @SuppressLint(\"ResourceType\")\n    public StatusDialog(@NonNull Context context) {\n        super(context);\n        this.setContentView(UiUtils.makeDialogLayout(this, \"DG-Lab Unlocker 日志\", container -> {\n            container.addView(addCurrentVersion(context));\n            container.addView(addStatus(context, \"[加载] 界面资源注入\", false, resourceInjection));\n            container.addView(addStatus(context, \"[加载] 模块设置界面\", false, moduleSettingsDialogInject));\n            container.addView(addStatus(context, \"[加载] 应用字段初始化\", false, fieldsLookup));\n\n            for (AbstractHook<?> hook : HookRegistry.hookInstances.values()) {\n                container.addView(addStatus(context, \"[注入] \" + hook.getName(), hook.isUnsupported(), hook.isHooked()));\n            }\n\n            for (Map.Entry<String, Map.Entry<Supplier<String>, Supplier<Integer>>> customStatus : HookRegistry.customStatuses.entrySet()) {\n                container.addView(addStatus(context, customStatus.getKey(),\n                        customStatus.getValue().getKey().get(),\n                        customStatus.getValue().getValue().get()));\n            }\n        }));\n    }\n\n    private LinearLayout addCurrentVersion(Context context) {\n        LinearLayout layout = new LinearLayout(context);\n        layout.setPadding(0, UiUtils.dpToPx(layout, 6), 0, 0);\n        TextView textTitle = UiUtils.createTextView(context);\n        textTitle.setText(\"[数据] 版本适配参数\");\n        textTitle.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1));\n        layout.addView(textTitle);\n\n        TextView textStatus = new TextView(context);\n        textStatus.setText(currentLoadedVersion != null ? currentLoadedVersion : \"不支持\");\n        textStatus.setTextColor(currentLoadedVersion != null ? 0xffc6ff00 : 0xfff44336);\n        layout.addView(textStatus);\n        return layout;\n    }\n\n    private LinearLayout addStatus(Context context, String title, boolean isUnsupported, boolean isHooked) {\n        return addStatus(context, title, isUnsupported ? \"不支持\" : isHooked ? \"成功\" : \"错误\", !isUnsupported && isHooked ? 0xffc6ff00 : 0xfff44336);\n    }\n\n    private LinearLayout addStatus(Context context, String title, String status, int color) {\n        LinearLayout layout = new LinearLayout(context);\n        layout.setPadding(0, UiUtils.dpToPx(layout, 6), 0, 0);\n        TextView textTitle = UiUtils.createTextView(context);\n        textTitle.setText(title);\n        textTitle.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1));\n        layout.addView(textTitle);\n\n        TextView textStatus = UiUtils.createTextView(context);\n        textStatus.setPadding(UiUtils.dpToPx(layout, 10), 0, 0, 0);\n        textStatus.setText(status);\n        textStatus.setTextColor(color);\n        textStatus.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);\n        layout.addView(textStatus);\n        return layout;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ui/WaveSelectDialog.java",
    "content": "package sakura.kooi.dglabunlocker.ui;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.widget.LinearLayout;\nimport android.widget.ScrollView;\n\nimport androidx.annotation.NonNull;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport sakura.kooi.dglabunlocker.utils.UiUtils;\n\npublic class WaveSelectDialog  extends Dialog {\n    public WaveSelectDialog(@NonNull Context context, String title, Map<String, Object> waveList, Consumer<List<Object>> selectedCallback) {\n        super(context);\n        this.setContentView(UiUtils.makeDialogLayout(this, title, container -> {\n            ArrayList<Object> selectedWave = new ArrayList<>();\n            ScrollView scrollView = new ScrollView(context);\n            LinearLayout selectContainer = new LinearLayout(context);\n            selectContainer.setOrientation(LinearLayout.VERTICAL);\n            scrollView.addView(selectContainer);\n\n            waveList.forEach((name, wave) -> UiUtils.createCheckbox(selectContainer, \" \" + name, selected -> {\n                if (selected) {\n                    selectedWave.add(wave);\n                } else {\n                    selectedWave.remove(wave);\n                }\n            }));\n\n            container.addView(scrollView);\n            UiUtils.createButton(container, \"确认\", v -> {\n                selectedCallback.accept(selectedWave);\n                dismiss();\n            });\n        }));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/DgLabVersion.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\npublic class DgLabVersion {\n    public static final int V_ANY = 0;\n    public static final int V_1_2_6 = 19;\n    public static final int V_1_3_1 = 21;\n    public static final int V_1_3_2 = 22;\n    public static final int V_1_3_3 = 23;\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/ExceptionLogger.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport android.util.Log;\n\npublic class ExceptionLogger {\n    public static void withCatch(String doing, ThrowableRunnable lambda) {\n        try {\n            lambda.run();\n        } catch (Exception e) {\n            Log.e(\"DgLabUnlocker\", \"An error occurred in \" + doing, e);\n        }\n    }\n\n    public interface ThrowableRunnable {\n        void run() throws Exception;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/FieldAccessor.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.reflect.Field;\n\npublic class FieldAccessor<T> {\n    private MethodHandle setter;\n    private MethodHandle getter;\n\n    public FieldAccessor(MethodHandles.Lookup lookup, Class<?> owner, boolean isStatic, String fieldName, Class<T> type) throws NoSuchFieldException, IllegalAccessException {\n        if (isStatic) {\n            getter = lookup.findStaticGetter(owner, fieldName, type);\n            setter = lookup.findStaticSetter(owner, fieldName, type);\n        } else {\n            getter = lookup.findGetter(owner, fieldName, type);\n            setter = lookup.findSetter(owner, fieldName, type);\n        }\n    }\n\n    public FieldAccessor(MethodHandles.Lookup lookup, Class<?> owner, String fieldName) throws IllegalAccessException, NoSuchFieldException {\n        Field field = owner.getDeclaredField(fieldName);\n        field.setAccessible(true);\n        getter = lookup.unreflectGetter(field);\n        setter = lookup.unreflectSetter(field);\n    }\n\n    public FieldAccessor(MethodHandles.Lookup lookup, Field field) throws IllegalAccessException {\n        getter = lookup.unreflectGetter(field);\n        setter = lookup.unreflectSetter(field);\n    }\n\n    public void set(T data) throws ReflectiveOperationException {\n        try {\n            setter.invoke(data);\n        } catch (Throwable throwable) {\n            throw new ReflectiveOperationException(throwable);\n        }\n    }\n\n    public void set(Object instance, T data) throws ReflectiveOperationException {\n        try {\n            setter.invoke(instance, data);\n        } catch (Throwable throwable) {\n            throw new ReflectiveOperationException(throwable);\n        }\n    }\n\n    public T get() throws ReflectiveOperationException {\n        try {\n            return (T) getter.invoke();\n        } catch (Throwable throwable) {\n            throw new ReflectiveOperationException(throwable);\n        }\n    }\n\n    public T get(Object instance) throws ReflectiveOperationException {\n        try {\n            return (T) getter.invoke(instance);\n        } catch (Throwable throwable) {\n            throw new ReflectiveOperationException(throwable);\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/ModuleException.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport androidx.annotation.NonNull;\n\npublic class ModuleException extends RuntimeException {\n    public ModuleException(String s) {\n        super(s);\n    }\n\n    @NonNull\n    @Override\n    public synchronized Throwable fillInStackTrace() {\n        return this;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/ModuleUtils.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.util.Log;\n\nimport de.robv.android.xposed.XposedBridge;\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class ModuleUtils {\n    public static Context applicationContext;\n\n    public static int getAppVersion(Context context) {\n        int versionCode = 0;\n        try {\n            versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;\n        } catch (PackageManager.NameNotFoundException ignored) {}\n        return versionCode;\n    }\n\n    // 不优雅, 能用就行.jpg\n    public static void logError(String tag, String s) {\n        XposedBridge.log(s);\n        Log.e(tag, s);\n    }\n\n    public static void logError(String tag, String s, Exception e) {\n        XposedBridge.log(s);\n        XposedBridge.log(e);\n        Log.e(tag, s, e);\n    }\n\n    public static void broadcastUiUpdate() throws ReflectiveOperationException {\n        Intent broadcast = new Intent();\n        broadcast.setAction(\"com.bjsm.dungeonlab.ble.abpower\");\n        broadcast.putExtra(\"apower\", Accessors.totalStrengthA.get());\n        broadcast.putExtra(\"bpower\", Accessors.totalStrengthB.get());\n        applicationContext.sendBroadcast(broadcast);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/UiUtils.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.graphics.Color;\nimport android.graphics.drawable.StateListDrawable;\nimport android.util.StateSet;\nimport android.util.TypedValue;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.view.Window;\nimport android.widget.CheckBox;\nimport android.widget.LinearLayout;\nimport android.widget.Space;\nimport android.widget.Switch;\nimport android.widget.TextView;\n\nimport androidx.annotation.NonNull;\n\nimport java.util.function.Consumer;\n\nimport sakura.kooi.dglabunlocker.ui.StatusDialog;\nimport sakura.kooi.dglabunlocker.variables.ResourceInject;\n\npublic class UiUtils {\n    public static int dpToPx(View view, float dp) {\n        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, view.getContext().getResources().getDisplayMetrics());\n    }\n\n    @NonNull\n    public static LinearLayout makeDialogContainer(Context context, String title) {\n        LinearLayout container = new LinearLayout(context);\n        container.setMinimumWidth(UiUtils.dpToPx(container, 270));\n        container.setPadding(dpToPx(container, 16), dpToPx(container, 16), dpToPx(container, 16), dpToPx(container, 16));\n        if (StatusDialog.resourceInjection) {\n            container.setBackground(ResourceInject.dialogSettingsBackground.getConstantState().newDrawable());\n        }\n        container.setOrientation(LinearLayout.VERTICAL);\n        TextView header = createTextView(context, title);\n        header.setGravity(Gravity.CENTER);\n        header.setPadding(0, 0, 0, dpToPx(container, 16));\n        container.addView(header);\n        return container;\n    }\n\n    public static LinearLayout makeDialogLayout(Dialog dialog, String title, Consumer<LinearLayout> layoutHandler) {\n        if (StatusDialog.resourceInjection) {\n            dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);\n        } else {\n            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\n        }\n        LinearLayout container = UiUtils.makeDialogContainer(dialog.getContext(), title);\n        layoutHandler.accept(container);\n        return container;\n    }\n\n    public static void createSpacing(LinearLayout container, float dp) {\n        Space space = new Space(container.getContext());\n        container.addView(space);\n        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) space.getLayoutParams();\n        params.height = dpToPx(space, dp);\n        space.setLayoutParams(params);\n    }\n\n    public static TextView createButton(LinearLayout container, String title, View.OnClickListener listener) {\n        return createButton(container, title, true, listener);\n    }\n\n    public static TextView createButton(LinearLayout container, String title, boolean withSpacing, View.OnClickListener listener) {\n        TextView button = createButton(container.getContext(), title, listener);\n        if (withSpacing) {\n            container.addView(button);\n            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();\n            layoutParams.topMargin = dpToPx(button, 6);\n            layoutParams.bottomMargin = dpToPx(button, 6);\n            button.setLayoutParams(layoutParams);\n        } else {\n            container.addView(button);\n        }\n        return button;\n    }\n\n    public static TextView createSettingButton(Context context, View.OnClickListener listener) {\n        TextView view = new TextView(context);\n        view.setPadding( dpToPx(view, 8), dpToPx(view, 3), dpToPx(view, 8), dpToPx(view, 3));\n        if (StatusDialog.resourceInjection) {\n            view.setBackground(ResourceInject.buttonSettingIcon.getConstantState().newDrawable());\n            view.setWidth(dpToPx(view, 24));\n            view.setHeight(dpToPx(view, 24));\n        } else {\n            view.setBackgroundResource(android.R.drawable.btn_default);\n            view.setText(\"设置\");\n        }\n        view.setGravity(Gravity.CENTER);\n        view.setOnClickListener(listener);\n        return view;\n    }\n\n\n    public static TextView createButton(Context context, String title, View.OnClickListener listener) {\n        TextView view = new TextView(context);\n        view.setPadding( dpToPx(view, 8), dpToPx(view, 3), dpToPx(view, 8), dpToPx(view, 3));\n        if (StatusDialog.resourceInjection) {\n            view.setBackground(ResourceInject.buttonBackground.getConstantState().newDrawable());\n            view.setTextColor(Color.BLACK);\n        } else {\n            view.setBackgroundResource(android.R.drawable.btn_default);\n        }\n        view.setText(title);\n        view.setGravity(Gravity.CENTER);\n        view.setOnClickListener(listener);\n        return view;\n    }\n\n    public static CheckBox createCheckbox(LinearLayout container, String title, Consumer<Boolean> listener) {\n        CheckBox checkbox = new CheckBox(container.getContext());\n        checkbox.setPadding( dpToPx(checkbox, 8), dpToPx(checkbox, 3), dpToPx(checkbox, 8), dpToPx(checkbox, 3));\n        if (StatusDialog.resourceInjection) {\n            checkbox.setTextColor(0xffffe99d);\n            StateListDrawable thumbSelector = new StateListDrawable();\n            thumbSelector.addState(new int[]{android.R.attr.state_checked}, ResourceInject.checkOn.getConstantState().newDrawable());\n            thumbSelector.addState(StateSet.WILD_CARD, ResourceInject.checkOff.getConstantState().newDrawable());\n            checkbox.setButtonDrawable(thumbSelector);\n        }\n        checkbox.setText(title);\n        checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> listener.accept(isChecked));\n        checkbox.setChecked(false);\n        container.addView(checkbox);\n        return checkbox;\n    }\n\n    public static TextView createTextView(Context context, String text) {\n        TextView textView = createTextView(context, 0xffffe99d);\n        textView.setText(text);\n        return textView;\n    }\n\n    public static TextView createTextView(Context context) {\n        return createTextView(context, 0xffffe99d);\n    }\n\n    public static TextView createTextView(Context context, int color) {\n        TextView view = new TextView(context);\n        if (StatusDialog.resourceInjection) {\n            view.setTextColor(color);\n        }\n        return view;\n    }\n\n    public static Switch createSwitch(Context context) {\n        Switch view = new Switch(context);\n        if (StatusDialog.resourceInjection) {\n            StateListDrawable trackSelector = new StateListDrawable();\n            trackSelector.addState(new int[]{android.R.attr.state_checked}, ResourceInject.switchOpenTrack.getConstantState().newDrawable());\n            trackSelector.addState(StateSet.WILD_CARD, ResourceInject.switchCloseTrack.getConstantState().newDrawable());\n            view.setTrackDrawable(trackSelector);\n            StateListDrawable thumbSelector = new StateListDrawable();\n            thumbSelector.addState(new int[]{android.R.attr.state_checked}, ResourceInject.switchOpenThumb.getConstantState().newDrawable());\n            thumbSelector.addState(StateSet.WILD_CARD, ResourceInject.switchCloseThumb.getConstantState().newDrawable());\n            view.setThumbDrawable(thumbSelector);\n            view.setTextOff(\"\");\n            view.setTextOn(\"\");\n        } else {\n            view.setTextOff(\"Off\");\n            view.setTextOn(\"On\");\n        }\n        return view;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/utils/WaveUtils.java",
    "content": "package sakura.kooi.dglabunlocker.utils;\n\nimport android.util.Log;\n\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class WaveUtils {\n    public static List<Object> getWaveList(boolean filterClassic) throws ReflectiveOperationException {\n        return Accessors.listWaveData.get().stream().filter(wave -> {\n            if (filterClassic) {\n                try {\n                    return Accessors.waveIsClassic.get(wave) == 1;\n                } catch (ReflectiveOperationException e) {\n                    Log.e(\"DgLabUnlocker\", \"An error occurred while checking wave is classic\", e);\n                    return false;\n                }\n            } else return true;\n        }).collect(Collectors.toList());\n    }\n    public static Map<String, Object> getWaveListWithName(boolean filterClassic) throws ReflectiveOperationException {\n        return getWaveList(filterClassic).stream().collect(Collectors.toMap(wave -> {\n            try {\n                return Accessors.waveName.get(wave);\n            } catch (ReflectiveOperationException e) {\n                Log.e(\"DgLabUnlocker\", \"An error occurred while getting wave name\", e);\n                return null;\n            }\n        }, wave -> wave, (o1, o2) -> o1, LinkedHashMap::new));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/variables/Accessors.java",
    "content": "package sakura.kooi.dglabunlocker.variables;\n\nimport android.widget.TextView;\n\nimport java.lang.invoke.MethodHandle;\nimport java.util.List;\n\nimport sakura.kooi.dglabunlocker.utils.FieldAccessor;\n\npublic class Accessors {\n    public static boolean isRemote;\n\n    public static FieldAccessor<Integer> localStrengthA;\n    public static FieldAccessor<Integer> totalStrengthA;\n    public static FieldAccessor<Integer> maxStrengthA;\n    public static FieldAccessor<Integer> remoteStrengthA;\n    public static FieldAccessor<Integer> localStrengthB;\n    public static FieldAccessor<Integer> totalStrengthB;\n    public static FieldAccessor<Integer> maxStrengthB;\n    public static FieldAccessor<Integer> remoteStrengthB;\n\n    public static FieldAccessor<TextView> textHomeActivityStrengthA;\n    public static FieldAccessor<TextView> textHomeActivityStrengthB;\n    public static FieldAccessor<Boolean> isRemoteControlling;\n\n    public static FieldAccessor<List<Object>> listWaveData;\n    public static Class<?> classWaveClassicBean;\n    public static FieldAccessor<Integer> waveIsClassic;\n    public static FieldAccessor<String> waveName;\n    \n    public static MethodHandle funcSaveWave;\n    public static MethodHandle funcAdapterSetList;\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/variables/HookRegistry.java",
    "content": "package sakura.kooi.dglabunlocker.variables;\n\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.clickable.FeatureExportWave;\nimport sakura.kooi.dglabunlocker.features.clickable.FeatureIgnoreBatteryOptimization;\nimport sakura.kooi.dglabunlocker.features.clickable.FeatureImportWave;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureBypassRemoteMaxStrength;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureEnforceLocalStrength;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureEnforceRemoteMaxStrength;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureUnlockRemoteMax;\nimport sakura.kooi.dglabunlocker.features.toggleable.FeatureWebsocketRpc;\nimport sakura.kooi.dglabunlocker.hooks.AbstractHook;\nimport sakura.kooi.dglabunlocker.hooks.preload.HookDisableForceUpdate;\nimport sakura.kooi.dglabunlocker.hooks.preload.HookUpdateClientSide;\n\npublic class HookRegistry {\n    // 调试用的实验性功能菜单开关\n    public static final boolean ENABLE_DEV_FEATURE = false;\n\n    public static final List<Class<? extends AbstractFeature>> features = List.of(\n            FeatureUnlockRemoteMax.class,\n            FeatureEnforceLocalStrength.class,\n            FeatureEnforceRemoteMaxStrength.class,\n            FeatureBypassRemoteMaxStrength.class,\n            FeatureWebsocketRpc.class,\n            FeatureIgnoreBatteryOptimization.class,\n            FeatureExportWave.class,\n            FeatureImportWave.class\n    );\n    public static final List<Class<? extends AbstractHook<?>>> preloadHooks = List.of(\n            HookDisableForceUpdate.class,\n            HookUpdateClientSide.class\n    );\n\n    public static final Map<Class<? extends AbstractFeature>, AbstractFeature> featureInstances = Collections.synchronizedMap(new LinkedHashMap<>());\n    public static final Map<Class<? extends AbstractHook<?>>, AbstractHook<?>> hookInstances = Collections.synchronizedMap(new LinkedHashMap<>());\n    public static final Map<String, Map.Entry<Supplier<String>, Supplier<Integer>>> customStatuses = Collections.synchronizedMap(new LinkedHashMap<>());\n    public static int versionCode;\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/variables/InjectPoints.java",
    "content": "package sakura.kooi.dglabunlocker.variables;\n\nimport java.util.List;\n\npublic class InjectPoints {\n    public static String class_BluetoothServiceDecoder;\n    public static String method_BluetoothServiceDecoder_decode;\n    public static String class_BluetoothService;\n    public static String method_BluetoothService_updateStrength;\n    public static String method_BluetoothService_updateClientSide;\n    public static List<String> class_StrengthTouchListeners;\n    public static String class_RemoteSettingDialog;\n    public static String field_RemoteSettingDialog_strengthA;\n    public static String field_RemoteSettingDialog_strengthB;\n    public static String class_StrengthLongPressHandler;\n    public static String class_HomeActivity;\n    public static String method_HomeActivity_updateStrengthText;\n    public static String field_HomeActivity_strengthTextA;\n    public static String field_HomeActivity_strengthTextB;\n    public static String class_MainListCustomizAdapter;\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/variables/ModuleSettings.java",
    "content": "package sakura.kooi.dglabunlocker.variables;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\n\nimport java.lang.reflect.Field;\n\nimport sakura.kooi.dglabunlocker.features.AbstractFeature;\nimport sakura.kooi.dglabunlocker.features.ToggleableFeature;\nimport sakura.kooi.dglabunlocker.features.WithExtraConfiguration;\nimport sakura.kooi.dglabunlocker.ui.ModuleDialog;\n\npublic class ModuleSettings {\n    public static SharedPreferences sharedPref;\n\n    public static void loadConfiguration(Context context) {\n        sharedPref = context.getSharedPreferences(\"dglabunlocker\", Context.MODE_PRIVATE);\n\n        for (AbstractFeature feature : HookRegistry.featureInstances.values()) {\n            if (feature instanceof ToggleableFeature) {\n                ToggleableFeature toggleableFeature = (ToggleableFeature) feature;\n                toggleableFeature.setEnabled(sharedPref.getBoolean(toggleableFeature.getConfigurationKey(), false));\n            }\n            if (feature instanceof WithExtraConfiguration) {\n                for (Field field : feature.getClass().getDeclaredFields()) {\n                    if (field.isAnnotationPresent(WithExtraConfiguration.ExtraConfigurationField.class)) {\n                        WithExtraConfiguration.ExtraConfigurationField extraConfigurationField = field.getAnnotation(WithExtraConfiguration.ExtraConfigurationField.class);\n                        if (extraConfigurationField == null || extraConfigurationField.key() == null)\n                            throw new IllegalArgumentException(\"Illegal extra config with null key in feature \" + feature.getName());\n                        field.setAccessible(true);\n                        try {\n                            if (field.getType() == int.class) {\n                                field.set(feature, sharedPref.getInt(extraConfigurationField.key(), field.getInt(feature)));\n                            } else if (field.getType() == String.class) {\n                                field.set(feature, sharedPref.getString(extraConfigurationField.key(), (String) field.get(feature)));\n                            } else if (field.getType() == boolean.class) {\n                                field.set(feature, sharedPref.getBoolean(extraConfigurationField.key(), field.getBoolean(feature)));\n                            } else\n                                throw new IllegalArgumentException(\"Illegal extra config \" + extraConfigurationField.key() + \" in feature \" + feature.getName());\n                        } catch (IllegalAccessException e) {\n                            e.printStackTrace();\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    public static void showSettingsDialog(Context context) {\n        new ModuleDialog(context).show();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/variables/ResourceInject.java",
    "content": "package sakura.kooi.dglabunlocker.variables;\n\nimport android.annotation.SuppressLint;\nimport android.content.res.Resources;\nimport android.content.res.XModuleResources;\nimport android.graphics.drawable.Drawable;\nimport android.util.Log;\n\nimport de.robv.android.xposed.callbacks.XC_InitPackageResources;\nimport sakura.kooi.dglabunlocker.R;\nimport sakura.kooi.dglabunlocker.ui.StatusDialog;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\n\npublic class ResourceInject {\n    public static String modulePath;\n\n    public static Drawable dialogSettingsBackground;\n    public static Drawable switchCloseThumb;\n    public static Drawable switchOpenThumb;\n    public static Drawable switchCloseTrack;\n    public static Drawable switchOpenTrack;\n    public static Drawable buttonBackground;\n    public static Drawable buttonSettingIcon;\n\n    public static Drawable checkOn;\n    public static Drawable checkOff;\n\n    @SuppressWarnings(\"deprecation\")\n    @SuppressLint(\"UseCompatLoadingForDrawables\")\n    public static void doResourceInject(XC_InitPackageResources.InitPackageResourcesParam resparam) {\n        Log.i(\"DgLabUnlocker\", \"Resource Loading: found target app \" + resparam.packageName);\n\n        XModuleResources modRes = XModuleResources.createInstance(modulePath, resparam.res);\n        try {\n            ResourceInject.dialogSettingsBackground = modRes.getDrawable(R.drawable.settings_bg);\n            ResourceInject.switchCloseThumb = modRes.getDrawable(R.drawable.switch_close_thumb);\n            ResourceInject.switchOpenThumb = modRes.getDrawable(R.drawable.switch_open_thumb);\n            ResourceInject.switchCloseTrack = modRes.getDrawable(R.drawable.switch_close_track);\n            ResourceInject.switchOpenTrack = modRes.getDrawable(R.drawable.switch_open_track);\n            ResourceInject.buttonBackground = modRes.getDrawable(R.drawable.button_yellow);\n            ResourceInject.checkOn = modRes.getDrawable(R.drawable.check_on);\n            ResourceInject.checkOff = modRes.getDrawable(R.drawable.check_off);\n            ResourceInject.buttonSettingIcon = modRes.getDrawable(R.drawable.icon_settings);\n            StatusDialog.resourceInjection = true;\n        } catch (Resources.NotFoundException e) {\n            ModuleUtils.logError(\"DgLabUnlocker\", \"resources cannot be found from XModuleResources, still try inject...\", e);\n        }\n\n        resparam.res.setReplacement(\"com.bjsm.dungeonlab\", \"string\", \"anquanxuzhi2\", \"模块设置\");\n        resparam.res.setReplacement(\"com.bjsm.dungeonlab\", \"string\", \"question_feedback\", \"DG-Lab Unlocker 设置\");\n        resparam.res.setReplacement(\"com.bjsm.dungeonlab\", \"string\", \"email_con\", \"模块设置替换失败, 请检查Logcat日志\");\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ver/AbstractVersionedCompatibilityProvider.java",
    "content": "package sakura.kooi.dglabunlocker.ver;\n\nimport java.lang.invoke.MethodHandle;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.reflect.Method;\nimport java.util.HashMap;\n\nimport sakura.kooi.dglabunlocker.utils.FieldAccessor;\nimport sakura.kooi.dglabunlocker.utils.ModuleUtils;\n\npublic abstract class AbstractVersionedCompatibilityProvider {\n    private HashMap<String, Class<?>> classCache = new HashMap<>();\n    private MethodHandles.Lookup lookup;\n    private ClassLoader classLoader;\n\n    protected abstract void initializeAccessors() throws ReflectiveOperationException;\n\n    protected abstract void initializeNames();\n\n    public void initializeAccessors(ClassLoader classLoader) throws ReflectiveOperationException {\n        this.lookup = MethodHandles.lookup();\n        this.classLoader = classLoader;\n        initializeNames();\n        initializeAccessors();\n    }\n\n    protected Class<?> lookupClass(String className) {\n        return classCache.computeIfAbsent(className, className1 -> {\n            try {\n                return Class.forName(className1, true, classLoader);\n            } catch (ClassNotFoundException e) {\n                ModuleUtils.logError(\"DgLabUnlocker\", \"Failed to find class \" + className1, e);\n                return null;\n            }\n        });\n    }\n\n    protected <T> FieldAccessor<T> lookupField(String className, String fieldName) throws ReflectiveOperationException {\n        Class<?> clazz = lookupClass(className);\n        if (clazz != null) {\n            return new FieldAccessor<>(lookup, clazz, fieldName);\n        }\n        return null;\n    }\n\n    protected MethodHandle lookupMethod(String className, String methodName, Class<?>... parameterTypes) throws ReflectiveOperationException {\n        Class<?> clazz = lookupClass(className);\n        if (clazz != null) {\n            Method method = clazz.getDeclaredMethod(methodName, parameterTypes);\n            method.setAccessible(true);\n            return lookup.unreflect(method);\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ver/Version126.java",
    "content": "package sakura.kooi.dglabunlocker.ver;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.*;\n\nimport java.util.Arrays;\n\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class Version126 extends AbstractVersionedCompatibilityProvider {\n    @Override\n    protected void initializeAccessors() throws ReflectiveOperationException {\n        String classGlobalVariables = \"com.bjsm.dungeonlab.global.b\";\n\n        // method_BluetoothServiceDecoder_decode\n        Accessors.totalStrengthA = lookupField(classGlobalVariables, \"V\");\n        Accessors.totalStrengthB = lookupField(classGlobalVariables, \"W\");\n        Accessors.remoteStrengthA = lookupField(classGlobalVariables, \"X\");\n        Accessors.remoteStrengthB = lookupField(classGlobalVariables, \"Y\");\n        Accessors.remoteStrengthB = lookupField(classGlobalVariables, \"Y\");\n        Accessors.isRemoteControlling = lookupField(classGlobalVariables, \"aZ\");\n\n        // HomeActivity LDC \"控制方连接成功\"\n        Accessors.localStrengthA = lookupField(classGlobalVariables, \"ab\"); // getRealStrengthA\n        Accessors.localStrengthB = lookupField(classGlobalVariables, \"ac\"); // getRealStrengthB\n        Accessors.maxStrengthA = lookupField(classGlobalVariables, \"Z\"); // getStrengthRangeMax\n        Accessors.maxStrengthB = lookupField(classGlobalVariables, \"aa\"); // getStrengthRangeMax\n    }\n\n    @Override\n    protected void initializeNames() {\n        class_BluetoothServiceDecoder = \"com.bjsm.dungeonlab.service.BlueToothService$18\";\n        method_BluetoothServiceDecoder_decode = \"a\";\n\n        class_BluetoothService = \"com.bjsm.dungeonlab.service.BlueToothService\";\n        method_BluetoothService_updateStrength = \"a\";\n        method_BluetoothService_updateClientSide = \"b\";\n\n        class_StrengthTouchListeners = Arrays.asList(\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$15\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$16\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$17\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$18\"\n        );\n\n        class_RemoteSettingDialog = \"com.bjsm.dungeonlab.widget.RemoteSettingDialog\";\n        field_RemoteSettingDialog_strengthA = \"a_channel_strength_range\";\n        field_RemoteSettingDialog_strengthB = \"b_channel_strength_range\";\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ver/Version131.java",
    "content": "package sakura.kooi.dglabunlocker.ver;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.*;\n\nimport java.util.Arrays;\n\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class Version131 extends AbstractVersionedCompatibilityProvider {\n    @Override\n    protected void initializeAccessors() throws ReflectiveOperationException {\n        String classGlobalVariables = \"com.bjsm.dungeonlab.global.b\";\n\n        Accessors.totalStrengthA = lookupField(classGlobalVariables, \"as\");\n        Accessors.totalStrengthB = lookupField(classGlobalVariables, \"at\");\n        Accessors.remoteStrengthA = lookupField(classGlobalVariables, \"aw\");\n        Accessors.remoteStrengthB = lookupField(classGlobalVariables, \"ax\");\n        Accessors.isRemoteControlling = lookupField(classGlobalVariables, \"by\");\n\n        Accessors.localStrengthA = lookupField(classGlobalVariables, \"ay\"); // getRealStrengthA\n        Accessors.localStrengthB = lookupField(classGlobalVariables, \"az\"); // getRealStrengthB\n        Accessors.maxStrengthA = lookupField(classGlobalVariables, \"aw\"); // getStrengthRangeMax\n        Accessors.maxStrengthB = lookupField(classGlobalVariables, \"ax\"); // getStrengthRangeMax\n    }\n\n    @Override\n    protected void initializeNames() {\n        class_BluetoothServiceDecoder = \"com.bjsm.dungeonlab.service.BlueToothService$18\";\n        method_BluetoothServiceDecoder_decode = \"a\";\n\n        class_BluetoothService = \"com.bjsm.dungeonlab.service.BlueToothService\";\n        method_BluetoothService_updateStrength = \"b\";\n        method_BluetoothService_updateClientSide = \"b\";\n\n        class_StrengthTouchListeners = Arrays.asList(\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$15\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$16\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$17\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$18\"\n        );\n\n        class_RemoteSettingDialog = \"com.bjsm.dungeonlab.widget.RemoteSettingDialog\";\n        field_RemoteSettingDialog_strengthA = \"a_channel_strength_range\";\n        field_RemoteSettingDialog_strengthB = \"b_channel_strength_range\";\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/sakura/kooi/dglabunlocker/ver/Version132.java",
    "content": "package sakura.kooi.dglabunlocker.ver;\n\nimport static sakura.kooi.dglabunlocker.variables.InjectPoints.*;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport sakura.kooi.dglabunlocker.variables.Accessors;\n\npublic class Version132 extends AbstractVersionedCompatibilityProvider {\n\n    @Override\n    protected void initializeAccessors() throws ReflectiveOperationException {\n        String classGlobalVariables = \"com.bjsm.dungeonlab.global.b\";\n\n        // method_BluetoothServiceDecoder_decode\n        Accessors.totalStrengthA = lookupField(classGlobalVariables, \"as\");\n        Accessors.totalStrengthB = lookupField(classGlobalVariables, \"at\");\n        Accessors.remoteStrengthA = lookupField(classGlobalVariables, \"au\");\n        Accessors.remoteStrengthB = lookupField(classGlobalVariables, \"av\");\n\n        Accessors.isRemoteControlling = lookupField(classGlobalVariables, \"by\");\n\n        // HomeActivity LDC \"控制方连接成功\"\n        Accessors.localStrengthA = lookupField(classGlobalVariables, \"ay\"); // getRealStrengthA\n        Accessors.localStrengthB = lookupField(classGlobalVariables, \"az\"); // getRealStrengthB\n        Accessors.maxStrengthA = lookupField(classGlobalVariables, \"aw\"); // getStrengthRangeMax\n        Accessors.maxStrengthB = lookupField(classGlobalVariables, \"ax\"); // getStrengthRangeMax\n\n        // PlayFragment.class -> MainListCustomizAdapter constructor -> DataUtils.b()\n        Accessors.listWaveData = lookupField(classGlobalVariables, \"ak\");\n\n        String classNameWaveBean = \"com.bjsm.dungeonlab.bean.WaveClassicBean\";\n        Accessors.classWaveClassicBean = lookupClass(classNameWaveBean);\n        Accessors.waveIsClassic = lookupField(classNameWaveBean, \"isClassic\");\n        Accessors.waveName = lookupField(classNameWaveBean, \"waveName\");\n\n        Accessors.funcSaveWave = lookupMethod(\"com.bjsm.dungeonlab.d.d\", \"a\", int.class, Accessors.classWaveClassicBean, int.class, String.class, int.class);\n\n        // MainListCustomizAdapter -> constr -> setList(collection) -> a\n        Accessors.funcAdapterSetList = lookupMethod(\"com.chad.library.adapter.base.BaseQuickAdapter\", \"a\", Collection.class);\n\n        // HomeActivity action.equals(\"com.bjsm.dungeonlab.ble.abpower\")\n        Accessors.textHomeActivityStrengthA = lookupField(class_HomeActivity, \"y\");\n        Accessors.textHomeActivityStrengthB = lookupField(class_HomeActivity, \"G\");\n    }\n\n    @Override\n    protected void initializeNames() {\n\n        // RemoteSettingDialog\n        class_RemoteSettingDialog = \"com.bjsm.dungeonlab.widget.RemoteSettingDialog\";\n        field_RemoteSettingDialog_strengthA = \"a_channel_strength_range\";\n        field_RemoteSettingDialog_strengthB = \"b_channel_strength_range\";\n\n        // BluetoothService.? implements BleNotifyCallback\n        class_BluetoothServiceDecoder = \"com.bjsm.dungeonlab.service.BlueToothService$18\";\n\n        // class_BluetoothServiceDecoder LDC \"notify 回调\"\n        method_BluetoothServiceDecoder_decode = \"a\";\n\n        // HomeActivity.? implements View.OnTouchListener && R.string.remote_strength_max\n        class_StrengthTouchListeners = Arrays.asList(\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$15\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$16\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$17\",\n                \"com.bjsm.dungeonlab.ui.activity.HomeActivity$18\"\n        );\n\n        // BlueToothService LDC \"写入强度数据成功\"\n        class_BluetoothService = \"com.bjsm.dungeonlab.service.BlueToothService\";\n        method_BluetoothService_updateStrength = \"b\";\n        // class_StrengthTouchListeners -> R.string.remote_strength_max -> if -> getter -> setter\n        method_BluetoothService_updateClientSide = \"b\";\n\n        class_StrengthLongPressHandler = \"com.bjsm.dungeonlab.ui.activity.HomeActivity$1\";\n\n        // HomeActivity action.equals(\"com.bjsm.dungeonlab.ble.abpower\")\n        class_HomeActivity = \"com.bjsm.dungeonlab.ui.activity.HomeActivity\";\n        method_HomeActivity_updateStrengthText = \"a\";\n        field_HomeActivity_strengthTextA = \"y\";\n        field_HomeActivity_strengthTextB = \"G\";\n\n        class_MainListCustomizAdapter = \"com.bjsm.dungeonlab.adapter.MainListCustomizAdapter\";\n    }\n}\n"
  },
  {
    "path": "app/src/main/res/drawable/button_yellow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <corners android:radius=\"5.0dip\" />\n    <gradient android:startColor=\"#ffffe99d\" android:endColor=\"#ffffe99d\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/check_off.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape\n    xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#ffffe99d\" />\n    <size android:height=\"20.0dip\" android:width=\"20.0dip\" />\n    <stroke android:width=\"1.0dip\" android:color=\"#ff1f1f1f\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/check_on.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item>\n        <shape>\n            <solid android:color=\"#ffffe99d\" />\n            <size android:width=\"20.0dip\" android:height=\"20.0dip\" />\n            <stroke android:width=\"1.0dip\" android:color=\"#ff1f1f1f\" />\n        </shape>\n    </item>\n    <item android:width=\"12dp\" android:height=\"4dp\"\n        android:top=\"8dp\" android:left=\"5.5dp\">\n        <rotate\n            android:fromDegrees=\"-45\">\n            <shape android:shape=\"rectangle\">\n                <solid android:color=\"#ff2e2e2e\" />\n            </shape>\n        </rotate>\n    </item>\n    <item android:width=\"8dp\" android:height=\"4dp\"\n    android:top=\"9.5dp\" android:left=\"3.25dp\">\n    <rotate\n        android:fromDegrees=\"45\">\n        <shape android:shape=\"rectangle\">\n            <solid android:color=\"#ff2e2e2e\" />\n        </shape>\n    </rotate>\n</item>\n\n</layer-list>"
  },
  {
    "path": "app/src/main/res/drawable/ic_launcher_foreground.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"108\"\n    android:viewportHeight=\"108\"\n    android:tint=\"#FFE99D\">\n  <group android:scaleX=\"2.1402\"\n      android:scaleY=\"2.1402\"\n      android:translateX=\"28.3176\"\n      android:translateY=\"28.3176\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M12,12c0,-3 2.5,-5.5 5.5,-5.5S23,9 23,12L12,12zM12,12c0,3 -2.5,5.5 -5.5,5.5S1,15 1,12h11zM12,12c-3,0 -5.5,-2.5 -5.5,-5.5S9,1 12,1v11zM12,12c3,0 5.5,2.5 5.5,5.5S15,23 12,23L12,12z\"/>\n  </group>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/icon_settings.xml",
    "content": "<vector android:height=\"32dp\" android:tint=\"#FFE99D\"\n    android:viewportHeight=\"24\" android:viewportWidth=\"24\"\n    android:width=\"32dp\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <path android:fillColor=\"@android:color/white\" android:pathData=\"M12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM17.25,12c0,0.23 -0.02,0.46 -0.05,0.68l1.48,1.16c0.13,0.11 0.17,0.3 0.08,0.45l-1.4,2.42c-0.09,0.15 -0.27,0.21 -0.43,0.15l-1.74,-0.7c-0.36,0.28 -0.76,0.51 -1.18,0.69l-0.26,1.85c-0.03,0.17 -0.18,0.3 -0.35,0.3h-2.8c-0.17,0 -0.32,-0.13 -0.35,-0.29l-0.26,-1.85c-0.43,-0.18 -0.82,-0.41 -1.18,-0.69l-1.74,0.7c-0.16,0.06 -0.34,0 -0.43,-0.15l-1.4,-2.42c-0.09,-0.15 -0.05,-0.34 0.08,-0.45l1.48,-1.16c-0.03,-0.23 -0.05,-0.46 -0.05,-0.69 0,-0.23 0.02,-0.46 0.05,-0.68l-1.48,-1.16c-0.13,-0.11 -0.17,-0.3 -0.08,-0.45l1.4,-2.42c0.09,-0.15 0.27,-0.21 0.43,-0.15l1.74,0.7c0.36,-0.28 0.76,-0.51 1.18,-0.69l0.26,-1.85c0.03,-0.17 0.18,-0.3 0.35,-0.3h2.8c0.17,0 0.32,0.13 0.35,0.29l0.26,1.85c0.43,0.18 0.82,0.41 1.18,0.69l1.74,-0.7c0.16,-0.06 0.34,0 0.43,0.15l1.4,2.42c0.09,0.15 0.05,0.34 -0.08,0.45l-1.48,1.16c0.03,0.23 0.05,0.46 0.05,0.69z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/settings_bg.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <stroke android:width=\"1.0dip\" android:color=\"#ffe99d\" />\n    <corners android:radius=\"10.0dip\" />\n    <gradient android:startColor=\"#2e2e2e\" android:endColor=\"#2e2e2e\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/switch_close_thumb.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"oval\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#ff2e2e2e\" />\n    <size android:height=\"20.0dip\" android:width=\"20.0dip\" />\n    <stroke android:width=\"1.0dip\" android:color=\"#ff1f1f1f\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/switch_close_track.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#ff1f1f1f\" />\n    <corners android:radius=\"10.0dip\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/switch_open_thumb.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"oval\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#ffffe99d\" />\n    <size android:height=\"20.0dip\" android:width=\"20.0dip\" />\n    <stroke android:width=\"1.0dip\" android:color=\"#55ffe99d\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/switch_open_track.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#55ffe99d\" />\n    <corners android:radius=\"10.0dip\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/mipmap-anydpi",
    "content": ""
  },
  {
    "path": "app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@color/ic_launcher_background\"/>\n    <foreground android:drawable=\"@drawable/ic_launcher_foreground\"/>\n</adaptive-icon>"
  },
  {
    "path": "app/src/main/res/values/arrays.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string-array name=\"module_scope\">\n        <item>com.bjsm.dungeonlabs</item>\n    </string-array>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"purple_200\">#FFBB86FC</color>\n    <color name=\"purple_500\">#FF6200EE</color>\n    <color name=\"purple_700\">#FF3700B3</color>\n    <color name=\"teal_200\">#FF03DAC5</color>\n    <color name=\"teal_700\">#FF018786</color>\n    <color name=\"black\">#FF000000</color>\n    <color name=\"white\">#FFFFFFFF</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/ic_launcher_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"ic_launcher_background\">#2A2A2A</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">DG-Lab Beta 魔改</string>\n</resources>"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\nplugins {\n    id 'com.android.application' version '7.2.0' apply false\n    id 'com.android.library' version '7.2.0' apply false\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-7.4.2-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n# AndroidX package structure to make it clearer which packages are bundled with the\n# Android operating system, and which are packaged with your app\"s APK\n# https://developer.android.com/topic/libraries/support-library/androidx-rn\nandroid.useAndroidX=true\n# Enables namespacing of each library's R class so that its R class includes only the\n# resources declared in the library itself and none from the library's dependencies,\n# thereby reducing the size of the R class for that library\nandroid.nonTransitiveRClass=true"
  },
  {
    "path": "gradlew",
    "content": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n#\n#   Gradle start up script for POSIX generated by Gradle.\n#\n#   Important for running:\n#\n#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is\n#       noncompliant, but you have some other compliant shell such as ksh or\n#       bash, then to run this script, type that shell name before the whole\n#       command line, like:\n#\n#           ksh Gradle\n#\n#       Busybox and similar reduced shells will NOT work, because this script\n#       requires all of these POSIX shell features:\n#         * functions;\n#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,\n#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;\n#         * compound commands having a testable exit status, especially «case»;\n#         * various built-in commands including «command», «set», and «ulimit».\n#\n#   Important for patching:\n#\n#   (2) This script targets any POSIX shell, so it avoids extensions provided\n#       by Bash, Ksh, etc; in particular arrays are avoided.\n#\n#       The \"traditional\" practice of packing multiple parameters into a\n#       space-separated string is a well documented source of bugs and security\n#       problems, so this is (mostly) avoided, by progressively accumulating\n#       options in \"$@\", and eventually passing that to Java.\n#\n#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,\n#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;\n#       see the in-line comments for details.\n#\n#       There are tweaks for specific operating systems such as AIX, CygWin,\n#       Darwin, MinGW, and NonStop.\n#\n#   (3) This script is generated from the Groovy template\n#       https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt\n#       within the Gradle project.\n#\n#       You can find Gradle at https://github.com/gradle/gradle/.\n#\n##############################################################################\n\n# Attempt to set APP_HOME\n\n# Resolve links: $0 may be a link\napp_path=$0\n\n# Need this for daisy-chained symlinks.\nwhile\n    APP_HOME=${app_path%\"${app_path##*/}\"}  # leaves a trailing /; empty if no leading path\n    [ -h \"$app_path\" ]\ndo\n    ls=$( ls -ld \"$app_path\" )\n    link=${ls#*' -> '}\n    case $link in             #(\n      /*)   app_path=$link ;; #(\n      *)    app_path=$APP_HOME$link ;;\n    esac\ndone\n\nAPP_HOME=$( cd \"${APP_HOME:-./}\" && pwd -P ) || exit\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=${0##*/}\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=maximum\n\nwarn () {\n    echo \"$*\"\n} >&2\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n} >&2\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"$( uname )\" in                #(\n  CYGWIN* )         cygwin=true  ;; #(\n  Darwin* )         darwin=true  ;; #(\n  MSYS* | MINGW* )  msys=true    ;; #(\n  NONSTOP* )        nonstop=true ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=$JAVA_HOME/jre/sh/java\n    else\n        JAVACMD=$JAVA_HOME/bin/java\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=java\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif ! \"$cygwin\" && ! \"$darwin\" && ! \"$nonstop\" ; then\n    case $MAX_FD in #(\n      max*)\n        MAX_FD=$( ulimit -H -n ) ||\n            warn \"Could not query maximum file descriptor limit\"\n    esac\n    case $MAX_FD in  #(\n      '' | soft) :;; #(\n      *)\n        ulimit -n \"$MAX_FD\" ||\n            warn \"Could not set maximum file descriptor limit to $MAX_FD\"\n    esac\nfi\n\n# Collect all arguments for the java command, stacking in reverse order:\n#   * args from the command line\n#   * the main class name\n#   * -classpath\n#   * -D...appname settings\n#   * --module-path (only if needed)\n#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif \"$cygwin\" || \"$msys\" ; then\n    APP_HOME=$( cygpath --path --mixed \"$APP_HOME\" )\n    CLASSPATH=$( cygpath --path --mixed \"$CLASSPATH\" )\n\n    JAVACMD=$( cygpath --unix \"$JAVACMD\" )\n\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    for arg do\n        if\n            case $arg in                                #(\n              -*)   false ;;                            # don't mess with options #(\n              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath\n                    [ -e \"$t\" ] ;;                      #(\n              *)    false ;;\n            esac\n        then\n            arg=$( cygpath --path --ignore --mixed \"$arg\" )\n        fi\n        # Roll the args list around exactly as many times as the number of\n        # args, so each arg winds up back in the position where it started, but\n        # possibly modified.\n        #\n        # NB: a `for` loop captures its iteration list before it begins, so\n        # changing the positional parameters here affects neither the number of\n        # iterations, nor the values presented in `arg`.\n        shift                   # remove old arg\n        set -- \"$@\" \"$arg\"      # push replacement arg\n    done\nfi\n\n# Collect all arguments for the java command;\n#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of\n#     shell script including quotes and variable substitutions, so put them in\n#     double quotes to make sure that they get re-expanded; and\n#   * put everything else in single quotes, so that it's not re-expanded.\n\nset -- \\\n        \"-Dorg.gradle.appname=$APP_BASE_NAME\" \\\n        -classpath \"$CLASSPATH\" \\\n        org.gradle.wrapper.GradleWrapperMain \\\n        \"$@\"\n\n# Use \"xargs\" to parse quoted args.\n#\n# With -n1 it outputs one arg per line, with the quotes and backslashes removed.\n#\n# In Bash we could simply go:\n#\n#   readarray ARGS < <( xargs -n1 <<<\"$var\" ) &&\n#   set -- \"${ARGS[@]}\" \"$@\"\n#\n# but POSIX shell has neither arrays nor command substitution, so instead we\n# post-process each arg (as a line of input to sed) to backslash-escape any\n# character that might be a shell metacharacter, then use eval to reverse\n# that process (while maintaining the separation between arguments), and wrap\n# the whole thing up as a single \"set\" statement.\n#\n# This will of course break if any of these variables contains a newline or\n# an unmatched quote.\n#\n\neval \"set -- $(\n        printf '%s\\n' \"$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\" |\n        xargs -n1 |\n        sed ' s~[^-[:alnum:]+,./:=@_]~\\\\&~g; ' |\n        tr '\\n' ' '\n    )\" '\"$@\"'\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\n@rem you may not use this file except in compliance with the License.\n@rem You may obtain a copy of the License at\n@rem\n@rem      https://www.apache.org/licenses/LICENSE-2.0\n@rem\n@rem Unless required by applicable law or agreed to in writing, software\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@rem See the License for the specific language governing permissions and\n@rem limitations under the License.\n@rem\n\n@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto execute\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto execute\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "settings.gradle",
    "content": "pluginManagement {\n    repositories {\n        gradlePluginPortal()\n        google()\n        mavenCentral()\n    }\n}\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        google()\n        mavenCentral()\n        maven { url \"https://api.xposed.info/\" }\n    }\n}\nrootProject.name = \"DgLabUnlocker\"\ninclude ':app'\n"
  }
]