[
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 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 Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\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,\nour General Public Licenses are 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.\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  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\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 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 work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be 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 Affero 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 Affero 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 Affero 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 Affero General Public License as published\n    by 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 Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\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 AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "## USB (including a 3.5mm jack and an internal speaker) sample rate changer for Android devices on the fly\n\nThis is not a Magisk module but a collection of root shell scripts using Magisk su or phh's SuperUser (uninstall \"termux\" and magisk modules replacing \"toybox\" and \"busybox\" commands if you've used them because they break the Adnroid standard and make this script work wrongly), and can be installed by just unpacking its ZIP archive on your Internal Storage (\"/sdcard\") or another. Under Magisk environment (<strong>\"root name space mount mode\" must be changed to \"global\"</strong> in the settings of Magisk Manager), this script changes the sample rate of the USB (including hardware offloading) audio class driver on Android devices on the fly like the developer setting of Bluetooth LDAC or the Windows mixer for <q><em>avoiding annoying SRC (Sample Rate Conversion) distortion ultimately (i.e., not only the distortion of the OS mixer as usual, but also the over-sampling distortion in DAC's; For those who are curious about such distortion, try my mock equipment parameters in the appendix table)</em></q>. This script signals the audioserver on the \"global\" mount name space to try to reload an audio policy configuration file generated by this script with a specified sample rate and bit depth, so the \"root name space mount mode\" change is needed. <br/>\n<br/>\nAdditionally, this script disables DRC (Dynamic Range Control, i.e., a kind of compression) if DRC has been enabled on a stock firmware. For example, smart phones and tablets whose SoC's have an SDM??? or SM???? model number usually enable DRC on all audio outputs, but those whose SoC's have an MT???? model number don't enable DRC on any audio output. (Note: some custom ROM's (not stocks and GSI's) intendedly invert or change the DRC mode on context, then this script cannot disable DRC)<br/>\n<br/>\nFinally, the Android OS mixer (AudioFlinger) recently changed its behavior so as to always bypass its resampling (or virtual analog low-pass filtering involved by sinc function interpolation) if the sampling frequency of its input is equal to that of its output. So the resampling doesn't distort sound, but does remove an effect easing jitter by buffering satisfying its filter length.\n\n* Usage: `sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh [--reset] [--drc] [--bypass-offload][--bypass-offload-safer][--offload][--offload-hifi-playback][--offload-drect][--offload-safer][--legacy][--safe][--safest][--safest-auto][--usb-only] [[44k|48k|88k|96k|176k|192k|353k|384k|706k|768k] [[16|24|32|float]]]`,\n\nif you unpack the archive under \"/sdcard\" (Internal Storage). The arguments are a sample rate and a bit depth (or 32bit float) to which you want to change, respectively. Their default values are `44k` (sample rate: 44.1 kHz) and `32` (bit depth: 32 bits (signed integer)) except both safe and safest mode internal outputs (default values: 48 kHz, 32 or 16 bits).\n\n  - Options\n    - `--reset`(without arguments): resets its previous execution results.\n    - `--drc`: enables DRC (Dynamic Range Control, i.e., compression, typically sticking to all audio outputs on Qcomm devices) for the purpose of comparison to this script's usual DRC-less audio quality (not effective for --usb-only mode). No DRC unless this option. Please unplug your headphones or earphones before executing a command for propagating this effect.\n    - `--bypass-offload`: changes an audio policy configuration file for bypassing USB & Bluetooth hardware offloading (worse in audio quality) and using a non- hardware offloading USB & Bluetooth audio driver (better in audio quality; A small jitter USB driver and an AOSP Bluetooth driver without unnecessary resampling) while a 3.5 mm jack and an internal speaker use a hardware offloading driver with specified samplerate and audio format but non- hardware offloading drives detect them automatically.\n    - `--bypass-offload-safer`: changes an audio policy configuration file for bypassing USB & Bluetooth hardware offloading (worse in audio quality) and using a non- hardware offloading USB & Bluetooth audio driver (better in audio quality) while a 3.5 mm jack and an internal speaker use a hardware offloading driver keeping the same settings (48 kHz & 16bit/24 bits).\n    - `--offload`: changes an audio policy configuration file for USB & Bluetooth hardware offloading (worse in audio quality; a large jitter USB driver and a Bluetooth driver forcing unnecessary resampling, i.e., typically 44.1 kHz -> 48 kHz -> 44.1 kHz double resampling). \n    - `--offload-hifi-playback`: changes an audio policy configuration file for USB hardware offloading including a USB audio \"hifi_playback\" mixer (worse in audio quality; its samplerate and audio format are automatically detected (for 7.0 audio implementations) or fixed at 192 kHz/96 kHz 32 bits mode otherwise) while disabling a2dp hardware offloading (better in audio quality).\n    - `--offload-direct`: changes an audio policy configuration file for USB & Bluetooth hardware offloading (worse in audio quality) with \"direct_pcm\" and \"compressed_offload\" modes for 3.5 mm jack, bluetooth and USB audio output bypassing mixers. Added for comparing usual mixer modes to direct modes on Qcomm devices with&without DRC, especially to bluetooth audio \"direct_pcm\" mode with&without DRC.\n    - `--offload-safer`: changes an audio policy configuration file for USB hardware offloading (worse in audio quality) except Bluetooth while a 3.5 mm jack and an internal speaker keeping the same settings (48 kHz & 32 bits).\n    - `--legacy`: changes an audio policy configuration file for a Bluetooth audio legacy HAL (<em>/system/{lib,lib64}/hw/audio.a2dp.default.so</em>).\n    - `--safe`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps considerably traditional settings for an internal speaker and others.\n    - `--safest`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps most traditional settings for an internal speaker and others.\n    - `--safest-auto`: changes an audio policy configuration file for a Bluetooth audio legacy HAL but keeps most traditional settings for an internal speaker and others with automatic max. samplerate detection for USB devices.\n    - `--usb-only`: changes a USB audio policy configuration file only.\n    - `--force-bluetooth-qti`: forces to use \"bluetooth_qti\" bluetooth module (Qcomm's legacy one) instead of usual ones.\n\n    - For typical example, `sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh` automatically investigates your device and determines the audio policy configuration type (\"offload\" (including USB & Bluetooth), \"bypass-offload-safer\" (\"offload\" except USB & Bluetooth), \"legacy\" (\"offload\" except USB & Bluetooth but using a legacy Bluetooth module \"a2dp\"), \"safe\" (for non-offloading devices using the \"a2dp\") and \"safest\" (for old devices). And this sets the sample rate and the bit depth of your device to be 44.1 kHz and 32 bits except internal ouputs of \"bypass-offload-safer\", \"safe\" and \"safest\" modes. If you want to set another sample rate and bit depth, please specify specific values.\n\n    - I recommend using `sManager` (Script Manager) or the like for easiness (at boot automatic execution, saving many combinations of script options and parameters as aliases, and so on. If your device doesn't allow to install it, try to use `mixplorer` (select and execute in its three dot menu) with \"Usage Samples\" (if you execute them by `su` on \"KernelSU-Next\", select \"nethunter.root\" app profile template for`mixplorer`). Or try `adb install --bypass-low-target-sdk-block sManager-package-name.apk` command on PC to force sManager installation.\n\n    - When using a USB DAC, please disconnect the DAC from the USB socket of an Android device once after your execute this script every time, for ensuring the changed audio configuration to be effective completely on the device.\n\n* Don't forget to install another magisk module of mine [\"Audio jitter silencer\"](https://github.com/Magisk-Modules-Alt-Repo/audio-jitter-silencer) with this tool and uninstall \"Digital Wellbeing\" app (for reducing very large jitters which this tool cannot reduce as itself)!\n\n* This script and following ones in \"extras\" folder have been tested on LineageOS and crDroid ROM's, and phh GSI's (Android 10 ~ 16, Qualcomm & MediaTek SoC, and Arm32 & Arm64 combinations).\n\n* Note 1: \"USB_SampleRate_Changer.sh\" requires unlocking the USB audio class driver's limitation (upto 96 kHz (USB HAL) lock, 384 kHz offload lock for Qcomm devices or 96 kHz offload lock for MTK (actually only bypass to the USB HAL driver) and Tensor devices) if you want to specify greater than 96 kHz or 384 kHz (in case of Qcomm USB hardware offloading, i.e., maybe hardware offload tunneling to the ALSA driver). See my companion magisk module [\"usb-samplerate-unlocker\"](https://github.com/Magisk-Modules-Alt-Repo/usb-samplerate-unlocker) for non- hardware offload drivers and Tensor specific offload drivers (only supprting 44.1, 48, 96 and 192 kHz with 24 and 32 bits (signed integer) depth). Although you specify a high sample rate for this script execution, you cannot connect your device to a USB DAC with the sample rate unless the USB DAC supports the sample rate (the USB driver will limit the connecting sample rate down to its maximum sample rate).\n\n* Note 2: This script and other extras ones can be executed under \"phh's SuperUser\" root environment on recent A/B partition phh-GSI's. If you find some errors under the environment, try `setenforce 0` with root permission for making Selinux mode to be permissive. Some phh-GSI's have wrong selinux permission settings.\n\n* Note 3: Entry class USB DAC's usually adopt an interface chip communicating with the adaptive mode or the synchronous one defined in the USB audio standard. As in these modes an Android host controller sends audio sampling rate clock signals to the DAC, jitter generated at the host side affects the audio quality of the DAC tremendously. Higher class DAC's communicate with the asynchronous mode (also defined in the standard) to a host controller, but they actually use a PLL to reduce jitter from the host not to stutter even in heavy jitter situations. As this result, they behave as the adaptive mode with a feedback loop to dynamically adjust the host side sampling clock signals while referring a DAC side clock in a real sense, so even with asynchronous mode they are more or less affected by host side jitter. You can see the mode of your USB DAC by opening \"/proc/asound/card1/stream0\" on your phone while playing music. Please see a word in parentheses at \"Endpoint:\" lines; \"SYNC\", \"ADAPTIVE\" or \"ASYNC\" means that your DAC uses \"synchronous\", \"adaptive\" or \"asynchronous\" mode to communicate to your phone, respectively. Moreover, almost all audio peripherals, e.g., bluetooth earphones, internal DAC's, network audio devices have a PLL in themselves and are affected by host side jitter for the same reason.\n\n* Tips 1: You can see the sample rate connecting to a USB DAC during music replaying by a command `cat /proc/asound/card1/pcm0p/sub0/hw_params` (for non- USB hardware offload drivers). You can also see mixer (\"AudioFlinger\") info by a command `dumpsys media.audio_flinger`. There are corresponding convenient scripts (\"alsa-hw-params.sh\" and \"dumpsys-filtered.sh\") and others in \"extras\" folder.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/alsa-hw-params.sh`\n    - outputs information of the ALSA audio driver for USB DAC's, 3.5mm Jack and internal speakers.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/dumpsys-filtered.sh [--all][--help]`\n     - outputs the active peripheral's information from `dumpsys media.audio_flinger`. With `--all` option, this script outputs all peripheral's information from the command.\n     \n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/dumpsys-bluetooth-filtered.sh [--all][--help]`\n     - outputs the active bluetooth codec information from `dumpsys bluetooth_manager`. With `--all` option, this script outputs all bluetooth manager information from the command.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/change-bluetooth-hal.sh [--help][--status][aosp | legacy | offload | sysbta]\"`\n     - changes the active bluetooth audio HAL to one you specify. With `--status` option, this script outputs currently enabled bluetooth audio HALs.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/getConfig.sh [--all][--help]`\n    - outputs brief information of the active audio policy configuration. With `--all` option, this script outputs all the information of the configuration.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/change-usb-period.sh [--status] [--reset][period_usec]`\n    - changes the USB audio data transfer period to a specified value in usec (default: 2250usec). With \"--status\" option, this script outputs the current period without changing the period. With \"--reset\" option, this script reverts the period to the original (5000usec). The best value is usuall around 2250 usec (or 3250 usec), but 20375 usec (or 2250 usec) for POCO F3 and 3875 usec for low performance old devices. Since the value directly affects the jitter of a PLL in a USB DAC, this script may improve the audio quality of the DAC frighteningly.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/change_resampling_quality.sh [--help] [--status] [--reset] [--bypass] [--cheat] [stop_band_dB [half_filter_length [cut_off_percent]]]`\n    - changes the resampling quality of the OS mixer (AudioFlinger). \"--help\" and \"--status\" options specify printing above usage and the status of AudioFlinger's resampling configuration without configuration changes, respectively. With \"--reset\" option, this script clears previous settings. \"--bypass\" option specifies to apply this configuration change except toward less than 48 kHz (excluding 48 kHz itself) frequencies. \"--cheat\" option specifies to switch the mode of third argument \"cut_off_percent\" (if specified) from \"cut off\" (i.e., at -3dB point, and also the middle point of a transition band) to \"transition band width cheat\" (i.e., the start point of a stop band). \"stop_band_dB\", \"half_filter_length\" and \"cut off percent\" specify a stop band attenuation in dB, the number of input data needed before the current point (optional) and a cut off (or a transition band width cheat) percent of the Nyquist frequency (optional), respectively. AOSP standard values are 90 dB and 32 (cut off: 100%), but this script's default values are 179 dB and 408 (cheat or stop band: 99%) as mastering quality values, i.e., no resampling distortion in a real sense (even though the 179dB targeted attenuation is not accomplished in the AOSP implementation).\n    - Note: the resampler of the Android OS mixer is a pure Kaiser windowed Sinc interpolator (a 16 bit integer polyphase FIR filter and a 32 bits one) that has 127 fixed phase sets of FIR coefficients generated from specified parameters and a variable phase set of FIR coeffcients linearly interpolated from other phase sets. So 2<sup>&#177;n</sup> (phases) type up-sampling and down-sampling are very precise.\n    - Remark: the Android OS mixer recently changed its behavior so as to always bypass its resampling (or virtual analog low-pass filtering involved by sinc function interpolation) if the sampling frequency of its input is equal to that of its output.\n\n    - Appendix A. Examples of Re-sampling Parameters :\n    \n    \n    | Stop band attenuation (dB) | Half filter length | Cut-off (%) | Stop band (%) | Memo |\n    | ---: | ---: | ---: | ---: | ---- |\n    | AOSP parameters: | - | - | - | - |\n    | 90 | 32 | 100 | | Default Quality|\n    | 80 | 16 | 100 | | LOW Quality |\n    | 84 | 16 | 100 | | MED Quality |\n    | 98 | 32 | 100 | | HIGH Quality |\n    | Recommended parameters: | - | - | - | - |\n    | 159 | 480 | 92 | | Old devices of A11 and earlier |\n    | 165 | 360 | | 104 | Low performance devices of A12 and later |\n    | 179 | 408 | | 99 | General purpose on A12 and later |\n    | 194 | 520 | | 98 | Ultra Hi-Fi for very high performance devices |\n    | 194 | 520 | 83 ~ 86 | | For LDAC bluetooth earphones and DAC's under $30 both having large amp. non-linearity |\n    | 179 | 520 | 91 ~ 94 | | The same as above but for only 44.1 kHz & 16 bits and 44.1 kHz & 24 bits tracks |\n    | 194 | 520 | 42,43 | | The same as above but for only 96 kHz & 24 bits Hires. tracks |\n    | 194 | 520 | 100 | | Bit-perfect when 1:1 resampling (ideal low-pass filtering for 32 bits depth; obsoleted) |\n    | My mock equipment parameters: | - | - | - | - |\n    | 150 | 80 | | 109 | Mock DAC-A filter (Fast roll-off N-fold over-sampling) |\n    | 120 | 80 | 97 | | Mock DAC-B filter (Fast roll-off N-fold over-sampling) |\n    | 100 | 80 | | 104 | Mock DAC-C filter (Fast roll-off N-fold over-sampling) |\n    | 159 | 240 | | 99 | Mock Mastering tool filter |\n    | External examples: | - | - | - | - |\n    | 100 | 29 | (91) | 109 | AK4493 (Sharp roll-off N-fold over-sampling) |\n    | 150 | 42 | (91) | 109 | AK4191EQ (Sharp roll-off N-fold over-sampling) |\n    | 120 | 35 | (97) | 110 | ES9038PRO (Fast roll-off N-fold over-sampling) |\n    | vary 50 ~ 118 | 34 | 96 | (398) | ES9039PRO (Fast roll-off N-fold over-sampling) |\n    | 110 | 40 | (96) | 109 | CS43131 (Fast roll-off N-fold over-sampling) |\n    | 110 | 40 | (96) | 109 | CS43198 (Fast roll-off N-fold over-sampling) |\n    | 98 | 130 | 98.5 | | MacOS Leopard (guess) |\n    | 159 | 240 | | 99 | iZotope, No-Alias (guess) |\n    | 100 | 64 | | 99 | SoX HQ linear phase (guess) |\n    | 170 | 520 | | 99 | SoX VHQ linear phase (guess) |\n    * Since Youtube Music's Opus (format:774; 48 kHz & 16 bits output)  tracks are ordinarily low-pass filtered with 20 kHz cut off, you probably don't need special re-sampling for cheapie devices except LDAC earphones and internal speakers having very large non-linear distortion.\n\n\n    - Appendix B. Characteristics of my mock DAC's :\n    \n    \n    | Name | Background opaqueness (aliasing noise) | Pre-echo and ringing | Mellowness (intermodulation) | Memo |\n    | ---: | ---: | ---: | ---: | ---- |\n    | DAC-A | light | heavy | heavy | imitating AK4491EQ Sharp roll-off |\n    | DAC-B | medium | medium | light | imitating ES9039PRO Fast roll-off |\n    | DAC-C | heavy | light | medium | SoX HQ quality (linear phase) + better |\n    | Mastering tool | slight | slight | light | imitating iZotope (no alias) |\n    | Recommended parameters | almost none | almost none | light | Ultra Hi-Fi |\n    | Recommended parameters | almost none | almost none | very slight | for LDAC bluetooth earphones and DAC's under $30 |\n    | Recommended parameters | very slight | very slight | medium | for low performance devices |\n    | Recommended parameters | slight | almost none | almost none | for old devices |\n\n* Tips 2: \"jitter-reducer.sh\" in \"extras\" folder is an interactive tool derived from [\"Hifi Maximizer\"](https://github.com/yzyhk904/hifi-maximizer-mod) which could reduce jitter distortions in all digital audio outputs relating to SELinux mode, thermal controls, doze (battery saving while idling), CPU&GPU governors, logd servers (to interface to logcat or the like), camera server, I/O scheduling, virtual memory, wifi suspension, battery management and the audio effects framework (to interface to equalizers, virtualizers, visualizers, echo cancelers, automatic gain controls, etc.). In my opinion, jitter distortions reduction is the very key to ultimate hifi audio quality.\n\n  - Usage:  `sh /sdcard/USB_SampleRate_Changer/extras/jitter-reducer.sh [--selinux|++selinux][--thermal|++thermal][--doze|++doze][---governor|++governor][--logd|++logd][--camera|++camera][--io [scheduler [light | m-light | medium | boost]] | ++io][--vm|++vm][--wifi|++wifi][--all|++all][--battery|++battery][--effect|++effect][--status][--help]`\n\n    - each \"--\" prefixed option except \"--status\" and \"--help\" options is an enabler for its corresponding jitter reducer, conversely each \"++\" prefixed option is a disabler for its corresponding jitter reducer. \"--all\" option is an alias of all \"--\" prefixed options except \"--effect\", \"--battery\", \"--status\" and \"--help\" option, and also \"++all\" option is an alias of all \"++\" prefixed options except \"++effect\" and \"++battery\" option.\n    - \"scheduler\" specifies an I/O scheduler for I/O block devices (typically \"deadline\", \"cfq\" or \"noop\", but you may specify \"*\" for automatic best selection) and has optional four modes \"light\" (for warmer tone), \"m-light\" (for slightly warmer tone), \"medium\" (default) and \"boost\" (for clearer tone).\n    - please remember that \"--wifi\" option is persistent even after reboot, but other options are not.\n    - and \"--doze\" option disables doze (light and deep) of your device at all and its battery charge remaining may fall rapidly while idling.\n\n  - For most \"hifi\" example,  `sh /sdcard/USB_SampleRate_Changer/extras/jitter-reducer.sh --all --battery --effect --status` enables all jitter reducers including effects framework one and outputs the jitter related statuses. For Bluetooth earphones, you may need to add `--io \"*\" boost` or `--io \"*\" m-light` option.  For DLNA transmitting, you may need to add `--io \"*\" boost` option. (If you use \"AirMusic\" to transmit audio data, I recommend setting around 4607 msec additional delay to reduce jitter distortion on the AirMusic panel to display target device(s). I think DLNA via\"AirMusic\" from usual streaming app is the best for audio quality among DLNA app's, google cast and various connect features).\n\n* Tips 3: I recommend expert users to manually disable \"Manage apps automatically\" in \"Battery manager\" (or \"Adaptive battery\" of \"Adaptive preferences\") in the battery section (needless to say, don't enable battery savers, performance limiters and the like), turn off \"Adaptive connectivity\" in the Network & internet section (if exists), and change \"Battery optimization\" from \"Optimize\" to \"Don't optimize\" (or change \"Battery usage\" from \"Optimized\" to \"Unrestricted\") for following app's manually through the settings UI of Android OS (to lower less than 10Hz jitter making extremely short reverb or foggy sound like distortion) even though disabling the Android doze itself. music (streaming) player apps, their licensing apps (if exist), \"AirMusic\" (if exists), \"AirMusic  Recording Service\" (system app; if exists), equalizer apps (if exist), \"Bluetooth\" (system app), \"Bluetooth MIDI Service\" (system app), \"MTP Host\" (system app), \"NFC Service\" (system app; if exists), \"Magisk\" (if exists), System WebView apps (system app), Browser apps, \"PhhTrebleApp\" (system app; if exists), \"Android Services Library\" (system app), \"Android Shared Library\" (system app), \"Android System\" (system app), \"System UI\" (system app), \"Input Devices\" (system app), {Gesture, 3 Button, 2  Button} Navigation Bar apps (which you are using only; system app), \"crDroid System\" (system app; if exists), \"LineageOS System\" (system app; if exists), launcher app, \"Google Play Store\" (system app), \"Google Play services\" (system app), \"Styles & wallpaper\" or the like (system app), {Lineage, crDroid, Arrow, etc.} themes app (system app; if exists),  \"AOSP panel\" (system app; if exists), \"OmniJaws\" (system app; if exists), \"OmniStyle\" (system app; if exists), \"Active Edge Service\" (system app; if exists), \"Android Device Security Module\" (system app; if exists), \"Call Management\" (system app; if exists), \"Phone\" (system app; if exists), \"Phone Calls\" (system app; if exists), \"Phone Services\" (system app; if exists), \"Phone and Messaging Storage\" (system app; if exists), \"Storage Manager\" (system app), \"Default\" (system app; if exists), \"Default StatusBar\" (system app; if exists), \"Wfd Service\" (system app; if exists), \"Wallpaper\" or the like (system app), \"Adreno Graphics Drivers\" (system app; if exists), \"com.android.providers.media\" (system app), \"Files by Google\" (system app; if exists), \"Google Play Services for AR\" (system app; if exists), \"Google Services Framework\" (system app), \"Waterfall cutout\" (system app), \"Punch Hole cutout\" (system app), \"Network Manager\" (system app), \"Companion Device Manager\" (system app), \"Intent Filter Verification Service\" (system app), \"Calendar\", camera apps, keyboard app, kernel adiutors (if exist), etc. And uninstall \"Digital Wellbeing\" (system app; if it exists) itself or change \"Battery usage\" from \"Optimized\" to \"Restricted\" (this is very harmful for audio like camera servers). Because [\"Audio jitter silencer\"](https://github.com/Magisk-Modules-Alt-Repo/audio-jitter-silencer) works automatically as above (but not completely), and needs some maintence after its installation.\n\n* Tips 4: See also my magisk module [\"audio-misc-settings\"](https://github.com/Magisk-Modules-Alt-Repo/audio-misc-settings). This can increase the number of media volume steps to 100 steps and so on.\n<br/>\n\n## DISCLAIMER\n\n* I am not responsible for any damage that may occur to your device, so it is your own choice whether to attempt this script or not.\n\n##\n"
  },
  {
    "path": "USB_SampleRate_Changer.sh",
    "content": "#!/system/bin/sh\n#\n# Version: 3.0.10\n#     by zyhk\n\nMYDIR=\"${0%/*}\"\n\n# Check whether this script has been marked \"disable\", or not\nif [ ! -d \"$MYDIR\" ]; then\n    echo \"cannot get the current directory!\" 1>&2 ; \n    exit 1\nelif [ -e \"$MYDIR/disable\" ] ; then\n    echo \"this script is now disabled!\" 1>&2 ; \n    exit 0\nfi\n# End\n\n# Default values\npolicyMode=\"auto\"\nresetMode=\"false\"\ntestMode=\"false\"\ntestTemplate=\"$MYDIR/templates/test_template.xml\"\namzmMode=\"false\"\namzmTemplate=\"$MYDIR/templates/bypass_offload_safer_amzm_template.xml\"\nDRC_enabled=\"false\"\nUSB_module=\"usb\"\nBT_module=\"bluetooth\"\nforceBluetoothQti=\"false\"\n\n# Help message\n\nwhile [ $# -gt 0 ]; do\n     case \"$1\" in\n        \"-o\" | \"--offload\" )\n            policyMode=\"offload\"\n            shift\n            ;;\n        \"-oh\" | \"--offload-hifi-playback\" )\n            policyMode=\"offload-hifi-playback\"\n            shift\n            ;;\n        \"-od\" | \"--offload-direct\" )\n            policyMode=\"offload-direct\"\n            shift\n            ;;\n        \"-os\" | \"--offload-safer\" )\n            policyMode=\"offload-safer\"\n            shift\n            ;;\n        \"-b\" | \"--bypass-offload\" )\n            policyMode=\"bypass\"\n            shift\n            ;;\n        \"-bs\" | \"--bypass-offload-safer\" )\n            policyMode=\"bypass-safer\"\n            shift\n            ;;\n        \"-l\" | \"--legacy\" )\n            policyMode=\"legacy\"\n            shift\n            ;;\n        \"-s\" | \"--safe\" )\n            policyMode=\"safe\"\n            shift\n            ;;\n        \"-ss\" | \"--safest\" )\n            policyMode=\"safest\"\n            shift\n            ;;\n        \"-ssa\" | \"--safest-auto\" )\n            policyMode=\"safest-auto\"\n            shift\n            ;;\n        \"-u\" | \"--usb-only\" )\n            policyMode=\"usb\"\n            shift\n            ;;\n        \"-fu\" | \"--force-usbv2\" )\n            USB_module=\"usbv2\"\n            shift\n            ;;\n        \"-fq\" | \"--force-bluetooth-qti\" )\n            forceBluetoothQti=\"true\"\n            shift\n            ;;\n        \"-a\" | \"--auto\" )\n            policyMode=\"auto\"\n            shift\n            ;;\n        \"-d\" | \"--drc\" )\n            DRC_enabled=\"true\"\n            shift\n            ;;\n        \"-r\" | \"--reset\" )\n            resetMode=\"true\"\n            shift\n            ;;\n        \"--amzm\" )\n            amzmMode=\"true\"\n            shift\n            ;;\n        \"--test\" )\n            testMode=\"true\"\n            shift\n            ;;\n        \"--test-template\" )\n            # This option takes one argument specifying a template file path whether it is absolute or relative to the template folder\n            shift\n            if [ $# -gt 0 ]; then\n                case \"$1\" in\n                    /* )\n                        testTemplate=\"$1\"\n                        ;;\n                    * )\n                        testTemplate=\"$MYDIR/templates/$1\"\n                        ;;\n                esac\n                shift\n            fi\n            ;;\n        \"-h\" | \"--help\" | -* )\n            echo -n \"Usage: ${0##*/} [--reset] [--drc] [--bypass-offload][--bypass-offload-safer][--offload][--offload-hifi-playback][--offload-direct][--offload-safer]\" 1>&2\n            echo    \"[--legacy][--safe][--safest][--safest-auto][--usb-only] [[44k|48k|88k|96k|176k|192k|353k|384k|706k|768k] [[16|24|32|float]]]\" 1>&2\n            echo -n \"\\nNote: ${0##*/} requires to unlock the USB audio class driver's limitation (upto 96kHz lock or 384kHz Qcomm offload lock)\" 1>&2\n            echo     \" if you specify greater than 96kHz or 384kHz (in case of Qcomm offload).\" 1>&2\n            exit 0\n            ;;\n        * )\n            break\n            ;;\n    esac\ndone\n# End of help message\n\n. \"$MYDIR/functions3.shlib\"\n\ngenfile=\"/data/local/tmp/audio_conf_generated.xml\"\n \n# Reset\nif \"$resetMode\"; then\n    if [ -e \"$MYDIR/.config\" ]; then\n        rm -f \"$MYDIR/.config\"\n    fi\n    removeGenFile \"$genfile\"\n    reloadAudioServers \"all\"\n    exit 0\nfi\n# Reset End\n\n# Set parameters\nsRate=\"44100\"\nbDepth=\"32\"\n\ncase $# in\n    0 ) ;;\n    1 )  sRate=\"$1\";;\n    2 )  sRate=\"$1\"; bDepth=\"$2\";;\n    * )  echo \"too many arguments (n=$#)!\" 1>&2 ; exit 1;;\nesac\n# End of setting parameters\n\n# Normalize arguments\ncase \"$sRate\" in\n    \"44k\" | \"44.1k\" )\n        sRate=\"44100\"\n        ;;\n    \"48k\" )\n        sRate=\"48000\"\n        ;;\n    \"88k\" | \"88.2k\" )\n        sRate=\"88200\"\n        ;;\n    \"96k\" )\n        sRate=\"96000\"\n        ;;\n    \"176k\" | \"176.4k\" )\n        sRate=\"176400\"\n        ;;\n    \"192k\" )\n      sRate=\"192000\"\n      ;;\n    \"352k\" | \"353k\" | \"352.8k\" )\n      sRate=\"352800\"\n      ;;\n    \"384k\" )\n      sRate=\"384000\"\n      ;;\n    \"705k\" | \"706k\" | \"705.6k\" )\n      sRate=\"705600\"\n      ;;\n    \"768k\" )\n      sRate=\"768000\"\n      ;;\n     * )\n        if expr \"$sRate\" : \"[1-9][0-9]*$\" 1>\"/dev/null\" 2>&1; then\n            if [ $sRate -lt 44100  -o  $sRate -gt 768000 ]; then\n                echo \"unsupported sample rate (rate=$sRate)!\" 1>&2 \n                exit 1\n            fi\n        else\n            echo \"unsupported sample rate (rate=$sRate)!\" 1>&2 \n            exit 1\n        fi\n        ;;\nesac\n\naFormat=\"AUDIO_FORMAT_PCM_32_BIT\"\ncase \"$bDepth\" in\n    16 )\n        aFormat=\"AUDIO_FORMAT_PCM_16_BIT\"\n        ;;\n    24 )\n        aFormat=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n        ;;\n    32 )\n        aFormat=\"AUDIO_FORMAT_PCM_32_BIT\"\n        ;;\n    \"float\" )\n        aFormat=\"AUDIO_FORMAT_PCM_FLOAT\"\n        ;;\n    * )\n        echo \"unknow bit depth specified (depth=$bDepth)!\" 1>&2\n        exit 1\n        ;;\nesac\n# End of argument normalization\n\n# Overlay a generated audio policy configuration file on \"/vendor/etc/audio_policy_configuration.xml\" (e.g. typical)\nif [ ! -r \"$MYDIR/.config\" ]; then\n    makeConfigFile \"$MYDIR/.config\"\nfi\n\nif [ -r \"$MYDIR/.config\" ]; then\n    . \"$MYDIR/.config\"\nfi\n\nif [ -z \"$PolicyFile\"  -o  \"$PolicyFile\" = \"N/A\" ]; then\n    # Very recent devices, e.g., Pixel 9 series\n    echo \"Recent AIDL only devices are not supported!\" 1>&2 \n    exit 1\nelse\n    overlayTarget=\"$PolicyFile\"\nfi\n\nif [ \"$policyMode\" = \"auto\"  -a  -n \"$BluetoothHal\" ];then\n    policyMode=\"$BluetoothHal\"\nfi\n\ncase \"$policyMode\" in\n    \"legacy\" | \"safe\" | \"safest\" | \"safest-auto\" )\n        BT_module=\"a2dp\"\n        ;;\n    * )\n        if [ \"`getprop ro.board.platform`\" = \"pineapple\"  -a  -r \"/vendor/lib64/hw/audio.bluetooth_qti.default.so\" ]; then\n            # A workaround for Pineapple devices for no using the AOSP bluetooth module temporary\n            BT_module=\"bluetooth_qti\"\n        elif [ \"`getprop ro.product.board`\" = \"taro\" -a  -r \"/vendor/lib64/hw/audio.bluetooth_qti.default.so\" ]; then\n            # An exception for Asus Zenfone 9\n            BT_module=\"bluetooth_qti\"\n        else\n            BT_module=\"bluetooth\"\n        fi\n        ;;\nesac\n\n# Force the bluetooth HAL to be \"bluetooth_qti\"\nif \"$forceBluetoothQti\"; then\n    BT_module=\"bluetooth_qti\"\n    if [ ! -r \"/vendor/lib64/hw/audio.bluetooth_qti.default.so\"  -a  ! -r \"/vendor/lib/hw/audio.bluetooth_qti.default.so\" ]; then\n            echo \"    Warning: ${0##*/} detected no \\\"bluetooth_qti\\\" audio HAL module on this device\" 1>&2\n    fi\nfi\n\nSysbtaCapable=\"`getprop persist.bluetooth.system_audio_hal.enabled`\"\n\nif [ \"$SysbtaCapable\" = \"1\" ]; then\n    BT_module=\"sysbta\"\nfi\n\nif [ -n \"$SysbtaCapable\"  -a  \"`getprop init.svc.system.bt-audio-hal`\" != \"stopped\" ]; then\n    if [ \"$policyMode\" = \"offload\"  -o  \"$policyMode\" = \"offload-direct\" ]; then\n        echo \"    Warning: ${0##*/} detected that \\\"sysbta\\\" (System Wide Bluetooth HAL) service was running\" 1>&2\n        \n        if [ \"$SysbtaCapable\" = \"1\" ]; then\n            echo \"    Info: \\\"sysbta\\\" rewrites bluetooth audio parts from \\\"$policyMode\\\" to its own forcibly on the fly! \\\nIf you like \\\"$policyMode\\\" to be unmodified anyway, please use \\\"extras/change-bluetooth-hal.sh\\\" \\\nto change the active bluetooth audio HAL to \\\"offload\\\"\" 1>&2\n        else\n            echo \"    Info: Please use \\\"extras/change-bluetooth-hal.sh\\\" to change the active bluetooth audio HAL to \\\"offload\\\", \\\nor your bluetooth device cannot output sound!\" 1>&2\n        fi\n        \n    fi\nfi\n\nif [ ! \\( \"$policyMode\" = \"offload\"  -o  \"$policyMode\" = \"offload-hifi-playback\"  -o  \"$policyMode\" = \"offload-direct\" \\\n             -o  \"$policyMode\" = \"offload-safer\" -o  \"$policyMode\" = \"bypass-offload\" \\)  -a  $sRate -gt 96000 ]; then\n    if [ ! -e \"/data/adb/modules/usb-samplerate-unlocker\"  -a  ! -e \"/data/adb/modules/audio-samplerate-changer\" \\\n            -a ! -e \"/data/adb/modules/hifi-maximizer-mod\" ]; then\n        echo \"    Warning: ${0##*/} requires to unlock the USB HAL driver's limitation (upto 96kHz lock) by \\\"usb-samplerate-unlocker\\\" or \\\"audio-samplerate-changer\\\"\" 1>&2\n    fi\nelif [ \"$policyMode\" = \"offload\"  -o  \"$policyMode\" = \"offload-direct\" -o \"$policyMode\" = \"offload-safer\" ]; then\n    case \"`getprop ro.board.platform`\" in\n        mt* | exynos* )\n            if [ $sRate -gt 96000 ]; then\n                echo -n \"    Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation\" 1>&2\n                echo     \" (upto 96kHz lock)\" 1>&2\n            fi\n        ;;\n       gs10? )\n            if [ ! -e \"/data/adb/modules/usb-samplerate-unlocker\"  -a  ! -e \"/data/adb/modules/audio-samplerate-changer\" \\\n                        -a ! -e \"/data/adb/modules/hifi-maximizer-mod\" ]; then\n                if [ $sRate -gt 96000 ]; then\n                    echo -n \"    Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation\" 1>&2\n                    echo     \" (upto 96kHz lock)\" 1>&2\n                fi\n            elif [ $sRate -gt 192000 ]; then\n                echo -n \"    Warning: ${0##*/} canot change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation\" 1>&2\n                echo     \" (upto 192kHz lock)\" 1>&2\n            fi\n        ;;\n       gs* | zuma* )\n            if [ $sRate -gt 192000 ]; then\n                echo -n \"    Warning: ${0##*/} canot change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation\" 1>&2\n                echo     \" (upto 192kHz lock)\" 1>&2\n            fi\n        ;;\n        * )\n            if [ $sRate -gt 384000 ]; then\n                echo -n \"    Warning: ${0##*/} may not change to the specified sample rate ($sRate) because of the hardware offloading driver's limitation\" 1>&2\n                echo     \" (upto 384kHz lock)\" 1>&2\n            fi\n        ;;\n    esac\nfi\n\nif IsSeventhAudio; then\n    case \"$policyMode\" in\n        \"offload\" )\n            template=\"$MYDIR/templates/offload_template.xml\"\n            ;;\n        \"offload-hifi-playback\" )\n            template=\"$MYDIR/templates/offload_hifi_playback_template.xml\"\n            ;;\n        \"offload-direct\" )\n            template=\"$MYDIR/templates/offload_direct_template.xml\"\n            ;;\n        \"offload-safer\" )\n            case \"`getprop ro.board.platform`\" in\n                gs* | zuma* )\n                    USB_module=\"usbv2\"\n            esac\n            template=\"$MYDIR/templates/offload_safer_template.xml\"\n            ;;\n        \"bypass\" )\n            template=\"$MYDIR/templates/bypass_offload_template.xml\"\n            ;;\n        \"bypass-safer\" )\n            case \"`getprop ro.board.platform`\" in\n                gs* | zuma* )\n                    USB_module=\"usbv2\"\n                    #template=\"$MYDIR/templates/offload_safer_template.xml\"\n                    template=\"$MYDIR/templates/bypass_offload_safer_template.xml\"\n                    ;;\n                * )\n                    template=\"$MYDIR/templates/bypass_offload_safer_template.xml\"\n                    ;;\n            esac\n            ;;\n        \"legacy\" )\n            template=\"$MYDIR/templates/Old/legacy_template.xml\"\n            ;;\n        \"safe\" )\n            template=\"$MYDIR/templates/bypass_offload_safer_template.xml\"\n            ;;\n        \"safest-auto\" )\n            template=\"$MYDIR/templates/bypass_offload_template.xml\"\n            sRate=\"48000\"\n            aFormat=\"AUDIO_FORMAT_PCM_16_BIT\"\n            ;;\n        \"usb\" )\n            template=\"$MYDIR/templates/Old/usb_only_template.xml\"\n            if [ -r \"/vendor/etc/usb_audio_policy_configuration.xml\" ]; then\n                overlayTarget=\"/vendor/etc/usb_audio_policy_configuration.xml\"\n            elif [ -r \"/vendor/etc/usbv2_audio_policy_configuration.xml\"  -a  -r \"/vendor/lib64/hw/audio.usbv2.default.so\" ]; then\n                overlayTarget=\"/vendor/etc/usbv2_audio_policy_configuration.xml\"\n                USB_module=\"usbv2\"\n            else\n                echo \"target USB configuration file (\\\"/vendor/etc/usb_audio_policy_configuration.xml\\\") not found!\" 1>&2 \n                exit 1\n            fi\n            ;;\n        \"safest\" | * )\n            template=\"$MYDIR/templates/Old/safest_template.xml\"\n            ;;\n    esac\nelse\n    case \"$policyMode\" in\n        \"offload\" )\n            template=\"$MYDIR/templates/Old/offload_template.xml\"\n            ;;\n        \"offload-hifi-playback\" )\n            case \"`getprop ro.board.platform`\" in\n                mt* )\n                    echo \"    Warning: ${0##*/} changed to \\\"--bypass-offload-safer\\\" mode because of the hardware offloading driver's restrictions\" 1>&2\n                    template=\"$MYDIR/templates/Old/bypass_offload_safer_mtk_template.xml\"\n                    ;;\n                * )\n                    template=\"$MYDIR/templates/Old/offload_hifi_playback_template.xml\"\n                    ;;\n            esac\n            ;;\n        \"offload-direct\" )\n            template=\"$MYDIR/templates/Old/offload_direct_template.xml\"\n            ;;\n        \"bypass\" )\n            template=\"$MYDIR/templates/Old/bypass_offload_template.xml\"\n            ;;\n        \"bypass-safer\" )\n            case \"`getprop ro.board.platform`\" in\n                mt* )\n                    template=\"$MYDIR/templates/Old/bypass_offload_safer_mtk_template.xml\"\n                    ;;\n                * )\n                    template=\"$MYDIR/templates/Old/bypass_offload_safer_template.xml\"\n                    ;;\n            esac\n            ;;\n        \"legacy\" )\n            template=\"$MYDIR/templates/Old/legacy_template.xml\"\n            ;;\n        \"usb\" )\n            template=\"$MYDIR/templates/Old/usb_only_template.xml\"\n            if [ -r \"/vendor/etc/usb_audio_policy_configuration.xml\" ]; then\n                overlayTarget=\"/vendor/etc/usb_audio_policy_configuration.xml\"\n            elif [ -r \"/vendor/etc/usbv2_audio_policy_configuration.xml\"  -a  -r \"/vendor/lib64/hw/audio.usbv2.default.so\" ]; then\n                overlayTarget=\"/vendor/etc/usbv2_audio_policy_configuration.xml\"\n                USB_module=\"usbv2\"\n            else\n                echo \"target USB configuration file (\\\"/vendor/etc/usb_audio_policy_configuration.xml\\\") not found!\" 1>&2 \n                exit 1\n            fi\n            ;;\n        \"safe\" )\n            template=\"$MYDIR/templates/Old/safe_template.xml\"\n            ;;\n        \"safest\" )\n            template=\"$MYDIR/templates/Old/safest_template.xml\"\n            ;;\n        \"safest-auto\" )\n            template=\"$MYDIR/templates/Old/safest_auto_template.xml\"\n            ;;\n         * )\n            template=\"$MYDIR/templates/Old/safe_template.xml\"\n            ;;\n    esac\nfi\n\n# Am@zon Music template mode\nif \"$amzmMode\"; then\n    template=\"$amzmTemplate\"\nfi\n# Am@zon Music template mode End\n\n# Test template mode\nif \"$testMode\"; then\n    template=\"$testTemplate\"\nfi\n# Test template mode End\n\nif [ -r \"$template\" ]; then\n\n    removeGenFile \"$genfile\"\n    if [ \"$USB_module\" = \"usb\"  -a  ! -r \"/vendor/lib64/hw/audio.usb.default.so\"  -a  -r \"/vendor/lib64/hw/audio.usbv2.default.so\" ]; then\n        USB_module=\"usbv2\"\n    fi\n    sed   -e \"s|%DRC_ENABLED%|$DRC_enabled|\" -e \"s|%USB_MODULE%|$USB_module|\" -e \"s|%BT_MODULE%|$BT_module|\" \\\n            -e \"s|%SAMPLING_RATE%|$sRate|\" -e \"s|%AUDIO_FORMAT%|$aFormat|\" \\\n            -e \"s|%VOLUME_FILE%|$VolumeFile|\" -e \"s|%DEFAULT_VOLUME_FILE%|$DefaultVolumeFile|\" \"$template\" >\"$genfile\"\n\n    if [ $? -eq 0 ]; then\n    \n        chmod 644 \"$genfile\"\n        chcon u:object_r:vendor_configs_file:s0 \"$genfile\"\n\n        targetDir=${overlayTarget%/*}\n        if [ -r \"$overlayTarget\"  -o  \"${targetDir##*_}\" = \"qssi\" ]; then\n            # \"${targetDir##*_}\" = \"qssi\" is for some OnePlus ROM's (probably a bug?)\n            \n            isMounted \"/proc/self/mountinfo\" \"$overlayTarget\" \"ExcludeMagisk\" \"NoShowKey\"\n            if [ $? -eq 0 ]; then\n                umount \"$overlayTarget\" 1>\"/dev/null\" 2>&1\n             fi\n             \n            mount -o bind \"$genfile\" \"$overlayTarget\"\n            if [ $? -gt 0 ]; then\n                echo \"failed to overlay a generated audio policy configuration XML file!\" 1>&2 \n                exit 1\n            fi\n            \n        else\n        \n            echo \"overlaying target (\\\"$overlayTarget\\\") doesn't exist!\" 1>&2 \n            exit 1\n            \n        fi\n        \n    else\n    \n        echo \"audio policy XML file genaration failed!\" 1>&2 \n        exit 1\n        \n    fi\n    \nelse\n\n    echo \"an audio configuration template file (\\\"$template\\\") not found!\" 1>&2 \n    exit 1\n    \nfi\n# End of overlay system files\n\n\n# Reload audio policy configuration files.  \nreloadAudioServers\n\n# End of reload\n"
  },
  {
    "path": "Usage_Samples/Bluetooth/change-bluetooth-hal_Status.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh --status\"\n"
  },
  {
    "path": "Usage_Samples/Bluetooth/change-bluetooth-hal_aosp.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh aosp\"\n"
  },
  {
    "path": "Usage_Samples/Bluetooth/change-bluetooth-hal_legacy.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh legacy\"\n"
  },
  {
    "path": "Usage_Samples/Bluetooth/change-bluetooth-hal_offload.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh offload\"\n"
  },
  {
    "path": "Usage_Samples/Bluetooth/change-bluetooth-hal_sysbta.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-bluetooth-hal.sh sysbta\"\n"
  },
  {
    "path": "Usage_Samples/Dump/alsa-hw-params_all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh --all\"\n"
  },
  {
    "path": "Usage_Samples/Dump/alsa-hw-params_none.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/alsa-hw-params.sh\"\n"
  },
  {
    "path": "Usage_Samples/Dump/dumpsys-bluetooth-filtered_all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh --all\"\n"
  },
  {
    "path": "Usage_Samples/Dump/dumpsys-bluetooth-filtered_none.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-bluetooth-filtered.sh\"\n"
  },
  {
    "path": "Usage_Samples/Dump/dumpsys-filtered_all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh --all\"\n"
  },
  {
    "path": "Usage_Samples/Dump/dumpsys-filtered_none.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/dumpsys-filtered.sh\"\n"
  },
  {
    "path": "Usage_Samples/Dump/getConfig_all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/getConfig.sh --all\"\n"
  },
  {
    "path": "Usage_Samples/Dump/getConfig_none.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/getConfig.sh\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++battery.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++battery --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++camera.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++camera --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++effect.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++effect --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++io.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++io --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_++wifi.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++wifi --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--all.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--battery.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --battery --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--boost-max.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --all --io '*' boost --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--camera.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --camera --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--effect.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --effect --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--io-boost.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --io '*' boost --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--most.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh ++all --wifi --logd --vm --camera --io '*' boost --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_--wifi.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --wifi --status\"\n"
  },
  {
    "path": "Usage_Samples/Jitter/jitter-reducer_Status.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/jitter-reducer.sh --status\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_159dB_480_92.sh",
    "content": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a very mastering quality (for old devices)\n#\n#   Characteristics: slight in background aliasing noise, almost none in pre-echo and ringing, and almost none in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 159dB_480_92 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 159 480 92\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_165dB_360_104.sh",
    "content": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a mastering quality (for low performance devices)\n#\n#   Characteristics: very slight in background aliasing noise, very slight in pre-echo and ringing, and medium in intermodulation\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 165 360 104\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_179dB_408_99.sh",
    "content": "#!/system/bin/sh\n#\n# General purpos re-sampling filter at a very mastering quality (for devices except low performance ones)\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and light in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 179 408 99\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_194dB_520_100.sh",
    "content": "#!/system/bin/sh\n#\n# The ideal re-sampling (bit-perfect) only when 1:1 ratio frequency re-sampling and 32 bit depth\n#\n#   Characteristics (except 1:1 re-sampling) : almost none in background aliasing noise, light in pre-echo and ringing, and light in intermodulation\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 100\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_Reset.sh",
    "content": "#!/system/bin/sh\n#\n# Reset and revert to the original system configuration for audio re-sampling\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --reset\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_Status.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --status\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality__Ultra-HiFi.sh",
    "content": "#!/system/bin/sh\n#\n# Ultra Hi-Fi mastering quality re-sampling filter (for very high performance devices)\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and light in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and this ultra-hifi after setting from 48kHz to 768kHz (16x) or 384kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 194 520 98\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz.sh",
    "content": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion\n#\n#  If you feel your LDAC earphones or \"cheapie\" DAC wouldn't become to sound good at all, \n#  try replacing \"92\" (below) with \"91\", \"93\" or \"94\" for appropriately cutting off ultrasonic noise causing intermodulation.\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation\n#\n# Try to use this for investigating differences of 179dB_408_99 and \"cheapies_44kHz\" after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 92\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_44kHz_cheapest.sh",
    "content": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion\n#\n#  If you feel your LDAC earphones or \"cheapie\" DAC wouldn't become to sound good at all, \n#  try replacing \"92\" (below) with \"91\", \"93\" or \"94\" for appropriately cutting off ultrasonic noise causing intermodulation.\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation\n#\n# Try to use this for investigating differences of 179dB_408_99 and \"cheapies_44kHz_cheapest\" after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 91\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz-cheapest.sh",
    "content": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 16 and 24 bits tracks (possibly 44.1 kHz ones)\n#\n#  If you feel your LDAC earphones or internal speakers wouldn't become to sound good at all, \n#  try replacing \"83\" (below) with \"84\", \"85\"  or \"86\" for appropriately cutting off ultrasonic noise causing intermodulation.\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation\n#\n# Try to use this for investigating differences of 179dB_408_99 and \"cheapies_48kHz-cheapest\" after setting from 48kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 83\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_48kHz.sh",
    "content": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 48 kHz & 16 and 24 bits tracks (possibly 44.1 kHz ones)\n#\n#  If you feel your LDAC earphones or internal speakers wouldn't become to sound good at all, \n#  try replacing \"84\" (below) with \"83\", \"85\"  or \"86\" for appropriately cutting off ultrasonic noise causing intermodulation.\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation\n#\n# Try to use this for investigating differences of 179dB_408_99 and \"cheapies_48kHz\" after setting from 48kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 194 520 84\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_cheapies_96kHz.sh",
    "content": "#!/system/bin/sh\n#\n# For LDAC earphones and DAC's under $30 having large non-linear distortion when replaying 96 kHz & 24 bits Hires. tracks\n#\n#  If you feel your LDAC earphones or \"cheapie\" DAC wouldn't become to sound good at all, \n#  try replacing \"42\" (below) with \"43\" for appropriately cutting off ultrasonic noise causing intermodulation.\n#\n#   Characteristics: almost none in background aliasing noise, almost none in pre-echo and ringing, and very slight in intermodulation\n#\n# Try to use this for investigating differences of 179dB_408_99 and \"cheapies_96kHz\" after setting from 96kHz to 768kHz (8x) or 384kHz (4x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass-hires 194 520 42\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-A.sh",
    "content": "#!/system/bin/sh\n#\n# My mock AK4191EQ-ish in-DAC N-fold Over-sampling filer (sharp roll-off type) when larger than or equal to 48kHz frequency up-sampling\n#\n#   Characteristics: light in background aliasing noise, heavy in pre-echo and ringing, and heavy in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 150 80 109\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-B.sh",
    "content": "#!/system/bin/sh\n#\n# My mock ES9039PRO-ish in-DAC N-fold Over-sampling filer (fast roll-off type)\n#\n#   Characteristics: medium in background aliasing noise, medium in pre-echo and ringing, and light in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh 120 80 97\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_mock-DAC-C.sh",
    "content": "#!/system/bin/sh\n#\n# My mock cheap in-DAC N-fold Over-sampling filer (fast roll-off type) of which quality level is set to be a bit better than that of SoX HQ linear phase\n# when larger than or equal to 48kHz frequency up-sampling\n#\n#   Characteristics: heavy in background aliasing noise, light in pre-echo and ringing, and medium in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --bypass --cheat 100 80 104\"\n"
  },
  {
    "path": "Usage_Samples/Resampling/change-resampling-quality_mock-Mastering.sh",
    "content": "#!/system/bin/sh\n#\n# My mock iZotope-ish mastering tool filer (no alias type)\n#\n#   Characteristics: light in background aliasing noise, slight in pre-echo and ringing, and light in intermodulation\n#\n# Try to use this for investigating differences of N-fold over-sampling among mock series and 179dB_408_99 after setting from 44.1kHz to 706kHz (16x) or 354kHz (8x) in 32bit depth up-sampling\n#\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-resampling-quality.sh --cheat 159 240 99\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_44k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 44k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_16.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 16\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_24.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_24_offload-direct.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 48k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_24_offload-direct_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-direct 48k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_24_offload-hifi-playback.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-hifi-playback 48k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_24_offload-hifi-playback_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-hifi-playback 48k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 48k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_32_bypass-offload.sh",
    "content": "#!/system/bin/sh\n\n# Internal speakers: 48kHz & 32bit; USB HAL & Bluetooth HAL: automatically detecting the best samplerate and audio format\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --bypass-offload 48k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_32_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 48k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_48k_32_offload-hifi-playback.sh",
    "content": "#!/system/bin/sh\n\n# Internal speakers: 48kHz & 32bit; offload USB driver & Bluetooth HAL: automatically detecting the best samplerate and audio format\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-hifi-playback 48k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_88k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 88k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_24.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 24\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_bluetooth-qti.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --force-bluetooth-qti 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_legacy.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --legacy 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_offload-direct.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_offload-direct_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc --offload-direct 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB_96k_32_offload-safer.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 96k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__176k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 176k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__192k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 192k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__192k_32_offload-safer.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 192k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__353k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 353k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__353k_32_offload-direct.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 353k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__384k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 384k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__384k_32_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 384k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__384k_32_offload-direct.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-direct 384k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__384k_32_offload-safer.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --offload-safer 384k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__706k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 706k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__768k_32.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh 768k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__768k_32_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc 768k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__Reset.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --reset\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__auto_max.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\n\ncase \"`getprop ro.board.platform`\" in\n    gs* | zuma* )\n        # for Tensor devices (Internal speaker: 48kHz 32bit; offload USB driver: automatic max. detection (<=192kHz)  for even non-HiRes. tracks)\n        # because they wouldn't run the USB HAL driver\n        Args=\"--offload-hifi-playback 48k 32\"\n        ;;\n    * )\n        if [ ! -e \"/vendor/lib64/hw/audio.bluetooth.default.so\" ]; then\n            # for old devices (under Android 10; various configurations)\n            Args=\"--safest-auto\"\n        elif [ \"`getprop persist.bluetooth.bluetooth_audio_hal.disabled`\" = \"true\" ]; then\n            # for legacy configuration devices (using \"a2dp\" legacy Bluetooth module)\n            Args=\"--safest-auto\"\n        elif [ \"`getprop ro.hardware.lights`\" = \"qcom\"  -o  \"`getprop ro.hardware`\" = \"qcom\" ]; then\n            # for Qcom devices (Internal speaker: 384kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)\n            Args=\"--bypass-offload 384k 32\"\n        else\n            # for MTK and other devices (Internal speaker: 48kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)\n            Args=\"--bypass-offload 48k 32\"\n        fi\n        ;;\nesac\n\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh $Args\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__auto_max_drc.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\n\ncase \"`getprop ro.board.platform`\" in\n    gs* | zuma* )\n        # for Tensor devices (Internal speaker: 48kHz 32bit; offload USB driver: automatic max. detection (<=192kHz)  for even non-HiRes. tracks)\n        # because they wouldn't run the USB HAL driver\n        Args=\"--offload-hifi-playback 48k 32\"\n        ;;\n    * )\n        if [ ! -e \"/vendor/lib64/hw/audio.bluetooth.default.so\" ]; then\n            # for old devices (under Android 10; various configurations)\n            Args=\"--safest-auto\"\n        elif [ \"`getprop persist.bluetooth.bluetooth_audio_hal.disabled`\" = \"true\" ]; then\n            # for legacy configuration devices (using \"a2dp\" legacy Bluetooth module)\n            Args=\"--safest-auto\"\n        elif [ \"`getprop ro.hardware.lights`\" = \"qcom\"  -o  \"`getprop ro.hardware`\" = \"qcom\" ]; then\n            # for Qcom devices (Internal speaker: 384kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)\n            Args=\"--bypass-offload 384k 32\"\n        else\n            # for MTK and other devices (Internal speaker: 48kHz 32bit; the USB HAL & the BT HAL driver: automatic max. detection for even non-HiRes. tracks)\n            Args=\"--bypass-offload 48k 32\"\n        fi\n        ;;\nesac\n\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --drc $Args\"\n"
  },
  {
    "path": "Usage_Samples/USB/USB__test_template.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu --mount-master -c \"/system/bin/sh ${MODDIR}/USB_SampleRate_Changer.sh --test 48k 32\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_2000.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2000\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_20375.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 20375\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_2250.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2250\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_2500.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2500\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_2750.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 2750\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_4000.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh 4000\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_Reset.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --reset\"\n"
  },
  {
    "path": "Usage_Samples/USB Period/change-usb-period_Status.sh",
    "content": "#!/system/bin/sh\n\nMODDIR=${0%/*/*/*}\nsu -c \"/system/bin/sh ${MODDIR}/extras/change-usb-period.sh --status\"\n"
  },
  {
    "path": "changelog.md",
    "content": "## Change logs\n\n# v3.0.10\n* Added \"--offload-safer\" mode (primary sample rate is fixed at 48 kHz & 32bit, but USB one varies by specified values)\n* Tuned I/O scheduling parameters for POCO F6, POCO F3, Motorola G54's and Pixel 6's \n\n# v3.0.9\n* Changed the bypass-offload-safer mode template for Tensor devices. Maybe a bug fixed sp that \"usbv2\" USB HAL driver can work now\n* Tuned I/O scheduling parameters for Tensor devices to optimize for \"usbv2\" HAL driver\n* Fixed a bug warning necessity to unlock USB sample rates even when Hifi maximizer was installed\n\n#v3.0.8\n* Tuned I/O scheduling parameters for MTK Dimensity\n\n# v3.07\n* Adjusted for dumpsys audioFlinger on A16 Pixles\n* Tuned I/O scheduling parameters for POCO F6\n* Stop AOCXD daemon on Tensor devices\n\n# v3.0.6\n* Tuned I/O scheduler tunables for Snapdragon, Dimensity and Tensor devices to reduce jitter\n* Added additional usage samples\n\n# v3.0.5\n* Tuned for POCO F3 and other \"kona\" board devices by adjusteding their core control parameters\n* Fixed disabling thermal core control for phones with big:1, mid:4 and little:3 CPU cores, e.g., POCO F6\n* Improved and fixed GPU boosting for recent Qcomm and Mtk SoC's\n\n# v3.0.4\n* Fixed Wired Headset Mic to be enabled\n* Tuned for POCO F6 (optimized for the ISIS kernel)\n* Tuned for POCO F6 (optimized for the stock kernel, but not for the ISIS kernel)\n* Fixed for InfiR kernel about VM tunables\n\n# v3.0.3\n* Added a script which enables \"DRC\" with max samplerate detection\n\n# v3.0.2\n* Added an exception for Asus Zenfone 9 to change its Bluetooth HAL form \"bluetooth\"  to \"bluetooth_qti\"\n* Added a cheapies-48kHz-cheapest resampler\n\n# v3.0.1\n* Added \"--safest-auto\" mode for automatic max. USB samplerate detection for old devices\n* Fixed to adjust volume curve table links in an audio policy configuration template dynamically for avoiding miss-linking\n\n# v3.0.0\n* Added 7.0 audio policy configuration supports\n* Added automatic max. sample rate detection (for USB devices) supports\n\n# v2.8.7\n* Added a workaround for Pineapple devices for no using the AOSP bluetooth module temporary\n* Added a support for Tensor G4 (zuma pro)\n* Tuned I/O scheduler tunables especially for \"resampling-for-cheapies\"\n\n# v2.8.6\n* Changed the default Bluetooth sample rate of \"safer\" templates from 44.1 kHz to 48 kHz for Am@zon music SD (Opus 48 kHz & 192 kbps vbr stereo) tracks\n* Adjusted jitter optimizations and others for YTM's format change from AAC (141; 44.1 kHz & 256 kbps cbr stereo) to Opus (774; 48 kHz & 256 kbps vbr stereo)\n\n# v2.8.5\n* Changed dirty_ratio and dirty_background_ration to be 100 to reduce jitter\n* Changed adjustSoC_mq for A14 and later clover not to round I/O parameters\n* Adjusted cfq I/O parameters for SDM69x devices\n* Added a new resampler script specially tuned for LDAC BT and DAC's under $30 devices both having large non-linear amp. distortion in \"Usage Samples/Resampling\"\n\n# v2.8.4\n* Changed read ahead buffer sizes from 16960 kB to 17000 kB to reduce I/O jitter\n* Adjusted NrRequests of I/O scheduling\n* Adjusted \"extras/jitter-reducer.sh\" for Galaxy S4 (A12)\n* Added mock equipment filters (in-DAC over-sampling filters and a mastering tool resampler) in \"Usage Samples/Resampling\"\n\n# v2.8.3\n* Fixed io-scheduler reverting (++io option) for Galaxy S4 (A12)\n* Fixed thermal-jitter-reducer in \"extras/jitter-reducer.sh\" (killing vendor.thermal-engine)\n* Fixed Pixel7's default USB sample rate limiter (96kHz -> 192kHz) for adapting to a recent change\n* Added a workaround for recent Pixel Firmwares (not to reboot when superuser resetprop'ing over props modified through system.prop of a magisk module)\n* Reorganized \"Usage Samples\"\n\n# v2.8.2\n* Fixed for Pixel 8's\n* Fixed Usage samples for executing on KernelSU (\"exec su\" to \"su\" for correct expansion of shell variables)\n\n# v2.8.1\n* Tuned \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter on Tensor devices\n* Fixed a bug for \"--force-bluetooth-qti\" option\n* Tuned \"extras/jitter-reducer.sh\" for reducing CFQ I/O scheduling jitter on Qcomm devices\n\n# v2.8.0\n* Tuned \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter on most devices\n* Added \"Usage_Samples\" to easily execute every script with its typical parameters on file explorers with some sh script execution capability like \"mixplorer\"\n\n# v2.7.3\n* Fixed \"extras/jitter-reducer.sh\" to change \"performance\" governor of GPU without fail\n* Tuned \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter on Tensor devices\n\n# v2.7.2\n* Tuned \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter, especially for Tensor devices\n* Fixed a bug for Magisk 26.x\n\n# v2.7.1\n* Optimized \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter\n* \"extras/jitter-reducer.sh\" now confirms and sets the cpu scaling max freq to its available max (sometimes the scaling max freq has been lowered before by a controller on some devices)\n* Removed \"raw\" mixers from template files\n* Fixed and adjusted \"extras/jitter-reducer.sh\" for Tensor devices (e.g., GPU max freq and the mq-deadline scheduler)\n* Added supports to Tensor devices; Tensor specific --offload-hifi-playback mode (USB 96kHz or 192kHz fixed for non- hires. music while 48kHz did on stock ROMs) and --bypass-offload-safer mode (only 44kHz, 48kHz, 96kHz and 192kHz are available by using Tensor device's offload driver)\n* Note: Audio outputs of stock Tensor devices work by 48kHz & float mode for non-hires. music, 96kHz & 32bit for hires. one, and exceptionally 44.1kHz & 16bit for AAC music files (compressed offload feature) without third party proprietary USB drivers. Till now, the usbv2 HAL driver cannot work at all after AOC (new USB Direct Access feature) was introduced. Tensor's hardware offload driver wouldn't change its sample rate except 44.1kHz, 48kHz, 96kHz and 192kHz (float and 32bit int format).\n\n# v2.7.0\n* Optimized \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter\n* Added a support for \"sysbta\" (System Wide Bluetooth Hal) of recent GSI's and \"bluetooth_qti\" (experimental)\n\n# v2.6.5\n* Optimized \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter\n* Added extras/dumpsys-bluetooth-filtered.sh command for displaying the active codec information\n\n# v2.6.4\n* Optimized \"extras/jitter-reducer.sh\" for reducing I/O scheduling jitter\n* Fixed bugs related to bluetooth SCO Headset (Hands-free) when \"--bypass-offload-safer\" modes\n* Improved \"extras/dumpsys-filtered.sh\" for bluetooth SCO\n\n# v2.6.3\n* Adjusted bluetooth device formats for letting Am*zon music app to output 44kHz & 32bit float format\n\nNote: The Am*zon app determines its output format (of its internal resampler) for bluetooth by looking at the bluetooth device format (picking up the max sample rate if multiple rates specified) in the audio policy configuration XML file on each phone, e.g. outputting 48kHz & 16bit for 48kHz & 16bit phones, 96kHz & 16bit for 96kHz & 16bit phones, 44.1kHz & 32bit float for 44.1kHz & 24bit or 32bit (used by my script). Please choose 44.1kHz & 32bit (or the possible largest bits) in developer settings.\n\nIf you like to specify the Am*zon's output format on recent phones, specify \"--offload-hifi-playback\" and \"96k 32\", \"48k 24\", etc. This option changes the initial format of bluetooth devices only, so you can change the current format through developer settings afterward.\n\n# v2.6.2\n* Added \"--offload-direct\" mode for comparing usual (non-a2dp hardware offload) mixer modes to \"direct_pcm\" and \"compressed_offload\" modes with&without DRC, especially for bluetooth audio\n\nNote: \"direct_pcm\" and \"compressed_offload\" modes cannot avoid default DRC on Qcomm devices. As some recent custom ROM's sometimes reverse on/off of the DRC switch, please confirm the difference by your ears.\n\n# v2.6.1\n* Added a bypass offload safer mode for recent MTK devices\n* Changed the default behavior to prefer bypass offload safer modes to bypass offload modes for limiting effect only on USB audio\n\n# v2.6.0\n* Added support for the usbv2 HAL module\n* Tuned for LDAC TWS's (use extras/jitter-reducer.sh --io * medium).\n\nNote: For crDroid Alioth users, try \"--bypass-offload-safer 96k 32\" or \"--offload-hifi-playback 48k 24\" option.\n\n# v2.5.5\n* Tuned \"extras/jitter-reducer.sh\" with respect to tunables for \"mq-deadline\", \"kyber\" and \"none\" I/O scheduler (latest kernel common schedulers?)\n* Added forgotten wired phone entries in \"bypass-offload-safer\" mode\n* Fixed for the Nyx kernel 4.19 (expiration tunables of its mq-deadline scheduler were changed in 10msec resolution from 3msec)\n* Disabled the work queue power efficient mode for reducing jitter if possible (especially for the Nyx kernel and other latest ones)\n\n# v2.5.4\n* Fixed a telephone audio configuration issue on Qcomm SoC Android 12 caused by a hal version mismatch\n* Added \"--bypass-offload-safer\" option for keeping the sample rate and the bit depth of internal speakers and a 3.5mm jack to be 48kHz 16/24bit\n\n# v2.5.3\n* Tuned \"extras/jitter-reducer.sh\" for Bluetooth devices, USB DAC's and DLNA receivers\n    \"extras/jitter-reducer.sh --all --io deadline medium\" for Bluetooth devices\n    \"extras/jitter-reducer.sh --all --io deadline boost\" for USB DAC's and DLNA receivers\n\n# v2.5.2\n* Added a workaround for Android 12 SELinux bug w.r.t. \"ro.audio.usb.period_us\" property\n* Tuned kernel tunables for clearer audio quality\n\n# v2.5.0\n* Added extras/change-resampling-quality.sh (to reduce resampling distortion) and extras/change-usb-period.sh (to reduce the jitter of a PLL in a DAC)directly)\n* Tuned kernel tunables by assuming an audio scheduling tunable \"vendor.audio.adm.buffering.ms\" to be \"2\" (please set this property by my magisk modules [\"usb-samplerate-unlocker\"](https://github.com/Magisk-Modules-Alt-Repo/usb-samplerate-unlocker) and/or [\"audio-misc-settings\"](https://github.com/Magisk-Modules-Alt-Repo/audio-misc-settings))\n\n# v2.4.11\n* extras/jitter-reducer.sh:  \n    1. Disabled the Android doze itself for reducing jitter considerably unless disabling battery optimizations of app's  \n    2. Tuned kernel tunables for recent Qcomm and MTK devices  \n\n* USB_SampleRate_Changer.sh:  \n    1. Added an option specifying \"float\" bit depth.  \n\n* Fixed an audioserver hang-up after setprop restart on A12 low performance devices (by sending a SIGHUP signal to the server)\n* Added resampling parameter examples in README\n\n# v2.4.10\n* Tuned for POCO F3 (SD870) on phh GSI's because I abandoned tuning for custom ROM's on POCO F3 except phh GSI's\n* Tuned for SD845 devices; Perhaps also SD855 & SD865 & SD880 devices\n* Tuned I/O scheduler and virtual memory parameters, especially on bluetooth earphones\n\n# v2.4.9\n* Improved \"extras/jitter-reducer.sh\" about thermal controls of performance Snapdragon's\n* Optimized for POCO F3, but some of its custom ROM's cannot disable DRC (ArrowOS has inverted the DRC switch, so add \"--drc\" option to disable DRC)\n\n# v2.4.8\n* Tuned tunable values of the I/O jitter reducer and added \"transition band cheat\" option (specifying a cut-off point over the Nyquist frequency) to \"extras/change-resampling-quality.sh\"\n* Fixed too many argument for resetprop\n\n# v2.4.7\n* Improved the I/O jitter-reducer\n\n# v2.4.6\n* Fixed a bug of usb-samplerate-unlocker detection\n* Added AudioFlinger's current resampling quality print option to \"extras/change-resampling-quality.sh\"\n* Improved \"extras/change-resampling-quality.sh\" for 1:1 ratio resampling, especially 44.1kHz 32bit data pass-through\n* Tuned parameters of the I/O jitter reducer\n\n# v2.4.5\n* \"extras/change-resampling-quality.sh\" (a changer for the resampling quality of AudioFlinger (the OS mixer)) was added\n\n# v2.4.4\n* Enhanced the vm jitter reducer in /extras/jitter-reducer.sh to handle \"swap_ratio\" and \"swap_ratio_enable\" for Snapdradons\n* Optimized tunables of the I/O jitter reducer\n* Added LICENSE\n\n# v2.4.3\n* Improved \"extras/jitter-reducer.sh\" by fixing the GPU frequency at the max one for Qualcomm SoC (min_pwrlevel to the max level 0) and MTK SoC (fixed frequency at the max one with no governor) \n\nRemarks: Don't forget to disable \"adaptive battery\" in the battery section of \"settings\" and battery optimizations for \"System UI\" (system app), etc. to lower reverb like jitter distortion in digital audio outputs.\n\n# v2.4.2\n* Optimized the I/O jitter reducer in \"extras/jitter-reducer.sh\" for Snapdragon devices\n\n# v2.4.1\n* Added an \"m-light\" tone mode for the I/O jitter reducer to \"extras'jitter-reduce.sh\"\n\nThe mode is optimal for somewhat insensitive bluetooth earphones\n\n# v2.4.0 (pre-release)\n* Enhanced extras/jitter-reducer.sh by replacing the I/O jitter reducer with that of the hifi maximizer which uses \"deadline\" and \"cfq\" I/O schedulers and their optimized tunable values\n\n# v2.3.0\n* Enhanced extras/jitter-reducer.sh by adding a wifi jitter reducer which is especially effective for music streaming services (both online and offline), Pixel's and other high performance devices\n* Cleaned up source codes\n\n# v2.2.5\n* Made \"--io\" option of \"extras/jitter-reducer.sh\" to have a parameter \"nr_requests\" (or presets \"light\", \"medium\" and \"boost\") for adjusting various peripheral devices (especially bluetooth earphones)\n\n# v2.2.4\n* \"extras/jitter-reducer.sh\" was improved for CPU&GPU governor and I/O scheduler (especially effective to bluetooth earphones)\n\n# v2.2.3\n* \"extras/jitter-reducer.sh\" was improved especially for old Qcomm devices\n\n# v2.2.2 (pre-release)\n* \"extras/jitter-reducer.sh\" was improved for virtual memory related jitters\n\n# v2.2.1 (pre-release)\n* \"extras/jitter-reducer.sh\" improved especially for old MTK SoC devices\n\n# v2.2.0\n* \"extras/jitter-reducer.sh\" (a simplified version of my [\"Hifi Maximizer\"](https://github.com/yzyhk904/hifi-maximizer-mod)) added\n\n# v2.1.0\n* ``--drc`` option added for the porpus of comparison to usual DRC-less audio quality\n\n# v2.0.1\n* \"--safe\", \"--safest\" and \"--usb-only\" options added\n\n# v2.0.0 (pre-release)\n* Supported \"disable a2dp hardware-offload\" in dev. settings and PHH treble GSI's \"force disable a2dp hardware-offload\"\n* Set an r_submix HAL to be 44.1kHz 16bit mode\n* Added \"auto\" mode for investigating device's environment and guessing best settings\n\n# v1.3.2\n* Over umounting and mount points loss issues was fixed\n\n# v1.3.1\n* Initial public release (on the Github)\n\n# v1.3.0\n* Selinux enforcing mode bug fixed\n\nNow this script can be used under both selinux enforcing and permissive modes\n\n# v1.2.0\n* (USB) hardware offload support added (currently experimental)\n* Bypass (USB) offload (using a non- USB hardware offload driver while the 3.5mm jack and internal speaker use a hardware offload driver) support added (currently experimental)\n\n# v1.1.0\n* Recent higher sample rates added\n\n# v1.0.0\n* Initial limited release\n\n##\n"
  },
  {
    "path": "extras/alsa-hw-params.sh",
    "content": "#!/system/bin/sh\n\nrst=\"closed\"\nfile=\"/proc/asound/card1/pcm0p/sub0/hw_params\"\nif [ -r \"$file\" ]; then\n    # For non-hardware offload use\n    rst=\"`cat $file`\"\n    if [ ! \"$rst\" = \"closed\" ];then\n        echo \"DAC Connection Status:\"\n        echo \"$rst\"\n    fi\nfi\n\nif [ \"$rst\" = \"closed\" ]; then\n    # For USB hardware offload use\n    for i in `seq 0 90`; do\n    \n        file=\"/proc/asound/card0/pcm${i}p/sub0/hw_params\"\n        if [ -r \"$file\" ]; then\n            rst=\"`cat $file`\"\n            \n            if [ ! \"$rst\" = \"closed\" ];then\n                echo \"Active Audio Connection Status (/proc/asound/card0/pcm${i}p):\"\n                echo \"$rst\"\n                break\n            fi\n            \n        fi\n        \n    done\nfi\n\nif [ -r \"/proc/asound/card1/id\" ]; then\n    if [ ! \"`cat /proc/asound/card1/id`\" = \"closed\"  -a  -r \"/proc/asound/card1/stream0\" ];then\n        echo \"\\nDAC Hardware Profile:\"\n        cat '/proc/asound/card1/stream0'\n    fi\nfi\n\n"
  },
  {
    "path": "extras/change-bluetooth-hal.sh",
    "content": "#!/system/bin/sh\n\nfunction usage()\n{\n    echo \"Usage: ${0##*/} [--help] [--status] [ aosp | legacy | offload | sysbta ]\" 1>&2\n}\n\nfunction which_resetprop_command()\n{\n    type resetprop 1>\"/dev/null\" 2>&1\n    if [ $? -eq 0 ]; then\n        echo \"resetprop\"\n    else\n        type resetprop_phh 1>\"/dev/null\" 2>&1\n        if [ $? -eq 0 ]; then\n            echo \"resetprop_phh\"\n        else\n            return 1\n        fi\n    fi\n    return 0\n}\n\nfunction reloadAudioserver()\n{\n    # wait for system boot completion and audiosever boot up\n    local i\n    for i in `seq 1 3` ; do\n        if [ \"`getprop sys.boot_completed`\" = \"1\"  -a  -n \"`getprop init.svc.audioserver`\" ]; then\n            break\n        fi\n        sleep 1\n    done\n\n    if [ -n \"`getprop init.svc.audioserver`\" ]; then\n    \n        setprop ctl.restart audioserver\n        sleep 0.2\n        if [ \"`getprop init.svc.audioserver`\" != \"running\" ]; then\n            # workaround for Android 12 old devices hanging up the audioserver after \"setprop ctl.restart audioserver\" is executed\n            local pid=\"`getprop init.svc_debug_pid.audioserver`\"\n            if [ -n \"$pid\" ]; then\n                kill -HUP $pid 1>\"/dev/null\" 2>&1\n            fi\n            for i in `seq 1 10` ; do\n                sleep 0.2\n                if [ \"`getprop init.svc.audioserver`\" = \"running\" ]; then\n                    break\n                elif [ $i -eq 10 ]; then\n                    echo \"audioserver reload failed!\" 1>&2\n                    return 1\n                fi\n            done\n        fi\n        \n        if [ $# -gt 0  -a  \"$1\" = \"all\"  -a  -n \"`getprop init.svc.vendor.audio-hal`\" ]; then\n            setprop ctl.restart \"vendor.audio-hal\" 1>\"/dev/null\" 2>&1\n            sleep 0.2\n            if [ \"`getprop init.svc.vendor.audio-hal`\" != \"running\" ]; then\n                kill \"`getprop init.svc_debug_pid.vendor.audio-hal`\" 1>\"/dev/null\" 2>&1\n            fi\n        fi\n        \n    else\n        echo \"audioserver is not found!\" 1>&2 \n        return 1\n    fi\n}\n\nfunction BluetoothHalStatus()\n{\n    if [ \"`getprop persist.bluetooth.system_audio_hal.enabled`\" = 1  -o  \"`getprop persist.bluetooth.system_audio_hal.enabled`\" = \"true\" ]; then\n        echo \"sysbta (\\\"sysbta\\\" HAL) : enabled\" 1>&2\n        \n    else\n        if [ \"`getprop persist.bluetooth.bluetooth_audio_hal.disabled`\" != \"true\"  -a  -r \"/vendor/lib64/hw/audio.bluetooth.default.so\" ]; then\n            echo \"aosp (\\\"bluetooth\\\" HAL) : enabled\" 1>&2\n        elif [ -r \"/system/lib64/hw/audio.a2dp.default.so\"  -o  -r \"/system/lib/hw/audio.a2dp.default.so\" ]; then\n            echo \"legacy (\\\"a2dp\\\" HAL) : enabled\" 1>&2\n        elif [ -r \"/vendor/lib64/hw/audio.bluetooth_qti.default.so\"  -o  -r \"/vendor/lib/hw/audio.bluetooth_qti.default.so\" ]; then\n            echo \"legacy (\\\"bluetooth_qti\\\" HAL) : enabled\" 1>&2\n        fi\n        \n        if [ \"`getprop ro.bluetooth.a2dp_offload.supported`\" = \"true\"  -a  \"`getprop persist.bluetooth.a2dp_offload.disabled`\" = \"false\" ]; then\n            echo \"offload (\\\"primary.$(getprop ro.board.platform)\\\" a2dp offload HAL) : enabled\" 1>&2\n        fi\n        \n    fi\n}\n\nAudioHALs=\"\nvendor.audio-hal\naudio_proxy_service\naudio-hal\naudio-hal-2-0\nvendor.audio-hal-2-0\nvendor.audio-hal-4-0-msd\nvendor.audio-hal-7-0\n\"\n\nfunction restartAudioHalExceptSysbta()\n{\n    local x\n    \n    for x in $AudioHALs \"system.bt-audio-hal\"; do\n        if [ \"`getprop init.svc.${x}`\" = \"running\" ]; then\n            stop ${x}\n        fi\n    done\n    \n    for x in $AudioHALs; do\n        if [ \"`getprop init.svc.${x}`\" = \"stopped\" ]; then\n            start ${x}\n        fi\n    done\n}\n\nfunction startSysbtaHal()\n{\n    local x\n    \n    for x in $AudioHALs \"system.bt-audio-hal\"; do\n        if [ \"`getprop init.svc.${x}`\" = \"stopped\" ]; then\n            start ${x}\n        fi\n    done\n}\n\nBTmode=\"aosp\"\n\nif [ $# -eq 1 ]; then\n    case \"$1\" in\n        \"aosp\" | \"legacy\" | \"offload\" | \"sysbta\" )\n            BTmode=\"$1\"\n            ;;\n        \"-s\" | \"--status\" )\n            BluetoothHalStatus\n            exit 0\n            ;;\n        \"-h\" | \"--help\" )\n            usage\n            exit 0\n            ;;\n        -* | * )\n            usage\n            exit 1\n            ;;\n    esac\nelse\n    usage\n    exit 0\nfi\n\nresetprop_command=\"`which_resetprop_command`\"\nif [ -z \"$resetprop_command\" ]; then\n    echo \"${0##*/} cannot change Bluetooth HAL; (no resetprop commands found)\" 1>&2\n    exit 1\nfi\n\nif [ -n \"`getprop persist.bluetooth.system_audio_hal.enabled`\" ]; then\n    if [ \"$BTmode\" = \"sysbta\" ]; then\n        setprop persist.bluetooth.bluetooth_audio_hal.disabled false\n        setprop persist.bluetooth.a2dp_offload.disabled true\n        \"$resetprop_command\" ro.bluetooth.a2dp_offload.supported false\n        setprop persist.bluetooth.system_audio_hal.enabled 1\n    else\n        \"$resetprop_command\" --delete persist.bluetooth.bluetooth_audio_hal.disabled\n        \"$resetprop_command\" --delete persist.bluetooth.a2dp_offload.disabled\n        \"$resetprop_command\" --delete ro.bluetooth.a2dp_offload.supported\n        setprop persist.bluetooth.system_audio_hal.enabled 0\n    fi\nfi\n\ncase \"$BTmode\" in\n    \"aosp\" )\n        if [ -r \"/vendor/lib64/hw/audio.bluetooth.default.so\"  -o   -r \"/vendor/lib/hw/audio.bluetooth.default.so\" ]; then\n            reloadAudioserver\n            setprop persist.bluetooth.bluetooth_audio_hal.disabled false\n            restartAudioHalExceptSysbta\n         else\n            echo \"${0##*/} cannot change to \\\"${BTmode}\\\"; (no ${BTmode} HAL module)\" 1>&2\n            exit 1\n         fi\n        ;;\n    \"legacy\" )\n        if [ -r \"/system/lib64/hw/audio.a2dp.default.so\"  -o   -r \"/system/lib/hw/audio.a2dp.default.so\" ]; then\n            reloadAudioserver\n            setprop persist.bluetooth.bluetooth_audio_hal.disabled true\n            restartAudioHalExceptSysbta\n        elif [ -r \"/vendor/lib64/hw/audio.bluetooth_qti.default.so\"  -o  -r \"/vendor/lib/hw/audio.bluetooth_qti.default.so\" ]; then\n            reloadAudioserver\n            setprop persist.bluetooth.bluetooth_audio_hal.disabled true\n            setprop persist.bluetooth.a2dp_offload.disabled false\n            \"$resetprop_command\" ro.bluetooth.a2dp_offload.supported true\n            restartAudioHalExceptSysbta\n        else\n            echo \"${0##*/} cannot change to \\\"${BTmode}\\\"; (no ${BTmode} HAL module)\" 1>&2\n            exit 1\n        fi\n        ;;\n    \"offload\" )\n        if [ -n \"`getprop persist.bluetooth.a2dp_offload.cap`\"  -o  -n \"`getprop persist.vendor.qcom.bluetooth.a2dp_offload_cap`\" ]; then\n            reloadAudioserver\n            setprop persist.bluetooth.bluetooth_audio_hal.disabled false\n            setprop persist.bluetooth.a2dp_offload.disabled false\n            \"$resetprop_command\" ro.bluetooth.a2dp_offload.supported true\n            restartAudioHalExceptSysbta\n        else\n            echo \"${0##*/} cannot change to \\\"${BTmode}\\\"; (no ${BTmode} HAL module)\" 1>&2\n            exit 1\n        fi\n        ;;\n    \"sysbta\" )\n        if [ -n \"`getprop init.svc.system.bt-audio-hal`\" ]; then\n            reloadAudioserver\n            startSysbtaHal\n        else\n            echo \"${0##*/} cannot change to \\\"${BTmode}\\\"; (no ${BTmode} HAL module)\" 1>&2\n            exit 1\n        fi\n        ;;\nesac\n\nBluetoothHalStatus\nexit 0\n"
  },
  {
    "path": "extras/change-resampling-quality.sh",
    "content": "#!/system/bin/sh\n\n#  Items                                             Stop_Band_Attenuation   Half_Filter_Length     Cut_Off_Percent or Stop_Band_Cheat (% of Nyquist freq.)\n# -- AOSP standard parameters --\n#   DYN_LOW_QUALITY(5):                               80dB                              8                          100\n#   DYN_MEDIUM_QUALITY(6):                          84dB                            16                          100\n#   AOSP default (>=48kHz):                             90dB                            32                          100   (options: --bypass)\n#   DYN_HIGH_QUALITY(7):                              98dB                             32                         100\n#\n#  -- Recommended parameters --\n#   This script's old default (for old Androids):    159dB                          480                            92\n#   For low perf Android 12+ (in general):         165dB                          360                          104   (options: --bypass --cheat)\n#   For Android 12+ (in general; new default):   179dB                          408                            99   (options:  --cheat)\n#   For bit perfect when 1:1 ratio:                     194dB                          520                          100\n#\n#  -- My mock series --\n#   Mock DAC-A over-sampling:                        150dB                            48                          109   (options: --bypass --cheat)\n#   Mock DAC-B over-sampling:                        118dB                            40                            96\n#   Mock mastering filter:                                 159dB                           240                            99   (options: --cheat)\n#\n\nif [ $# -ge 1 ]; then\n    stopBand=159\n    filterLength=480\n    cutOffPercent=92\n    cheatFlag=0\nelse\n    stopBand=179\n    filterLength=408\n    cutOffPercent=99\n    cheatFlag=1\nfi\n\nresetFlag=0\nbypassFlag=0\n\nfunction usage()\n{\n    echo \"Usage: ${0##*/} [--help] [--status] [--reset] [--bypass] [--cheat] [stop_band_dB [half_filter_length [cut_off_percent]]]\" 1>&2\n}\n\nfunction which_resetprop_command()\n{\n    type resetprop 1>\"/dev/null\" 2>&1\n    if [ $? -eq 0 ]; then\n        echo \"resetprop\"\n    else\n        type resetprop_phh 1>\"/dev/null\" 2>&1\n        if [ $? -eq 0 ]; then\n            echo \"resetprop_phh\"\n        else\n            return 1\n        fi\n    fi\n    return 0\n}\n\nfunction reloadAudioserver()\n{\n    # wait for system boot completion and audiosever boot up\n    local i\n    for i in `seq 1 3` ; do\n        if [ \"`getprop sys.boot_completed`\" = \"1\"  -a  -n \"`getprop init.svc.audioserver`\" ]; then\n            break\n        fi\n        sleep 0.9\n    done\n\n    if [ -n \"`getprop init.svc.audioserver`\" ]; then\n\n        setprop ctl.restart audioserver\n        sleep 0.2\n        if [ \"`getprop init.svc.audioserver`\" != \"running\" ]; then\n            # workaround for Android 12 old devices hanging up the audioserver after \"setprop ctl.restart audioserver\" is executed\n            local pid=\"`getprop init.svc_debug_pid.audioserver`\"\n            if [ -n \"$pid\" ]; then\n                kill -HUP $pid 1>\"/dev/null\" 2>&1\n            fi\n            for i in `seq 1 10` ; do\n                sleep 0.2\n                if [ \"`getprop init.svc.audioserver`\" = \"running\" ]; then\n                    break\n                elif [ $i -eq 10 ]; then\n                    echo \"audioserver reload failed!\" 1>&2\n                    return 1\n                fi\n            done\n        fi\n        return 0\n        \n    else\n        echo \"audioserver is not found!\" 1>&2 \n        return 1\n    fi\n}\n\nfunction PrintStatus()\n{\n    if [ $# -eq 5 ]; then\n        echo \"AudioFlinger's current resampling configuration:\" 1>&2\n        if [ -n \"$2\" ]; then\n            echo \"  Effective Freq. (kHz) >= : $2\" 1>&2\n        fi\n        if [ -n \"$3\" ]; then\n            echo \"  Stop Band (dB): $3\" 1>&2\n        fi\n        if [ -n \"$4\" ]; then\n            echo \"  Half Filter Length: $4\" 1>&2\n        fi\n        if [ -n \"$5\" ]; then\n            if [ \"$1\" = \"cheat\" ]; then\n                echo \"  Cheat (% Nyquist freq.): $5\" 1>&2\n            else\n                echo \"  Cut Off (% Nyquist freq.): $5\" 1>&2\n            fi\n        fi\n    fi\n}\n\nfunction AudioFlingerStatus()\n{\n    local val1 val2 val3 val4\n    val1=\"`getprop ro.audio.resampler.psd.enable_at_samplerate`\"\n    if [ -n \"$val1\" ]; then\n        val1=`echo \"scale=1; $val1 / 1000.0\" | bc`\n        val2=\"`getprop ro.audio.resampler.psd.stopband`\"\n        val3=\"`getprop ro.audio.resampler.psd.halflength`\"\n        val4=\"`getprop ro.audio.resampler.psd.tbwcheat`\"\n        if [ -n \"$val4\" -a \"$val4\" -gt 0 ]; then\n            PrintStatus \"cheat\" \"$val1\" \"$val2\" \"$val3\" \"$val4\"\n        else\n            val4=\"`getprop ro.audio.resampler.psd.cutoff_percent`\"\n            PrintStatus \"cut-off\" \"$val1\" \"$val2\" \"$val3\" \"$val4\"\n        fi\n    else\n        PrintStatus \"cut-off\" 48.0 90 32 100\n    fi\n}\n\nwhile [ $# -gt 0 ]; do\n    case \"$1\" in\n        \"-s\" | \"--status\" )\n            AudioFlingerStatus\n            exit 0\n            ;;\n        \"-r\" | \"--reset\" )\n            resetFlag=1\n            shift\n            ;;\n        \"-b\" | \"--bypass\" )\n            bypassFlag=1\n            shift\n            ;;\n        \"-bh\" | \"--bypass-hires\" )\n            bypassFlag=2\n            shift\n            ;;\n        \"-c\" | \"--cheat\" )\n            cheatFlag=1\n            cutOffPercent=99\n            shift\n            ;;\n        \"-h\" | \"--help\" | -* )\n            usage\n            exit 0\n            ;;\n        * )\n            break\n            ;;\n    esac\ndone\n\nif [ $# -ge 1 ]; then\n     if expr \"$1\" : \"[1-9][0-9]*$\" 1>\"/dev/null\" 2>&1; then\n        \n        if [ $1 -lt 20  -o  $1 -gt 242 ]; then\n            echo \"unsupported stop band dB ($1; valid: 20~242)!\" 1>&2\n            usage\n            exit 1\n        else\n            stopBand=\"$1\"\n            if [ $stopBand -le 60 ]; then\n                filterLength=72\n            elif [ $stopBand -le 84 ]; then\n                filterLength=112\n            elif [ $stopBand -le 90 ]; then\n                filterLength=152\n            elif [ $stopBand -le 98 ]; then\n                filterLength=192\n            else\n                filterLength=\"`expr 192 + \\( $1 - 98 \\) / 8 \\* 8 \\* 4`\"\n            fi\n        fi\n        \n    else\n        \n        echo \"unsupported stop band dB ($1; valid: 20~242)!\" 1>&2\n        usage\n        exit 1\n        \n    fi\nfi\n\nif [ $# -ge 2 ]; then\n     if expr \"$2\" : \"[1-9][0-9]*$\" 1>\"/dev/null\" 2>&1; then\n        \n        if [ $2 -lt 8  -o  $2 -gt 640 ]; then\n            echo \"unsupported half filter length ($2; valid: 8~640)!\" 1>&2\n            usage\n            exit 1\n        else\n            filterLength=\"`expr $2 / 8 \\* 8`\"\n        fi\n        \n    else\n        \n        echo \"unsupported half filter length ($2; valid: 8~640)!\" 1>&2\n        usage\n        exit 1\n        \n    fi\nfi\n\nif [ $# -ge 3 ]; then\n     if expr \"$3\" : \"[1-9][0-9]*$\" 1>\"/dev/null\" 2>&1; then\n\n        if [ $cheatFlag -gt 0 ]; then        \n            if [ $3 -le 0  -o  $3 -gt 200 ]; then\n                echo \"unsupported cheat percent ($3; valid: 1~200)!\" 1>&2\n                usage\n                exit 1\n            else\n                cutOffPercent=$3\n            fi\n        elif [ $3 -lt 0  -o  $3 -gt 100 ]; then\n            echo \"unsupported cut off percent ($3; valid: 0~100)!\" 1>&2\n            usage\n            exit 1\n        else\n            cutOffPercent=$3\n        fi\n        \n    else\n        \n        if [ $cheatFlag -gt 0 ]; then        \n            echo \"unsupported cheat percent ($3; valid: 1~200)!\" 1>&2\n        else\n            echo \"unsupported cut off percent ($3; valid: 0~100)!\" 1>&2\n        fi\n        usage\n        exit 1\n        \n    fi\nfi\n\nresetprop_command=\"`which_resetprop_command`\"\nif [ -n \"$resetprop_command\" ]; then\n    if [ $resetFlag -gt 0 ]; then\n        \"$resetprop_command\" --delete af.resampler.quality 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.enable_at_samplerate 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.stopband 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.halflength 1>/dev/null 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1\n    else\n        # Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)\n        \"$resetprop_command\" --delete af.resampler.quality 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.enable_at_samplerate 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.stopband 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.halflength 1>/dev/null 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1\n        \"$resetprop_command\" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1\n        # End of workaround\n        \n        \"$resetprop_command\" af.resampler.quality 7 1>\"/dev/null\" 2>&1\n        if [ $bypassFlag -gt 1 ]; then\n            \"$resetprop_command\" ro.audio.resampler.psd.enable_at_samplerate 96000 1>\"/dev/null\" 2>&1\n        elif [ $bypassFlag -gt 0 ]; then\n            \"$resetprop_command\" ro.audio.resampler.psd.enable_at_samplerate 48000 1>\"/dev/null\" 2>&1\n        else\n            \"$resetprop_command\" ro.audio.resampler.psd.enable_at_samplerate 44100 1>\"/dev/null\" 2>&1\n        fi\n        \"$resetprop_command\" ro.audio.resampler.psd.stopband \"$stopBand\" 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" ro.audio.resampler.psd.halflength \"$filterLength\" 1>\"/dev/null\" 2>&1\n        if [ $cheatFlag -gt 0 ]; then\n            \"$resetprop_command\" ro.audio.resampler.psd.tbwcheat \"$cutOffPercent\" 1>\"/dev/null\" 2>&1\n            \"$resetprop_command\" --delete ro.audio.resampler.psd.cutoff_percent 1>/dev/null 2>&1\n        else\n            \"$resetprop_command\" ro.audio.resampler.psd.cutoff_percent \"$cutOffPercent\" 1>\"/dev/null\" 2>&1\n            \"$resetprop_command\" --delete ro.audio.resampler.psd.tbwcheat 1>/dev/null 2>&1\n        fi\n    fi\n    reloadAudioserver\nelse\n    echo \"cannot change resampling quality (no resetprop commands found)\" 1>&2\n    exit 1\nfi\n\nAudioFlingerStatus\nexit 0\n"
  },
  {
    "path": "extras/change-usb-period.sh",
    "content": "#!/system/bin/sh\n\nperiod_us=2250\n\nresetFlag=0\n\nfunction usage()\n{\n    echo \"Usage: ${0##*/} [--help] [--status] [--reset] [period_usec]\" 1>&2\n    echo \"  (default: 2250 usec)\" 1>&2\n}\n\nfunction which_resetprop_command()\n{\n    type resetprop 1>\"/dev/null\" 2>&1\n    if [ $? -eq 0 ]; then\n        echo \"resetprop\"\n    else\n        type resetprop_phh 1>\"/dev/null\" 2>&1\n        if [ $? -eq 0 ]; then\n            echo \"resetprop_phh\"\n        else\n            return 1\n        fi\n    fi\n    return 0\n}\n\nfunction reloadAudioserver()\n{\n    # wait for system boot completion and audiosever boot up\n    local i\n    for i in `seq 1 3` ; do\n        if [ \"`getprop sys.boot_completed`\" = \"1\"  -a  -n \"`getprop init.svc.audioserver`\" ]; then\n            break\n        fi\n        sleep 0.9\n    done\n\n    if [ -n \"`getprop init.svc.audioserver`\" ]; then\n\n        setprop ctl.restart audioserver\n        sleep 0.2\n        if [ \"`getprop init.svc.audioserver`\" != \"running\" ]; then\n            # workaround for Android 12 old devices hanging up the audioserver after \"setprop ctl.restart audioserver\" is executed\n            local pid=\"`getprop init.svc_debug_pid.audioserver`\"\n            if [ -n \"$pid\" ]; then\n                kill -HUP $pid 1>\"/dev/null\" 2>&1\n            fi\n            for i in `seq 1 10` ; do\n                sleep 0.2\n                if [ \"`getprop init.svc.audioserver`\" = \"running\" ]; then\n                    break\n                elif [ $i -eq 10 ]; then\n                    echo \"audioserver reload failed!\" 1>&2\n                    return 1\n                fi\n            done\n        fi\n        return 0\n        \n    else\n        echo \"audioserver is not found!\" 1>&2 \n        return 1\n    fi\n}\n\nfunction PrintStatus()\n{\n    if [ $# -eq 1 ]; then\n        echo \"USB driver's transfer property:\" 1>&2\n        if [ -n \"$1\" ]; then\n            echo \"  period = $1 usec\" 1>&2\n        fi\n    fi\n}\n\nfunction AudioDriverStatus()\n{\n    local val\n    val=\"`getprop vendor.audio.usb.perio`\"\n    if [ -z \"$val\" ]; then\n        val=\"`getprop ro.audio.usb.period_us`\"\n    fi\n    if [ -n \"$val\" ]; then\n        PrintStatus \"$val\"\n    elif [ $resetFlag -eq 0 ]; then\n        echo \"Warning: root permisson is needed for the right answer!\" 1>&2\n        PrintStatus \"5000(?)\"\n    else\n        PrintStatus \"5000(?)\"\n    fi\n}\n\nwhile [ $# -gt 0 ]; do\n    case \"$1\" in\n        \"-s\" | \"--status\" )\n            AudioDriverStatus\n            exit 0\n            ;;\n        \"-r\" | \"--reset\" )\n            resetFlag=1\n            shift\n            ;;\n        \"-h\" | \"--help\" | -* )\n            usage\n            exit 0\n            ;;\n        * )\n            break\n            ;;\n    esac\ndone\n\nif [ $# -ge 1 ]; then\n     if expr \"$1\" : \"[1-9][0-9]*$\" 1>\"/dev/null\" 2>&1; then\n        \n        if [ $1 -lt 125  -o  $1 -gt 50000 ]; then\n            echo \"unsupported transfer period ($1; valid: 125~50000 usec)!\" 1>&2\n            usage\n            exit 1\n        else\n            period_us=\"`expr $1 / 125 \\* 125`\"\n        fi\n        \n    else\n        \n        echo \"unsupported transfer period ($1; valid: 125~50000 usec)!\" 1>&2\n        usage\n        exit 1\n        \n    fi\nfi\n\nresetprop_command=\"`which_resetprop_command`\"\nif [ -n \"$resetprop_command\" ]; then\n    if [ $resetFlag -gt 0 ]; then\n        \"$resetprop_command\" --delete ro.audio.usb.period_us 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.perio 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.out.period_us 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.out.period_count 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio_hal.period_multiplier 1>\"/dev/null\" 2>&1\n    else\n        # Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)\n        \"$resetprop_command\" --delete ro.audio.usb.period_us 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.perio 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.out.period_us 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio.usb.out.period_count 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" --delete vendor.audio_hal.period_multiplier 1>\"/dev/null\" 2>&1\n        # End of workaround\n\n        \"$resetprop_command\" \"ro.audio.usb.period_us\" \"$period_us\" 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" \"vendor.audio.usb.perio\" \"$period_us\" 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" \"vendor.audio.usb.out.period_us\" \"$period_us\" 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" \"vendor.audio.usb.out.period_count\" \"2\" 1>\"/dev/null\" 2>&1\n        \"$resetprop_command\" \"vendor.audio_hal.period_multiplier\" \"1\" 1>\"/dev/null\" 2>&1\n    fi\n    reloadAudioserver\nelse\n    echo \"cannot change the USB transfer period (no resetprop commands found)\" 1>&2\n    exit 1\nfi\n\nAudioDriverStatus\nexit 0\n"
  },
  {
    "path": "extras/dumpsys-bluetooth-filtered.sh",
    "content": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n    case \"$1\" in\n        \"-a\" | \"--all\" )\n            allFlag=1\n            ;;\n        \"-h\" | \"--help\" )\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 0\n            ;;\n        * )\n            echo \"wrong argument ($1)\" 1>&2\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 1\n            ;;\n    esac\n\nfi\n\ndumpsys bluetooth_manager | sed -e '/^Bluetooth Status/,/^A2DP State:/d' -e '/^A2DP Sink State:/,$d' \\\n    | awk -v allFlag=$allFlag '\n        BEGIN {\n            RS=\"\"\n            FS=\"\\n\"\n            printFlag=1\n            if (allFlag == 1)\n                print \"A2DP State:\"\n        }\n        allFlag==1 || (printFlag==1 && /\\n  Config: Rate/) {\n            print $0 \"\\n\"\n            if (allFlag == 0)\n                printFlag=0\n        }'\n"
  },
  {
    "path": "extras/dumpsys-filtered.sh",
    "content": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n    case \"$1\" in\n        \"-a\" | \"--all\" )\n            allFlag=1\n            ;;\n        \"-h\" | \"--help\" )\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 0\n            ;;\n        * )\n            echo \"wrong argument ($1)\" 1>&2\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 1\n            ;;\n    esac\n\nfi\n\ndumpsys media.audio_flinger | sed -e '/^  Hal stream dump/,/^  Normal mixer raw underrun counters:/d' -e '/^-/d'  -e '/^Output thread/,/^$/!d' \\\n    | awk '\n        /^$/ ||\n        /^Output thread/ ||\n        /^  Sample rate:/ ||\n        /^  HAL format:/ ||\n        /^  Timestamp stats:/ ||\n        /^  AudioStreamOut:/ ||\n        /^  Output devices?:/ ||\n        /^  Local log:/ ||\n        /^   [0-1][0-9]-[0-3][0-9] [0-9.:]+ AT::add / {\n            print\n        }' \\\n    | awk -v allFlag=$allFlag '\n        BEGIN {\n            RS=\"\"\n            FS=\"\\n\"\n        }\n        (allFlag==1 && /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_SPEAKER\\)/) ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_EARPIECE\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_USB_HEADSET\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_USB_DEVICE\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_WIRED_HEADSET\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_WIRED_HEADPHONE\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_LINE\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_REMOTE_SUBMIX\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_SCO\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\\)/ ||\n        /Output devices?:[^(]+\\(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\\)/ {\n            print $0 \"\\n\"\n        }'\n"
  },
  {
    "path": "extras/getConfig.sh",
    "content": "#!/system/bin/sh\n\nallFlag=0\nif [ $# -gt 0 ];then\n\n    case \"$1\" in\n        \"-a\" | \"--all\" )\n            allFlag=1\n            ;;\n        \"-h\" | \"--help\" )\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 0\n            ;;\n        * )\n            echo \"wrong argument ($1)\" 1>&2\n            echo \"Usage: ${0##*/} [--all][--help]\" 1>&2\n            exit 1\n            ;;\n    esac\n\nfi\n\ndumpsys media.audio_policy | sed -e '/^Supported/,/^$/d' -e '/^ Outputs/,$d' \\\n    | awk -v allFlag=$allFlag '\n    function getDRCswitch(fname)\n    {\n        v=0\n        if (system(\"test -r \" fname) > 0)\n            return(-1)\n        for (;;) {\n            r=(getline x < fname)\n            if (r < 0)\n                retrun(-1)\n            else if ( r == 0) {\n                v=0\n                break\n            }\n            else {\n                if (x ~ /speaker_drc_enabled[:space:]*=[:space:]*\\\"true\\\"/) {\n                    v=1\n                    break\n                }\n                else if (x ~ /speaker_drc_enabled[:space:]*=[:space:]*\\\"false\\\"/) {\n                    v=0\n                    break\n                }\n            }\n        }\n        close(fname)\n        return(v)\n    }\n\n    allFlag==1 {\n        print\n    }\n    allFlag!=1 &&\n    ( /^- HW Module / || /^  - name: / ) {\n        print\n    }\n    allFlag!=1 &&\n    /^ Config source: / {\n        print  \" Config source: \\\"\" $3 \"\\\"\"\n        v=getDRCswitch($3)\n        if (v == 1)\n            print  \" DRC switch: on\"\n        else if (v == 0)\n            print  \" DRC switch: off\"\n    }\n    allFlag!=1 &&\n    /^  [1-9][0-9]*\\. Handle:/ {\n        print \"\\n\\n HW module: \" $4\n    }\n    allFlag!=1 &&\n    /^    [1-9][0-9]*\\. [^{]+\\{AUDIO_DEVICE/ {\n        print\n    }'\n"
  },
  {
    "path": "extras/jitter-reducer-functions.shlib",
    "content": "#!/system/bin/sh\n\nfunction forceOnlineCPUs()\n{\n    local i st en\n    IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n    if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n        for i in `seq $st $en`; do\n            if [ -e \"/sys/devices/system/cpu/cpu$i/online\" ]; then\n                chmod 644 \"/sys/devices/system/cpu/cpu$i/online\"\n                echo '1' >\"/sys/devices/system/cpu/cpu$i/online\"\n            fi\n        done\n    fi\n}\n\nfunction searchDefaultCpuGovernor()\n{\n    # Search default CPU governor\n    local gov=\"\"\n    local i\n    for i in `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`; do\n        if [ \"$i\" = \"walt\"  -o  \"$i\" = \"sugov_ext\"  -o  \"$i\" = \"sched_pixel\"  -o  \"$i\" = \"schedutil\" ]; then\n            gov=\"$i\"\n            break;\n        elif [ ! \"$gov\" = \"schedplus\" ]; then\n             if [ \"$i\" = \"schedplus\" ]; then\n                gov=\"$i\"\n            elif [ ! \"$gov\" = \"interactive\" ]; then\n                gov=\"$i\"\n            fi\n        fi\n    done\n    if [ -z \"$gov\" ]; then\n        gov=\"performance\"\n    fi\n    echo \"$gov\"\n}\n\nfunction reduceSelinuxJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n        \n        if [ $flag -gt 0 ]; then\n            setenforce 0\n        elif [ $flag -lt 0 ]; then\n            if [ \"`getprop ro.build.product`\" = \"jfltexx\"  -a   \"`getprop ro.system.build.version.release`\" -ge \"12\" ]; then\n                echo \"Warning: ignored trying to change Selinux mode\" 1>&2\n            else\n                setenforce 1\n            fi\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            echo \"  Selinux mode: `getenforce`\"\n        fi\n    else\n        return 1\n    fi\n}\n\nfunction reduceThermalJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n        \n        if [ $flag -gt 0 ]; then   \n         \n            # Stop thermal core control\n            if [ -w \"/sys/module/msm_thermal/core_control/enabled\" ]; then\n                echo '0' > \"/sys/module/msm_thermal/core_control/enabled\"\n            fi\n            if [ -r \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                local i st en\n                IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n                if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n                    if [ -w \"/sys/devices/system/cpu/cpu7/core_ctl/enable\" ]; then\n                        # SD850 or higher type core control\n                        local ncpu_remained=7\n                        \n                        echo '1'  > \"/sys/devices/system/cpu/cpu7/core_ctl/enable\"\n                        echo '1'  > \"/sys/devices/system/cpu/cpu7/core_ctl/min_cpus\"\n                        echo '55'  > \"/sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres\"\n                        echo '2900'  > \"/sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu7/core_ctl/enable\"\n                        if [ -w \"/sys/devices/system/cpu/cpu3/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu3/core_ctl/enable\"\n                            # min_cpus cannot be set to be 4, so 3\n                            echo '3'  > \"/sys/devices/system/cpu/cpu3/core_ctl/min_cpus\"\n                            echo '55 55 55'  > \"/sys/devices/system/cpu/cpu3/core_ctl/busy_down_thres\"\n                            echo '0 0 0'  > \"/sys/devices/system/cpu/cpu3/core_ctl/busy_up_thres\"\n                            echo '2900'  > \"/sys/devices/system/cpu/cpu3/core_ctl/offline_delay_ms\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu3/core_ctl/enable\"\n                            ncpu_remained=3\n                        elif [ -w \"/sys/devices/system/cpu/cpu4/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                            echo '3'  > \"/sys/devices/system/cpu/cpu4/core_ctl/min_cpus\"\n                            echo '55 55 55'  > \"/sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres\"\n                            echo '0 0 0'  > \"/sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres\"\n                            echo '2900'  > \"/sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                            ncpu_remained=4\n                        fi\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                            echo \"$ncpu_remained\"  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                            echo '55 55 55 55'  > \"/sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres\"\n                            echo '0 0 0 0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres\"\n                            echo '2900'  > \"/sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu6/core_ctl/enable\" ]; then\n                        # Dimensity type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu6/core_ctl/enable\"\n                        echo '2'  > \"/sys/devices/system/cpu/cpu6/core_ctl/min_cpus\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu6/core_ctl/enable\"\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                            echo '6'  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu4/core_ctl/enable\" ]; then\n                        # SD840 or lower type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                        echo '4'  > \"/sys/devices/system/cpu/cpu4/core_ctl/min_cpus\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                            echo '4'  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                        # unknown type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        echo '4'  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                    fi\n                fi\n            fi\n            # Stop the MPDecision (CPU hotplug)\n            if [ \"`getprop init.svc.mpdecision`\" = \"running\" ]; then\n                setprop ctl.stop mpdecision\n                forceOnlineCPUs\n            elif [ \"`getprop init.svc.mpdecision`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.mpdecision`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                    forceOnlineCPUs\n                fi\n            elif [ \"`getprop init.svc.vendor.mpdecision`\" = \"running\" ]; then\n                setprop ctl.stop vendor.mpdecision\n                forceOnlineCPUs\n            elif [ \"`getprop init.svc.vendor.mpdecision`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.vendor.mpdecision`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                    forceOnlineCPUs\n                fi\n            fi\n            # Stop the thermal server\n            if [ \"`getprop init.svc.thermal`\" = \"running\" ]; then\n                setprop ctl.stop thermal\n            elif [ \"`getprop init.svc.thermal`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.thermal`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            elif [ \"`getprop init.svc.vendor.thermal`\" = \"running\" ]; then\n                setprop ctl.stop vendor.thermal\n            elif [ \"`getprop init.svc.vendor.thermal`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.vendor.thermal`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            \n            # Stop MTK thermald and thermal_core\n            if [ \"`getprop init.svc.thermald`\" = \"running\" ]; then\n                setprop ctl.stop thermald\n            elif [ \"`getprop init.svc.thermald`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.thermald`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.thermal_core`\" = \"running\" ]; then\n                setprop ctl.stop thermal_core\n            elif [ \"`getprop init.svc.thermal_core`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.thermal_core`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n\n            # Stop the mi_thermald server\n            if [ \"`getprop init.svc.mi_thermald`\" = \"running\" ]; then\n                setprop ctl.stop mi_thermald\n            elif [ \"`getprop init.svc.mi_thermald`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.mi_thermald`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            elif [ \"`getprop init.svc.vendor.mi_thermald`\" = \"running\" ]; then\n                setprop ctl.stop vendor.mi_thermald\n            elif [ \"`getprop init.svc.vendor.mi_thermald`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.vendor.mi_thermald`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            # Stop the thermal-engine server\n            if [ \"`getprop init.svc.thermal-engine`\" = \"running\" ]; then\n                setprop ctl.stop thermal-engine\n            elif [ \"`getprop init.svc.thermal-engine`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.thermal-engine`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            elif [ \"`getprop init.svc.vendor.thermal-engine`\" = \"running\" ]; then\n                setprop ctl.stop vendor.thermal-engine\n            elif [ \"`getprop init.svc.vendor.thermal-engine`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.vendor.thermal-engine`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            # For MediaTek CPU's\n            if [ -w \"/proc/cpufreq/cpufreq_sched_disable\" ]; then\n                echo '1' > \"/proc/cpufreq/cpufreq_sched_disable\"\n                forceOnlineCPUs\n            fi\n        \n        elif [ $flag -lt 0 ]; then\n        \n            # Start thermal core control\n             if [ -w \"/sys/module/msm_thermal/core_control/enabled\" ]; then\n                echo '1' > \"/sys/module/msm_thermal/core_control/enabled\"\n            fi\n            if [ -r \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                local st en\n                IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n                if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n                    if [ -w \"/sys/devices/system/cpu/cpu7/core_ctl/enable\" ]; then\n                        local ncpu_remained=7\n                        # SD850 or higher type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu7/core_ctl/enable\"\n                        echo '0'  > \"/sys/devices/system/cpu/cpu7/core_ctl/min_cpus\"\n                        echo '30'  > \"/sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres\"\n                        echo '60'  > \"/sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres\"\n                        echo '100'  > \"/sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms\"\n                        if [ -w \"/sys/devices/system/cpu/cpu3/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu3/core_ctl/enable\"\n                            echo '3'  > \"/sys/devices/system/cpu/cpu3/core_ctl/min_cpus\"\n                            echo '30 30 30'  > \"/sys/devices/system/cpu/cpu3/core_ctl/busy_down_thres\"\n                            echo '60 60 60'  > \"/sys/devices/system/cpu/cpu3/core_ctl/busy_up_thres\"\n                            echo '100'  > \"/sys/devices/system/cpu/cpu3/core_ctl/offline_delay_ms\"\n                            ncpu_remained=3\n                        elif [ -w \"/sys/devices/system/cpu/cpu4/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                            echo '2'  > \"/sys/devices/system/cpu/cpu4/core_ctl/min_cpus\"\n                            echo '30 30 30'  > \"/sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres\"\n                            echo '60 60 60'  > \"/sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres\"\n                            echo '100'  > \"/sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms\"\n                            ncpu_remained=4\n                        fi\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                            echo \"$ncpu_remained\"  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                            echo '0 0 0 0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres\"\n                            echo '0 0 0 0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres\"\n                            echo '100'  > \"/sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms\"\n                            echo '0'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu6/core_ctl/enable\" ]; then\n                        # Dimensity type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu6/core_ctl/enable\"\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu4/core_ctl/enable\" ]; then\n                        # SD840 or lower type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                        echo '1'  > \"/sys/devices/system/cpu/cpu4/core_ctl/min_cpus\"\n                        if [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                            echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                        fi\n                    elif [ -w \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                        # unknown type core control\n                        echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                        echo '1'  > \"/sys/devices/system/cpu/cpu0/core_ctl/min_cpus\"\n                    fi\n                fi\n            fi\n            # Start the MPDecision (CPU hotplug)\n            if [ \"`getprop init.svc.mpdecision`\" = \"stopped\" ]; then\n                setprop ctl.start mpdecision\n                forceOnlineCPUs\n            elif [ \"`getprop init.svc.vendor.mpdecision`\" = \"stopped\" ]; then\n                setprop ctl.start vendor.mpdecision\n                forceOnlineCPUs\n            fi\n            # Start the thermal server\n            if [ \"`getprop init.svc.thermal`\" = \"stopped\" ]; then\n                setprop ctl.start thermal\n            elif [ \"`getprop init.svc.vendor.thermal`\" = \"stopped\" ]; then\n                setprop ctl.start vendor.thermal\n            fi\n            # Start the MTK thermald and thermal_core server\n            if [ \"`getprop init.svc.thermald`\" = \"stopped\" ]; then\n                setprop ctl.start thermald\n            fi\n            if [ \"`getprop init.svc.thermal_core`\" = \"stopped\" ]; then\n                setprop ctl.start thermal_core\n            fi\n            # Start the mi_thermald server\n            if [ \"`getprop init.svc.mi_thermald`\" = \"stopped\" ]; then\n                setprop ctl.start mi_thermald\n            elif [ \"`getprop init.svc.vendor.mi_thermald`\" = \"stopped\" ]; then\n                setprop ctl.start vendor.mi_thermald\n            fi\n            # Start the thermal-engine server\n            if [ \"`getprop init.svc.thermal-engine`\" = \"stopped\" ]; then\n                setprop ctl.start thermal-engine\n            elif [ \"`getprop init.svc.vendor.thermal-engine`\" = \"stopped\" ]; then\n                setprop ctl.start vendor.thermal-engine\n            fi\n            # For MediaTek CPU's\n            if [ -w \"/proc/cpufreq/cpufreq_sched_disable\" ]; then\n                val=\"`searchDefaultCpuGovernor`\"\n                if [ \"$val\" = \"schedutil\"  -a  \"`getprop ro.vendor.build.version.release`\" -lt \"11\" ]; then\n                    echo \"    Notice: EAS hasn't been enabled, so skipping thermal MTK EAS+ enabling\" 1>&2\n                else\n                    echo '0' > \"/proc/cpufreq/cpufreq_sched_disable\"\n                fi\n            fi\n        \n        fi\n      \n        if [ $printStatus -gt 0 ]; then\n            local found=0\n            \n            # Qualcomm Core control\n            if [ -w \"/sys/module/msm_thermal/core_control/enabled\" ]; then\n                if [ \"`cat /sys/module/msm_thermal/core_control/enabled`\" -eq 0 ]; then\n                    echo \"  Thermal msm_thermal: disabled\"\n                else\n                    echo \"  Thermal msm_thermal: enabled\"\n                fi\n                found=1\n            fi\n            if [ -r \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                local i st en ctl_enabled=0\n                IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n                if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n                    if [ -r \"/sys/devices/system/cpu/cpu7/core_ctl/enable\" ]; then\n                        read ctl_enabled <\"/sys/devices/system/cpu/cpu7/core_ctl/enable\"\n                    elif [ -r \"/sys/devices/system/cpu/cpu6/core_ctl/enable\" ]; then\n                        read ctl_enabled <\"/sys/devices/system/cpu/cpu6/core_ctl/enable\"\n                    elif [ -r \"/sys/devices/system/cpu/cpu4/core_ctl/enable\" ]; then\n                        read ctl_enabled <\"/sys/devices/system/cpu/cpu4/core_ctl/enable\"\n                    elif [ -r \"/sys/devices/system/cpu/cpu0/core_ctl/enable\" ]; then\n                        read ctl_enabled <\"/sys/devices/system/cpu/cpu0/core_ctl/enable\"\n                    fi\n                    if [ \"$ctl_enabled\" -gt 0 ]; then\n                        echo \"  Thermal core_ctl: enabled\"\n                    else\n                        echo \"  Thermal core_ctl: disabled\"\n                    fi\n                    found=1\n                fi\n            fi\n            if [ -n \"`getprop init.svc.thermal`\" ]; then\n                echo \"  Thermal server: `getprop init.svc.thermal`\"\n                found=1\n            elif [ -n \"`getprop init.svc.vendor.thermal`\" ]; then\n                echo \"  Thermal server: `getprop init.svc.vendor.thermal`\"\n                found=1\n            fi\n            if [ -n \"`getprop init.svc.thermald`\" ]; then\n                echo \"  Thermal MTK thermald: `getprop init.svc.thermald`\"\n                found=1\n            fi\n            if [ -n \"`getprop init.svc.thermal_core`\" ]; then\n                echo \"  Thermal MTK thermal_core: `getprop init.svc.thermal_core`\"\n                found=1\n            fi\n            if [ -n \"`getprop init.svc.mi_thermald`\" ]; then\n                echo \"  Thermal mi_thermald: `getprop init.svc.mi_thermald`\"\n                found=1\n            elif [ -n \"`getprop init.svc.vendor.mi_thermald`\" ]; then\n                echo \"  Thermal mi_thermald: `getprop init.svc.vendor.mi_thermald`\"\n                found=1\n            fi\n            if [ -n \"`getprop init.svc.thermal-engine`\" ]; then\n                echo \"  Thermal thermal-engine: `getprop init.svc.thermal-engine`\"\n                found=1\n            elif [ -n \"`getprop init.svc.vendor.thermal-engine`\" ]; then\n                echo \"  Thermal thermal-engine: `getprop init.svc.vendor.thermal-engine`\"\n                found=1\n            fi\n\n            # MPDecision\n            if [ -n \"`getprop init.svc.mpdecision`\" ]; then\n                echo \"  Thermal MPDecision: `getprop init.svc.mpdecision`\"\n                found=1\n            elif [ -n \"`getprop init.svc.vendor.mpdecision`\" ]; then\n                echo \"  Thermal MPDecision: `getprop init.svc.vendor.mpdecision`\"\n                found=1\n            fi\n\n            # MediaTek EAS+ scheduling\n            if [ -r \"/proc/cpufreq/cpufreq_sched_disable\" ]; then\n                set `cat /proc/cpufreq/cpufreq_sched_disable`\n                val=$3\n                if [ \"$val\" -eq '1' ]; then\n                    echo \"  Thermal MTK EAS+: stopped\"\n                else\n                    echo \"  Thermal MTK EAS+: running\"\n                fi\n                found=1\n            fi\n            \n            if [ $found -eq 0 ]; then\n                echo \"  Thermal control: N/A\"\n            fi\n        # End of status print section\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction reduceDozeJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n\n        if [ $flag -gt 0 ]; then\n            # Disable Doze of the device\n            dumpsys deviceidle disable all 1>\"/dev/null\" 2>&1\n        elif [ $flag -lt 0 ]; then\n            # Enable Doze of the device\n            dumpsys deviceidle enable all 1>\"/dev/null\" 2>&1\n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            if [ \"`dumpsys deviceidle enabled all`\" -gt 0 ]; then\n                echo \"  Doze battery saver: enabled\"\n            else\n                echo \"  Doze battery saver: disabled\"\n            fi\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction getQcomGpuFreq()\n{\n    local isMax=\"0\"\n    \n    if [ $# -eq 1  -a  \"$1\" = \"max\" ]; then\n        isMax=\"1\"\n    fi\n    \n    if [ -r \"/sys/class/kgsl/kgsl-3d0/gpu_available_frequencies\"  -a  -r \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\" ]; then\n        local tab x y freq=\"\"\n        \n        read tab <\"/sys/class/kgsl/kgsl-3d0/gpu_available_frequencies\"\n        if [ -z \"$tab\" ]; then\n            return 1\n        fi\n        set $tab 1>\"/dev/null\" 2>&1\n        \n        if [ \"$isMax\" -eq 1 ]; then\n            freq=\"$1\"\n        elif [ -r \"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\" ]; then\n            read x <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n            read y <\"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\"\n            if [ \"$y\" -lt \"$x\" ]; then\n                x=\"$y\"\n            fi\n            if [ \"$x\" -lt $# ]; then\n                shift $x\n            fi\n            freq=\"$1\"\n        else\n            # no estimation possible, so check the current real GPU clock\n            read freq <\"/sys/class/kgsl/kgsl-3d0/gpuclk\"\n        fi\n        \n        if [ -n \"$freq\" ]; then\n            echo \"$freq\"\n            return 0\n        else\n            return 1\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction getMtkGpuFreqKhz()\n{\n    local isMax=\"0\"\n    \n    if [ $# -eq 1  -a  \"$1\" = \"max\" ]; then\n        isMax=\"1\"\n    fi\n    \n    if [ -r \"/proc/gpufreq/gpufreq_opp_dump\" ]; then\n        local x1 x2 x3 x4 x5 freq=\"\" IFS=\" ,\"\n        \n        if [ \"$isMax\" -eq 1 ]; then\n            read x1 x2 x3 x4 x5 <\"/proc/gpufreq/gpufreq_opp_dump\"\n            freq=\"$x4\"\n        else\n            while read x1 x2 x3 x4 x5; do\n                freq=\"$x4\"\n            done <\"/proc/gpufreq/gpufreq_opp_dump\"\n        fi\n        \n        if [ -n \"$freq\" ]; then\n            echo \"$freq\"\n            return 0\n        else\n            return 1\n        fi\n        \n    elif [ -r \"/proc/gpufreqv2/gpu_working_opp_table\"  -a  \"$isMax\" -eq 1 ]; then\n        local x1 x2 x3 x4 freq=\"\" IFS=\" ,\"\n        \n        read x1 x2 x3 x4 <\"/proc/gpufreqv2/gpu_working_opp_table\"\n        freq=\"$x3\"\n        \n        if [ -n \"$freq\" ]; then\n            echo \"$freq\"\n            return 0\n        else\n            return 1\n        fi\n        \n    elif [ -r \"/proc/gpufreqv2/gpufreq_status\" ]; then\n        local x1 x2 x3 x4 x5 x6 x7 freq=\"\" IFS=\" ,\"\n       \n       { \n            read\n            read x1 x2 x3 x4 x5 x6\n            freq=\"$x5\"\n            \n            if [ -n \"$freq\" ]; then\n                echo \"$freq\"\n                return 0\n            else\n                return 1\n            fi\n        } <\"/proc/gpufreqv2/gpufreq_status\"\n        return 0\n\n    else\n        return 1\n    fi\n}\n\nfunction getTensorGpuFreqKhz()\n{\n    local isMax=\"0\"\n    \n    if [ $# -eq 1  -a  \"$1\" = \"max\" ]; then\n        isMax=\"1\"\n    elif [ $# -eq 1  -a  \"$1\" = \"min\" ]; then\n        isMax=\"-1\"\n    fi\n    \n    if [ -r \"/sys/devices/platform/1c500000.mali/available_frequencies\" ]; then\n        local tab x freq=\"\"\n        \n        read tab <\"/sys/devices/platform/1c500000.mali/available_frequencies\"\n        if [ -z \"$tab\" ]; then\n            return 1\n        fi\n        set $tab 1>\"/dev/null\" 2>&1\n        \n        if [ \"$isMax\" -eq 1 ]; then\n            freq=\"$1\"\n        elif [ \"$isMax\" -eq -1 ]; then\n            freq=\"$(eval echo '$'{$#})\"\n        else\n            # return the current GPU clock\n            read freq <\"/sys/devices/platform/1c500000.mali/cur_freq\"\n        fi\n        \n        if [ -n \"$freq\" ]; then\n            echo \"$freq\"\n            return 0\n        else\n            return 1\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction isMtkGpuFreqFixed()\n{\n    if [ -r \"/proc/gpufreq/gpufreq_opp_freq\" ]; then\n        local x1 x2 x3 x4 x5\n        read x1 x2 x3 x4 x5 <\"/proc/gpufreq/gpufreq_opp_freq\"\n        if [ \"$x5\" = \"enabled\" ]; then\n            return 0\n        else\n            return 1\n        fi\n    elif [ -r \"/proc/gpufreqv2/fix_target_opp_index\" ]; then\n        local x1 x2 x3 x4 x5 x6\n        read x1 x2 x3 x4 x5 x6 <\"/proc/gpufreqv2/fix_target_opp_index\"\n        if [ \"$x6\" = \"disabled\" ]; then\n            return 1\n        else\n            return 0\n        fi\n    else\n        return 1\n    fi\n}\n\nfunction validGpuGovernor()\n{\n    if [ $# -eq 2  -a  -r \"$1\" ]; then\n        local lst\n        local gov=\"$2\"\n        local i\n        lst=\"`cat <\\\"$1\\\"`\"\n        for i in $lst; do\n            if [ \"$i\" = \"$gov\" ]; then\n                return 0\n            fi\n        done\n        return 1\n    else\n        return 1\n    fi\n}\n\nfunction getGpuBusmonPath()\n{\n    local x\n    \n    if [ -e \"/sys/class/devfreq/soc:qcom,kgsl-busmon\" ]; then\n        x=\"/sys/class/devfreq/soc:qcom,kgsl-busmon\"\n    elif [ -e \"/sys/class/devfreq/kgsl-busmon\" ]; then\n        x=\"/sys/class/devfreq/kgsl-busmon\"\n     else\n        x=\"\"\n     fi\n     echo \"$x\"\n     return 0\n}\n\nfunction reduceGovernorJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n        local x\n\n        if [ $flag -gt 0 ]; then\n        \n            # CPU governor\n            # prevent CPU offline stuck by forcing online between double  governor writing \n            local i st en\n            IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n            if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n                for i in `seq $st $en`; do\n                    if [ -e \"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\" ]; then\n                        chmod 644 \"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                        echo 'performance' >\"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                        chmod 644 \"/sys/devices/system/cpu/cpu$i/online\"\n                        echo '1' >\"/sys/devices/system/cpu/cpu$i/online\"\n                        # Set the cpu max freq to the scaling_max_freq because some devices sometimes set it to be lower\n                        read x <\"/sys/devices/system/cpu/cpu$i/cpufreq/cpuinfo_max_freq\"\n                        chmod 644 \"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq\"\n                        echo \"$x\" >\"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq\"\n                        echo 'performance' >\"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                    fi\n                done\n            fi\n\n            # Support for the Nyx kernel and others; Disable a workqueue power efficient featute\n            if [ -e \"/sys/module/workqueue/parameters/power_efficient\" ]; then\n                chmod 644 \"/sys/module/workqueue/parameters/power_efficient\"\n                echo 'N' >\"/sys/module/workqueue/parameters/power_efficient\"\n            fi\n\n            # GPU's\n            if [ -w \"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\" ]; then\n                # For old Qcomm GPU's\n                echo 'performance' >\"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\"\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\" ]; then\n                    # Set the min power level to be maximum\n                    read x <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"0\" >\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                    fi\n                fi\n            elif [ -w \"/sys/class/kgsl/kgsl-3d0/devfreq/governor\" ]; then\n                # For Qcomm GPU's\n                if validGpuGovernor \"/sys/class/kgsl/kgsl-3d0/devfreq/available_governors\" \"performance\"; then\n                    # Check whether \"performance\" governor exists or not because some Qcomm recent GPU's don't have the governor\n                    echo 'performance' >\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                    sleep 0.1\n                fi\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq\" ]; then\n                    # Set the min freq\n                    read x <\"/sys/class/kgsl/kgsl-3d0/devfreq/max_freq\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"$x\" >\"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq\"\n                    fi\n                fi\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\" ]; then\n                    # Set the min power level to be maximum\n                    read x <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"0\" >\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                    fi\n                fi\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\" ]; then\n                    # Set the default power level to be maximum\n                    read x <\"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"0\" >\"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\"\n                    fi\n                fi\n                # For some Qcomm GPU's, because they revert the governor after setting min_pwrlevel several times\n                if validGpuGovernor \"/sys/class/kgsl/kgsl-3d0/devfreq/available_governors\" \"performance\"; then\n                    for i in `seq 1 9`; do\n                        x=\"`echo \\\"scale=1;${i}/10\\\" | bc`\"\n                        sleep $x\n                        read x <\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                        if [ \"$x\" = \"performance\" ]; then\n                            break\n                        fi\n                        echo 'performance' >\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                    done\n                fi\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/throttling\" ]; then\n                        echo \"0\" >\"/sys/class/kgsl/kgsl-3d0/throttling\"\n                fi\n                if [ -w \"/sys/class/devfreq/soc:qcom,gpubw/min_freq\" ]; then\n                    # Set the min freq\n                    read x <\"/sys/class/devfreq/soc:qcom,gpubw/max_freq\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"$x\" >\"/sys/class/devfreq/soc:qcom,gpubw/min_freq\"\n                    fi\n                fi\n                local busmon=\"`getGpuBusmonPath`\"\n                if [ -w \"${busmon}/min_freq\" ]; then\n                    # Set the min freq\n                    read x <\"${busmon}/max_freq\"\n                    if [ \"$x\" -ne 0 ]; then\n                        echo \"$x\" >\"${busmon}/min_freq\"\n                    fi\n                    echo \"performance\" >\"${busmon}/governor\"\n                fi\n            elif [ -w \"/proc/gpufreq/gpufreq_opp_freq\" ]; then\n                # Maximum fixed frequency setting for MediaTek GPU's\n                local freq=\"`getMtkGpuFreqKhz \\\"max\\\"`\"\n                if [ -n \"$freq\" ]; then\n                    echo \"$freq\" >\"/proc/gpufreq/gpufreq_opp_freq\"\n                fi\n            elif [ -w \"/proc/gpufreqv2/fix_target_opp_index\" ]; then\n                # Maximum fixed frequency (index 0) setting for MediaTek GPU's\n                echo \"0\" >\"/proc/gpufreqv2/fix_target_opp_index\"\n            elif [ -w \"/sys/devices/platform/1c500000.mali/hint_min_freq\" ]; then\n                # Maximum fixed frequency setting for Tensor GPU's\n                # This makes audio quality poor really, so is avoided\n                local freq=\"`getTensorGpuFreqKhz \\\"max\\\"`\"\n                if [ -n \"$freq\" ]; then\n                    #echo \"$freq\" >\"/sys/devices/platform/1c500000.mali/hint_min_freq\"\n                    :\n                fi\n            fi\n            \n        elif [ $flag -lt 0 ]; then\n\n            # CPU's governor\n            local gov=\"`searchDefaultCpuGovernor`\"\n            # prevent CPU offline stuck by forcing online between double  governor writing\n            local i st en\n            IFS=\"-\" read st en <\"/sys/devices/system/cpu/present\"\n            if [ -n \"$st\"  -a  -n \"$en\"  -a \"$st\" -ge 0  -a  \"$en\" -ge 0 ]; then\n                for i in `seq $st $en`; do\n                    if [ -e \"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\" ]; then\n                        chmod 644 \"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                        echo \"$gov\" >\"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                        chmod 644 \"/sys/devices/system/cpu/cpu$i/online\"\n                        echo '1' >\"/sys/devices/system/cpu/cpu$i/online\"\n                        echo \"$gov\" >\"/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor\"\n                    fi\n                done\n            fi\n            \n            # Support for the Nyx kernel and others; Revert a workqueue power efficient featute\n            if [ -e \"/sys/module/workqueue/parameters/power_efficient\" ]; then\n                chmod 644 \"/sys/module/workqueue/parameters/power_efficient\"\n                echo 'Y' >\"/sys/module/workqueue/parameters/power_efficient\"\n            fi\n\n            # GPU's\n            if [ -w \"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\" ]; then\n                # Default GPU governor for old Qcomm GPU's\n                if [ \"`getprop ro.build.product`\" = \"jfltexx\"  -a   \"`getprop ro.system.build.version.release`\" -ge \"12\" ]; then\n                    echo 'performance' >\"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\"\n                else\n                    echo 'ondemand' >\"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\"\n                fi\n                if [ -r \"/sys/class/kgsl/kgsl-3d0/num_pwrlevels\"  -a  -w \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\" ]; then\n                    # Set the min power level to be minimum\n                    local x=\"4\"\n                    local tmp\n                    read x <\"/sys/class/kgsl/kgsl-3d0/num_pwrlevels\"\n                    x=\"`expr $x - 1`\"\n                    if [ -n \"$x\" ]; then\n                        read tmp <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                        if [ \"$tmp\" -ne \"$x\" ]; then\n                            echo \"$x\" >\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                        fi\n                    fi\n                fi\n            elif [ -w \"/sys/class/kgsl/kgsl-3d0/devfreq/governor\" ]; then\n                local x\n                # Default GPU governor for Qcomm GPU's\n                echo 'msm-adreno-tz' >\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                sleep 0.1\n                if [ -r \"/sys/class/kgsl/kgsl-3d0/num_pwrlevels\"  -a  -w \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\" ]; then\n                    # Set the min power level to be minimum\n                    x=\"6\"\n                    local tmp\n                    read x <\"/sys/class/kgsl/kgsl-3d0/num_pwrlevels\"\n                    x=\"`expr $x - 1`\"\n                    if [ -n \"$x\" ]; then\n                        read tmp <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                        if [ \"$tmp\" -ne \"$x\" ]; then\n                            echo \"$x\" >\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                        fi\n                    fi\n                fi\n                if [ -r \"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"  -a  -w \"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\" ]; then\n                    read x <\"/sys/class/kgsl/kgsl-3d0/min_pwrlevel\"\n                    if [ -n \"$x\" ]; then\n                        echo \"$x\" >\"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\"\n                    fi\n                fi\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq\" ]; then\n                    # Set the min freq to the lowest\n                    echo \"0\" >\"/sys/class/kgsl/kgsl-3d0/devfreq/min_freq\"\n                fi\n\n                # For some Qcomm GPU's, because they revert the governor after setting min_pwrlevel several times\n                for i in `seq 1 9`; do\n                    x=\"`echo \\\"scale=1;${i}/10\\\" | bc`\"\n                    sleep $x\n                    read x <\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                    if [ \"$x\" = \"msm-adreno-tz\" ]; then\n                        break\n                    fi\n                    echo 'msm-adreno-tz' >\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                done\n                if [ -w \"/sys/class/kgsl/kgsl-3d0/throttling\" ]; then\n                        echo \"1\" >\"/sys/class/kgsl/kgsl-3d0/throttling\"\n                fi\n                if [ -w \"/sys/class/devfreq/soc:qcom,gpubw/min_freq\" ]; then\n                    echo \"0\" >\"/sys/class/devfreq/soc:qcom,gpubw/min_freq\"\n                fi\n                local busmon=\"`getGpuBusmonPath`\"\n                if [ -w \"${busmon}/min_freq\" ]; then\n                    # Set the min freq\n                    echo \"0\" >\"${busmon}/min_freq\"\n                    echo \"gpubw_mon\" >\"${busmon}/governor\"\n                fi\n            elif [ -w \"/proc/gpufreq/gpufreq_opp_freq\" ]; then\n                # Variable frequency setting for MediaTek GPU's\n                echo '0' >\"/proc/gpufreq/gpufreq_opp_freq\"\n            elif [ -w \"/proc/gpufreqv2/fix_target_opp_index\" ]; then\n                # Variable frequency (index -1) setting for MediaTek GPU's\n                echo \"-1\" >\"/proc/gpufreqv2/fix_target_opp_index\"\n            elif [ -w \"/sys/devices/platform/1c500000.mali/hint_min_freq\" ]; then\n                # Variable frequency setting for Tensor GPU's\n                local freq=\"`getTensorGpuFreqKhz \\\"min\\\"`\"\n                if [ -n \"$freq\" ]; then\n                    echo \"$freq\" >\"/sys/devices/platform/1c500000.mali/hint_min_freq\"\n                fi\n            fi\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            #CPU Governor\n            if [ -r \"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor\" ]; then\n                # Support for the Nyx kernel and others; Print the status of a workqueue power efficient featute\n                if [ -r \"/sys/module/workqueue/parameters/power_efficient\" ]; then\n                    local pf\n                    read pf <\"/sys/module/workqueue/parameters/power_efficient\"\n                    if [ \"$pf\" = \"Y\" ]; then\n                        pf=\"yes\"\n                    else\n                        pf=\"no\"\n                    fi\n                    echo \"  Gov. CPU: `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` (wq psave: $pf)\"\n                else\n                    echo \"  Gov. CPU: `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`\"\n                fi\n            fi\n            \n            if [ -r \"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\" ]; then\n                # For old Qcomm GPU Governor\n                local freq gov\n                read gov <\"/sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor\"\n                if [ \"$gov\" = \"performance\" ]; then\n                    freq=\"`getQcomGpuFreq \\\"max\\\"`\"\n                    freq=\"`expr $freq / 1000000`MHz\"\n                    echo \"  Gov. GPU: performance (fixed: $freq)\"\n                else\n                    freq=\"`getQcomGpuFreq \\\"typical\\\"`\"\n                    freq=\"`expr $freq / 1000000`Mhz\"\n                    echo \"  Gov. GPU: $gov (typ.: $freq)\"\n                fi\n            elif [ -w \"/sys/class/kgsl/kgsl-3d0/devfreq/governor\" ]; then\n                # For Qcomm GPU Governor\n                local freq gov def_pwrl\n                read gov <\"/sys/class/kgsl/kgsl-3d0/devfreq/governor\"\n                if [ -r \"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\" ]; then\n                    read def_pwrl <\"/sys/class/kgsl/kgsl-3d0/default_pwrlevel\"\n                else\n                    def_pwrl=\"1\"\n                fi\n                if [ \"$gov\" = \"performance\"  -o  \"$def_pwrl\" -eq 0 ]; then\n                    freq=\"`getQcomGpuFreq \\\"max\\\"`\"\n                    freq=\"`expr $freq / 1000000`MHz\"\n                    echo \"  Gov. GPU: $gov (fixed: $freq)\"\n                else\n                    freq=\"`getQcomGpuFreq \\\"typical\\\"`\"\n                    freq=\"`expr $freq / 1000000`MHz\"\n                    echo \"  Gov. GPU: $gov (typ.: $freq)\"\n                fi\n            elif [ -r \"/proc/gpufreq/gpufreq_opp_freq\"  -o  -r \"/proc/gpufreqv2/gpu_working_opp_table\" ]; then\n                # For getting MediaTek GPU settings\n                local freq\n                if isMtkGpuFreqFixed; then\n                    freq=\"`getMtkGpuFreqKhz \\\"max\\\"`\"\n                    freq=\"`expr $freq / 1000`MHz\"\n                    echo \"  Gov. GPU: max freq (fixed: $freq)\"\n                else\n                    freq=\"`getMtkGpuFreqKhz \\\"typical\\\"`\"\n                    freq=\"`expr $freq / 1000`MHz\"\n                    echo \"  Gov. GPU: variable freq (typ.: $freq)\"\n                fi\n            elif [ -r \"/sys/devices/platform/1c500000.mali/cur_freq\" ]; then\n                # Get the current Tensor GPU frequency\n                local freq=\"`getTensorGpuFreqKhz`\"\n                if [ \"$freq\" = \"`getTensorGpuFreqKhz \\\"max\\\"`\" ]; then\n                    freq=\"`expr $freq / 1000`MHz\"\n                    echo \"  Gov. GPU: max freq (fixed: $freq)\"\n                else\n                    freq=\"`expr $freq / 1000`MHz\"\n                    echo \"  Gov. GPU: variable freq (typ.: $freq)\"\n                fi\n            fi\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction reduceLogdJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n\n        if [ $flag -gt 0 ]; then\n        \n            # Stop the Logd servers\n            if [ \"`getprop init.svc.logd`\" = \"running\" ]; then\n                setprop ctl.stop logd\n            elif [ \"`getprop init.svc.logd`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.logd`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.traced`\" = \"running\" ]; then\n                setprop ctl.stop traced\n            elif [ \"`getprop init.svc.traced`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.traced`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.traced_probes`\" = \"running\" ]; then\n                setprop ctl.stop traced_probes\n            elif [ \"`getprop init.svc.traced_probes`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.traced_probes`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            \n        elif [ $flag -lt 0 ]; then\n        \n            # Start the Logd servers\n            if [ \"`getprop init.svc.traced_probes`\" = \"stopped\" ]; then\n                setprop ctl.start traced_probes\n            elif [ \"`getprop init.svc.traced_probes`\" = \"stopping\" ]; then\n                setprop ctl.restart traced_probes\n            fi\n            if [ \"`getprop init.svc.traced`\" = \"stopped\" ]; then\n                setprop ctl.start traced\n            elif [ \"`getprop init.svc.traced`\" = \"stopping\" ]; then\n                setprop ctl.restart traced\n            fi\n            if [ \"`getprop init.svc.logd`\" = \"stopped\" ]; then\n                setprop ctl.start logd\n            elif [ \"`getprop init.svc.logd`\" = \"stopping\" ]; then\n                setprop ctl.restart logd\n            fi\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            local val=\"`getprop init.svc.logd`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Logd main server: $val\"\n            fi\n            val=\"`getprop init.svc.traced`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Logd traced server: $val\"\n            fi\n            val=\"`getprop init.svc.traced_probes`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Logd traced_probes server: $val\"\n            fi\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction reduceCameraJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n\n        if [ $flag -gt 0 ]; then\n        \n            # Stop the camera servers\n            if [ \"`getprop init.svc.qcamerasvr`\" = \"running\" ]; then\n                setprop ctl.stop qcamerasvr\n            elif [ \"`getprop init.svc.qcamerasvr`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.qcamerasvr`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.vendor.qcamerasvr`\" = \"running\" ]; then\n                setprop ctl.stop vendor.qcamerasvr\n            elif [ \"`getprop init.svc.vendor.qcamerasvr`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.vendor.qcamerasvr`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.cameraserver`\" = \"running\" ]; then\n                setprop ctl.stop cameraserver\n            elif [ \"`getprop init.svc.cameraserver`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.cameraserver`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.camerasloganserver`\" = \"running\" ]; then\n                setprop ctl.stop camerasloganserver\n            elif [ \"`getprop init.svc.camerasloganserver`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.camerasloganserver`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            if [ \"`getprop init.svc.camerahalserver`\" = \"running\" ]; then\n                setprop ctl.stop camerahalserver\n            elif [ \"`getprop init.svc.camerahalserver`\" = \"stopping\" ]; then\n                local pid=\"`getprop init.svc_debug_pid.camerahalserver`\"\n                if [ -n \"$pid\" ]; then\n                    kill -HUP $pid 1>\"/dev/null\" 2>&1\n                fi\n            fi\n            \n        elif [ $flag -lt 0 ]; then\n        \n            # Start the camera servers\n            if [ \"`getprop init.svc.qcamerasvr`\" = \"stopped\" ]; then\n                setprop ctl.start qcamerasvr\n            elif [ \"`getprop init.svc.qcamerasvr`\" = \"stopping\" ]; then\n                setprop ctl.restart qcamerasvr\n            fi\n            if [ \"`getprop init.svc.vendor.qcamerasvr`\" = \"stopped\" ]; then\n                setprop ctl.start vendor.qcamerasvr\n            elif [ \"`getprop init.svc.vendor.qcamerasvr`\" = \"stopping\" ]; then\n                setprop ctl.restart vendor.qcamerasvr\n            fi\n            if [ \"`getprop init.svc.cameraserver`\" = \"stopped\" ]; then\n                setprop ctl.start cameraserver\n            fi\n            if [ \"`getprop init.svc.camerasloganserver`\" = \"stopped\" ]; then\n                setprop ctl.start camerasloganserver\n            fi\n            if [ \"`getprop init.svc.camerahalserver`\" = \"stopped\" ]; then\n                setprop ctl.start camerahalserver\n            fi\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            local val=\"`getprop init.svc.qcamerasvr`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Qcom camera server: $val\"\n                return 0\n            fi\n            val=\"`getprop init.svc.vendor.qcamerasvr`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Qcom camera server: $val\"\n                return 0\n            fi\n            val=\"`getprop init.svc.cameraserver`\"\n            if [ -n  \"$val\" ]; then\n                echo \"  Camera server: $val\"\n                return 0\n            fi\n        fi\n        \n    else\n        return 1\n    fi\n}\n\n# choose the best I/O scheduler for very Hifi audio outputs, and output it into the standard output\nfunction chooseBestIOScheduler()\n{\n    if [ $# -eq 1  -a  -r \"$1\" ]; then\n        local x scheds ret_val=\"\"\n  \n        scheds=\"`tr -d '[]' <\\\"$1\\\"`\"\n        for x in $scheds; do\n            case \"$x\" in\n                \"deadline\" ) ret_val=\"deadline\"; break ;;\n                \"mq-deadline\" ) ret_val=\"mq-deadline\"; break ;;\n                \"kyber\" ) ret_val=\"kyber\" ;;\n                \"cfq\" ) if [ \"$ret_val\" != \"kyber\" ]; then ret_val=\"cfq\"; fi ;;\n                \"noop\" | \"none\" ) if [ \"$ret_val\" != \"cfq\"  -o  \"$ret_val\" != \"kyber\" ]; then ret_val=\"$x\"; fi ;;\n                * ) ;;\n            esac\n        done\n        echo \"$ret_val\"\n        return 0\n    else\n        return 1\n    fi\n}\n\nfunction selectedScheduler()\n{\n    if [ $# -eq 1  -a  -r \"$1\" ]; then\n        local sched=\"`cat \\\"$1\\\"`\"\n        if [ -n \"$sched\" ]; then\n            local val\n            val=`expr \"$sched\" : '[^[]*\\[\\([^]]*\\)\\]'`\n            echo \"$val\"\n            return 0\n        else\n            return 1\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction validScheduler()\n{\n    if [ $# -eq 2  -a  -r \"$1\" ]; then\n        local lst\n        local sched=\"$2\"\n        local i\n        lst=\"`tr -d '[]' <\\\"$1\\\"`\"\n        for i in $lst; do\n            if [ \"$i\" = \"$sched\" ]; then\n                return 0\n            fi\n        done\n        return 1\n    else\n        return 1\n    fi\n}\n\nfunction nth()\n{\n    if [ $# -eq 2  -a  -n \"$1\" ]; then\n    \n        if [ -n \"$2\"  -a  \"$2\" -gt 0 ]; then\n        \n            local v\n            local i=1\n            \n            for v in $1; do\n                if [ \"$2\" -eq \"$i\" ]; then\n                    echo \"$v\"\n                    return 0\n                else\n                    i=\"`expr $i + 1`\"\n                fi\n            done\n            return 1\n            \n        else\n        \n            retrun 1\n            \n        fi\n        \n    else\n    \n        return 1\n        \n    fi\n}\n\nfunction getSocModelName()\n{\n    local modelName=\"`getprop ro.board.platform`\"\n    case \"$modelName\" in\n            sd* | msm* | exynos* | mt* | gs* )\n                echo \"$modelName\"\n                return 0\n                ;;\n            zuma* )\n                echo \"gs301\"\n                return 0\n                ;;\n            * )\n                case \"`getprop ro.boot.hardware`\" in\n                    qcom )\n                        # High performance Qcomm SoC devices tend to have code names\n                        # (not real SoC name, but compatible name in this library)\n                        case \"$modelName\" in\n                            \"kona\" | \"kalama\" | \"shima\" | \"yupik\" )\n                                echo \"sdm870\"\n                                ;;\n                            \"bengal\" )\n                                echo \"sdm680\"\n                                ;;\n                            \"holi\" )\n                                echo \"sdm680\"\n                                ;;\n                            \"pineapple\" )\n                                echo \"sm8635\"\n                                ;;\n                            * )\n                                 if [ -r \"/sys/devices/system/cpu/cpu7/core_ctl/enable\" ]; then\n                                    echo \"sdm855\"\n                                 else\n                                    echo \"sdm845\"\n                                 fi\n                                ;;\n                        esac\n                        return 0\n                        ;;\n                    * )\n                        echo \"unknown\"\n                        return 0\n                        ;;\n                esac\n                ;;\n    esac\n    \n    return 1\n}\n\nfunction adjustForSoC()\n{\n    if [ $# -eq 1  -a  -n \"$1\"  -a  \"$1\" -ge 0 ]; then\n        case \"`getSocModelName`\" in\n            sdm* | msm* | sd* | exynos* )\n                echo \"`expr  '(' $1 / 10 ')' '*' 10 + '(' '(' $1 % 10 ')' / 3 ')' '*' 3`\"\n                ;;\n            mt6* )\n                echo \"`expr '(' '(' $1 + 1 ')' / 4 ')' '*' 4`\"\n                ;;\n            * )\n                echo \"$1\"\n                ;;\n        esac\n        return 0\n        \n    else\n        return 1\n        \n    fi\n}\n\nfunction adjustForSoC_mq()\n{\n    if [ $# -eq 1  -a  -n \"$1\"  -a  \"$1\" -ge 0 ]; then\n        local kername=\"`uname -r`\"\n        kername=${kername#*-}\n\n        case  \"$kername\" in\n            perf* | android* )\n                # Round to multiples of 4; for Xiaomi Bengal and Google kernels\n                echo \"`expr  '(' '(' $1 + 2 ')' / 4 ')' '*' 4`\"\n                return 0\n                ;;\n            SouthWest* | Nyx* )\n                # for Nyx and SouthWest kernels (100Hz)\n                if [ \"$1\" -ge 250 ]; then\n                    # Round off (<7) and up (>=7)\n                    echo \"`expr  '(' '(' $1 + 3 ')' / 10 ')' '*' 10`\"\n                else\n                    # Round down\n                    echo \"`expr  '(' '(' $1 + 0 ')' / 10 ')' '*' 10`\"\n                fi\n                return 0\n                ;;\n            * )\n               if [ \"`getprop ro.build.product`\" = \"clover\"  -a  \"`getprop ro.build.version.release`\" -ge \"14\" ]; then\n                    # Not Round for A14 and later (1000Hz kernels)\n                    echo \"$1\"\n                else\n                    adjustForSoC \"$1\"\n                fi\n                 return 0\n                ;;\n        esac\n        return 0\n        \n    else\n        return 1\n        \n    fi\n}\n\nfunction adjustSchedulerParameter()\n{\n    if [ $# -eq 3 ]; then\n        \n        if [ \"$1\" = \"deadline\"  -a  -n \"$2\"  -a  -n \"$3\" ]; then\n            case \"$2\" in\n                \"read_expire\" )\n                    echo \"`adjustForSoC \\\"$3\\\"`\"\n                    ;;\n                \"write_expire\" )\n                    echo \"`adjustForSoC \\\"$3\\\"`\"\n                    ;;\n                * )\n                    echo \"$3\"\n                    ;;\n            esac\n        elif [ \"$1\" = \"mq-deadline\"  -a  -n \"$2\"  -a  -n \"$3\" ]; then\n            case \"$2\" in\n                \"read_expire\" )\n                    echo \"`adjustForSoC_mq \\\"$3\\\"`\"\n                    ;;\n                \"write_expire\" )\n                    echo \"`adjustForSoC_mq \\\"$3\\\"`\"\n                    ;;\n                * )\n                    echo \"$3\"\n                    ;;\n            esac\n        else\n            echo \"$3\"\n        fi\n        return 0\n        \n    else\n        \n        return 1\n        \n    fi\n}\n\nfunction getSchedulerParams()\n{\n    if [ $# -eq 1 ]; then\n        case \"$1\" in\n            \"deadline\" | \"mq-deadline\" )\n                echo \"fifo_batch front_merges read_expire write_expire writes_starved\"\n                ;;\n            \"cfq\" )\n                echo \"back_seek_penalty fifo_expire_async fifo_expire_sync group_idle low_latency quantum slice_async slice_async_rq \\\n                    slice_async_us slice_idle slice_sync target_latency\"\n                ;;\n            \"kyber\" )\n                echo \"read_lat_nsec write_lat_nsec\"\n                ;;\n            \"noop\" | \"none\" | * )\n                echo \"\"\n                ;;\n        esac\n        return 0\n    else\n        return 1\n    fi\n}\n\nfunction getSchedulerValues()\n{\n    if [ $# -eq 2 ]; then\n        case \"$1\" in\n            \"deadline\" | \"mq-deadline\" )\n                #   fifo_batch front_merges read_expire write_expire writes_starved\n                case \"$2\" in\n                    \"light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* | gs* )\n                                echo \"71 0 28 496 0\"\n                                ;;\n                            sdm8* )\n                                echo \"73 0 24 484 0\"\n                                ;;\n                            * )\n                                echo \"64 0 32 504 0\"\n                                ;;\n                        esac\n                        ;;\n                    \"m-light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* | gs* )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                            sdm8* )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                            mt68* )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                            mt67[7-9]? )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                            * )\n                                echo \"92 0 36 516 0\"\n                                ;;\n                        esac\n                        ;;\n                    \"boost\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* )\n                                echo \"139 0 36 516 0\"\n                                ;;\n                            sdm8[5-9]* | sdm9* )\n                                echo \"145 0 36 516 0\"\n                                ;;\n                            gs* )\n                                echo \"145 0 36 516 0\"\n                                ;;\n                            sdm8* )\n                                echo \"133 0 36 516 0\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"133 0 38 517 0\"\n                                ;;\n                            mt68* )\n                                echo \"149 0 36 516 0\"\n                                ;;\n                            mt67[7-9]? )\n                                echo \"139 0 36 516 0\"\n                                ;;\n                            * )\n                                echo \"139 0 36 516 0\"\n                                ;;\n                        esac\n                        ;;\n                    \"medium\" | *)\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                            gs* )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                            sdm8* )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"127 0 38 517 0\"\n                                ;;\n                            mt68* )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                            mt67[7-9]? )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                            * )\n                                echo \"127 0 36 516 0\"\n                                ;;\n                        esac\n                        ;;\n                esac\n                ;;\n                \n            \"cfq\" )\n                #   back_seek_penalty fifo_expire_async fifo_expire_sync group_idle low_latency quantum slice_async slice_async_rq\n                #       slice_async_us slice_idle slice_sync target_latency\n                case \"$2\" in\n                    \"light\" )\n                        echo \"1 3 3 0 1 1 3 46 3000 0 3 3\"\n                        ;;\n                    \"m-light\" )\n                        echo \"1 3 3 0 1 1 3 51 3000 0 3 3\"\n                        ;;\n                    \"boost\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | mt68* | gs* | sd* | exynos* )\n                                echo \"1 1 1 0 1 1 0 77 877 0 1 1\"\n                                ;;\n                            * )\n                                echo \"1 3 3 0 1 1 3 59 3000 0 3 3\"\n                                ;;\n                        esac\n                        ;;\n                    \"medium\" | * )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | mt68* | gs* | sd* | exynos* )\n                                echo \"1 1 1 0 1 1 0 77 877 0 1 1\"\n                                ;;\n                            * )\n                                echo \"1 3 3 0 1 1 3 59 3000 0 3 3\"\n                                ;;\n                        esac\n                        ;;\n                esac\n                ;;\n                \n            \"kyber\" )\n                #  read_lat_nsec write_lat_nsec\n                echo \"1000001 1000001\"\n                ;;\n                \n            \"noop\" | \"none\" | * )\n                echo \"\"\n                ;;\n                \n        esac\n        return 0\n    else\n        return 1\n    fi\n}\n\nfunction getSchedulerNrRequests()\n{\n    if [ $# -eq 2 ]; then\n        \n        case \"$1\" in\n            \"mq-deadline\" | \"kyber\" | \"bfq\" )\n                case \"`getSocModelName`\" in\n                    sm[6-8]* )\n                        echo \"2031\"\n                        ;;\n                    gs* )\n                        echo \"2031\"\n                        ;;\n                    mt68* )\n                        echo \"2031\"\n                        ;;\n                    * )\n                        echo \"2031\"\n                        ;;\n                esac\n                ;;\n                \n            \"none\" )\n                echo \"31\"\n                ;;\n                \n            \"deadline\" )\n                case \"$2\" in\n                    \"light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* | gs* )\n                                echo \"80645\"\n                                ;;\n                            sdm8* )\n                                echo \"80000\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"81660\"\n                                ;;\n                            * )\n                                echo \"78550\"\n                                ;;\n                        esac\n                        ;;\n                    \"m-light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* | gs* )\n                                echo \"86170\"\n                                ;;\n                            sdm8* )\n                                echo \"86164\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"86170\"\n                                ;;\n                            mt68* )\n                                echo \"86174\"\n                                ;;\n                            mt67[6-9]? )\n                                echo \"86172\"\n                                ;;\n                            * )\n                                echo \"86172\"\n                                ;;\n                        esac\n                        ;;\n                    \"boost\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* )\n                                echo \"86181\"\n                                ;;\n                            sdm8[5-9]* | sdm9* )\n                                echo \"86179\"\n                                ;;\n                            gs* )\n                                echo \"86181\"\n                                ;;\n                            sdm8* )\n                                echo \"86193\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"86193\"\n                                ;;\n                            mt68* )\n                                echo \"86181\"\n                                ;;\n                            mt67[7-9]? )\n                                echo \"86181\"\n                                ;;\n                            * )\n                                echo \"86181\"\n                                ;;\n                        esac\n                        ;;\n                    \"medium\" | * )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm8[5-9]* | sdm9* | gs* )\n                                echo \"86179\"\n                                ;;\n                            sdm8* )\n                                echo \"86179\"\n                                ;;\n                            sdm* | msm* | sd* | exynos* )\n                                echo \"86179\"\n                                ;;\n                            mt68* )\n                                echo \"86179\"\n                                ;;\n                            mt67[6-9]? )\n                                echo \"86179\"\n                                ;;\n                            * )\n                                echo \"86179\"\n                                ;;\n                        esac\n                        ;;\n                esac\n                ;;\n                \n            \"cfq\" )\n                case \"$2\" in\n                    \"light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86021\"\n                                ;;\n                            * )\n                                echo \"86021\"\n                                ;;\n                        esac\n                        ;;\n                    \"m-light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86164\"\n                                ;;\n                            * )\n                                echo \"86164\"\n                                ;;\n                        esac\n                        ;;\n                    \"boost\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86172\"\n                                ;;\n                            * )\n                                echo \"86172\"\n                                ;;\n                        esac\n                        ;;\n                    \"medium\" | * )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86172\"\n                                ;;\n                            * )\n                                echo \"86172\"\n                                ;;\n                        esac\n                        ;;\n                esac\n                ;;\n            \n            \"noop\" | * )\n                case \"$2\" in\n                    \"light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"80645\"\n                                ;;\n                            * )\n                                echo \"80645\"\n                                ;;\n                        esac\n                        ;;\n                    \"m-light\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86164\"\n                                ;;\n                            * )\n                                echo \"86164\"\n                                ;;\n                        esac\n                        ;;\n                    \"boost\" )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86172\"\n                                ;;\n                            * )\n                                echo \"86172\"\n                                ;;\n                        esac\n                        ;;\n                    \"medium\" | * )\n                        case \"`getSocModelName`\" in\n                            sm[6-8]* | sdm* | msm* | sd* | exynos* | gs* )\n                                echo \"86172\"\n                                ;;\n                            * )\n                                echo \"86172\"\n                                ;;\n                        esac\n                        ;;\n                esac\n               ;;\n                \n        esac\n        return 0\n    else\n        return 1\n    fi\n}\n\nfunction reduceIoJitter() \n{\n    if [ $# -eq 4 ]; then\n        local flag=\"$1\"\n        local ioScheduler=\"$2\"\n        local toneMode=\"$3\"\n        local printStatus=\"$4\"\n\n        if [ $flag -gt 0 ]; then\n        \n            local sched params vals nr_requests\n            local i p v j\n            for i in sda mmcblk0 mmcblk1; do\n                if [ -d \"/sys/block/$i/queue\" ]; then\n                    if [ -z \"$ioScheduler\"  -o  \"$ioScheduler\" = \"*\" ]; then\n                        sched=\"`chooseBestIOScheduler \\\"/sys/block/$i/queue/scheduler\\\"`\"\n                    else\n                        sched=\"$ioScheduler\"\n                    fi\n                    if validScheduler \"/sys/block/$i/queue/scheduler\" \"$sched\"; then\n                        \n                        params=\"`getSchedulerParams \\\"$sched\\\"`\"\n                        vals=\"`getSchedulerValues \\\"$sched\\\" \\\"$toneMode\\\"`\"\n                        nr_requests=\"`getSchedulerNrRequests \\\"$sched\\\" \\\"$toneMode\\\"`\"\n                        echo \"$sched\" >\"/sys/block/$i/queue/scheduler\"\n                        echo '17000' >\"/sys/block/$i/queue/read_ahead_kb\"\n                        echo '0' >\"/sys/block/$i/queue/iostats\"\n                        echo '0' >\"/sys/block/$i/queue/add_random\"\n                        echo '2' >\"/sys/block/$i/queue/rq_affinity\"\n                        echo '2' >\"/sys/block/$i/queue/nomerges\"\n                        echo \"$nr_requests\" >\"/sys/block/$i/queue/nr_requests\"\n                        # waiting for kenel tunables syncing\n                        sleep 0.05\n                        read v <\"/sys/block/$i/queue/nr_requests\"\n                        if [ \"$nr_requests\" -ne \"$v\" ]; then\n                            # If exceeding its max value, then use a safe kenel value (for multi-queue schedulers) within 2048 (except its \"none\" scheduler)\n                            if [ \"$sched\" = \"none\" ]; then\n                                echo \"31\" >\"/sys/block/$i/queue/nr_requests\"\n                            else\n                                echo \"2031\" >\"/sys/block/$i/queue/nr_requests\"\n                            fi\n                        fi\n                        \n                        # For 5.10 or later Kernels\n                        if [ \"$sched\" = \"mq-deadline\" ]; then\n                            if [ -w \"/sys/block/$i/queue/iosched/async_depth\" ]; then\n                                case \"`getSocModelName`\" in\n                                    sm[6-8]* )\n                                        echo '30' >\"/sys/block/$i/queue/iosched/async_depth\"\n                                        ;;\n                                    gs* )\n                                        echo '30' >\"/sys/block/$i/queue/iosched/async_depth\"\n                                        ;;\n                                    mt68* )\n                                        echo '30' >\"/sys/block/$i/queue/iosched/async_depth\"\n                                        ;;\n                                    * )\n                                        echo '30' >\"/sys/block/$i/queue/iosched/async_depth\"\n                                        ;;\n                                esac\n                            fi\n                            if [ -w \"/sys/block/$i/queue/iosched/prio_aging_expire\" ]; then\n                                case \"`getSocModelName`\" in\n                                    sm[6-8]* )\n                                        echo '6903164' >\"/sys/block/$i/queue/iosched/prio_aging_expire\"\n                                        ;;\n                                    gs* )\n                                        echo '6903164' >\"/sys/block/$i/queue/iosched/prio_aging_expire\"\n                                        ;;\n                                    * )\n                                        echo '6903152' >\"/sys/block/$i/queue/iosched/prio_aging_expire\"\n                                        ;;\n                                esac\n                            elif [ -w \"/sys/block/$i/queue/iosched/aging_expire\" ]; then\n                                # for MTK Dimensity\n                                echo '6903164' >\"/sys/block/$i/queue/iosched/aging_expire\"\n                            fi\n                        fi\n                        \n                        j=1\n                        for p in $params; do\n                            v=\"`nth \\\"$vals\\\" \\\"$j\\\"`\"\n                            v=\"`adjustSchedulerParameter \\\"$sched\\\" \\\"$p\\\" \\\"$v\\\"`\"\n                            if [ -w \"/sys/block/$i/queue/iosched/$p\"  -a  -n \"$v\"  -a  \"$v\" -ge 0 ]; then\n                                echo \"$v\" >\"/sys/block/$i/queue/iosched/$p\"\n                            fi\n                            j=\"`expr $j + 1`\"\n                        done\n                        \n                    else\n                        \n                        local sched_lst=\"`tr -d '[]'  <\\\"/sys/block/$i/queue/scheduler\\\"`\"\n                        echo \"Warning: ignoring wrong I/O scheduler (\\\"$sched\\\") settings for block device \\\"/dev/$i\\\".\" 1>&2\n                        echo \"  available I/O schedulers: $sched_lst\" 1>&2\n                        \n                    fi\n                fi\n            done\n            \n        elif [ $flag -lt 0 ]; then\n        \n            for i in sda mmcblk0 mmcblk1; do\n                if [ -d \"/sys/block/$i/queue\" ]; then\n                    if validScheduler \"/sys/block/$i/queue/scheduler\" \"noop\"; then\n                        echo 'noop' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"none\"; then\n                        echo 'none' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    fi\n                    \n                    local kerVersion=\"`uname -r`\"\n                    kerVersion=${kerVersion%%.*}\n                    if [ \"`getprop ro.build.product`\" = \"jfltexx\" ] && validScheduler \"/sys/block/$i/queue/scheduler\" \"deadline\"; then\n                        echo 'deadline' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif [ \"$kerVersion\" -ge 6 ] && validScheduler \"/sys/block/$i/queue/scheduler\" \"mq-deadline\"; then\n                        echo 'mq-deadline' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"ssg\"; then\n                        echo 'ssg' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif [ \"`getprop ro.soc.manufacturer`\" = \"Mediatek\"  -a  \"$kerVersion\" -eq 5 ] \\\n                          && validScheduler \"/sys/block/$i/queue/scheduler\" \"mq-deadline\"; then\n                        echo 'mq-deadline' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"cfq\"; then\n                        echo 'cfq' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"bfq\"; then\n                        echo 'bfq' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"mq-deadline\"; then\n                        echo 'mq-deadline' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"kyber\"; then\n                        echo 'kyber' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    elif validScheduler \"/sys/block/$i/queue/scheduler\" \"deadline\"; then\n                        echo 'deadline' >\"/sys/block/$i/queue/scheduler\"\n                        sleep 0.05\n                    fi\n                    \n                    echo '1' >\"/sys/block/$i/queue/iostats\"\n                    echo '0' >\"/sys/block/$i/queue/add_random\"\n                    echo '1' >\"/sys/block/$i/queue/rq_affinity\"\n                    echo '0' >\"/sys/block/$i/queue/nomerges\"\n                    \n                    case \"`getSocModelName`\" in\n                        sm[6-8]* | sdm8[5-9]* | sdm9* | sdm66* )\n                            echo '512' >\"/sys/block/$i/queue/read_ahead_kb\"\n                            echo '128' >\"/sys/block/$i/queue/nr_requests\"\n                            ;;\n                        gs* )\n                            echo '128' >\"/sys/block/$i/queue/read_ahead_kb\"\n                            echo '64' >\"/sys/block/$i/queue/nr_requests\"\n                            ;;\n                        * )\n                            if [ \"`getprop ro.build.product`\" = \"jfltexx\"  -a   \"`getprop ro.system.build.version.release`\" -ge \"12\" ]; then\n                                echo '512' >\"/sys/block/$i/queue/read_ahead_kb\"\n                            else\n                                echo '128' >\"/sys/block/$i/queue/read_ahead_kb\"\n                            fi\n                            \n                            echo '128' >\"/sys/block/$i/queue/nr_requests\"\n                            ;;\n                    esac\n                fi\n            done\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            local i j val lst\n            for i in sda mmcblk0 mmcblk1; do\n                if [ -d \"/sys/block/$i/queue\" ]; then\n                    val=\"`selectedScheduler \\\"/sys/block/$i/queue/scheduler\\\"`\"\n                    echo \"  I/O scheduler: $val\"\n                    lst=\"`ls \\\"/sys/block/$i/queue/iosched/\\\"*`\" 2>\"/dev/null\"\n                    if [ -n \"$lst\" ]; then\n                        echo \"    {\"\n                        for j in $lst; do\n                            val=\"`cat \\\"$j\\\"`\"\n                            echo \"      ${j##*/}: $val\"\n                        done\n                        echo \"    }\"\n                    fi\n                    val=\"`cat \\\"/sys/block/$i/queue/read_ahead_kb\\\"`\"\n                    echo \"  I/O read ahead size: $val KB\"\n                    val=\"`cat \\\"/sys/block/$i/queue/iostats\\\"`\"\n                    echo \"  I/O iostat: $val\"\n                    val=\"`cat \\\"/sys/block/$i/queue/rq_affinity\\\"`\"\n                    echo \"  I/O rq affinity: $val\"\n                    val=\"`cat \\\"/sys/block/$i/queue/nomerges\\\"`\"\n                    echo \"  I/O nomerges: $val\"\n                    val=\"`cat \\\"/sys/block/$i/queue/nr_requests\\\"`\"\n                    echo \"  I/O nr requests: $val\"\n                    break\n                fi\n            done\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction reduceVmJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n\n        if [ $flag -gt 0 ]; then\n        \n            if [ -w \"/proc/sys/vm/swappiness\" ]; then\n                echo '0' >\"/proc/sys/vm/swappiness\"\n            fi\n            if [ -w \"/proc/sys/vm/direct_swappiness\" ]; then\n                echo '0' >\"/proc/sys/vm/direct_swappiness\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_ratio\" ]; then\n                echo '100' >\"/proc/sys/vm/dirty_ratio\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_background_ratio\" ]; then\n                echo '100' >\"/proc/sys/vm/dirty_background_ratio\"\n            elif [ -w \"/proc/sys/vm/dirty_background_ratio_nosys\" ]; then\n                echo '100' >\"/proc/sys/vm/dirty_background_ratio_nosys\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_expire_centisecs\" ]; then\n                echo '1201001' >\"/proc/sys/vm/dirty_expire_centisecs\"\n            elif [ -w \"/proc/sys/vm/dirty_expire_centisecs_nosys\" ]; then\n                echo '1201001' >\"/proc/sys/vm/dirty_expire_centisecs_nosys\"\n            fi\n            echo '221001' >\"/proc/sys/vm/dirty_writeback_centisecs\"\n            echo '1' >\"/proc/sys/vm/laptop_mode\"\n            if [ -w \"/proc/sys/vm/swap_ratio\" ]; then\n                echo '0' >\"/proc/sys/vm/swap_ratio\"\n            fi\n            if [ -w \"/proc/sys/vm/swap_ratio_enable\" ]; then\n                echo '1' >\"/proc/sys/vm/swap_ratio_enable\"\n            fi\n            \n        elif [ $flag -lt 0 ]; then\n        \n            if [ -w \"/proc/sys/vm/swappiness\" ]; then\n                echo '60' >\"/proc/sys/vm/swappiness\"\n            fi\n            if [ -w \"/proc/sys/vm/direct_swappiness\" ]; then\n                echo '60' >\"/proc/sys/vm/direct_swappiness\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_ratio\" ]; then\n                echo '20' >\"/proc/sys/vm/dirty_ratio\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_background_ratio\" ]; then\n                echo '10' >\"/proc/sys/vm/dirty_background_ratio\"\n            elif [ -w \"/proc/sys/vm/dirty_background_ratio_nosys\" ]; then\n                echo '10' >\"/proc/sys/vm/dirty_background_ratio_nosys\"\n            fi\n            if [ -w \"/proc/sys/vm/dirty_expire_centisecs\" ]; then\n                echo '200' >\"/proc/sys/vm/dirty_expire_centisecs\"\n                echo '500' >\"/proc/sys/vm/dirty_writeback_centisecs\"\n            elif [ -w \"/proc/sys/vm/dirty_expire_centisecs_nosys\" ]; then\n                echo '3000' >\"/proc/sys/vm/dirty_expire_centisecs_nosys\"\n                echo '0' >\"/proc/sys/vm/dirty_writeback_centisecs\"\n            fi\n            echo '0' >\"/proc/sys/vm/laptop_mode\"\n            if [ -w \"/proc/sys/vm/swap_ratio\" ]; then\n                echo '100' >\"/proc/sys/vm/swap_ratio\"\n            fi\n            if [ -w \"/proc/sys/vm/swap_ratio_enable\" ]; then\n                echo '0' >\"/proc/sys/vm/swap_ratio_enable\"\n            fi\n            \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            # I don't know the reason, but \"read val <'/proc/sys/vm/swappiness'\", etc. cannot get its whole value (only first one character)\n            local val\n            if [ -r \"/proc/sys/vm/swappiness\" ]; then\n                val=\"`cat /proc/sys/vm/swappiness`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM swappiness: $val\"\n                fi\n            fi\n            if [ -r \"/proc/sys/vm/direct_swappiness\" ]; then\n                val=\"`cat /proc/sys/vm/direct_swappiness`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM direct_swappiness: $val\"\n                fi\n            fi\n            if [ -r \"/proc/sys/vm/dirty_ratio\" ]; then\n                val=\"`cat /proc/sys/vm/dirty_ratio`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM dirty ratio: $val\"\n                fi\n            fi\n            if [ -r \"/proc/sys/vm/dirty_background_ratio\" ]; then\n                val=\"`cat /proc/sys/vm/dirty_background_ratio`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM dirty background ratio: $val\"\n                fi\n            elif [ -r \"/proc/sys/vm/dirty_background_ratio_nosys\" ]; then\n                val=\"`cat /proc/sys/vm/dirty_background_ratio_nosys`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM dirty background ratio (nosys): $val\"\n                fi\n            fi\n            if [ -r \"/proc/sys/vm/dirty_expire_centisecs\" ]; then\n                val=\"`cat /proc/sys/vm/dirty_expire_centisecs`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM dirty expire centisecs: $val\"\n                fi\n            elif [ -r \"/proc/sys/vm/dirty_expire_centisecs_nosys\" ]; then\n                val=\"`cat /proc/sys/vm/dirty_expire_centisecs_nosys`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM dirty expire centisecs (nosys): $val\"\n                fi\n            fi\n            val=\"`cat /proc/sys/vm/dirty_writeback_centisecs`\"\n            if [ -n \"$val\" ]; then\n                echo \"  VM dirty writeback centisecs: $val\"\n            fi\n            val=\"`cat /proc/sys/vm/laptop_mode`\"\n            if [ \"$val\" = \"1\" ]; then\n                echo \"  VM laptop mode: on\"\n            else\n                echo \"  VM laptop mode: off\"\n            fi\n            if [ -r \"/proc/sys/vm/swap_ratio\" ]; then\n                val=\"`cat /proc/sys/vm/swap_ratio`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM swap_ratio: $val\"\n                fi\n            fi\n            if [ -r \"/proc/sys/vm/swap_ratio_enable\" ]; then\n                val=\"`cat /proc/sys/vm/swap_ratio_enable`\"\n                if [ -n \"$val\" ]; then\n                    echo \"  VM swap_ratio_enable: $val\"\n                fi\n            fi\n            # End of print status\n        fi\n        \n    else\n        return 1\n    fi\n}\n\nfunction reloadAudioserver()\n{\n    # wait for system boot completion and audiosever boot up\n    local i\n    for i in `seq 1 3` ; do\n        if [ \"`getprop sys.boot_completed`\" = \"1\"  -a  -n \"`getprop init.svc.audioserver`\" ]; then\n            break\n        fi\n        sleep 0.9\n    done\n\n    if [ -n \"`getprop init.svc.audioserver`\" ]; then\n\n        setprop ctl.restart audioserver\n        sleep 0.2\n        if [ \"`getprop init.svc.audioserver`\" != \"running\" ]; then\n            # workaround for Android 12 old devices hanging up the audioserver after \"setprop ctl.restart audioserver\" is executed\n            local pid=\"`getprop init.svc_debug_pid.audioserver`\"\n            if [ -n \"$pid\" ]; then\n                kill -HUP $pid 1>\"/dev/null\" 2>&1\n            fi\n            for i in `seq 1 10` ; do\n                sleep 0.2\n                if [ \"`getprop init.svc.audioserver`\" = \"running\" ]; then\n                    break\n                elif [ $i -eq 10 ]; then\n                    echo \"audioserver reload failed!\" 1>&2\n                    return 1\n                fi\n            done\n        fi\n        return 0\n        \n    else\n        echo \"audioserver is not found!\" 1>&2 \n        return 1\n    fi\n}\n\nfunction which_resetprop_command()\n{\n    type resetprop 1>\"/dev/null\" 2>&1\n    if [ $? -eq 0 ]; then\n        echo \"resetprop\"\n    else\n        type resetprop_phh 1>\"/dev/null\" 2>&1\n        if [ $? -eq 0 ]; then\n            echo \"resetprop_phh\"\n        else\n            return 1\n        fi\n    fi\n    return 0\n}\n\nfunction reduceEffectJitter()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n        local val\n\n        if [ $flag -gt 0 ]; then\n            resetprop_command=\"`which_resetprop_command`\"\n            if [ -n \"$resetprop_command\" ]; then\n                # Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)\n                \"$resetprop_command\" --delete ro.audio.ignore_effects 1>\"/dev/null\" 2>&1\n                # End of workaround\n                \n                \"$resetprop_command\" ro.audio.ignore_effects true\n                # support for Tensor devices, etc.\n                val=\"`getprop ro.audio.spatializer_enabled`\"\n                if [ -n \"$val\"  -a  \"$val\" = \"true\" ]; then\n                    # Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)\n                    \"$resetprop_command\" --delete ro.audio.spatializer_enabled 1>\"/dev/null\" 2>&1\n                    # End of workaround\n                    \n                    \"$resetprop_command\" ro.audio.spatializer_enabled false\n                fi\n                # Stop Tensor device's AOC daemon for reducing significant jitter\n                if [ \"`getprop init.svc.aocd`\" = \"running\" ]; then\n                    setprop ctl.stop aocd\n                fi\n                # Stop Tensor device's AOCX daemon for reducing significant jitter\n                if [ \"`getprop init.svc.aocxd`\" = \"running\" ]; then\n                    setprop ctl.stop aocxd\n                fi\n                reloadAudioserver\n            else\n                return 2\n            fi\n        elif [ $flag -lt 0 ]; then\n            resetprop_command=\"`which_resetprop_command`\"\n            if [ -n \"$resetprop_command\" ]; then\n                \"$resetprop_command\" --delete ro.audio.ignore_effects\n                # support for Tensor devices, etc.\n                val=\"`getprop ro.audio.spatializer_enabled`\"\n                if [ -n \"$val\"  -a  \"$val\" = \"false\" ]; then\n                    # Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)\n                    \"$resetprop_command\" --delete ro.audio.spatializer_enabled 1>\"/dev/null\" 2>&1\n                    # End of workaround\n                    \n                    \"$resetprop_command\" ro.audio.spatializer_enabled true\n                fi\n                if [ \"`getprop init.svc.aocd`\" = \"stopped\" ]; then\n                    setprop ctl.start aocd\n                fi\n                if [ \"`getprop init.svc.aocxd`\" = \"stopped\" ]; then\n                    setprop ctl.start aocxd\n                fi\n                reloadAudioserver\n            else\n                return 2\n            fi\n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            val=\"`getprop ro.audio.ignore_effects`\"\n            if [ -n \"$val\"  -a  \"$val\" = \"true\" ]; then\n                echo \"  Effects framework: disabled\"\n            else\n                echo \"  Effects framework: enabled\"\n            fi\n            \n            val=\"`getprop init.svc.aocd`\"\n            if [ -n \"$val\"  ]; then\n                echo \"  Effects AOC server: $val\"\n            fi\n            val=\"`getprop init.svc.aocxd`\"\n            if [ -n \"$val\"  ]; then\n                echo \"  Effects AOCX server: $val\"\n            fi\n            \n        fi\n        \n        return 0\n        \n    else\n        return 1\n    fi\n}\n\nfunction restartWifi()\n{\n    local val=\"`settings get global wifi_on`\"\n    \n    if [ -n \"$val\"  -a  \"$val\" != \"0\" ]; then\n        svc wifi disable\n        svc wifi enable\n    fi\n}\n\nfunction reduceWifiJitter ()\n{\n    if [ $# -eq 3 ]; then\n        local flag=\"$1\"\n        local restartFlag=\"$2\"\n        local printStatus=\"$3\"\n\n        if [ $flag -gt 0 ]; then\n        \n            # Reducing wifi jitter by suspend wifi optimizations\n            settings put global wifi_suspend_optimizations_enabled 0 1>\"/dev/null\" 2>&1\n            settings put secure adaptive_connectivity_enabled 0 1>\"/dev/null\" 2>&1\n            if [ \"$restartFlag\" = \"Restart\" ]; then\n                restartWifi\n            fi\n            \n        elif [ $flag -lt 0 ]; then\n        \n            # Revert wifi jitter by suspend wifi optimizations\n            settings delete global wifi_suspend_optimizations_enabled 1>\"/dev/null\" 2>&1\n            settings delete secure adaptive_connectivity_enabled 1>\"/dev/null\" 2>&1\n            if [ \"$restartFlag\" = \"Restart\" ]; then\n                restartWifi\n            fi\n        \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            local val=\"`settings get global wifi_suspend_optimizations_enabled`\"\n            if [ -n \"$val\"  -a  \"$val\" = \"0\" ]; then\n                echo \"  Wifi suspend optimizations: disabled\"\n            else\n                echo \"  Wifi suspend optimizations: enabled\"\n            fi\n            val=\"`settings get secure adaptive_connectivity_enabled`\"\n            if [ -n \"$val\"  -a  \"$val\" = \"0\" ]; then\n                echo \"  Wifi adaptive connectivity: disabled\"\n            else\n                echo \"  Wifi adaptive connectivity: enabled\"\n            fi\n        fi\n\n    else\n        return 1\n    fi\n}\n\nfunction reduceBatteryJitter ()\n{\n    if [ $# -eq 2 ]; then\n        local flag=\"$1\"\n        local printStatus=\"$2\"\n\n        if [ $flag -gt 0 ]; then\n        \n            # Reducing battery jitters\n            settings put global adaptive_battery_management_enabled 0 1>\"/dev/null\" 2>&1\n            settings put secure adaptive_charging_enabled 0 1>\"/dev/null\" 2>&1\n            \n        elif [ $flag -lt 0 ]; then\n        \n            # Revert battery jitters\n            settings delete global adaptive_battery_management_enabled 1>\"/dev/null\" 2>&1\n            settings delete secure adaptive_charging_enabled 1>\"/dev/null\" 2>&1\n        \n        fi\n        \n        if [ $printStatus -gt 0 ]; then\n            local val=\"`settings get global adaptive_battery_management_enabled`\"\n            if [ -n \"$val\"  -a  \"$val\" = \"0\" ]; then\n                echo \"  Battery adaptive management: disabled\"\n            else\n                echo \"  Battery adaptive management: enabled\"\n            fi\n            val=\"`settings get secure adaptive_charging_enabled`\"\n            if [ -n \"$val\"  -a  \"$val\" = \"0\" ]; then\n                echo \"  Battery adaptive charging: disabled\"\n            else\n                echo \"  Battery adaptive charging: enabled\"\n            fi\n        fi\n\n    else\n        return 1\n    fi\n}\n"
  },
  {
    "path": "extras/jitter-reducer.sh",
    "content": "#!/system/bin/sh\n#\n# Version: 2.6.0\n#     by zyhk\n\nMYDIR=\"${0%/*}\"\n\n# Check whether this script has been marked \"disable\", or not\nif [ ! -d \"$MYDIR\" ]; then\n    echo \"cannot get the current directory!\" 1>&2 ; \n    exit 1\nelif [ -e \"$MYDIR/disable\" ] ; then\n    echo \"this script is now disabled!\" 1>&2 ; \n    exit 0\nfi\n# End\n\nfunction usage()\n{\n      echo \"Usage: ${0%/*} [--selinux|++selinux][--thermal|++thermal][--doze|++doze][---governor|++governor][--logd][++logd][--camera|++camera][--io [scheduler [light | m-light | medium | boost]] | ++io][--vm|++vm][--wifi|++wifi][--all|++all][--battery|++battery][--effect|++effect][--status][--help]\" 1>&2\n      echo -n \"\\nNote 1: each \\\"--\\\" prefixed option except \\\"--status\\\" and \\\"--help\\\" options is an enabler for its corresponding jitter reducer,\" 1>&2\n      echo -n \" conversely each \\\"++\\\" prefixed option is an disabler for its corresponding jitter reducer.\" 1>&2\n      echo -n \" \\\"--all\\\" option is an alias of all \\\"--\\\" prefixed options except \\\"--effect\\\", \\\"--battery\\\", \\\"--status\\\" and \\\"--help\\\" option,\" 1>&2\n      echo      \" and also \\\"++all\\\" option is an alias of all \\\"++\\\" prefixed options except \\\"++effect\\\" and \\\"++battery\\\" option.\" 1>&2\n      echo -n \"\\nNote 2: \\\"scheduler\\\" specifys an I/O scheduler for I/O block devices \" 1>&2\n      echo -n \"(typically \\\"deadline\\\", \\\"cfq\\\" or \\\"noop\\\", but you may specify \\\"*\\\" for automatical best selection), \" 1>&2\n      echo -n \"and has optional four modes \\\"light\\\" (for warmer tone), \\\"m-light\\\" (for slightly warmer tone),\" 1>&2\n      echo     \" \\\"medium\\\" (default) and \\\"boost\\\" (for clearer tone).\" 1>&2\n      echo     \"\\nNote 3: \\\"--wifi\\\" option is persistent even after reboot, but other options are not.\" 1>&2\n}\n\nselinuxFlag=0\nthermalFlag=0\ndozeFlag=0\ngovernorFlag=0\ncameraFlag=0\nlogdFlag=0\nioFlag=0\nioScheduler=\"\"\ntoneMode=\"medium\"\nvmFlag=0\nwifiFlag=0\nwifiNoRestart=0\nbatteryFlag=0\neffectFlag=0\nprintStatus=0\n\nif [ $# -eq 0 ];then\n    usage\n    exit 0\nelse\n\n    while [ $# -gt 0 ]; do\n        \n        case \"$1\" in\n            \"-a\" | \"--all\" )\n                selinuxFlag=1\n                thermalFlag=1\n                governorFlag=1\n                cameraFlag=1\n                logdFlag=1\n                ioFlag=1\n                vmFlag=1\n                wifiFlag=1\n                dozeFlag=1\n                shift\n                ;;\n            \"+a\" | \"++all\" )\n                selinuxFlag=-1\n                thermalFlag=-1\n                governorFlag=-1\n                cameraFlag=-1\n                logdFlag=-1\n                ioFlag=-1\n                vmFlag=-1\n                wifiFlag=-1\n                dozeFlag=-1\n                shift\n                ;;\n            \"-se\" | \"--selinux\" )\n                 selinuxFlag=1\n                shift\n                ;;\n            \"+se\" | \"++selinux\" )\n                selinuxFlag=-1\n                shift\n                ;;\n            \"-t\" | \"--thermal\" )\n                thermalFlag=1\n                shift\n                ;;\n            \"+t\" | \"++thermal\" )\n                thermalFlag=-1\n                shift\n                ;;\n            \"-d\" | \"--doze\" )\n                dozeFlag=1\n                shift\n                ;;\n            \"+d\" | \"++doze\" )\n                dozeFlag=-1\n                shift\n                ;;\n            \"-g\" | \"--governor\" )\n                governorFlag=1\n                shift\n                ;;\n            \"+g\" | \"++governor\" )\n                governorFlag=-1\n                shift\n                ;;\n            \"-c\" | \"--camera\" )\n                cameraFlag=1\n                shift\n                ;;\n            \"+c\" | \"++camera\" )\n                cameraFlag=-1\n                shift\n                ;;\n            \"-l\" | \"--logd\" )\n                logdFlag=1\n                shift\n                ;;\n            \"+l\" | \"++logd\" )\n                logdFlag=-1\n                shift\n                ;;\n            \"-i\" | \"--io\" )\n                ioFlag=1\n                shift\n                \n                if [ $# -gt 0 ]; then\n                \n                    case \"$1\" in\n                        -* )\n                            ;;\n                        * )\n                            ioScheduler=\"$1\"\n                            shift\n                            ;;\n                     esac\n                    \n                    # Tone: \"light\", \"medium\", \"boost\", \"exp\"\n                    if [ \"$1\" = \"light\" ]; then\n                        toneMode=\"light\" \n                        shift\n                    elif [ \"$1\" = \"m-light\" ]; then\n                        toneMode=\"m-light\" \n                        shift\n                    elif [ \"$1\" = \"medium\" ]; then\n                        toneMode=\"medium\" \n                        shift\n                    elif [ \"$1\" = \"boost\" ]; then\n                        toneMode=\"boost\"\n                        shift\n                    elif [ \"$1\" = \"exp\" ]; then\n                        toneMode=\"exp\"\n                        shift\n                    elif expr \"$1\" : '[^-].*' >\"/dev/null\" 2>&1; then\n                        echo \"wrong I/O scheduler parameter (\\\"$1\\\"). valid parameters: light m-light medium boost\" 1>&2\n                        usage\n                        exit 1\n                    fi\n                    \n                fi\n                \n                ;;\n            \"+i\" | \"++io\" )\n                ioFlag=-1\n                shift\n                ;;\n            \"-v\" | \"--vm\" )\n                vmFlag=1\n                shift\n                ;;\n            \"+v\" | \"++vm\" )\n                vmFlag=-1\n                shift\n                ;;\n            \"-w\" | \"--wifi\" )\n                wifiFlag=1\n                wifiNoRestart=0\n                shift\n                ;;\n            \"-wn\" | \"--wifi-no-restart\" )\n                wifiFlag=1\n                wifiNoRestart=1\n                shift\n                ;;\n            \"+w\" | \"++wifi\" )\n                wifiFlag=-1\n                wifiNoRestart=0\n                shift\n                ;;\n            \"-b\" | \"--battery\" )\n                batteryFlag=1\n                shift\n                ;;\n            \"+b\" | \"++battery\" )\n                batteryFlag=-1\n                shift\n                ;;\n            \"-e\" | \"--effect\" )\n                effectFlag=1\n                shift\n                ;;\n            \"+e\" | \"++effect\" )\n                effectFlag=-1\n                shift\n                ;;\n            \"-st\" | \"--status\" )\n                printStatus=1\n                shift\n                ;;\n            \"-h\" | \"--help\" )\n                usage\n                exit 0\n                ;;\n            * )\n                echo \"wrong option (\\\"$1\\\")\" 1>&2\n                usage\n                exit 1\n                ;;\n        esac\n        \n    done\n    \nfi\n\n. \"$MYDIR/jitter-reducer-functions.shlib\"\n\nreduceSelinuxJitter $selinuxFlag $printStatus\nreduceGovernorJitter $governorFlag $printStatus\nreduceThermalJitter $thermalFlag $printStatus\nreduceDozeJitter $dozeFlag $printStatus\nreduceLogdJitter $logdFlag $printStatus\nreduceCameraJitter $cameraFlag $printStatus\nreduceIoJitter \"$ioFlag\" \"$ioScheduler\" \"$toneMode\" \"$printStatus\"\nreduceVmJitter $vmFlag $printStatus\nif [ $wifiNoRestart -gt 0 ]; then\n    reduceWifiJitter $wifiFlag \"NoRestart\" $printStatus\nelse\n    reduceWifiJitter $wifiFlag \"Restart\" $printStatus\nfi\nreduceBatteryJitter $batteryFlag $printStatus\nreduceEffectJitter $effectFlag $printStatus\n\nif [ $? -eq 2 ]; then\n    if [ $effectFlag -gt 0 ]; then\n        echo \"\\n\\\"--effect\\\" option ignored (no resetprop commands found)\" 1>&2\n    elif [ $effectFlag -lt 0 ]; then\n        echo \"\\n\\\"++effect\\\" option ignored (no resetprop commands found)\" 1>&2\n    fi\nfi\n"
  },
  {
    "path": "functions3.shlib",
    "content": "#!/system/bin/sh\n#\n\nMYDIR=${0%/*}\n\n# Forcing to reload audioservers\nfunction reloadAudioServers() \n{\n    # wait for system boot completion and audiosever boot up\n    local i\n    for i in `seq 1 3` ; do\n        if [ \"`getprop sys.boot_completed`\" = \"1\"  -a  -n \"`getprop init.svc.audioserver`\" ]; then\n            break\n        fi\n        sleep 1\n    done\n\n    if [ -n \"`getprop init.svc.audioserver`\" ]; then\n    \n        setprop ctl.restart audioserver\n        sleep 0.2\n        if [ \"`getprop init.svc.audioserver`\" != \"running\" ]; then\n            # workaround for Android 12 old devices hanging up the audioserver after \"setprop ctl.restart audioserver\" is executed\n            local pid=\"`getprop init.svc_debug_pid.audioserver`\"\n            if [ -n \"$pid\" ]; then\n                kill -HUP $pid 1>\"/dev/null\" 2>&1\n            fi\n            for i in `seq 1 10` ; do\n                sleep 0.2\n                if [ \"`getprop init.svc.audioserver`\" = \"running\" ]; then\n                    break\n                elif [ $i -eq 10 ]; then\n                    echo \"audioserver reload failed!\" 1>&2\n                    return 1\n                fi\n            done\n        fi\n        \n        if [ $# -gt 0  -a  \"$1\" = \"all\"  -a  -n \"`getprop init.svc.vendor.audio-hal`\" ]; then\n            setprop ctl.restart \"vendor.audio-hal\" 1>\"/dev/null\" 2>&1\n            sleep 0.2\n            if [ \"`getprop init.svc.vendor.audio-hal`\" != \"running\" ]; then\n                kill \"`getprop init.svc_debug_pid.vendor.audio-hal`\" 1>\"/dev/null\" 2>&1\n            fi\n        fi\n        \n    else\n        echo \"audioserver is not found!\" 1>&2 \n        return 1\n    fi\n    \n}\n\n# Find mount points paired with arg2 (\"/data/...\") in arg1 (typycally \"/proc/self/mountinfo\"). \n#   arg3 1: show a key with its paired mount point, 0: moun point only.\nfunction findMounts()\n{\n    if [ $# -ne 3 ]; then\n        return 1\n    elif [ ! -r \"$1\"  -o  `expr \"$2\" : /data` -ne 5 ]; then\n        return 1\n    fi\n\n    local mf=${2:5}    \n    local showKey=0\n    case \"$3\" in\n        \"true\" | \"1\" )\n            showKey=1\n            ;;\n        \"false\" | \"0\" )\n            showKey=0\n            ;;\n    esac\n    \n    awk -v showKey=$showKey -v mFile=\"^$mf\\$|^$mf//deleted$\" '\n        BEGIN { \n            status=1\n        }\n        $4 ~ mFile  && $10 ~ /^\\/dev\\/block\\// {\n            if (showKey)\n                print $4 \" \" $5\n            else\n                print  $5\n            status=0\n        }\n        END {\n            exit status \n        }' <\"$1\"\n}\n\n# Find a mount point arg2 in arg1 (typycally \"/proc/self/mountinfo\"). \n#   arg3 \"IncludeMagisk\" (including Magisk mount points) or \"ExcludeMagisk\" (exclude Magisk mount points)\n#   arg4 \"ShowKey\" (print a key with its specified mount point) or \"NoShowKey\" (don't print the key)\n#   If found, then return 0 else return 1\nfunction isMounted()\n{\n    if [ $# -ne 4 ]; then\n        return 1\n    elif [ ! -r \"$1\" ]; then\n        return 1\n    fi\n\n    local mf=\"$2\"\n    local includeMagisk=0\n    if [ \"$3\" = \"IncludeMagisk\" ]; then\n        includeMagisk=1\n    fi\n    local showKey=0\n    if [ \"$4\" = \"ShowKey\" ]; then\n        showKey=1\n    fi\n\n    awk -v showKey=$showKey -v includeMagisk=$includeMagisk -v mFile=\"^$mf\\$\" '\n        BEGIN {\n            status=1\n        }\n        $5 ~ mFile  && (includeMagisk==1 || ($4 !~ /^\\/adb\\/modules\\// && $4 !~ /^\\/data\\/adb\\/modules\\// && $10 ~ /^\\/dev\\/block\\//)) {\n            if (showKey)\n                print $4 \" \" $5\n            status=0\n            exit\n        }\n        END {\n            exit status\n        }' <\"$1\"\n}\n\n# Remove somewheres bind mounted with arg1\nfunction removeMountPoints()\n{\n    if [ $# -eq 1 ]; then\n    \n        local mDirs=\"`findMounts \\\"/proc/self/mountinfo\\\" \\\"$1\\\" 0`\"\n        if [ -n \"$mDirs\" ]; then\n        \n            local i\n            for i in $mDirs ; do\n                if [ -e \"$i\" ]; then\n                    case \"$i\" in\n                        /data/local/tmp/* )\n                            ;;\n                        * )\n                            umount \"$i\" 1>\"/dev/null\" 2>&1\n                            ;;\n                    esac\n                fi\n            done\n            \n        fi\n        \n    fi\n    \n    return 0\n}\n \n# Remove arg1 file probaby bind mounted somewheres\nfunction removeGenFile()\n{\n    if [ $# -eq 1 ]; then\n        removeMountPoints \"$1\"\n        if [ -e \"$1\" ]; then\n            rm -f \"$1\"\n        fi\n        # Remove Magisk overlayed files. The above remove may fail.\n        removeMountPoints \"$1\"\n        return $?\n    fi\n    return 1\n}\n\n# Does this device support the 7.0 audio policy configuration\nfunction IsSeventhAudio()\n{\n    # Busybox cannot execute \"/vendor/lib{,64}\" expansion properly unlike mksh, so manually expanded\n    if [ -z \"`ls /vendor/lib64/android.hardware.audio@7.?.so 2>/dev/null`\"  -a  -z \"`ls /vendor/lib/android.hardware.audio@7.?.so 2>/dev/null`\" ] && \\\n       [ -z \"`ls /system/lib64/android.hardware.audio@7.?.so 2>/dev/null`\"  -a  -z \"`ls /system/lib/android.hardware.audio@7.?.so 2>/dev/null`\" ]; then\n        return 1\n    elif [ \"`getprop ro.build.product`\" = \"jfltexx\" ]; then\n        # Galaxy S4 has a bug for the 7.0 audio policy configuration\n        return 1\n    else\n        return 0\n    fi\n}\n\n# Get the active audio policy configuration fille from the audioserever\nfunction getActivePolicyFile()\n{\n    dumpsys media.audio_policy | awk ' \n        /^ Config source: / {\n            print $3\n        }' \n}\n\n# Extract the file name of an audio_policy_volumes.xml\nfunction getVolumeFile()\n{\n    if [ $# -gt 0  -a  -r \"$1\" ]; then\n        grep -m 1 -e '<xi:include[[:space:]]*href[[:space:]]*=[[:space:]]*\".*audio_policy_volumes.*\\.xml\"' \"$1\" | awk -F '\"' '{ print $2 }'\n    else\n        return 1\n    fi\n}\n\n# Extract the file name of a default_volume_tables.xml\nfunction getDefaultVolumeFile()\n{\n    if [ $# -gt 0  -a  -r \"$1\" ]; then\n        grep -m 1 -e '<xi:include[[:space:]]*href[[:space:]]*=[[:space:]]*\".*default_volume_tables.*\\.xml\"' \"$1\" | awk -F '\"' '{ print $2 }'\n    else\n        return 1\n    fi\n}\n\n# Make a configuration file for this script\nfunction makeConfigFile()\n{\n    if [ $# -eq 1 ]; then\n    \n        local policyFile=\"`getActivePolicyFile`\"\n        local volumeFile=\"\"\n        local defaultVolumeFile=\"\"\n        if [ -z \"$policyFile\"  -o  ! -r \"$policyFile\" ]; then\n            policyFile=\"N/A\"\n        else\n            volumeFile=\"`getVolumeFile \\\"$policyFile\\\"`\"\n            defaultVolumeFile=\"`getDefaultVolumeFile \\\"$policyFile\\\"`\"\n        fi\n        \n        if [ -z \"$volumeFile\" ]; then\n            volumeFile=\"/vendor/etc/audio_policy_volumes.xml\"\n        fi\n        if [ -z \"$defaultVolumeFile\" ]; then\n            defaultVolumeFile=\"/vendor/etc/default_volume_tables.xml\"\n        fi\n        \n        local bltHal\n        if [ \"`getprop persist.bluetooth.bluetooth_audio_hal.disabled`\" = \"true\" ]; then\n        \n            case \"`getprop ro.board.platform`\" in\n                sdm* | msm* | sd* )\n                    bltHal=\"legacy\"\n                    ;;\n                * )\n                    bltHal=\"safe\"\n                    ;;\n            esac\n            \n        elif [ -e \"/vendor/lib64/hw/audio.bluetooth.default.so\" ]; then\n            bltHal=\"bypass-safer\"\n        elif [ \"`getprop ro.bluetooth.a2dp_offload.supported`\" = \"true\" ]; then\n            bltHal=\"offload\"\n        else\n        \n            case \"`getprop ro.board.platform`\" in\n                mt* )\n                    bltHal=\"safe\"\n                    ;;\n                * )\n                    bltHal=\"safest\"\n                    ;;\n            esac\n            \n        fi\n        \n        if [ -e \"$1\" ]; then\n            rm -f \"$1\"\n        fi\n        \n        cat <<_EOT_ > \"$1\"\nPolicyFile=\"$policyFile\"\nBluetoothHal=\"$bltHal\"\nVolumeFile=\"$volumeFile\"\nDefaultVolumeFile=\"$defaultVolumeFile\"\n_EOT_\n\n        return 0\n        \n    fi\n    \n    return 1\n}\n"
  },
  {
    "path": "templates/Old/bypass_offload_safer_mtk_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall_music_uplink\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n               <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                </devicePort>\n                <!-- TODO: Enable multi-channel recording -->\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx,incall_music_uplink\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/bypass_offload_safer_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall_music_uplink\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n               <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                </devicePort>\n                <!-- TODO: Enable multi-channel recording -->\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx,incall_music_uplink\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/bypass_offload_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                            samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" address=\"\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"HDMI\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"FM\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" address=\"top\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"HDMI\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"FM\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,USB Headset In,Telephony Rx\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/legacy_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2016 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n    <modules>\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Earpiece</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall_music_uplink\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx,incall_music_uplink\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/offload_direct_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"mmap_no_irq_out\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_MMAP_NOIRQ\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"direct_pcm\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DIRECT\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_8_24_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                  <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                </mixPort>\n                <mixPort name=\"compressed_offload\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_MP3\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_FLAC\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_ALAC\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_APE\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_LC\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_HE_V1\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_HE_V2\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_DTS\"\n                             samplingRates=\"32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_DTS_HD\"\n                             samplingRates=\"32000,44100,48000,64000,88200,96000,128000,176400,192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_WMA\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_WMA_PRO\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_LC\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_HE_V1\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_HE_V2\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"mmap_no_irq_in\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_MMAP_NOIRQ\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n            </mixPorts>\n\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\"/>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" address=\"\"/>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\"/>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\"/>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\"/>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"HDMI\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"FM\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\"/>\n                </devicePort>\n\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" address=\"top\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"HDMI\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload\"/>\n                <route type=\"mix\" sink=\"FM\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,USB Headset In,Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"mmap_no_irq_in\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n            </routes>\n\n        </module>\n\n        <!-- A2DP Audio HAL -->\n        <module name=\"a2dp\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n\n            <routes>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/offload_hifi_playback_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_playback\" role=\"source\"/>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n            </mixPorts>\n\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                            samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" address=\"\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"HDMI\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"FM\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" address=\"top\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"HDMI\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"FM\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"primary output,deep_buffer,voip_rx,hifi_playback\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"primary output,deep_buffer,voip_rx,hifi_playback\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,USB Headset In,Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n            </routes>\n\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                         samplingRates=\"%SAMPLING_RATE%\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/offload_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved\n     Not a Contribution.\n-->\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Earpiece</item>\n                <item>Speaker</item>\n                <item>Telephony Tx</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Rx</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice_tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice_rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n            </mixPorts>\n\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                            samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" address=\"\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Line\" type=\"AUDIO_DEVICE_OUT_LINE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"HDMI\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000\" channelMasks=\"dynamic\"/>\n                </devicePort>\n                <devicePort tagName=\"FM\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_LHDC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE AUDIO_FORMAT_APTX_TWSP\">\n                            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" address=\"top\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,11025,12000,16000,22050,24000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Telephony Rx\" type=\"AUDIO_DEVICE_IN_TELEPHONY_RX\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Line\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"HDMI\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"FM\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"primary output,deep_buffer,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\"\n                       sources=\"voice_tx\"/>\n                <route type=\"mix\" sink=\"voice_rx\"\n                       sources=\"Telephony Rx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,USB Device In,USB Headset In,Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,BT SCO Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n            </routes>\n\n        </module>\n\n        <!-- A2DP Audio HAL -->\n        <module name=\"a2dp\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100,48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n\n            <routes>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/safe_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>FM Tuner In</item>\n                <item>Voice Call In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital Out\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Analog Dock Headset\" type=\"AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Digital Dock Headset\" type=\"AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner Out\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital In\" type=\"AUDIO_DEVICE_IN_AUX_DIGITAL\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner In\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Primary In\" type=\"AUDIO_DEVICE_IN_BUS\" role=\"source\" address=\"usb_phone_call\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Voice Call In\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"AUX Digital Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Analog Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Digital Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"FM Tuner Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,FM Tuner In,USB Primary In,Voice Call In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/safest_auto_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>FM Tuner In</item>\n                <item>Voice Call In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital Out\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Analog Dock Headset\" type=\"AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Digital Dock Headset\" type=\"AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner Out\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital In\" type=\"AUDIO_DEVICE_IN_AUX_DIGITAL\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner In\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Primary In\" type=\"AUDIO_DEVICE_IN_BUS\" role=\"source\" address=\"usb_phone_call\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Voice Call In\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"AUX Digital Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Analog Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Digital Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"FM Tuner Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,FM Tuner In,USB Primary In,Voice Call In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/safest_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<audioPolicyConfiguration version=\"1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->\n\n    <!-- Global configuration Decalaration -->\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\"/>\n\n\n    <!-- Modules section:\n        There is one section per audio HW module present on the platform.\n        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.\n        The module names are the same as in current .conf file:\n                “primary”, “A2DP”, “remote_submix”, “USB”\n        Each module will contain the following sections:\n        “devicePorts”: a list of device descriptors for all input and output devices accessible via this\n        module.\n        This contains both permanently attached devices and removable devices.\n        “mixPorts”: listing all output and input streams exposed by the audio HAL\n        “routes”: list of possible connections between input and output devices or between stream and\n        devices.\n            \"route\": is defined by an attribute:\n                -\"type\": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)\n                -\"sink\": the sink involved in this route\n                -\"sources\": all the sources than can be connected to the sink via vis route\n        “attachedDevices”: permanently attached devices.\n        The attachedDevices section is a list of devices names. The names correspond to device names\n        defined in <devicePorts> section.\n        “defaultOutputDevice”: device to be used by default when no policy rule applies\n    -->\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>FM Tuner In</item>\n                <item>Voice Call In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep_buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_MONO\"/>\n                </devicePort>\n                <devicePort tagName=\"Speaker\" role=\"sink\" type=\"AUDIO_DEVICE_OUT_SPEAKER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital Out\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Analog Dock Headset\" type=\"AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Digital Dock Headset\" type=\"AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner Out\" type=\"AUDIO_DEVICE_OUT_FM\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"AUX Digital In\" type=\"AUDIO_DEVICE_IN_AUX_DIGITAL\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"FM Tuner In\" type=\"AUDIO_DEVICE_IN_FM_TUNER\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Primary In\" type=\"AUDIO_DEVICE_IN_BUS\" role=\"source\" address=\"usb_phone_call\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"Voice Call In\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                     <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000,16000,32000,44100,48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_VOICE_UPLINK,AUDIO_CHANNEL_IN_VOICE_DNLINK\"/>\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep_buffer\"/>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep_buffer,FM Tuner In\"/>\n                <route type=\"mix\" sink=\"AUX Digital Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Analog Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"Digital Dock Headset\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"FM Tuner Out\"\n                       sources=\"primary output\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,AUX Digital In,FM Tuner In,USB Primary In,Voice Call In\"/>\n            </routes>\n        </module>\n\n        <!-- A2DP Audio HAL -->\n    <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n        <mixPorts>\n            <mixPort name=\"a2dp output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"a2dp input\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n        </mixPorts>\n        <devicePorts>\n            <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </devicePort>\n            <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"48000\"\n                         channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"BT A2DP Out\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                   sources=\"a2dp output\"/>\n            <route type=\"mix\" sink=\"a2dp input\"\n                   sources=\"BT A2DP In\"/>\n        </routes>\n    </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n    <!-- Remote Submix Audio HAL -->\n    <module name=\"r_submix\" halVersion=\"2.0\">\n        <attachedDevices>\n            <item>Remote Submix In</item>\n        </attachedDevices>\n        <mixPorts>\n            <mixPort name=\"r_submix output\" role=\"source\">\n                <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                         samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n            </mixPort>\n            <mixPort name=\"r_submix input\" role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </mixPort>\n       </mixPorts>\n       <devicePorts>\n           <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n           </devicePort>\n           <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n               <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                        samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n            </devicePort>\n        </devicePorts>\n        <routes>\n            <route type=\"mix\" sink=\"Remote Submix Out\"\n                   sources=\"r_submix output\"/>\n            <route type=\"mix\" sink=\"r_submix input\"\n                   sources=\"Remote Submix In\"/>\n        </routes>\n    </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/Old/usb_only_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Copyright (C) 2015 The Android Open Source Project\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          http://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<!-- USB Audio HAL Audio Policy Configuration file -->\n\n<module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n    <mixPorts>\n        <mixPort name=\"usb_accessory output\" role=\"source\">\n            <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                     samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n        </mixPort>\n        <mixPort name=\"usb_device output\" role=\"source\">\n            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                     samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n        </mixPort>\n        <mixPort name=\"usb_device input\" role=\"sink\"/>\n    </mixPorts>\n    <devicePorts>\n        <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n            <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                     samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n        </devicePort>\n        <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                     samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n        </devicePort>\n        <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n            <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                     samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n        </devicePort>\n        <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\"/>\n        <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\"/>\n    </devicePorts>\n    <routes>\n        <route type=\"mix\" sink=\"USB Host Out\"\n               sources=\"usb_accessory output\"/>\n        <route type=\"mix\" sink=\"USB Device Out\"\n               sources=\"usb_device output\"/>\n        <route type=\"mix\" sink=\"USB Headset Out\"\n               sources=\"usb_device output\"/>\n        <route type=\"mix\" sink=\"usb_device input\"\n               sources=\"USB Device In,USB Headset In\"/>\n    </routes>\n</module>\n"
  },
  {
    "path": "templates/bypass_offload_safer_amzm_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\"/>\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\" >\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\"/>\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/bypass_offload_safer_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\"/>\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\" >\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\"/>\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/bypass_offload_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\"\n                         recommendedMuteDurationMs=\"40\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\" />\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\" >\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\" />\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"usb_device output\" role=\"source\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n           </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_device output\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_device output\"/>\n             </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/offload_direct_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"mmap_no_irq_out\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_MMAP_NOIRQ\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\" />\n                </mixPort>\n                <mixPort name=\"usb_playback\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"direct_pcm\" role=\"source\"\n                        flags=\"AUDIO_OUTPUT_FLAG_DIRECT\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_8_24_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 352800 384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_24_BIT_PACKED\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 352800 384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                  <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000 352800 384000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                </mixPort>\n                <mixPort name=\"compressed_offload\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD AUDIO_OUTPUT_FLAG_NON_BLOCKING AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_MP3\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_FLAC\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_ALAC\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_APE\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_LC\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_HE_V1\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_HE_V2\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_DTS\"\n                             samplingRates=\"32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_DTS_HD\"\n                             samplingRates=\"32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_WMA\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_WMA_PRO\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_2POINT1 AUDIO_CHANNEL_OUT_QUAD AUDIO_CHANNEL_OUT_PENTA AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_6POINT1 AUDIO_CHANNEL_OUT_7POINT1\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_VORBIS\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000 128000 176400 192000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_LC\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_HE_V1\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                    <profile name=\"\" format=\"AUDIO_FORMAT_AAC_ADTS_HE_V2\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000 64000 88200 96000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"mmap_no_irq_in\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_MMAP_NOIRQ\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"direct_pcm,compressed_offload,mmap_no_irq_out,usb_playback\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"direct_pcm,compressed_offload,mmap_no_irq_out,usb_playback\"/>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"primary output,deep buffer,direct_pcm,compressed_offload,mmap_no_irq_out,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,A2DP In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"mmap_no_irq_in\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL for LE Audio -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/offload_hifi_playback_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\" />\n                </mixPort>\n                <mixPort name=\"usb_playback\" role=\"source\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep buffer\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\"/>\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/offload_safer_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\"\n                         recommendedMuteDurationMs=\"40\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\" />\n                </mixPort>\n                <mixPort name=\"usb_playback\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\" />\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\" >\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\" />\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"a2dp output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"a2dp input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"a2dp output\"/>\n                <route type=\"mix\" sink=\"a2dp input\"\n                       sources=\"BT A2DP In\"/>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  },
  {
    "path": "templates/offload_template.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!-- Copyright (C) 2020 The Android Open Source Project\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          http://www.apache.org/licenses/LICENSE-2.0\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<audioPolicyConfiguration version=\"7.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n    <globalConfiguration speaker_drc_enabled=\"%DRC_ENABLED%\" call_screen_mode_supported=\"false\" />\n    <modules>\n        <!-- Primary Audio HAL -->\n        <module name=\"primary\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Speaker</item>\n                <item>Speaker Safe</item>\n                <item>Earpiece</item>\n                <item>Built-In Mic</item>\n                <item>Built-In Back Mic</item>\n                <item>Telephony Tx</item>\n                <item>Voice Call And Telephony Rx</item>\n                <item>Echo Ref In</item>\n            </attachedDevices>\n            <defaultOutputDevice>Speaker</defaultOutputDevice>\n            <mixPorts>\n                <mixPort name=\"primary output\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_PRIMARY AUDIO_OUTPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"deep buffer\" role=\"source\" flags=\"AUDIO_OUTPUT_FLAG_DEEP_BUFFER\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"haptic\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A\" />\n                </mixPort>\n                <mixPort name=\"usb_playback\" role=\"source\">\n                    <profile name=\"\" format=\"%AUDIO_FORMAT%\"\n                             samplingRates=\"%SAMPLING_RATE%\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall playback\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_INCALL_MUSIC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voice call tx\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"voip_rx\" role=\"source\"\n                         flags=\"AUDIO_OUTPUT_FLAG_VOIP_RX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                           samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"primary input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_INDEX_MASK_3\"/>\n                </mixPort>\n                <mixPort name=\"hotword input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_HW_HOTWORD\" maxActiveCount=\"0\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"8000 11025 12000 16000 22050 24000 32000 44100 48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"incall capture\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voice call rx\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"voip_tx\" role=\"sink\"\n                         flags=\"AUDIO_INPUT_FLAG_VOIP_TX\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_IN_MONO\"/>\n                </mixPort>\n                <mixPort name=\"fast input\" role=\"sink\" flags=\"AUDIO_INPUT_FLAG_RAW AUDIO_INPUT_FLAG_FAST\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"hifi_input\" role=\"sink\" />\n                <mixPort name=\"echo_ref_input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->\n                <devicePort tagName=\"Earpiece\" type=\"AUDIO_DEVICE_OUT_EARPIECE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker\" type=\"AUDIO_DEVICE_OUT_SPEAKER\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Speaker Safe\" type=\"AUDIO_DEVICE_OUT_SPEAKER_SAFE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headphones\" type=\"AUDIO_DEVICE_OUT_WIRED_HEADPHONE\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Car Kit\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Aux Digital\" type=\"AUDIO_DEVICE_OUT_AUX_DIGITAL\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Telephony Tx\" type=\"AUDIO_DEVICE_OUT_TELEPHONY_TX\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"Proxy\" type=\"AUDIO_DEVICE_OUT_PROXY\" role=\"sink\">\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Out\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Headphones\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT A2DP Speaker\" type=\"AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER\" role=\"sink\"\n                            encodedFormats=\"AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Device Out\" type=\"AUDIO_DEVICE_OUT_USB_DEVICE\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"USB Headset Out\" type=\"AUDIO_DEVICE_OUT_USB_HEADSET\" role=\"sink\">\n                    <profile name=\"\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <!-- Input devices declaration, i.e. Source DEVICE PORT -->\n                <devicePort tagName=\"Built-In Mic\" type=\"AUDIO_DEVICE_IN_BUILTIN_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Built-In Back Mic\" type=\"AUDIO_DEVICE_IN_BACK_MIC\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Wired Headset Mic\" type=\"AUDIO_DEVICE_IN_WIRED_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"BT SCO Headset Mic\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Device In\" type=\"AUDIO_DEVICE_IN_USB_DEVICE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"USB Headset In\" type=\"AUDIO_DEVICE_IN_USB_HEADSET\" role=\"source\">\n                </devicePort>\n                <!-- AUDIO_DEVICE_IN_VOICE_CALL and AUDIO_DEVICE_IN_TELEPHONY_RX are in the same value -->\n                <devicePort tagName=\"Voice Call And Telephony Rx\" type=\"AUDIO_DEVICE_IN_VOICE_CALL\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"Echo Ref In\" type=\"AUDIO_DEVICE_IN_ECHO_REFERENCE\" role=\"source\">\n                </devicePort>\n                <devicePort tagName=\"A2DP In\" type=\"AUDIO_DEVICE_IN_BLUETOOTH_A2DP\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <!-- route declaration, i.e. list all available sources for a given sink -->\n            <routes>\n                <route type=\"mix\" sink=\"Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Speaker Safe\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Earpiece\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Wired Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Aux Digital\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Proxy\"\n                       sources=\"primary output,deep buffer\"/>\n                <route type=\"mix\" sink=\"BT SCO\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Headset\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT SCO Car Kit\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"USB Device Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"USB Headset Out\"\n                       sources=\"usb_playback\"/>\n                <route type=\"mix\" sink=\"BT A2DP Out\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Headphones\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"BT A2DP Speaker\"\n                       sources=\"primary output,deep buffer,haptic,voip_rx\"/>\n                <route type=\"mix\" sink=\"Telephony Tx\" sources=\"incall playback,voice call tx\"/>\n                <route type=\"mix\" sink=\"primary input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,A2DP In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"hotword input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"incall capture\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voice call rx\" sources=\"Voice Call And Telephony Rx\" />\n                <route type=\"mix\" sink=\"voip_tx\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In,BT SCO Headset Mic\"/>\n                <route type=\"mix\" sink=\"fast input\"\n                       sources=\"Built-In Mic,Built-In Back Mic,Wired Headset Mic,USB Device In,USB Headset In\"/>\n                <route type=\"mix\" sink=\"hifi_input\" sources=\"USB Device In,USB Headset In\" />\n                <route type=\"mix\" sink=\"echo_ref_input\" sources=\"Echo Ref In\"/>\n            </routes>\n        </module>\n\n        <!-- Bluetooth Audio HAL for LE Audio -->\n        <module name=\"%BT_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"le audio output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"le audio input\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"48000\"\n                             channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"BT BLE Out\" type=\"AUDIO_DEVICE_OUT_BLE_HEADSET\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Speaker\" type=\"AUDIO_DEVICE_OUT_BLE_SPEAKER\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BT BLE Broadcast\" type=\"AUDIO_DEVICE_OUT_BLE_BROADCAST\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_32_BIT\"\n                             samplingRates=\"48000\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n                <devicePort tagName=\"BLE Headset In\" type=\"AUDIO_DEVICE_IN_BLE_HEADSET\" role=\"source\"/>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"BT BLE Out\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Speaker\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"BT BLE Broadcast\"\n                       sources=\"le audio output\"/>\n                <route type=\"mix\" sink=\"le audio input\"\n                       sources=\"BLE Headset In\"/>\n            </routes>\n        </module>\n\n        <!-- Usb Audio HAL -->\n        <module name=\"%USB_MODULE%\" halVersion=\"2.0\">\n            <mixPorts>\n                <mixPort name=\"usb_accessory output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n            </mixPorts>\n            <devicePorts>\n                <devicePort tagName=\"USB Host Out\" type=\"AUDIO_DEVICE_OUT_USB_ACCESSORY\" role=\"sink\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"USB Host Out\"\n                       sources=\"usb_accessory output\"/>\n            </routes>\n        </module>\n\n        <!-- Remote Submix Audio HAL -->\n        <module name=\"r_submix\" halVersion=\"2.0\">\n            <attachedDevices>\n                <item>Remote Submix In</item>\n            </attachedDevices>\n            <mixPorts>\n                <mixPort name=\"r_submix output\" role=\"source\">\n                    <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                             samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n                </mixPort>\n                <mixPort name=\"r_submix input\" role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </mixPort>\n           </mixPorts>\n           <devicePorts>\n               <devicePort tagName=\"Remote Submix Out\" type=\"AUDIO_DEVICE_OUT_REMOTE_SUBMIX\"  role=\"sink\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_OUT_STEREO\"/>\n               </devicePort>\n               <devicePort tagName=\"Remote Submix In\" type=\"AUDIO_DEVICE_IN_REMOTE_SUBMIX\"  role=\"source\">\n                   <profile name=\"\" format=\"AUDIO_FORMAT_PCM_16_BIT\"\n                            samplingRates=\"44100\" channelMasks=\"AUDIO_CHANNEL_IN_STEREO\"/>\n                </devicePort>\n            </devicePorts>\n            <routes>\n                <route type=\"mix\" sink=\"Remote Submix Out\"\n                       sources=\"r_submix output\"/>\n                <route type=\"mix\" sink=\"r_submix input\"\n                       sources=\"Remote Submix In\"/>\n            </routes>\n        </module>\n\n    </modules>\n    <!-- End of Modules section -->\n\n    <!-- Volume section -->\n\n    <xi:include href=\"%VOLUME_FILE%\"/>\n    <xi:include href=\"%DEFAULT_VOLUME_FILE%\"/>\n\n    <!-- End of Volume section -->\n</audioPolicyConfiguration>\n"
  }
]