├── .gitignore ├── LICENSE ├── NOTICE ├── README-ru.md ├── README-zh.md ├── README.md ├── changelog.md ├── config ├── JSON-CONFIG-ru.md ├── JSON-CONFIG-zh.md ├── JSON-CONFIG.md ├── README.md └── memory.json ├── image ├── list.jpg ├── ui_cn.jpg ├── ui_ru.jpg └── ui_us.jpg ├── magisk.sh ├── module ├── HC_memory ├── META-INF │ └── com │ │ └── google │ │ └── android │ │ ├── update-binary │ │ └── updater-script ├── app │ └── app-release.apk ├── config │ ├── HC_memory │ │ └── 名单列表.conf │ └── Language │ │ ├── language.json │ │ └── list │ │ ├── de-DE.json │ │ ├── en-US.json │ │ ├── es-ES.json │ │ ├── ru-RU.json │ │ └── zh-CN.json ├── customize.sh ├── lib │ └── arm64-v8a │ │ └── libhook_lmkd.so ├── module.prop ├── service.sh ├── system.prop ├── system │ └── bin │ │ ├── UI_memory │ │ └── amui └── uninstall.sh └── version.json /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | /.vscode 3 | /.cache 4 | /build 5 | /.DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | A1Memroy 2 | 3 | Third-Party Software Notices and Information 4 | ============================================ 5 | 6 | This repository incorporates components from the following projects: 7 | 8 | 1. Dobby (https://github.com/jmpews/Dobby): a lightweight, multi-platform, multi-architecture hook framework. 9 | 10 | - License: Apache License 2.0 (https://github.com/jmpews/Dobby/blob/master/LICENSE) 11 | - Copyright: jmpews 12 | - Other relevant information: Please refer to the Dobby project for additional details and acknowledgments. 13 | 14 | 2. And64InlineHook (https://github.com/Rprop/And64InlineHook): Lightweight ARMv8-A(ARM64, AArch64, Little-Endian) Inline Hook Library for Android C/C++ 15 | 16 | - License: MIT License (https://github.com/Rprop/And64InlineHook/blob/master/LICENSE) 17 | - Copyright: Rprop 18 | - Other relevant information: Please refer to the And64InlineHook project for additional details and acknowledgments. 19 | 20 | 3. json (https://github.com/nlohmann/json): JSON for Modern C++ 21 | 22 | - License: MIT License (https://github.com/nlohmann/json/blob/develop/LICENSE.MIT) 23 | - Copyright: nlohmann 24 | - Other relevant information: Please refer to the json project for additional details and acknowledgments. 25 | 26 | 4. spdlog (https://github.com/gabime/spdlog): Fast C++ logging library. 27 | 28 | - License: MIT License (https://github.com/gabime/spdlog/blob/v1.x/LICENSE) 29 | - Copyright: gabime 30 | - Other relevant information: Please refer to the spdlog project for additional details and acknowledgments. 31 | 32 | 5. imgui (https://github.com/ocornut/imgui): Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies 33 | 34 | - License: MIT License (https://github.com/ocornut/imgui/blob/master/LICENSE.txt) 35 | - Copyright: ocornut 36 | - Other relevant information: Please refer to the imgui project for additional details and acknowledgments. 37 | 38 | 6. FTXUI (https://github.com/ArthurSonzogni/FTXUI): 💻 C++ Functional Terminal User Interface. ❤️ 39 | 40 | - License: MIT License (https://github.com/ArthurSonzogni/FTXUI/blob/main/LICENSE) 41 | - Copyright: ArthurSonzogni 42 | - Other relevant information: Please refer to the FTXUI project for additional details and acknowledgments. 43 | 44 | Please refer to the individual components' licenses and original sources for more detailed information. 45 | The licenses and copyright notices for each component can be found in their respective source code files or accompanying documentation. 46 | -------------------------------------------------------------------------------- /README-ru.md: -------------------------------------------------------------------------------- 1 |
2 |

Управление памятью A1

3 | C Language 4 | C++ Language 5 | Bash Shell 6 | Android Support 7 | arm64-v8a Support 8 | Присоединиться к каналу Telegram 9 |

English | 简体中文 | Русский

10 |

Стороннее управление памятью, работающее на Android, может уменьшить оперативную память, используемую приложениями.

11 |
12 | 13 | ## ✨Важные особенности 14 | - Управление фоновым процессом жизни и смерти 15 | - Укажите, чтобы освободить дочерний процесс фонового приложения. 16 | - Не позволяйте демону убийцы с низким объемом памяти убивать фон 17 | - Автоматическое освобождение неиспользуемой памяти 18 | - Приложения для сна, чтобы уменьшить использование процессора и памяти. 19 | 20 | ## 💡Описание 21 | - Этот модуль поддерживает только Android8 ~ 14, а платформа поддерживает только arm64-v8a. 22 | - Магиск не ниже 20.4+, и большинство ксу совместимы 23 | - Этот модуль вряд ли будет конфликтовать с другими модулями. 24 | 25 | ### Путь к списку по умолчанию 26 | ![列表图片](image/list.jpg) 27 | - Список имен: /sdcard/Android/HChai/HC_memory/名单列表.conf 28 | 29 | ## 📱Терминальный интерфейс 30 | Настройка функции переключения, поддерживается только простое переключение функций. Для более детальной настройки параметров, пожалуйста, смотрите 📝 Пользовательские настройки. 31 | ![UI图片](image/ui_ru.jpg) 32 | Как получить доступ к терминальному интерфейсу? 33 | - Вы можете использовать команду `amui` в Termux или выполнить /sdcard/Android/HChai/HC_memory/`terminal.sh` в менеджере mt. 34 | 35 | Как сохранить и переключить функции? 36 | - Используйте стрелки для навигации и нажмите Enter для сохранения. 37 | - Если нет клавиатуры, нажмите на иконку "lm" в нижнем правом углу, чтобы вызвать клавиатуру. 38 | 39 | Для чего эта функция? 40 | - Пояснение будет добавлено в терминальный интерфейс позже. В настоящее время доступно только руководство по настройке Json. 41 | 42 | ## 📝Пользовательская конфигурация 43 | Встроенная конфигурация подходит для большинства устройств, но есть еще некоторые устройства, которые не относятся к конфигурации по умолчанию, поэтому открывается больше встроенных настраиваемых параметров. Это требование было учтено при разработке фреймворка HAMv2.Большинство параметров можно настраивать и корректировать, а этот проект можно встраивать в другие модули для запуска. Файл конфигурации Json находится по адресу ['/data/adb/modules/Hc_memory/config/memory.json']. 44 | 45 | ### Информационный проект 46 | ```json 47 | "project": { 48 | "name": "官方配置 [23.06.25]", 49 | "author": "火機@coolapk" 50 | } 51 | ``` 52 | 53 | | имя поля | тип | описание | 54 | | -------- | ------ | -------------------------------------------- | 55 | | name | string | Имя конфигурационного файла | 56 | | author | string | информация об авторе конфигурационного файла | 57 | 58 | `name` и `author` отражаются в журнале следующим образом: 59 | ``` 60 | [2023-07-06 19:00:22] [info] config 官方配置 [23.06.25] | by: 火機@coolapk 61 | ``` 62 | 63 | - Более подробное описание конфигурационного файла json см. [здесь](config/JSON-CONFIG-ru.md) 64 | 65 | ## 🔍Часто задаваемые вопросы 66 | 67 | Можно ли использовать его с другими модулями оптимизации памяти? 68 | - Управление памятью A1 полностью отличается от других принципов оптимизации памяти, поэтому эффект от использования других модулей будет только 1+1=2. 69 | 70 | Будет ли он потреблять энергию? 71 | - Вовсе нет. Когда я разрабатывал инфраструктуру HAMv2, я потратил много времени на оптимизацию основного кода и принял базовый язык C/C++. Следовательно, потребление энергии, вызванное рамкой, незначительно. 72 | 73 | Будет ли это вызывать конфликты с другими модулями Magisk или модулями Xp? 74 | - Конфликт с другими модулями практически невозможен, конфликтов с этим модулем пока не встречалось. 75 | 76 | Влияет ли это на энергопотребление в режиме ожидания? 77 | - Фреймворк HAMv2 не будет вызывать энергопотребление в режиме ожидания, так как в режиме ожидания управление памятью A1 переходит в неактивное состояние. 78 | 79 | Включите, чтобы lmkd не убивал фон, почему фон все равно убивается? 80 | - Потому что он не позволяет lmkd убивать фон и не включает фоновые программы-убийцы различных производителей мобильных телефонов. 81 | 82 | Как настроить милый список? 83 | - Для настройки смарт-списка необходимо добавить в соответствующий список правило "KILL имя пакета: имя дочернего процесса". Перед добавлением вам необходимо убедиться, что вы понимаете функцию и роль подпроцесса, чтобы не вызвать непредвиденных проблем. 84 | 85 | Почему он переходит в режим fb после входа в систему в течение определенного периода времени? 86 | - Большинство телефонов, у которых есть эта проблема, являются телефонами Samsung, и функция перехвата, которая не позволяет lmkd завершить процесс, включена, что может быть причиной. В настоящее время нет способа исправить это, но это можно сделать, отключив функцию, которая не позволяет lmkd убивать процессы. 87 | 88 | Почему процесс воспроизведения аудио приостановлен? 89 | - Редко случается, что аудио процесс приостанавливается, если это все же происходит, вы можете добавить процесс в белый список, либо отключить функцию сна приложения. Это гарантирует, что аудиопроцесс продолжит работать без паузы. 90 | 91 | При установке модуля пишет Не совместимо с этой платформой: xxxx 92 | - В настоящее время модуль поддерживает только платформу arm-v8a, а другие платформы временно не поддерживают его. 93 | 94 | ## 🚀 Скачать 95 | - [Перейдите на Github для загрузки](https://github.com/OneB1ank/A1Memory/releases) 96 | 97 | ## 🌟Любимый тренд 98 | 99 | 100 | 101 | 102 | 103 | Star History Chart 104 | 105 | 106 | 107 | ## 🙏 Спасибо 108 | 109 | Благодаря исходному коду следующих пользователей или проектов за их помощь в этом проекте: 110 | - [@yc9559](https://github.com/yc9559) 111 | - [@HChenX](https://github.com/HChenX) 112 | 113 | Спасибо следующим пользователям за отзывы о тестировании и обнаружение ошибок: 114 | - @火機(coolapk) 115 | 116 | ## 🎉 Пожертвовать на поддержку 117 | Как вы думаете, этот модуль очень полезен, вы можете пожертвовать, чтобы поддержать меня 118 | - [爱发电](https://afdian.net/a/HCha1) 119 | - [patreon](https://patreon.com/A1memory) 120 | - USDT(TRC20) 121 | > Address: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 122 | -------------------------------------------------------------------------------- /README-zh.md: -------------------------------------------------------------------------------- 1 |
2 |

A1内存管理

3 | C Language 4 | C++ Language 5 | Bash Shell 6 | Android Support 7 | arm64-v8a Support 8 | 加入电报频道 9 |

English | 简体中文 | Русский

10 |

运行在Android的第三方内存管理,可减少应用使用运行内存。

11 |
12 | 13 | ## ✨重要功能 14 | - 管理后台进程存活和死亡 15 | - 指定释放后台应用子进程 16 | - 阻止Low Memory Killer Daemon杀后台 17 | - 自动释放非常用内存 18 | - 让应用休眠减少CPU和内存使用 19 | 20 | ## 💡说明 21 | - 该模块只支持Android8 ~ 14,平台仅支持arm64-v8a 22 | - Magisk不低于20.4+,ksu大部分可兼容 23 | - 此模块基本不会与其他模块产生冲突 24 | 25 | ### 默认列表路径 26 | ![列表图片](image/list.jpg) 27 | - 名单列表:/sdcard/Android/HChai/HC_memory/名单列表.conf 28 | 29 | ## 📱终端UI 30 | 自定义开关功能,只支持简单的功能开关,更具体的参数配置请查看📝自定义配置。 31 | ![UI图片](image/ui_cn.jpg) 32 | 如何打开终端UI界面? 33 | - 可在Termux中使用`amui`命令,也可在mt管理器中执行/sdcard/Android/HChai/HC_memory/`terminal.sh` 34 | 35 | 如何保存和开关功能? 36 | - 使用方向键来控制,回车保存。 37 | - 如果没有键盘点击右下角lm呼出键盘。 38 | 39 | 功能作用? 40 | - 之后会在终端UI中添加说明,目前只有Json配置说明。 41 | 42 | ## 📝自定义配置 43 | 自带配置适用于绝大多数设备,但还是有一些设备不适用默认配置,因此开放更多内置可调参数。在设计HAMv2框架时遍已经考虑到该需求,绝大多数的参数都可自定义调整,而且此项目可嵌入到其他模块中运行。Json配置文件位于`/data/adb/modules/Hc_memory/config/memory.json` 44 | 45 | ### 项目信息 46 | ```json 47 | "project": { 48 | "name": "官方配置 [23.06.25]", 49 | "author": "火機@coolapk" 50 | } 51 | ``` 52 | 53 | | 字段名 | 类型 | 描述 | 54 | | ------ | ------ | ------------------ | 55 | | name | string | 配置文件的名称 | 56 | | author | string | 配置文件的作者信息 | 57 | 58 | `name`与`author`在日志以如下方式体现: 59 | ``` 60 | [2023-07-06 19:00:22] [info] config 官方配置 [23.06.25] | by: 火機@coolapk 61 | ``` 62 | 63 | - 更详细的json配置文件说明请参考[这里](config/JSON-CONFIG-zh.md) 64 | 65 | ## 🔍常见问题 66 | 67 | 可以搭配其他内存优化模块吗? 68 | - A1内存管理与其他内存优化原理完全不同,因此搭配其他模块效果只会是1+1=2。 69 | 70 | 是否会耗电? 71 | - 完全不会。我在开发HAMv2框架时,花费了大量时间来优化核心代码,并采用了底层的C/C++语言。因此,该框架所造成的耗电量微乎其微,可以忽略不计。 72 | 73 | 与其他Magisk模块或者Xp模块会造成冲突吗? 74 | - 几乎不太可能与其他模块发生冲突,至今尚未遇到与本模块发生冲突的情况。 75 | 76 | 是否造成待机耗电? 77 | - HAMv2框架不会导致待机耗电,因为在待机状态下,A1内存管理会进入休眠状态。 78 | 79 | 启用阻止lmkd杀后台,为什么后台还是被杀了? 80 | - 因为只阻止lmkd杀后台,不包含各个手机厂商的杀后台程序。 81 | 82 | 如何配置乖巧列表? 83 | - 要配置乖巧列表,你需要在相应的列表中添加"KILL 包名:子进程名"的规则。在添加之前,你需要确保了解子进程的功能和作用,以免造成意外问题。 84 | 85 | 为什么进入系统一段时间后进入fb模式? 86 | - 出现该问题的大部分都是三星手机,并且启用了hook阻止lmkd杀进程的功能,这可能是导致的原因。目前尚无法解决这个问题,但可以通过关闭阻止lmkd杀进程的功能来解决。 87 | 88 | 为什么播放音频的进程被暂停了? 89 | - 音频进程被暂停的情况很少发生,如果确实发生了,可以将该进程添加到白名单中,或者关闭应用休眠功能。这样可以确保音频进程持续运行而不被暂停。 90 | 91 | 安装模块时提示Not compatible with this platform: xxxx 92 | - 目前模块仅支持arm-v8a平台,其他平台暂时不支持。 93 | 94 | ## 🚀下载 95 | - [前往Github下载](https://github.com/OneB1ank/A1Memory/releases) 96 | 97 | ## 🌟收藏趋势 98 | 99 | 100 | 101 | 102 | 103 | Star History Chart 104 | 105 | 106 | 107 | ## 🙏致谢 108 | 109 | 感谢以下用户或项目的源码对本项目的帮助: 110 | - [@yc9559](https://github.com/yc9559) 111 | - [@HChenX](https://github.com/HChenX) 112 | 113 | 感谢以下用户的测试反馈和错误定位: 114 | - @火機(coolapk) 115 | 116 | ## 🎉捐赠支持 117 | 如何你觉得这个模块很好用,可以捐赠来支持我 118 | - [爱发电](https://afdian.net/a/HCha1) 119 | - [patreon](https://patreon.com/A1memory) 120 | - USDT(TRC20) 121 | > 地址: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

A1 memory management

3 | C Language 4 | C++ Language 5 | Bash Shell 6 | Android Support 7 | arm64-v8a Support 8 | Join Telegram Channel 9 |

English | 简体中文 | Русский

10 |

Third-party memory management running on Android can reduce the running memory used by applications.

11 |
12 | 13 | ## ✨important function 14 | - Managing the survival and termination of background processes 15 | - Specifying the release of background application child processes 16 | - Preventing Low Memory Killer Daemon from killing background processes 17 | - Automatically releasing non-essential memory 18 | - Putting applications to sleep to reduce CPU and memory usage 19 | 20 | ## 💡Description 21 | - This module only supports Android 8 to 14, and the platform is limited to arm64-v8a. 22 | - Magisk version should be 20.4+ and ksu is mostly compatible. 23 | - This module is unlikely to conflict with other modules. 24 | 25 | ### Default List Path 26 | ![列表图片](image/list.jpg) 27 | - List File: /sdcard/Android/HChai/HC_memory/名单列表.conf 28 | 29 | ## 📱Terminal UI 30 | Custom toggle functionality, only supports simple feature toggling. For more detailed parameter configurations, please see 📝 Custom Configuration. 31 | ![UI图片](image/ui_us.jpg) 32 | How to access the Terminal UI interface? 33 | - You can use the `amui` command in Termux or execute /sdcard/Android/HChai/HC_memory/`terminal.sh` in the mt manager. 34 | 35 | How to save and toggle features? 36 | - Use the arrow keys for navigation and press Enter to save. 37 | - If there's no keyboard, click on the bottom right corner "lm" to summon the keyboard. 38 | 39 | What does the feature do? 40 | - An explanation will be added to the Terminal UI later. Currently, only the Json configuration guide is available. 41 | 42 | ## 📝Custom Configuration 43 | The built-in configuration is suitable for most devices, but there are still some devices that may not work with the default configuration. Therefore, more adjustable parameters are provided. This requirement was already taken into consideration when designing the HAMv2 framework, and most parameters can be customized and adjusted. Moreover, this project can be embedded and run within other modules. The JSON configuration file is located at `/data/adb/modules/Hc_memory/config/memory.json` 44 | 45 | ### Project Information 46 | ```json 47 | "project": { 48 | "name": "官方配置 [23.06.25]", 49 | "author": "火機@coolapk" 50 | } 51 | ``` 52 | 53 | | Field | Type | Description | 54 | | ------ | ------ | -------------------------------------------- | 55 | | name | string | Name of the configuration file | 56 | | author | string | Author information of the configuration file | 57 | 58 | The `name` and `author` are reflected in the logs in the following format: 59 | ``` 60 | [2023-07-06 19:00:22] [info] config 官方配置 [23.06.25] | by: 火機@coolapk 61 | ``` 62 | 63 | - For more detailed instructions on the JSON configuration file, please refer to[here.](config/JSON-CONFIG.md) 64 | 65 | ## 🔍Frequently Asked Questions 66 | 67 | Can it be used in conjunction with other memory optimization modules? 68 | - A1 memory management works completely differently from other memory optimization methods, so using it together with other modules will only yield a cumulative effect of 1+1=2. 69 | 70 | Does it consume power? 71 | - Not at all. I spent a considerable amount of time optimizing the core code while developing the HAMv2 framework. It is implemented in low-level languages such as C/C++, resulting in minimal power consumption that can be completely ignored. 72 | 73 | Does it conflict with other Magisk modules or Xposed modules? 74 | - It is highly unlikely to conflict with other modules. So far, no conflicts have been encountered with this module. 75 | 76 | Does it cause power consumption during standby? 77 | - The HAMv2 framework does not cause power consumption during standby, as the A1 memory management enters a sleep state when the device is in standby mode. 78 | 79 | Why is the background process still killed even after enabling the lmkd process kill prevention? 80 | - This is because it only prevents lmkd from killing background processes and does not include the background process killing programs from various phone manufacturers. 81 | 82 | How to configure the smart list? 83 | - To configure the smart list, you need to add the rule "KILL package_name:subprocess_name" in the respective list. Before adding, make sure you understand the functionality and purpose of the subprocess to avoid any unexpected issues. 84 | 85 | Why does the device enter fb mode after a certain period of time? 86 | - Most cases of this issue occur on Samsung devices when the hook to prevent lmkd process killing is enabled. This is likely the cause of the problem. Currently, there is no solution available, but you can try disabling the hook to prevent lmkd process killing to resolve it. 87 | 88 | Why is the process playing audio being paused? 89 | - The occurrence of audio process being paused is rare. If it indeed happens, you can add the process to the whitelist or disable the app hibernation feature. This will ensure continuous operation of the audio process without being paused. 90 | 91 | Not compatible with this platform: xxxx error when installing the module. 92 | - Currently, the module only supports the arm-v8a platform and does not support other platforms temporarily. 93 | 94 | ## 🚀download 95 | - [Go to Github to download](https://github.com/OneB1ank/A1Memory/releases) 96 | 97 | ## 🌟Star History 98 | 99 | 100 | 101 | 102 | 103 | Star History Chart 104 | 105 | 106 | 107 | ## 🙏Acknowledgments 108 | 109 | Thanks to the following users or projects for their source code contributions to this project: 110 | - [@yc9559](https://github.com/yc9559) 111 | - [@HChenX](https://github.com/HChenX) 112 | 113 | Thanks to the following users for their testing feedback and bug identification: 114 | - @火機(coolapk) 115 | 116 | ## 🎉Support Donations 117 | If you find this module useful, you can make a donation to support me. 118 | - [爱发电](https://afdian.net/a/HCha1) 119 | - [patreon](https://patreon.com/A1memory) 120 | - USDT(TRC20) 121 | > Address: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 122 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # 【更新日志】 2 | 3 | ## Richard8 2023.11.26 4 | - 更新ndk到r26b 5 | - 更新hllvm混淆 6 | 7 | ## Richard7 2023.11.08 8 | - 修复Inotify导致的问题 9 | - 优化代码减少CPU消耗 10 | 11 | ## Richard6 2023.11.07 12 | - 更新依赖库 13 | - Inotify优化减少消耗 14 | - 优化service.sh代码 15 | - 删除沉淀代码 16 | 17 | ## Richard5 2023.11.06 18 | - 尝试修复Android14无限重启 19 | - 未实验谨慎更新 20 | 21 | ## Richard4 2023.11.04 22 | - 注入支持Android14 23 | - 修复注入一些问题 24 | - 注入隐藏避免被检测 25 | 26 | ## Richard3 2023.10.05 27 | - 修复小窗不被识别为前台 28 | - 限制三星开启阻止lmkd 29 | - 内置/外置参数更变 30 | 31 | ## Richard2 2023.09.30 32 | - 重构注入,修复若干个问题 33 | - 对三星手机不再有注入的限制 34 | - 大概率解决了注入后导致系统程序出现问题 35 | 36 | ## Richard1 2023.09.29 37 | - 添加更加详细的日志问题 38 | - 更改默认配置 39 | - 结束Beta测试版 40 | 41 | ## Beta24 2023.09.27 42 | - 修复乖巧误识别 43 | - 修改内存管理前台后台判断逻辑 44 | 45 | ## Beta23 2023.09.26 46 | - 修复导致开机时间增加 47 | - 终端UI添加功能简单说明 48 | - 修复HEAD不改变 49 | 50 | ## Beta22 2023.09.25 51 | - 修复判断sys.boot_completed造成陷入死循环 52 | 53 | ## Beta21 2023.09.24 54 | - 预支持Android14 55 | - 解决多次注入导致lmkd发生错误 56 | 57 | ## Beta20 2023.09.19 58 | - 修复了部分手机无法使用v4 59 | - 减少初始化消耗CPU资源 60 | - 因争议取消本地socket,并且取消本地模块之间互联,包括未来xp模块与magisk模块相互通信(模块只有本地通信) 61 | - 优化线程池代码 62 | 63 | ## Beta19 2023.09.10 64 | - 减少非必要运行的代码 65 | - 修改框架核心逻辑 66 | - 增加线程池 67 | - 多线程接收/发送socket通信 68 | 69 | ## Beta18 2023.08.25 70 | - 修改代码核心逻辑 71 | - 验证运行环境 72 | 73 | ## Beta17 2023.08.16 74 | - 删除非必要的hook 75 | 76 | ## Beta16 2023.08.15 77 | - 修复内存阈值逻辑bug 78 | - 卸载自动删除附加app 79 | 80 | ## Beta15 2023.08.14 81 | - 新增西班牙语支持(es-ES) 82 | - 修复dobby框架导致注入无效 83 | - 修改判断magisk和ksu的逻辑 84 | - 附加lsp模块保活后台 85 | - 修复log文件夹权限被改导致无法创建的问题 86 | - 新增拦截相机杀后台 87 | - 修复lmkd进程优先级问题 88 | 89 | ## Beta14 2023.08.05 90 | - 支持多国语言(en-US,zh-CN,ru-RU,de-DE) 91 | - 可自定义添加其他语言 92 | 93 | ## Beta13 2023.07.30 94 | - 优化核心代码逻辑 95 | - 删除部分日志 96 | 97 | ## Beta12 2023.07.27 98 | - 终端添加基础功能开关 99 | - 调整日志输出 100 | - 配置文件可继承与补丁 101 | - 说明、专业配置、日志预览、设备参数等等,后续添加 102 | - 修复面板错误 103 | 104 | ## Beta11 2023.07.26 105 | - 预更新终端面板 106 | - 应用休眠实现方式更改 107 | - 增加了一些日志 108 | 109 | ## Beta10 2023.07.18 110 | - 调整hook代码 111 | - 减少lmkd进程消耗 112 | 113 | ## Beta9 2023.07.14 114 | - 修复了指针异常导致HC_memory进程崩溃 115 | - 修复了一处可能导致HC_memory进程崩溃的问题 116 | 117 | ## Beta8 2023.07.13 118 | - 默认关闭保活和应用休眠 119 | - 优化注入代码 120 | - 预加入控制面板 121 | 122 | ## Beta7 2023.07.12 123 | - 更改为c++20标准 124 | - 日志方面进行了优化 125 | - 修复三星手机无法正常运行的问题 126 | 127 | ## Beta6 2023.07.11 128 | - 修复了模块从未生效的问题 129 | - 修复了一处可能陷入死循环的问题 130 | - 优化了正则表达式性能 131 | 132 | ## Beta5 2023.07.10 133 | - 参数细微调整 134 | - 更换dobby版本 135 | - 这次更新不再有问题 136 | 137 | ## Beta4 2023.07.09 138 | - 修复休眠后无法唤醒的问题 139 | - 默认关闭疯狂杀戮 140 | 141 | ## Beta3 2023.07.08 142 | - 更改A1发送SIGKILL信号为SIGTERM 143 | - 内置com.android.shell白名单防止掉root 144 | - 优化了正则表达式性能 145 | - 修复重启HC_memory进程不删除旧日志 146 | 147 | ## Beta2 2023.07.07 148 | 149 | - 修复kill面具导致掉root 150 | - 默认开启疯狂杀戮 151 | 152 | ## Beta1 2023.07.06 153 | 154 | - 重建项目,使用HAMv2框架 155 | - 相对于内存管理v3.1减少80%性能消耗 156 | - 改进编译优化,减少二进制体积 157 | 158 | ## 重要更新在频道通知:[TG频道](https://t.me/HCha1234) | [项目地址](https://github.com/OneB1ank/A1Memory) -------------------------------------------------------------------------------- /config/JSON-CONFIG-ru.md: -------------------------------------------------------------------------------- 1 | # Описание Json-файла конфигурации управления памятью A1 v4 2 | 3 | A1 Memory Management v4 разработан с использованием фреймворка HAMv2, поэтому параметры управления памятью можно настраивать через конфигурационные файлы без изменения исходного кода. В этом документе подробно рассказывается, как настроить файлы конфигурации Json. 4 | 5 | ## Параметр пользовательских модулей 6 | 7 | ```json 8 | "config": { 9 | "path": "/sdcard/Android/HChai/HC_memory", 10 | "modulePath": "/data/adb/modules/Hc_memory", 11 | "list": { 12 | "name": "名单列表.conf", 13 | "whiteList": { 14 | "optional": true, 15 | "smart": true, 16 | "system": false 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | | имя поля | тип | описание | 23 | | ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | 24 | | path | string | путь к файлу конфигурации | 25 | | modulePath | string | имя модуля путь | 26 | | name | string | Имя файла конфигурационного списка, в котором хранятся белый список и смарт-список | 27 | | optional | bool | Включить ли белый список, после включения процессы в белом списке не будут убиты | 28 | | smart | bool | Включить ли смарт-белый список, после его включения процесс будет автоматически идентифицирован и добавлен в белый список | 29 | | system | bool | Включить ли системный белый список, все системное ПО будет добавлено в белый список после включения | 30 | 31 | Следует отметить, что добавление белого списка должно быть добавлено в следующем формате: 32 | 33 | ``` 34 | WHITE Имена пакетов 35 | ``` 36 | 37 | ## Путь/уровень журнала 38 | 39 | Записывайте журналы, когда запущено управление памятью A1 v4, и вы можете настроить вывод журнала, изменив путь журнала и уровень журнала. 40 | 41 | ```json 42 | "log": { 43 | "path": "/sdcard/Android/HChai/HC_memory/Run.log", 44 | "level": "info" 45 | } 46 | ``` 47 | 48 | | имя поля | тип | описание | 49 | | -------- | ------ | ----------------------------------------------------------------------------- | 50 | | path | string | путь журнала | 51 | | level | string | уровень лога, варианты: debug, info, warn, err, critical | 52 | 53 | Если вы хотите отключить журнал, вы можете установить критический уровень журнала или, если вы хотите видеть только журнал текущих ошибок, вы можете настроить его на предупреждение. 54 | 55 | ## Основные рабочие параметры функции 56 | 57 | Функция этого параметра заключается в том, что после изменения приложения переднего плана переключение процесса переднего плана в течение определенного периода времени не приведет к запуску основной функции. 58 | 59 | ```json 60 | "initProcess": { 61 | "afterTopChange": { 62 | "sleep": 1 63 | } 64 | } 65 | ``` 66 | 67 | | имя поля | тип | описание | 68 | | -------- | --- | ------------------------- | 69 | | sleep | int | время ожидания в секундах | 70 | 71 | "sleep" указывает время ожидания после изменения приоритетного приложения в секундах. Установка его на 1 секунду означает, что после изменения приложения переднего плана подождите 1 секунду, прежде чем переключиться на передний план, прежде чем снова выполнять основную функцию. Другими словами, основная функция не будет выполнена, если передний план переключится в течение 1 секунды. Этот параметр можно использовать для управления повторным выполнением основной функции в течение периода времени после изменения приложения переднего плана, чтобы предотвратить ненужные операции или трату ресурсов. 72 | 73 | ## Управление памятью A1 завершает ненужные процессы 74 | 75 | Управление памятью A1 v4 может завершать ненужные процессы для освобождения памяти. Ниже приведены примеры параметров, используемых для управления этим поведением: 76 | 77 | ```json 78 | "a1Memory": { 79 | "enable": true, 80 | "oomAdj": 905 81 | } 82 | ``` 83 | 84 | | имя поля | тип | описание | 85 | | -------- | ---- | ------------------------------------------------------------------- | 86 | | enable | bool | Включить ли управление памятью A1 для завершения ненужных процессов | 87 | | oomAdj | int | Значение больше oomAdj будет прекращено | 88 | 89 | - `enable` указывает, следует ли включить управление памятью A1 для завершения ненужных процессов. Если установлено значение true, управление памятью A1 выполнит операцию завершения процесса; если установлено значение false, управление памятью A1 не завершит ни один процесс. 90 | - `oomAdj` указывает значение настройки, используемое для определения того, завершен ли процесс. Только когда значение oomAdj процесса больше установленного значения "oomAdj", они будут завершены управлением памятью A1. Это значение находится в диапазоне от 0 до 1000. Чем больше значение, тем меньше процессов завершается, и наоборот, чем меньше значение, тем больше процессов завершается. Следует отметить, что не все процессы будут идентифицированы и остановлены, будут прекращены только те процессы, которые алгоритм оценивает как ненужные и у которых значение oomAdj больше заданного значения. 91 | 92 | ## Разрешить приложению автоматически освобождать память 93 | 94 | Управление памятью A1 v4 позволяет приложениям автоматически освобождать память. Ниже приведены примеры параметров, используемых для управления этим поведением: 95 | 96 | ```json 97 | "initCutMemory": { 98 | "freed": { 99 | "enable": true, 100 | "level": "80", 101 | "regex": "( CAC|SVC|CEM).*", 102 | "change": 20 103 | } 104 | } 105 | ``` 106 | 107 | | имя поля | тип | описание | 108 | | -------- | ------ | ------------------------------------------------------------------------------------------------- | 109 | | enable | bool | Разрешить ли приложению автоматически освобождать память | 110 | | level | string | 0-100, чем выше значение, тем больше памяти будет освобождено | 111 | | regex | string | Регулярное выражение, соответствующее состоянию приложения, которому необходимо освободить память | 112 | | change | int | сколько раз передний план переключается для выполнения операции автоотпуска | 113 | 114 | - `enable` указывает, разрешить ли приложению автоматически освобождать память. Если установлено значение true, управление памятью A1 реализует приложение для автоматического освобождения операции с памятью; если установлено значение false, управление памятью A1 не будет выполнять приложение для автоматического освобождения операции с памятью. 115 | - `level` указывает степень освобождения памяти. Это значение находится в диапазоне от 0 до 100. Чем выше значение, тем больше памяти будет освобождено, и наоборот, чем меньше значение, тем меньше памяти будет освобождено. 116 | - `regex` представляет собой регулярное выражение, используемое для сопоставления состояния приложения, которому необходимо освободить память. Память будет освобождена только для соответствующего состояния приложения. Правила сопоставления регулярных выражений такие же, как и в языке JS, вы можете обратиться к [здесь](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions). 117 | - `change` указывает, сколько раз приложение переднего плана переключается для выполнения операции автоматического выпуска. Я рекомендую это значение между 10-30. 118 | 119 | Как узнать, память каких приложений нужно освободить? Получить статус можно командой: 120 | ```shell 121 | Заказ: dumpsys activity lru 122 | выход: ACTIVITY MANAGER LRU PROCESSES (dumpsys activity lru) 123 | Activities: 124 | #67: fg TOP LCMN 6918:bin.mt.plus/u0a226 act:activities|recents 125 | #66: vis BFGS ---N 3152:com.miui.home/u0a80 act:activities 126 | #65: prev LAST ---- 25424:com.omarea.vtools/u0a672 act:activities|recents 127 | #64: cch CAC ---- 5586:com.kiwibrowser.browser/u0a91 act:activities|recents 128 | #63: cch CACC ---- 5961:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:4/u0a91i-8996 act:client 129 | #62: cch+10 CAC ---- 22204:com.tencent.mobileqq/u0a481 act:activities|recents 130 | #61: cch+10 CACC ---- 22308:com.tencent.mobileqq:MSF/u0a481 act:client 131 | #60: cch+20 CACC ---- 5715:com.kiwibrowser.browser:kiwi_privileged_process0/u0a91 act:client 132 | #59: cch+20 CACC ---- 5748:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:1/u0a91i-8999 act:client 133 | #58: hvy CAC ---- 31098:com.coolapk.market/u0a677 act:activities|recents 134 | #57: hvy SVC ---- 9696:com.tencent.mm/u0a201 act:activities|recents 135 | #56: vis SVC ---- 4370:com.google.android.gms/u0a159 act:client 136 | #55: vis BFGS ---N 4265:com.google.android.gms.persistent/u0a159 act:client 137 | #54: hvy SVC ---- 9290:com.tencent.mm:push/u0a201 act:client 138 | #53: cch+30 CACC ---- 6104:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:5/u0a91i-8995 act:client 139 | #52: hvy CAC ---- 22734:org.telegram.plus/u0a386 act:activities|recents 140 | #51: hvy CAC ---- 24029:mark.via/u0a222 act:activities|recents 141 | #50: cch+30 CACC ---- 24074:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a222i1 act:client 142 | #49: cch+40 CAC ---- 25274:com.google.android.apps.translate/u0a548 act:activities|recents 143 | #48: hvy CAC ---- 21987:com.github.kr328.clash/u0a329 act:activities|recents 144 | Other: 145 | #47: fg BTOP ---N 4315:com.miui.securitycenter.remote/1000 146 | #46: vis BFGS ---N 4948:com.miui.powerkeeper/1000 147 | #45: cch+ 5 CEM ---- 4209:com.miui.weather2/u0a203 148 | #44: vis BTOP ---N 4853:com.miui.securitycenter.bootaware/1000 149 | #43: cch+15 CEM ---- 11717:com.android.mms/u0a66 150 | #42: cch+25 CEM ---- 7159:egrn.pucm.pgo/u0a764 151 | #41: psvc PER LCMN 4197:com.android.providers.media.module/u0a197 152 | #40: prcp FGS ---N 5977:com.miui.gallery/u0a68 153 | #39: vis FGS ---N 22036:com.github.kr328.clash:background/u0a329 act:client 154 | #38: cch+35 SVC ---- 31061:com.android.settings:remote/1000 155 | #37: svcb SVC ---- 4569:com.xiaomi.xmsf/u0a141 156 | #36: cch+45 CEM ---- 5950:com.xiaomi.aiasst.service/1000 157 | #35: prcp FGS ---N 20376:com.miui.misound/u0a126 158 | #34: fg BFGS ---N 5543:com.xiaomi.misettings:remote/1000 159 | #33: fg FGS ---N 5665:com.miui.notification:remote/1000 160 | #32: cch+55 CEM ---- 4396:com.android.providers.calendar/u0a50 161 | #31: cch+65 CEM ---- 9210:com.xiaomi.market:guard/u0a117 162 | #30: hvy CEM ---- 9075:com.xiaomi.joyose/1000 163 | #29: cch+75 CEM ---- 8819:com.miui.core/u0a145 164 | #28: cch+85 CEM ---- 8352:com.android.shell/2000 165 | #27: prcp TRNB ---- 4793:com.lbe.security.miui/u0a52 166 | #26: vis BFGS LCMN 5035:com.sohu.inputmethod.sogou.xiaomi/u0a134 act:treated 167 | #25: pers PER LCMN 4180:com.miui.face/1000 168 | #24: pers PER LCMN 4171:com.qualcomm.location/u0a182 169 | #23: pers PER LCMN 4149:org.mipay.android.manager/u0a150 170 | #22: pers PER LCMN 4130:com.tencent.soter.soterserver/u0a151 act:client 171 | #21: pers PER LCMN 4126:com.qualcomm.qti.workloadclassifier/u0a191 172 | #20: pers PER LCMN 4073:com.xiaomi.mircs/u0a76 173 | #19: pers PER LCMN 4081:com.xiaomi.xmsfkeeper/u0a140 174 | #18: pers PER LCMN 4061:com.miui.voicetrigger/u0a102 175 | #17: pers PER LCMN 4038:.slas/1000 176 | #16: pers PER LCMN 4001:system/u0a46 177 | #15: pers PER LCMN 4003:org.ifaa.aidl.manager/u0a149 178 | #14: pers PER LCMN 3996:com.android.nfc/1027 179 | #13: pers PER LCMN 3967:com.miui.contentcatcher/1000 180 | #12: vis BFGS LCMN 2913:com.miui.miwallpaper/u0a119 181 | #11: vis IMPF ---- 3432:com.android.smspush/u0a187 182 | #10: pers PER LCMN 3135:com.android.systemui/1000 183 | # 9: pers PER LCMN 3119:com.android.phone/1001 184 | # 8: pers PER LCMN 3104:com.xiaomi.finddevice/6110 185 | # 7: pers PER LCMN 3103:com.android.se/1068 186 | # 6: pers PER LCMN 3137:.dataservices/1001 187 | # 5: pers PER LCMN 3106:com.qualcomm.qti.devicestatisticsservice/u0a161 188 | # 4: pers PER LCMN 3094:org.codeaurora.ims/u0a184 189 | # 3: pers PER LCMN 3098:com.qti.qualcomm.mstatssystemservice/u0a186 190 | # 2: pers PER LCMN 3072:com.qti.phone/u0a175 191 | # 1: pers PER LCMN 3051:.qtidataservices/u0a148 192 | # 0: sys PER LCMN 1824:system/1000 193 | ``` 194 | Велика вероятность, что вы не знаете, что означает статус процесса, поясню вкратце: 195 | - PER (Persistent): это постоянное состояние, означающее, что процесс не будет уничтожен системой. Обычно это относится к критически важным системным процессам, таким как системные службы. 196 | - PERU (Persistent and Upward): это также постоянное состояние, но оно позволяет системе завершить процесс, если ему не хватает памяти. Это означает, что в некоторых случаях процесс может быть остановлен, но в большинстве случаев он будет продолжать работать. 197 | - TOP (Top): Это указывает на то, что процесс является видимым в данный момент приложением переднего плана, т. е. приложением, с которым взаимодействует пользователь. 198 | - BTOP (Bound Top): это состояние похоже на TOP, но система может остановить процесс из-за нехватки памяти. Обычно это происходит, когда на устройстве запущено много приложений, а памяти мало. 199 | - FGS (Foreground Service): указывает, что процесс предоставляет службы переднего плана. Служба переднего плана — это служба, которая взаимодействует с пользователем, отображая уведомления или другой пользовательский интерфейс. 200 | - BFGS (Bound Foreground Service): аналогична FGS, но система может завершить процесс из-за нехватки памяти. 201 | - IMPF (Important Background): указывает, что процесс является важным фоновым процессом, который выполняет некоторые важные задачи, но не должен отображаться для пользователя на переднем плане. 202 | - IMPB (Important Background and Upward): это состояние похоже на IMPF, но система может остановить процесс из-за нехватки памяти. 203 | - TRNB (Trusted Background): указывает, что процесс является доверенным фоновым процессом и выполняет некоторые доверенные задачи. 204 | - BKUP (Backup): Указывает, что процесс выполняет операции резервного копирования приложений, такие как резервное копирование данных в облако или другие устройства хранения. 205 | - SVC (Service): указывает, что процесс является фоновой службой, выполняющей определенные функции, и ее не нужно отображать для пользователя на переднем плане. 206 | - RCVR (Receiver): указывает, что процесс является широковещательным приемником для приема и обработки широковещательных сообщений, отправленных системой или приложениями. 207 | - TPSL (Top Sleeping): указывает, что процесс находится в состоянии ожидания верхнего уровня, то есть приложение находится в состоянии ожидания, но остается на переднем плане. 208 | - HVY (Heavy Weight): Указывает, что процесс является тяжеловесным, обычно потому, что он использует много системных ресурсов, таких как память или ЦП. 209 | - HOME: указывает, что процесс является приложением домашнего экрана устройства, рабочим столом, который видит пользователь. 210 | - LAST: Указывает, что процесс является последним завершенным процессом приложения. 211 | - CAC (Cached Activity Client): указывает, что процесс является активным клиентом кэша, обычно это приложение, работающее в фоновом режиме. 212 | - CACC (Cached Recent): указывает, что процесс является последним активным клиентом кэша и обычно завершается, когда ему не хватает памяти. 213 | - CRE (Cached Empty): указывает, что процесс является кэшированным пустым процессом, у него нет никаких действий или задач. 214 | - CEM (Cached Empty and Maintained): указывает, что процесс является кэшированным пустым процессом, но может быть остановлен при нехватке памяти. 215 | - NONE: Указывает, что процесс не имеет состояния или его состояние не может быть определено. 216 | 217 | ## параметры, связанные с внедрением хуков 218 | 219 | Управление памятью A1 v4 может использовать хуки, чтобы предотвратить уничтожение фоновых процессов lmkd. Ниже приведены примеры параметров, используемых для управления этим поведением: 220 | 221 | ```json 222 | "initInjection": { 223 | "enable": true, 224 | "processName": "/system/bin/lmkd", 225 | "symbolsFunc": "hc_hook", 226 | "libraryPath": "/data/adb/modules/Hc_memory/lib/arm64-v8a/libhook_lmkd.so", 227 | "lmkd": { 228 | "memThreshold": { 229 | "enable": true, 230 | "value": 90 231 | }, 232 | "hookFunc": { 233 | "kill": true, 234 | "pidfd_send_signal": true, 235 | "__android_log_print": false, 236 | "meminfo": { 237 | "updateTime": 60 238 | } 239 | }, 240 | "model": { 241 | "inlineHook": "dobby" 242 | } 243 | } 244 | } 245 | ``` 246 | 247 | | имя поля | тип | описание | 248 | | ------------- | ------ | ------------------------------------------------- | 249 | | initInjection | object | инъекция инициализации | 250 | | enable | bool | bool ли ловушку lmkd | 251 | | processName | string | имя процесса | 252 | | symbolsFunc | string | Имя функции, которая будет выполняться после хука | 253 | | libraryPath | string | Путь к библиотеке хуков | 254 | 255 | Вы можете изменить путь, чтобы внедрить свою библиотеку ловушек в указанный процесс.Я рекомендую использовать абсолютный путь для имени процесса. 256 | - `initInjection` означает инъекцию инициализации. 257 | - `enable` указывает, включать ли хук lmkd. Если установлено значение true, управление памятью A1 будет перехватывать lmkd; если установлено значение false, управление памятью A1 не будет перехватывать lmkd. 258 | 259 | ### порог памяти 260 | 261 | | имя поля | тип | описание | 262 | | ------------ | ------ | -------------------------------------------------------------------------------------------------- | 263 | | memThreshold | object | порог памяти | 264 | | enable | bool | Включить ли порог памяти | 265 | | value | int | Когда использование памяти достигает 90%, больше не препятствовать тому, чтобы lmkd убивал процесс | 266 | 267 | Порог памяти — очень важная функция, она позволяет больше не препятствовать тому, чтобы lmkd убивал процесс после того, как использование памяти достигает определенного уровня. Преимущество этого заключается в том, что это может предотвратить зависание системы из-за большого использования памяти, но также приведет к остановке фонового процесса. Таким образом, вы можете контролировать использование памяти до определенного уровня, установив пороговое значение памяти, и больше не запрещать lmkd убивать процесс. 268 | - `memThreshold` представляет функцию порога памяти. 269 | - `enable` указывает, следует ли включить функцию порога памяти. Если установлено значение true, управление памятью A1 активирует функцию порога памяти; если установлено значение false, управление памятью A1 не активирует функцию порога памяти. 270 | - `value` указывает, что когда использование памяти достигает 90%, больше не препятствовать тому, чтобы lmkd убивал процесс. 271 | 272 | ### Выберите функцию для перехвата 273 | 274 | | имя поля | тип | описание | 275 | | ------------------- | ------ | ------------------------------------------- | 276 | | hookFunc | object | функция ловушки | 277 | | kill | bool | Перехватывать ли функцию `kill` | 278 | | pidfd_send_signal | bool | будет ли `hook pidfd_send_signal` функция | 279 | | __android_log_print | bool | будет ли `hook __android_log_print` функция | 280 | | meminfo | object | информация о памяти | 281 | | updateTime | int | время обновления в секундах | 282 | 283 | - `hookFunc` представляет функцию ловушки. 284 | - для `kill` установлено значение true, чтобы перехватывать функцию kill, управление памятью A1 будет перехватывать функцию kill; установите для него значение false, чтобы не перехватывать функцию kill. 285 | - `pidfd_send_signal` имеет значение true, чтобы перехватывать функцию `pidfd_send_signal`, управление памятью A1 будет цеплять функцию `pidfd_send_signal`, чтобы предотвратить завершение процесса; установите для него значение false, чтобы не цеплять функцию `pidfd_send_signal`. 286 | - Установите для `__android_log_print` значение true, чтобы перехватывать функцию `__android_log_print`, управление памятью A1 будет перехватывать функцию `__android_log_print`; установите для него значение false, чтобы не перехватывать функцию `__android_log_print`. Не рекомендуется включать эту функцию, поскольку это приведет к сбою вывода журнала и может вызвать исключение lmkd. 287 | 288 | ### Время обновления информации о памяти 289 | 290 | Эффективно избегайте потребления производительности, вызванного повторным обновлением информации в памяти meminfo, вы можете контролировать интервал обновления, устанавливая время обновления. 291 | - `meminfo` информация о памяти. 292 | - `updateTime` Время обновления занимаемой памяти в процентах, рекомендуемое значение от 30 до 90. Чем больше значение, тем больше интервал обновления и меньше потребление производительности; чем меньше значение, тем короче интервал обновления и больше потребление производительности. 293 | 294 | | имя поля | тип | описание | 295 | | ---------- | ------ | ---------------- | 296 | | model | object | модель | 297 | | inlineHook | string | режим inlineHook | 298 | 299 | - `model` указывает на образец. 300 | - `inlineHook` по умолчанию использует [dobby](https://github.com/jmpews/Dobby) для изменения адреса функции. Если хук нельзя использовать нормально, вы можете попробовать изменить его на [And64InlineHook](https: //github.com/Rprop/And64InlineHook). 301 | 302 | ## Разрешить приложению спать, чтобы уменьшить использование ЦП и памяти 303 | 304 | Управление памятью A1 v4 позволяет приложениям переходить в спящий режим, чтобы уменьшить использование ЦП и памяти. Ниже приведены примеры параметров, используемых для управления этим поведением: 305 | 306 | | имя поля | тип | описание | 307 | | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- | 308 | | appSleep | object | приложение сна | 309 | | enable | bool | Включать ли гибернацию приложений для снижения использования ЦП и памяти | 310 | | idle | string | Для пользователей после бездействия все означает все/текущий означает текущего пользователя, текущий не действует на мультиоткрытие | 311 | | bg | string | статус фонового приложения, ignore означает игнорирование запроса на пробуждение и запрос приложения на извлечение | 312 | | top | string | Статус приложения переднего плана, разрешить означает разрешить запросы пробуждения и запросы приложений подтягивания | 313 | 314 | - для `enable` установлено значение true, чтобы включить спящий режим приложения для сокращения операций использования ЦП и памяти; установите значение false, чтобы не выполнять. 315 | - настройка `idle` для пользователя после бездействия. Необязательные значения: все (все пользователи) и текущий (текущий пользователь), где текущий не влияет на мультиоткрытие. 316 | - `bg` настройки состояния фонового приложения. Необязательные значения: игнорировать (игнорировать запрос пробуждения и запрос приложения подтягивания), разрешить (разрешить запрос пробуждения и запрос приложения подтягивания), запретить (запретить запрос пробуждения и запрос приложения подтягивания). . 317 | - `top` установка состояния приложения переднего плана. Необязательные значения такие же, как и у параметра bg. 318 | 319 | ## милый режим 320 | 321 | Проще говоря, это означает убить подпроцесс приложения и попытаться предотвратить подтягивание подпроцесса основным процессом, чтобы приложение могло уменьшить использование ЦП и памяти. 322 | Чтобы удовлетворить потребности большего количества людей, управление памятью A1 v4 по умолчанию включает некоторые подпроцессы приложений, но это может по-прежнему не охватывать все ситуации. Если вам нужно УБИТЬ другие дочерние процессы, вы можете добавить их, отредактировав файл list.conf. Ниже приведен пример формата файла roster-list.conf: 323 | ``` 324 | KILL имя пакета: дочерний процесс 325 | ``` 326 | 327 | | имя поля | тип | описание | 328 | | -------- | ------ | ---------------------------------- | 329 | | clever | object | умный режим | 330 | | enable | bool | Включать ли интеллектуальный режим | 331 | 332 | ## безумно бойня 333 | 334 | Вызовите API ядра, чтобы убить некоторые процессы.Принцип пока не ясен, но он может эффективно убить некоторые процессы. Я думаю, об этом можно судить по значению oom. Ниже приведены примеры параметров, используемых для управления этим поведением: 335 | 336 | | имя поля | тип | описание | 337 | | --------- | ------ | ------------------------------ | 338 | | crazyKill | object | безумное убийство | 339 | | enable | bool | Разрешить ли безумное убийство | 340 | 341 | ## Записать содержимое в файл 342 | 343 | Содержимое может быть записано в файл. Ниже приведены примеры параметров, используемых для управления этим поведением: 344 | 345 | ```json 346 | "file": { 347 | "write": [ 348 | { 349 | "path": "/proc/sys/fs/inotify/max_queued_events", 350 | "content": "102400" 351 | }, 352 | { 353 | "path": "/proc/sys/fs/inotify/max_user_watches", 354 | "content": "102400" 355 | }, 356 | ... 357 | ] 358 | } 359 | ``` 360 | 361 | В приведенном выше примере мы записали содержимое в два файла, тем самым активировав функцию inotify. 362 | 363 | | имя поля | тип | описание | 364 | | -------- | ------ | ------------------------- | 365 | | write | array | запись содержимого в файл | 366 | | path | string | путь к файлу | 367 | | content | string | письменный контент | 368 | 369 | ### После изменения файла конфигурации необходимо перезагрузить телефон или завершить процесс HC_memory, чтобы изменения вступили в силу. 370 | 371 | ## Спасибо 372 | 373 | Благодаря исходному коду следующих пользователей или проектов за их помощь в этом проекте: 374 | - [@yc9559](https://github.com/yc9559) 375 | - [@HChenX](https://github.com/HChenX) 376 | 377 | Спасибо следующим пользователям за отзывы о тестировании и обнаружение ошибок: 378 | - @火機(coolapk) 379 | 380 | ## Пожертвовать на поддержку 381 | Как вы думаете, этот модуль очень полезен, вы можете пожертвовать, чтобы поддержать меня 382 | - [爱发电](https://afdian.net/a/HCha1) 383 | - [patreon](https://patreon.com/A1memory) 384 | - USDT(TRC20) 385 | > Address: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 386 | -------------------------------------------------------------------------------- /config/JSON-CONFIG-zh.md: -------------------------------------------------------------------------------- 1 | # A1内存管理v4 Json配置文件说明 2 | 3 | A1内存管理v4 使用框架HAMv2开发,因此可以在不修改源码的情况下,通过配置文件来调整内存管理的参数。本文档将详细介绍如何配置Json配置文件。 4 | 5 | ## 自定义modules参数 6 | 7 | ```json 8 | "config": { 9 | "path": "/sdcard/Android/HChai/HC_memory", 10 | "modulePath": "/data/adb/modules/Hc_memory", 11 | "list": { 12 | "name": "名单列表.conf", 13 | "whiteList": { 14 | "optional": true, 15 | "smart": true, 16 | "system": false 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | | 字段名 | 类型 | 描述 | 23 | | ---------- | ------ | ------------------------------------------------------ | 24 | | path | string | 配置文件路径 | 25 | | modulePath | string | 模块名字路径 | 26 | | name | string | 配置列表的文件名字,该文件存储白名单和乖巧名单 | 27 | | optional | bool | 是否启用白名单,启用后,白名单中的进程不会被杀死 | 28 | | smart | bool | 是否启用智能白名单,启用后将会自动识别进程加入白名单 | 29 | | system | bool | 是否启用系统白名单,启用后所有的系统软件都会加入白名单 | 30 | 31 | 需要注意,添加白名单要按照以下格式添加: 32 | 33 | ``` 34 | WHITE 包名 35 | ``` 36 | 37 | ## 日志路径/级别 38 | 39 | 记录A1内存管理v4运行时的日志,可以通过修改日志路径和日志级别来调整日志的输出。 40 | 41 | ```json 42 | "log": { 43 | "path": "/sdcard/Android/HChai/HC_memory/Run.log", 44 | "level": "info" 45 | } 46 | ``` 47 | 48 | | 字段名 | 类型 | 描述 | 49 | | ------ | ------ | ---------------------------------------------------- | 50 | | path | string | 日志路径 | 51 | | level | string | 日志级别,可选项:debug, info, warn, err, critical | 52 | 53 | 如果你想要关闭日志,可以将日志级别设置为critical,或者您只想查看运行错误的日志可以设置为warn。 54 | 55 | ## 主函数运行参数 56 | 57 | 这个参数的作用是在前台应用发生变化后,在一段时间内再切换前台进程不会再运行主函数。 58 | 59 | ```json 60 | "initProcess": { 61 | "afterTopChange": { 62 | "sleep": 1 63 | } 64 | } 65 | ``` 66 | 67 | | 字段名 | 类型 | 描述 | 68 | | ------ | ---- | ------------------ | 69 | | sleep | int | 等待时间,单位为秒 | 70 | 71 | "sleep"表示在前台应用发生变化后等待的时间,以秒为单位。设置为1秒意味着在前台应用发生变化后,等待1秒后切换前台才会再次执行主函数。换句话说,在这1秒的时间内切换前台,主函数不会被执行。这个参数可以用于控制在前台应用变化后的一段时间内避免主函数的重复执行,以防止不必要的操作或资源浪费。 72 | 73 | ## A1内存管理结束不必要的进程 74 | 75 | A1内存管理v4可以结束不必要的进程以释放内存。下面是用于控制此行为的参数示例: 76 | 77 | ```json 78 | "a1Memory": { 79 | "enable": true, 80 | "oomAdj": 905 81 | } 82 | ``` 83 | 84 | | 字段名 | 类型 | 描述 | 85 | | ------ | ---- | ---------------------------------- | 86 | | enable | bool | 是否启用A1内存管理结束不必要的进程 | 87 | | oomAdj | int | 大于oomAdj的数值才会被结束 | 88 | 89 | - `enable`表示是否启用A1内存管理来结束不必要的进程。如果设置为true,A1内存管理将会执行进程结束操作;如果设置为false,A1内存管理将不会结束任何进程。 90 | - `oomAdj`表示用于判断进程是否被结束的调整值。只有进程的oomAdj值大于设定的"oomAdj"数值时,它们才会被A1内存管理结束。此数值范围为0到1000之间,数值越大,被结束的进程就越少;反之,数值越小,被结束的进程就越多。需要注意的是,并非所有进程都会被识别和结束,只有那些被算法判断为非必要进程且oomAdj值大于指定数值的进程才会被结束。 91 | 92 | ## 让应用自动释放内存 93 | 94 | A1内存管理v4可以让应用自动释放内存。下面是用于控制此行为的参数示例: 95 | 96 | ```json 97 | "initCutMemory": { 98 | "freed": { 99 | "enable": true, 100 | "level": "80", 101 | "regex": "( CAC|SVC|CEM).*", 102 | "change": 20 103 | } 104 | } 105 | ``` 106 | 107 | | 字段名 | 类型 | 描述 | 108 | | ------ | ------ | -------------------------------------- | 109 | | enable | bool | 是否启用应用自动释放内存 | 110 | | level | string | 0-100,数值越高释放的内存越多 | 111 | | regex | string | 正则表达式,匹配需要释放内存的应用状态 | 112 | | change | int | 前台切换多少次执行一次自动释放操作 | 113 | 114 | - `enable`表示是否启用应用自动释放内存。如果设置为true,A1内存管理将会执行应用自动释放内存操作;如果设置为false,A1内存管理将不会执行应用自动释放内存操作。 115 | - `level`表示释放内存的程度。此数值范围为0到100之间,数值越高,释放的内存就越多;反之,数值越低,释放的内存就越少。 116 | - `regex`表示用于匹配需要释放内存的应用状态的正则表达式。只有匹配到的应用状态才会被释放内存。正则表达式的匹配规则与JS语言相同,可以参考[这里](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions)。 117 | - `change`表示前台应用切换多少次后执行一次自动释放操作。此数值我推荐10-30之间。 118 | 119 | 我怎么知道要释放哪些应用的内存?你可以通过以命令来获取状态: 120 | ```shell 121 | 命令: dumpsys activity lru 122 | 输出: ACTIVITY MANAGER LRU PROCESSES (dumpsys activity lru) 123 | Activities: 124 | #67: fg TOP LCMN 6918:bin.mt.plus/u0a226 act:activities|recents 125 | #66: vis BFGS ---N 3152:com.miui.home/u0a80 act:activities 126 | #65: prev LAST ---- 25424:com.omarea.vtools/u0a672 act:activities|recents 127 | #64: cch CAC ---- 5586:com.kiwibrowser.browser/u0a91 act:activities|recents 128 | #63: cch CACC ---- 5961:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:4/u0a91i-8996 act:client 129 | #62: cch+10 CAC ---- 22204:com.tencent.mobileqq/u0a481 act:activities|recents 130 | #61: cch+10 CACC ---- 22308:com.tencent.mobileqq:MSF/u0a481 act:client 131 | #60: cch+20 CACC ---- 5715:com.kiwibrowser.browser:kiwi_privileged_process0/u0a91 act:client 132 | #59: cch+20 CACC ---- 5748:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:1/u0a91i-8999 act:client 133 | #58: hvy CAC ---- 31098:com.coolapk.market/u0a677 act:activities|recents 134 | #57: hvy SVC ---- 9696:com.tencent.mm/u0a201 act:activities|recents 135 | #56: vis SVC ---- 4370:com.google.android.gms/u0a159 act:client 136 | #55: vis BFGS ---N 4265:com.google.android.gms.persistent/u0a159 act:client 137 | #54: hvy SVC ---- 9290:com.tencent.mm:push/u0a201 act:client 138 | #53: cch+30 CACC ---- 6104:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:5/u0a91i-8995 act:client 139 | #52: hvy CAC ---- 22734:org.telegram.plus/u0a386 act:activities|recents 140 | #51: hvy CAC ---- 24029:mark.via/u0a222 act:activities|recents 141 | #50: cch+30 CACC ---- 24074:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a222i1 act:client 142 | #49: cch+40 CAC ---- 25274:com.google.android.apps.translate/u0a548 act:activities|recents 143 | #48: hvy CAC ---- 21987:com.github.kr328.clash/u0a329 act:activities|recents 144 | Other: 145 | #47: fg BTOP ---N 4315:com.miui.securitycenter.remote/1000 146 | #46: vis BFGS ---N 4948:com.miui.powerkeeper/1000 147 | #45: cch+ 5 CEM ---- 4209:com.miui.weather2/u0a203 148 | #44: vis BTOP ---N 4853:com.miui.securitycenter.bootaware/1000 149 | #43: cch+15 CEM ---- 11717:com.android.mms/u0a66 150 | #42: cch+25 CEM ---- 7159:egrn.pucm.pgo/u0a764 151 | #41: psvc PER LCMN 4197:com.android.providers.media.module/u0a197 152 | #40: prcp FGS ---N 5977:com.miui.gallery/u0a68 153 | #39: vis FGS ---N 22036:com.github.kr328.clash:background/u0a329 act:client 154 | #38: cch+35 SVC ---- 31061:com.android.settings:remote/1000 155 | #37: svcb SVC ---- 4569:com.xiaomi.xmsf/u0a141 156 | #36: cch+45 CEM ---- 5950:com.xiaomi.aiasst.service/1000 157 | #35: prcp FGS ---N 20376:com.miui.misound/u0a126 158 | #34: fg BFGS ---N 5543:com.xiaomi.misettings:remote/1000 159 | #33: fg FGS ---N 5665:com.miui.notification:remote/1000 160 | #32: cch+55 CEM ---- 4396:com.android.providers.calendar/u0a50 161 | #31: cch+65 CEM ---- 9210:com.xiaomi.market:guard/u0a117 162 | #30: hvy CEM ---- 9075:com.xiaomi.joyose/1000 163 | #29: cch+75 CEM ---- 8819:com.miui.core/u0a145 164 | #28: cch+85 CEM ---- 8352:com.android.shell/2000 165 | #27: prcp TRNB ---- 4793:com.lbe.security.miui/u0a52 166 | #26: vis BFGS LCMN 5035:com.sohu.inputmethod.sogou.xiaomi/u0a134 act:treated 167 | #25: pers PER LCMN 4180:com.miui.face/1000 168 | #24: pers PER LCMN 4171:com.qualcomm.location/u0a182 169 | #23: pers PER LCMN 4149:org.mipay.android.manager/u0a150 170 | #22: pers PER LCMN 4130:com.tencent.soter.soterserver/u0a151 act:client 171 | #21: pers PER LCMN 4126:com.qualcomm.qti.workloadclassifier/u0a191 172 | #20: pers PER LCMN 4073:com.xiaomi.mircs/u0a76 173 | #19: pers PER LCMN 4081:com.xiaomi.xmsfkeeper/u0a140 174 | #18: pers PER LCMN 4061:com.miui.voicetrigger/u0a102 175 | #17: pers PER LCMN 4038:.slas/1000 176 | #16: pers PER LCMN 4001:system/u0a46 177 | #15: pers PER LCMN 4003:org.ifaa.aidl.manager/u0a149 178 | #14: pers PER LCMN 3996:com.android.nfc/1027 179 | #13: pers PER LCMN 3967:com.miui.contentcatcher/1000 180 | #12: vis BFGS LCMN 2913:com.miui.miwallpaper/u0a119 181 | #11: vis IMPF ---- 3432:com.android.smspush/u0a187 182 | #10: pers PER LCMN 3135:com.android.systemui/1000 183 | # 9: pers PER LCMN 3119:com.android.phone/1001 184 | # 8: pers PER LCMN 3104:com.xiaomi.finddevice/6110 185 | # 7: pers PER LCMN 3103:com.android.se/1068 186 | # 6: pers PER LCMN 3137:.dataservices/1001 187 | # 5: pers PER LCMN 3106:com.qualcomm.qti.devicestatisticsservice/u0a161 188 | # 4: pers PER LCMN 3094:org.codeaurora.ims/u0a184 189 | # 3: pers PER LCMN 3098:com.qti.qualcomm.mstatssystemservice/u0a186 190 | # 2: pers PER LCMN 3072:com.qti.phone/u0a175 191 | # 1: pers PER LCMN 3051:.qtidataservices/u0a148 192 | # 0: sys PER LCMN 1824:system/1000 193 | ``` 194 | 你大概率不知道进程状态代表什么意思,我简单解释一下: 195 | - PER (Persistent): 这是一个永久状态,表示进程不会被系统杀死。这通常适用于关键系统进程,如系统服务。 196 | - PERU (Persistent and Upward): 这也是一个永久状态,但允许系统在内存不足时终止该进程。这意味着进程在某些情况下可以被杀死,但在大多数情况下将保持运行。 197 | - TOP (Top): 这表示进程是当前可见的前台应用程序,即用户正在与之交互的应用程序。 198 | - BTOP (Bound Top): 这是一个与TOP类似的状态,但是由于内存不足,系统可能会选择终止该进程。它通常发生在设备上运行大量应用程序并且内存不足的情况下。 199 | - FGS (Foreground Service): 表示进程正在提供前台服务。前台服务是一种与用户交互的服务,会显示通知或其他用户界面。 200 | - BFGS (Bound Foreground Service): 类似于FGS,但由于内存不足,系统可能会终止该进程。 201 | - IMPF (Important Background): 表示进程是一个重要的后台进程,正在执行一些关键任务,但不需要在前台显示给用户。 202 | - IMPB (Important Background and Upward): 这是类似于IMPF的状态,但是由于内存不足,系统可能会选择终止该进程。 203 | - TRNB (Trusted Background): 表示进程是一个可信任的后台进程,正在执行一些受信任的任务。 204 | - BKUP (Backup): 表示进程正在执行应用程序备份操作,例如将数据备份到云端或其他存储设备。 205 | - SVC (Service): 表示进程是一个后台服务,正在执行某些功能而不需要在前台显示给用户。 206 | - RCVR (Receiver): 表示进程是一个广播接收器,用于接收和处理系统或应用程序发送的广播消息。 207 | - TPSL (Top Sleeping): 表示进程是顶层睡眠状态,即应用程序处于睡眠状态但仍保持在前台。 208 | - HVY (Heavy Weight): 表示进程是一个重量级进程,通常因为它使用了大量系统资源,如内存或CPU。 209 | - HOME: 表示进程是设备的主屏幕应用程序,即用户所看到的桌面。 210 | - LAST: 表示进程是上一个已经终止的应用程序进程。 211 | - CAC (Cached Activity Client): 表示进程是缓存的活动客户端,通常是在后台运行的应用程序。 212 | - CACC (Cached Recent): 表示进程是缓存的最近活动客户端,通常在内存不足时被终止。 213 | - CRE (Cached Empty): 表示进程是缓存的空进程,它没有任何活动或任务。 214 | - CEM (Cached Empty and Maintained): 表示进程是缓存的空进程,但在内存不足时可能会被终止。 215 | - NONE: 表示进程没有状态或无法确定其状态。 216 | 217 | ## hook注入相关参数 218 | 219 | A1内存管理v4可以使用hook让lmkd无法杀死后台进程。下面是用于控制此行为的参数示例: 220 | 221 | ```json 222 | "initInjection": { 223 | "enable": true, 224 | "processName": "/system/bin/lmkd", 225 | "symbolsFunc": "hc_hook", 226 | "libraryPath": "/data/adb/modules/Hc_memory/lib/arm64-v8a/libhook_lmkd.so", 227 | "lmkd": { 228 | "memThreshold": { 229 | "enable": true, 230 | "value": 90 231 | }, 232 | "hookFunc": { 233 | "kill": true, 234 | "pidfd_send_signal": true, 235 | "__android_log_print": false, 236 | "meminfo": { 237 | "updateTime": 60 238 | } 239 | }, 240 | "model": { 241 | "inlineHook": "dobby" 242 | } 243 | } 244 | } 245 | ``` 246 | 247 | | 字段名 | 类型 | 描述 | 248 | | ------------- | ------ | ------------------------ | 249 | | initInjection | object | 初始化注入 | 250 | | enable | bool | 是否启用hook lmkd | 251 | | processName | string | 进程名字 | 252 | | symbolsFunc | string | hook后需要执行的函数名字 | 253 | | libraryPath | string | hook库的路径 | 254 | 255 | 你可以修改路径来向指定进程注入你的hook库,进程名字我推荐使用绝对路径。 256 | - `initInjection`表示初始化注入。 257 | - `enable`表示是否启用hook lmkd。如果设置为true,A1内存管理将会hook lmkd;如果设置为false,A1内存管理将不会hook lmkd。 258 | 259 | ### 内存阈值 260 | 261 | | 字段名 | 类型 | 描述 | 262 | | ------------ | ------ | ------------------------------------- | 263 | | memThreshold | object | 内存阈值 | 264 | | enable | bool | 是否启用内存阈值 | 265 | | value | int | 当内存占用到达90%,不再阻止lmkd杀进程 | 266 | 267 | 内存阈值是很重要的功能,它可以让你在内存占用到达一定程度后,不再阻止lmkd杀进程。这样做的好处是可以防止内存占用过高导致系统卡顿,但是也会导致后台进程被杀死。因此,你可以通过设置内存阈值来控制内存占用到达一定程度后,不再阻止lmkd杀进程。 268 | - `memThreshold`表示内存阈值功能。 269 | - `enable`表示是否启用内存阈值功能。如果设置为true,A1内存管理将会启用内存阈值功能;如果设置为false,A1内存管理将不会启用内存阈值功能。 270 | - `value`表示当内存占用到达90%,不再阻止lmkd杀进程。 271 | 272 | ### 选择要hook的函数 273 | 274 | | 字段名 | 类型 | 描述 | 275 | | ------------------- | ------ | ---------------------------------- | 276 | | hookFunc | object | hook函数 | 277 | | kill | bool | 是否hook `kill`函数 | 278 | | pidfd_send_signal | bool | 是否`hook pidfd_send_signal`函数 | 279 | | __android_log_print | bool | 是否`hook __android_log_print`函数 | 280 | | meminfo | object | 内存信息 | 281 | | updateTime | int | 更新时间,单位为秒 | 282 | 283 | - `hookFunc`表示hook函数。 284 | - `kill`设置为true以hook kill函数,A1内存管理将会hook `kill`函数;设置为false则不hook `kill`函数。 285 | - `pidfd_send_signal`设置为true以hook `pidfd_send_signal`函数,A1内存管理将会hook `pidfd_send_signal`函数以阻止结束进程;设置为false则不hook `pidfd_send_signal`函数。 286 | - `__android_log_print`设置为true以hook `__android_log_print`函数,A1内存管理将会hook `__android_log_print`函数;设置为false则不hook `__android_log_print`函数。不建议启用该功能,因为会导致日志无法输出,还有可能会造成lmkd异常。 287 | 288 | ### 内存信息刷新时间 289 | 290 | 有效避免重复刷新meminfo内存信息造成的性能消耗,你可以通过设置更新时间来控制更新的时间间隔。 291 | - `meminfo`内存信息。 292 | - `updateTime`更新已占用内存百分比的时间,推荐取值在30到90之间。数值越大,更新的时间间隔越长,性能消耗越少;数值越小,更新的时间间隔越短,性能消耗越多。 293 | 294 | | 字段名 | 类型 | 描述 | 295 | | ---------- | ------ | -------------- | 296 | | model | object | 模式 | 297 | | inlineHook | string | inlineHook模式 | 298 | 299 | - `model`表示模式。 300 | - `inlineHook`默认使用的是[dobby](https://github.com/jmpews/Dobby)来修改函数地址,如果无法正常hook,你可以尝试修改为[And64InlineHook](https://github.com/Rprop/And64InlineHook)。 301 | 302 | ## 让应用休眠减少CPU和内存使用 303 | 304 | A1内存管理v4可以让应用休眠减少CPU和内存使用。下面是用于控制此行为的参数示例: 305 | 306 | | 字段名 | 类型 | 描述 | 307 | | -------- | ------ | -------------------------------------------------------------------- | 308 | | appSleep | object | 应用休眠 | 309 | | enable | bool | 是否启用应用休眠减少CPU和内存使用 | 310 | | idle | string | 空闲后针对用户,all代表全部/current代表当前用户,current对多开不生效 | 311 | | bg | string | 后台应用状态,ignore代表忽略唤醒请求和拉起应用请求 | 312 | | top | string | 前台应用状态,allow代表允许唤醒请求和拉起应用请求 | 313 | 314 | - `enable`设置为true以启用应用休眠以减少CPU和内存使用操作;设置为false则不执行。 315 | - `idle`空闲后针对用户的设置。可选值为all(全部用户)和current(当前用户),其中current对多开不生效。 316 | - `bg`后台应用状态设置。可选值为ignore(忽略唤醒请求和拉起应用请求),allow(允许唤醒请求和拉起应用请求),deny(拒绝唤醒请求和拉起应用请求)。 317 | - `top`前台应用状态设置。可选值和bg参数一样。 318 | 319 | ## 乖巧模式 320 | 321 | 简单来说就是杀死应用的子进程,并且试图阻止主进程拉起子进程,从而实现应用减少CPU和内存的使用。 322 | 为了满足更多人的需求,A1内存管理v4默认已经包含了一些应用的子进程,但可能仍然无法涵盖所有情况。如果需要KILL其他子进程,你可以通过编辑名单列表.conf文件来添加。以下是名单列表.conf文件的格式示例: 323 | ``` 324 | KILL 包名:子进程名 325 | ``` 326 | 327 | | 字段名 | 类型 | 描述 | 328 | | ------ | ------ | ---------------- | 329 | | clever | object | 乖巧模式 | 330 | | enable | bool | 是否启用乖巧模式 | 331 | 332 | ## 疯狂杀戮 333 | 334 | 调用内核的api来杀死一些进程,目前暂不清楚原理,但是可以有效的杀死一些进程。我猜想可能是根据oom数值来判断的。下面是用于控制此行为的参数示例: 335 | 336 | | 字段名 | 类型 | 描述 | 337 | | --------- | ------ | ---------------- | 338 | | crazyKill | object | 疯狂杀戮 | 339 | | enable | bool | 是否启用疯狂杀戮 | 340 | 341 | ## 写入内容到文件 342 | 343 | 可以将内容写入到文件中。下面是用于控制此行为的参数示例: 344 | 345 | ```json 346 | "file": { 347 | "write": [ 348 | { 349 | "path": "/proc/sys/fs/inotify/max_queued_events", 350 | "content": "102400" 351 | }, 352 | { 353 | "path": "/proc/sys/fs/inotify/max_user_watches", 354 | "content": "102400" 355 | }, 356 | ... 357 | ] 358 | } 359 | ``` 360 | 361 | 上面的示例中,我们将内容写入到了两个文件中,从而启用了inotify功能。 362 | 363 | | 字段名 | 类型 | 描述 | 364 | | ------- | ------ | -------------- | 365 | | write | array | 写入内容到文件 | 366 | | path | string | 文件路径 | 367 | | content | string | 写入的内容 | 368 | 369 | ### 更改配置文件后需要重启手机或者结束HC_memory进程才能生效。 370 | 371 | ## 致谢 372 | 373 | 感谢以下用户或项目的源码对本项目的帮助: 374 | - [@yc9559](https://github.com/yc9559) 375 | - [@HChenX](https://github.com/HChenX) 376 | 377 | 感谢以下用户的测试反馈和错误定位: 378 | - @火機(coolapk) 379 | 380 | ## 捐赠支持 381 | 如何你觉得这个模块很好用,可以捐赠来支持我 382 | - [爱发电](https://afdian.net/a/HCha1) 383 | - [patreon](https://patreon.com/A1memory) 384 | - USDT(TRC20) 385 | > 地址: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 386 | -------------------------------------------------------------------------------- /config/JSON-CONFIG.md: -------------------------------------------------------------------------------- 1 | # Description of A1 memory management v4 Json configuration file 2 | 3 | A1 Memory Management v4 utilizes the HAMv2 framework, allowing you to adjust memory management parameters through configuration files without modifying the source code. This document will provide a detailed guide on how to configure the JSON configuration file. 4 | 5 | ## Customizing Modules Parameters 6 | 7 | ```json 8 | "config": { 9 | "path": "/sdcard/Android/HChai/HC_memory", 10 | "modulePath": "/data/adb/modules/Hc_memory", 11 | "list": { 12 | "name": "名单列表.conf", 13 | "whiteList": { 14 | "optional": true, 15 | "smart": true, 16 | "system": false 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | | Field Name | Type | Description | 23 | | ---------- | ------ | ----------------------------------------------------------------------------------------------------------------------- | 24 | | path | string | The path to the configuration file. | 25 | | modulePath | string | The path to the module name. | 26 | | name | string | The filename of the configuration list file, which stores the whitelist and naughty list. | 27 | | optional | bool | Indicates whether the whitelist is enabled. When enabled, processes in the whitelist will not be killed. | 28 | | smart | bool | Indicates whether the smart whitelist is enabled. When enabled, processes will be automatically added to the whitelist. | 29 | | system | bool | Indicates whether the system whitelist is enabled. When enabled, all system software will be added to the whitelist. | 30 | 31 | Please note that when adding entries to the whitelist, they should follow the following format: 32 | 33 | ``` 34 | WHITE PackageName 35 | ``` 36 | 37 | ## Log path/level 38 | 39 | Logging Runtime Logs for A1 Memory Management v4, which can be Adjusted by Modifying Log Path and Log Level. 40 | 41 | ```json 42 | "log": { 43 | "path": "/sdcard/Android/HChai/HC_memory/Run.log", 44 | "level": "info" 45 | } 46 | ``` 47 | 48 | | Field Name | Type | Description | 49 | | ---------- | ------ | --------------------------------------------------------------------- | 50 | | path | string | The path to the log file. | 51 | | level | string | The log level. Available options: debug, info, warn, err, critical. | 52 | 53 | If you wish to disable logging, you can set the log level to "critical". Alternatively, if you only want to view logs related to runtime errors, you can set the log level to "warn". 54 | 55 | ## Main function running parameters 56 | 57 | The purpose of this parameter is to prevent the execution of the main function when switching to a foreground process within a certain period of time after a change in the foreground application. 58 | 59 | ```json 60 | "initProcess": { 61 | "afterTopChange": { 62 | "sleep": 1 63 | } 64 | } 65 | ``` 66 | 67 | | Field Name | Type | Description | 68 | | ---------- | ---- | ---------------------------- | 69 | | sleep | int | The waiting time in seconds. | 70 | 71 | The "sleep" parameter represents the waiting time, in seconds, after a change in the foreground application. Setting it to 1 second means that after a change in the foreground application, the main function will wait for 1 second before being executed again upon switching to the foreground. In other words, during this 1-second interval of foreground switching, the main function will not be executed. 72 | This parameter can be used to control the avoidance of repetitive execution of the main function within a certain period of time after a change in the foreground application. It helps prevent unnecessary operations or resource wastage. 73 | 74 | ## A1 memory management ends unnecessary processes 75 | 76 | A1 Memory Management v4 can terminate unnecessary processes to free up memory. Here is an example of the parameters used to control this behavior: 77 | 78 | ```json 79 | "a1Memory": { 80 | "enable": true, 81 | "oomAdj": 905 82 | } 83 | ``` 84 | 85 | | Field Name | Type | Description | 86 | | ---------- | ---- | --------------------------------------------------------------------------------------------- | 87 | | enable | bool | Indicates whether to enable the termination of unnecessary processes by A1 Memory Management. | 88 | | oomAdj | int | Only processes with an oomAdj value greater than the specified value will be terminated. | 89 | 90 | - `enable`: Specifies whether to enable A1 Memory Management to terminate unnecessary processes. When set to true, A1 Memory Management will perform process termination. When set to false, A1 Memory Management will not terminate any processes. 91 | - `oomAdj`: Represents the adjustment value used to determine whether a process should be terminated. Only processes with an oomAdj value greater than the specified "oomAdj" value will be terminated by A1 Memory Management. The "oomAdj" value ranges from 0 to 1000. A higher value will result in fewer terminated processes, while a lower value will result in more terminated processes. It is important to note that not all processes will be identified and terminated. Only processes deemed unnecessary by the algorithm and with an oomAdj value higher than the specified threshold will be terminated. 92 | 93 | ## Let the application automatically release memory 94 | 95 | A1 Memory Management v4 can enable automatic memory release for applications. Here is an example of the parameters used to control this behavior: 96 | 97 | ```json 98 | "initCutMemory": { 99 | "freed": { 100 | "enable": true, 101 | "level": "80", 102 | "regex": "( CAC|SVC|CEM).*", 103 | "change": 20 104 | } 105 | } 106 | ``` 107 | 108 | | Field Name | Type | Description | 109 | | ---------- | ------ | ---------------------------------------------------------------------------------------------------- | 110 | | enable | bool | Indicates whether to enable automatic memory release for applications. | 111 | | level | string | A value between 0 and 100, where higher values result in more memory being released. | 112 | | regex | string | A regular expression used to match the application status for which memory release is required. | 113 | | change | int | Specifies the number of foreground switches before triggering an automatic memory release operation. | 114 | 115 | - `enable`: Specifies whether to enable automatic memory release for applications. When set to true, A1 Memory Management will perform automatic memory release operations for applications. When set to false, A1 Memory Management will not perform automatic memory release operations. 116 | - `level`: Determines the extent of memory release. The value ranges from 0 to 100, where higher values indicate a greater amount of memory being released, and lower values indicate less memory being released. 117 | - `regex`: Specifies a regular expression used to match the application status for which memory release is required. Only applications that match the defined regex pattern will have their memory released. The regex pattern follows the same rules as the JavaScript language. You can refer to[this link](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions)for more information on regular expressions in JavaScript. 118 | - `change`: Specifies the number of foreground application switches before triggering an automatic memory release operation. It is recommended to set this value between 10 and 30. 119 | 120 | How do I know which applications' memory needs to be released? You can obtain the status by using a command: 121 | ```shell 122 | Command: dumpsys activity lru 123 | Output: ACTIVITY MANAGER LRU PROCESSES (dumpsys activity lru) 124 | Activities: 125 | #67: fg TOP LCMN 6918:bin.mt.plus/u0a226 act:activities|recents 126 | #66: vis BFGS ---N 3152:com.miui.home/u0a80 act:activities 127 | #65: prev LAST ---- 25424:com.omarea.vtools/u0a672 act:activities|recents 128 | #64: cch CAC ---- 5586:com.kiwibrowser.browser/u0a91 act:activities|recents 129 | #63: cch CACC ---- 5961:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:4/u0a91i-8996 act:client 130 | #62: cch+10 CAC ---- 22204:com.tencent.mobileqq/u0a481 act:activities|recents 131 | #61: cch+10 CACC ---- 22308:com.tencent.mobileqq:MSF/u0a481 act:client 132 | #60: cch+20 CACC ---- 5715:com.kiwibrowser.browser:kiwi_privileged_process0/u0a91 act:client 133 | #59: cch+20 CACC ---- 5748:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:1/u0a91i-8999 act:client 134 | #58: hvy CAC ---- 31098:com.coolapk.market/u0a677 act:activities|recents 135 | #57: hvy SVC ---- 9696:com.tencent.mm/u0a201 act:activities|recents 136 | #56: vis SVC ---- 4370:com.google.android.gms/u0a159 act:client 137 | #55: vis BFGS ---N 4265:com.google.android.gms.persistent/u0a159 act:client 138 | #54: hvy SVC ---- 9290:com.tencent.mm:push/u0a201 act:client 139 | #53: cch+30 CACC ---- 6104:com.kiwibrowser.browser:kiwi_sandboxed_process0:org.chromium.content.app.KiwiSandboxedProcessService0:5/u0a91i-8995 act:client 140 | #52: hvy CAC ---- 22734:org.telegram.plus/u0a386 act:activities|recents 141 | #51: hvy CAC ---- 24029:mark.via/u0a222 act:activities|recents 142 | #50: cch+30 CACC ---- 24074:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a222i1 act:client 143 | #49: cch+40 CAC ---- 25274:com.google.android.apps.translate/u0a548 act:activities|recents 144 | #48: hvy CAC ---- 21987:com.github.kr328.clash/u0a329 act:activities|recents 145 | Other: 146 | #47: fg BTOP ---N 4315:com.miui.securitycenter.remote/1000 147 | #46: vis BFGS ---N 4948:com.miui.powerkeeper/1000 148 | #45: cch+ 5 CEM ---- 4209:com.miui.weather2/u0a203 149 | #44: vis BTOP ---N 4853:com.miui.securitycenter.bootaware/1000 150 | #43: cch+15 CEM ---- 11717:com.android.mms/u0a66 151 | #42: cch+25 CEM ---- 7159:egrn.pucm.pgo/u0a764 152 | #41: psvc PER LCMN 4197:com.android.providers.media.module/u0a197 153 | #40: prcp FGS ---N 5977:com.miui.gallery/u0a68 154 | #39: vis FGS ---N 22036:com.github.kr328.clash:background/u0a329 act:client 155 | #38: cch+35 SVC ---- 31061:com.android.settings:remote/1000 156 | #37: svcb SVC ---- 4569:com.xiaomi.xmsf/u0a141 157 | #36: cch+45 CEM ---- 5950:com.xiaomi.aiasst.service/1000 158 | #35: prcp FGS ---N 20376:com.miui.misound/u0a126 159 | #34: fg BFGS ---N 5543:com.xiaomi.misettings:remote/1000 160 | #33: fg FGS ---N 5665:com.miui.notification:remote/1000 161 | #32: cch+55 CEM ---- 4396:com.android.providers.calendar/u0a50 162 | #31: cch+65 CEM ---- 9210:com.xiaomi.market:guard/u0a117 163 | #30: hvy CEM ---- 9075:com.xiaomi.joyose/1000 164 | #29: cch+75 CEM ---- 8819:com.miui.core/u0a145 165 | #28: cch+85 CEM ---- 8352:com.android.shell/2000 166 | #27: prcp TRNB ---- 4793:com.lbe.security.miui/u0a52 167 | #26: vis BFGS LCMN 5035:com.sohu.inputmethod.sogou.xiaomi/u0a134 act:treated 168 | #25: pers PER LCMN 4180:com.miui.face/1000 169 | #24: pers PER LCMN 4171:com.qualcomm.location/u0a182 170 | #23: pers PER LCMN 4149:org.mipay.android.manager/u0a150 171 | #22: pers PER LCMN 4130:com.tencent.soter.soterserver/u0a151 act:client 172 | #21: pers PER LCMN 4126:com.qualcomm.qti.workloadclassifier/u0a191 173 | #20: pers PER LCMN 4073:com.xiaomi.mircs/u0a76 174 | #19: pers PER LCMN 4081:com.xiaomi.xmsfkeeper/u0a140 175 | #18: pers PER LCMN 4061:com.miui.voicetrigger/u0a102 176 | #17: pers PER LCMN 4038:.slas/1000 177 | #16: pers PER LCMN 4001:system/u0a46 178 | #15: pers PER LCMN 4003:org.ifaa.aidl.manager/u0a149 179 | #14: pers PER LCMN 3996:com.android.nfc/1027 180 | #13: pers PER LCMN 3967:com.miui.contentcatcher/1000 181 | #12: vis BFGS LCMN 2913:com.miui.miwallpaper/u0a119 182 | #11: vis IMPF ---- 3432:com.android.smspush/u0a187 183 | #10: pers PER LCMN 3135:com.android.systemui/1000 184 | # 9: pers PER LCMN 3119:com.android.phone/1001 185 | # 8: pers PER LCMN 3104:com.xiaomi.finddevice/6110 186 | # 7: pers PER LCMN 3103:com.android.se/1068 187 | # 6: pers PER LCMN 3137:.dataservices/1001 188 | # 5: pers PER LCMN 3106:com.qualcomm.qti.devicestatisticsservice/u0a161 189 | # 4: pers PER LCMN 3094:org.codeaurora.ims/u0a184 190 | # 3: pers PER LCMN 3098:com.qti.qualcomm.mstatssystemservice/u0a186 191 | # 2: pers PER LCMN 3072:com.qti.phone/u0a175 192 | # 1: pers PER LCMN 3051:.qtidataservices/u0a148 193 | # 0: sys PER LCMN 1824:system/1000 194 | ``` 195 | You are correct that you may not be familiar with the meaning of the process states. Let me provide a brief explanation: 196 | - PER (Persistent): This is a permanent state indicating that the process will not be killed by the system. It typically applies to critical system processes, such as system services. 197 | - PERU (Persistent and Upward): This is also a permanent state but allows the system to terminate the process when memory is low. This means the process can be killed under certain circumstances but will generally remain running. 198 | - TOP (Top): This indicates that the process is the currently visible foreground application, meaning the application with which the user is actively interacting. 199 | - BTOP (Bound Top): This is a state similar to TOP, but the system may choose to terminate the process due to memory constraints. This often occurs when the device is running multiple applications and memory is scarce. 200 | - FGS (Foreground Service): It indicates that the process is providing a foreground service. Foreground services are services that interact with the user and may display notifications or other user interfaces. 201 | - BFGS (Bound Foreground Service): Similar to FGS, but the system may terminate the process due to memory constraints. 202 | - IMPF (Important Background): This indicates that the process is an important background process performing critical tasks but does not need to be shown in the foreground to the user. 203 | - IMPB (Important Background and Upward): This is a state similar to IMPF, but the system may choose to terminate the process due to memory constraints. 204 | - TRNB (Trusted Background): It represents a trusted background process performing trusted tasks. 205 | - BKUP (Backup): It signifies that the process is performing application backup operations, such as backing up data to the cloud or other storage devices. 206 | - SVC (Service): It denotes that the process is a background service performing certain functionalities without the need to be displayed in the foreground to the user. 207 | - RCVR (Receiver): It indicates that the process is a broadcast receiver used to receive and handle broadcast messages sent by the system or applications. 208 | - TPSL (Top Sleeping): It represents a process in the top-level sleep state, where the application is in sleep mode but still remains in the foreground. 209 | - HVY (Heavy Weight): It signifies that the process is a heavyweight process, usually because it utilizes a significant amount of system resources, such as memory or CPU. 210 | - HOME: It indicates that the process is the main home screen application of the device, i.e., the user's desktop. 211 | - LAST: It represents the process of the previously terminated application. 212 | - CAC (Cached Activity Client): It signifies that the process is a cached activity client, typically an application running in the background. 213 | - CACC (Cached Recent): It represents a cached recent activity client that is often terminated when memory is low. 214 | - CRE (Cached Empty): It indicates that the process is a cached empty process with no active tasks. 215 | - CEM (Cached Empty and Maintained): It denotes a cached empty process that may be terminated when memory is low. 216 | - NONE: It signifies that the process has no state or its state cannot be determined. 217 | 218 | ## Hook injection related parameters 219 | 220 | A1 Memory Management v4 can utilize hooks to prevent lmkd (low memory killer daemon) from killing background processes. Below is an example of the parameters used to control this behavior: 221 | 222 | ```json 223 | "initInjection": { 224 | "enable": true, 225 | "processName": "/system/bin/lmkd", 226 | "symbolsFunc": "hc_hook", 227 | "libraryPath": "/data/adb/modules/Hc_memory/lib/arm64-v8a/libhook_lmkd.so", 228 | "lmkd": { 229 | "memThreshold": { 230 | "enable": true, 231 | "value": 90 232 | }, 233 | "hookFunc": { 234 | "kill": true, 235 | "pidfd_send_signal": true, 236 | "__android_log_print": false, 237 | "meminfo": { 238 | "updateTime": 60 239 | } 240 | }, 241 | "model": { 242 | "inlineHook": "dobby" 243 | } 244 | } 245 | } 246 | ``` 247 | 248 | | Field Name | Type | Description | 249 | | ------------- | ------ | -------------------------------------------------- | 250 | | initInjection | object | Initialization injection configuration. | 251 | | enable | bool | Indicates whether to enable lmkd hooking. | 252 | | processName | string | The name of the process. | 253 | | symbolsFunc | string | The name of the function to execute after hooking. | 254 | | libraryPath | string | The path to the hook library. | 255 | 256 | You can modify the path to inject your hook library into the specified process. I recommend using the absolute path for the process name. 257 | - `initInjection`: Represents the configuration for initialization injection. 258 | - `enable`Indicates whether to enable lmkd hooking. When set to true, A1 Memory Management will hook lmkd. When set to false, A1 Memory Management will not hook lmkd. 259 | 260 | ### memory threshold 261 | 262 | | Field Name | Type | Description | 263 | | ------------ | ------ | -------------------------------------------------------------------------------------- | 264 | | memThreshold | object | Memory threshold configuration. | 265 | | enable | bool | Indicates whether to enable the memory threshold. | 266 | | value | int | The value at which the memory usage reaches 90%, allowing lmkd to terminate processes. | 267 | 268 | The memory threshold feature is important as it allows you to stop preventing lmkd from terminating processes when the memory usage reaches a certain level. This feature helps prevent excessive memory usage, which can lead to system lag, but it may result in background processes being terminated. Therefore, you can control the prevention of lmkd from terminating processes by setting the memory threshold. 269 | - `memThreshold`: Represents the memory threshold feature. 270 | - `enable`: Indicates whether to enable the memory threshold feature. When set to true, A1 Memory Management will enable the memory threshold feature. When set to false, A1 Memory Management will not enable the memory threshold feature. 271 | - `value`: Specifies the threshold at which the memory usage reaches 90%. Once the memory usage exceeds this threshold, A1 Memory Management will no longer prevent lmkd from terminating processes. 272 | 273 | ### Selecting the functions to hook 274 | 275 | | Field Name | Type | Description | 276 | | ------------------- | ------ | ------------------------------------------------------------- | 277 | | hookFunc | object | Function hook configuration. | 278 | | kill | bool | Indicates whether to hook the `kill` function. | 279 | | pidfd_send_signal | bool | Indicates whether to hook the `pidfd_send_signal` function. | 280 | | __android_log_print | bool | Indicates whether to hook the `__android_log_print` function. | 281 | | meminfo | object | Memory information configuration. | 282 | | updateTime | int | Update time in seconds for the memory information. | 283 | 284 | - `hookFunc`: Represents the function hook configuration. 285 | - `kill`: When set to true, A1 Memory Management will hook the `kill` function. When set to false, A1 Memory Management will not hook the `kill` function. 286 | - `pidfd_send_signal`: When set to true, A1 Memory Management will hook the `pidfd_send_signal` function to prevent process termination. When set to false, A1 Memory Management will not hook the `pidfd_send_signal` function. 287 | - `__android_log_print`: When set to true, A1 Memory Management will hook the `__android_log_print` function. When set to false, A1 Memory Management will not hook the `__android_log_print` function. It is not recommended to enable this feature as it may prevent log outputs and potentially cause lmkd abnormalities. 288 | 289 | ### Memory information refresh time 290 | 291 | To efficiently avoid performance impact caused by repetitive refreshing of meminfo memory information, you can control the update interval by setting the updateTime parameter. 292 | - `meminfo`: Represents the memory information. 293 | - `updateTime`: Specifies the update interval for the occupied memory percentage. It is recommended to set the value between 30 and 90. A higher value results in longer update intervals and lower performance impact, while a lower value leads to shorter update intervals and higher performance impact. 294 | 295 | | Field Name | Type | Description | 296 | | ---------- | ------ | ------------------- | 297 | | model | object | Mode configuration. | 298 | | inlineHook | string | Inline hook mode. | 299 | 300 | - `model`Represents the mode configuration. 301 | - `inlineHook`By default, A1 Memory Management v4 uses[dobby](https://github.com/jmpews/Dobby)for modifying function addresses. If the hooking process is not working as expected, you can try modifying it to [And64InlineHook](https://github.com/Rprop/And64InlineHook). 302 | ## Enabling app hibernation reduces CPU and memory usage. 303 | 304 | A1 Memory Management v4 can enable app hibernation to reduce CPU and memory usage. Here is an example of the parameters used to control this behavior: 305 | 306 | | Field Name | Type | Description | 307 | | ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 308 | | appSleep | object | App hibernation configuration. | 309 | | enable | bool | Indicates whether to enable app hibernation to reduce CPU and memory usage. | 310 | | idle | string | User idle setting: "all" for all users, "current" for the current user (not applicable to multi-user environments). | 311 | | bg | string | Background app status setting: "ignore" to ignore wake-up and launch requests, "allow" to allow wake-up and launch requests, "deny" to deny wake-up and launch requests. | 312 | | top | string | Foreground app status setting: Same options as `bg`. | 313 | 314 | - `enable`: Set to true to enable app hibernation and reduce CPU and memory usage; set to false to disable it. 315 | - `idle`: User idle setting. Available values are "all" (all users) and "current" (the current user). Note that "current" setting does not apply in multi-user environments. 316 | - `bg`: Background app status setting. Available values are "ignore" (ignore wake-up and launch requests), "allow" (allow wake-up and launch requests), and "deny" (deny wake-up and launch requests). 317 | - `top`: Foreground app status setting. Same options as `bg` parameter. 318 | 319 | ## Clever Mode 320 | 321 | In simple terms, Clever Mode is designed to kill an application's child processes and attempt to prevent the main process from relaunching the child processes, thereby reducing the CPU and memory usage of the application. 322 | To meet the diverse needs of users, A1 Memory Management v4 already includes some child processes of applications by default. However, it may not cover all scenarios. If you need to kill other child processes, you can add them by editing the whitelist.conf file. Here is an example of the format for the whitelist.conf file: 323 | ``` 324 | KILL package_name:child_process_name 325 | ``` 326 | 327 | | Field Name | Type | Description | 328 | | ---------- | ------ | ---------------------------------------- | 329 | | clever | object | Clever Mode configuration. | 330 | | enable | bool | Indicates whether to enable Clever Mode. | 331 | 332 | ## Crazy Kill 333 | 334 | The Crazy Kill feature utilizes kernel APIs to kill certain processes. Currently, the exact mechanism behind it is not clear, but it can effectively terminate specific processes. It is speculated that it may be based on the OOM (Out of Memory) score of the processes. Below is an example of the parameters used to control this behavior: 335 | 336 | | Field Name | Type | Description | 337 | | ---------- | ------ | --------------------------------------- | 338 | | crazyKill | object | Crazy Kill configuration. | 339 | | enable | bool | Indicates whether to enable Crazy Kill. | 340 | 341 | ## Write Content to File 342 | 343 | You can write content to files using A1 Memory Management v4. Below is an example of the parameters used to control this behavior: 344 | 345 | ```json 346 | "file": { 347 | "write": [ 348 | { 349 | "path": "/proc/sys/fs/inotify/max_queued_events", 350 | "content": "102400" 351 | }, 352 | { 353 | "path": "/proc/sys/fs/inotify/max_user_watches", 354 | "content": "102400" 355 | }, 356 | ... 357 | ] 358 | } 359 | ``` 360 | 361 | In the above example, we write content to two files, enabling the inotify feature. 362 | 363 | | Field Name | Type | Description | 364 | | ---------- | ------ | ------------------------------- | 365 | | write | array | Write content to files. | 366 | | path | string | File path. | 367 | | content | string | Content to write into the file. | 368 | 369 | ### Restart the Phone or Terminate HC_memory Process to Apply Configuration Changes 370 | 371 | ## Acknowledgments 372 | 373 | Thanks to the following users or projects for their source code contributions to this project: 374 | - [@yc9559](https://github.com/yc9559) 375 | - [@HChenX](https://github.com/HChenX) 376 | 377 | Thanks to the following users for their testing feedback and bug identification: 378 | - @火機(coolapk) 379 | 380 | ## Support Donations 381 | If you find this module useful, you can make a donation to support me. 382 | - [爱发电](https://afdian.net/a/HCha1) 383 | - [patreon](https://patreon.com/A1memory) 384 | - USDT(TRC20) 385 | > Address: TSqTqn2NcyUAbEwsdGgsrYoU5pokno5PnQ 386 | 387 | -------------------------------------------------------------------------------- /config/README.md: -------------------------------------------------------------------------------- 1 | ## A1内存管理Json配置文件说明 2 | 3 | [English document](JSON-CONFIG.md) | [中文文档](JSON-CONFIG-zh.md) | [Русский язык](JSON-CONFIG-ru.md) -------------------------------------------------------------------------------- /config/memory.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": { 3 | "name": "官方配置 [23.09.29]", 4 | "author": "火機@coolapk" 5 | }, 6 | "modules": { 7 | "config": { 8 | "path": "/sdcard/Android/HChai/HC_memory", 9 | "modulePath": "/data/adb/modules/Hc_memory", 10 | "list": { 11 | "name": "名单列表.conf", 12 | "whiteList": { 13 | "optional": true, 14 | "smart": true, 15 | "system": false 16 | } 17 | } 18 | }, 19 | "log": { 20 | "path": "/sdcard/Android/HChai/HC_memory/Run.log", 21 | "level": "info" 22 | }, 23 | "initProcess": { 24 | "afterTopChange": { 25 | "sleep": 2 26 | } 27 | }, 28 | "a1Memory": { 29 | "enable": true, 30 | "oomAdj": 905 31 | }, 32 | "initCutMemory": { 33 | "freed": { 34 | "enable": true, 35 | "level": "80", 36 | "regex": "( CAC|SVC|CEM).*", 37 | "change": 20 38 | } 39 | }, 40 | "initInjection": { 41 | "enable": false, 42 | "processName": "/system/bin/lmkd", 43 | "symbolsFunc": "hc_hook", 44 | "libraryPath": "/data/adb/modules/Hc_memory/lib/arm64-v8a/libhook_lmkd.so", 45 | "lmkd": { 46 | "memThreshold": { 47 | "enable": true, 48 | "value": 85 49 | }, 50 | "hookFunc": { 51 | "kill": true, 52 | "pidfd_send_signal": true, 53 | "__android_log_print": false, 54 | "meminfo": { 55 | "updateTime": 30 56 | } 57 | }, 58 | "model": { 59 | "inlineHook": "dobby" 60 | } 61 | } 62 | }, 63 | "appSleep": { 64 | "enable": false, 65 | "idle": "current", 66 | "bg": "ignore", 67 | "top": "allow" 68 | }, 69 | "clever": { 70 | "enable": true 71 | }, 72 | "crazyKill": { 73 | "enable": false 74 | } 75 | }, 76 | "file": { 77 | "write": [ 78 | { 79 | "path": "/proc/sys/fs/inotify/max_queued_events", 80 | "content": "16384" 81 | }, 82 | { 83 | "path": "/proc/sys/fs/inotify/max_user_watches", 84 | "content": "98304" 85 | }, 86 | { 87 | "path": "/proc/sys/fs/inotify/max_user_instances", 88 | "content": "896" 89 | } 90 | ] 91 | } 92 | } -------------------------------------------------------------------------------- /image/list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/image/list.jpg -------------------------------------------------------------------------------- /image/ui_cn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/image/ui_cn.jpg -------------------------------------------------------------------------------- /image/ui_ru.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/image/ui_ru.jpg -------------------------------------------------------------------------------- /image/ui_us.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/image/ui_us.jpg -------------------------------------------------------------------------------- /magisk.sh: -------------------------------------------------------------------------------- 1 | # 2 | #Copyright (C) 2022-2023 OneB1ank 3 | # 4 | #This program is free module: you can redistribute it and/or modify 5 | #it under the terms of the GNU General Public License as published by 6 | #the Free Software Foundation, either version 3 of the License, or 7 | #(at your option) any later version. 8 | # 9 | #This program is distributed in the hope that it will be useful, 10 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | #GNU General Public License for more details. 13 | # 14 | #You should have received a copy of the GNU General Public License 15 | #along with this program. If not, see . 16 | # 17 | 18 | set -e 19 | 20 | MODPATH=${0%/*} 21 | CURRENT_DATE=$(date +%Y-%m-%d) 22 | 23 | init() { 24 | cd $MODPATH/module 25 | echo "- 切换到模块路径" 26 | } 27 | 28 | packaged_Modules() { 29 | cp -f $MODPATH/config/memory.json $MODPATH/module/config/memory.json 30 | zip -r -9 "A1Memory-$CURRENT_DATE.zip" * 31 | mv -f "A1Memory-$CURRENT_DATE.zip" "../build/" 32 | echo "- 打包成功,模块名" "A1Memory-$CURRENT_DATE.zip" 33 | } 34 | 35 | clear() { 36 | rm config/memory.json 37 | } 38 | 39 | init 40 | packaged_Modules 41 | clear -------------------------------------------------------------------------------- /module/HC_memory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/module/HC_memory -------------------------------------------------------------------------------- /module/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | ################# 2 | # Initialization 3 | ################# 4 | 5 | umask 022 6 | 7 | # echo before loading util_functions 8 | ui_print() { echo "$1"; } 9 | 10 | require_new_magisk() { 11 | ui_print "*******************************" 12 | ui_print " Please install Magisk v20.4+! " 13 | ui_print "*******************************" 14 | exit 1 15 | } 16 | 17 | ######################### 18 | # Load util_functions.sh 19 | ######################### 20 | 21 | OUTFD=$2 22 | ZIPFILE=$3 23 | 24 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 25 | . /data/adb/magisk/util_functions.sh 26 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk 27 | 28 | install_module 29 | exit 0 -------------------------------------------------------------------------------- /module/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /module/app/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/module/app/app-release.apk -------------------------------------------------------------------------------- /module/config/HC_memory/名单列表.conf: -------------------------------------------------------------------------------- 1 | ———————————————————————— 2 | #A1内存管理 配置文件 作者: HChai || A1 Memory Management configuration file Author: HChai 3 | ———————————————————————— 4 | #使用说明 || Instructions for use: 5 | ———————————————————————— 6 | #必须遵守初始化名单的格式 || The format of the initialization list must be followed 7 | 8 | #添加到白名单的包名前必须添加WHITE 9 | #WHITE must be added before the package name added to the whitelist 10 | 11 | #添加到乖巧名单的包名跟白名单同理,添加KILL 12 | #The package name added to the list of child processes to be killed is the same as the white list, add KILL 13 | 14 | #如果你不按照规定随意添加,A1内存管理将会直接失效 15 | #If you do not follow the regulations to add at will, A1 memory management will directly fail 16 | 17 | #我相信只要你不是傻瓜,都会按照下面的初始化名单列表格式添加包名 18 | #I believe as long as you are not a fool, you will add the package name according to the initialization list list format below 19 | 20 | #注释字符串一定要添加# 21 | #The comment string must add # 22 | 23 | ———————————————————————— 24 | #白名单 || whitelist: 25 | ———————————————————————— 26 | { 27 | WHITE com.netease.cloudmusic 28 | WHITE com.tencent.mm 29 | WHITE com.tencent.mobileqq 30 | } 31 | 32 | ———————————————————————— 33 | #乖巧名单 || list of child processes to kill: 34 | ———————————————————————— 35 | { 36 | #TIM 37 | KILL com.tencent.tim:mail 38 | KILL com.tencent.tim:web 39 | KILL com.tencent.tim:MSF 40 | KILL com.tencent.tim:troop 41 | #QQ 42 | KILL com.tencent.mobileqq:peak 43 | KILL com.tencent.mobileqq:qzone 44 | KILL com.tencent.mobileqq:tool 45 | #哔哩哔哩 || Bilibili 46 | KILL tv.danmaku.bili:download 47 | KILL tv.danmaku.bili:pushservice 48 | KILL tv.danmaku.bili:web 49 | #酷安 || coolapk 50 | KILL com.coolapk.market:xg_vip_service 51 | #腾讯视频 || QQlive 52 | KILL com.tencent.qqlive:cache 53 | KILL com.tencent.qqlive:wxa_container0 54 | KILL com.tencent.qqlive:services 55 | KILL com.tencent.ilink.ServiceProcess 56 | KILL com.tencent.qqlive:pmservice 57 | KILL com.tencent.qqlive:mini1 58 | #KILL com.tencent.qqlive:xg_vip_service 59 | #虎牙 || Huya live 60 | KILL com.duowan.kiwi:remoteweb 61 | KILL com.duowan.kiwi:logcat 62 | KILL com.duowan.kiwi:lelinkps 63 | KILL com.duowan.kiwi:cloudpatch 64 | KILL com.duowan.kiwi:Unity 65 | KILL com.duowan.kiwi:download 66 | KILL com.duowan.kiwi:pushservice 67 | #抖音 || douyin 68 | KILL com.ss.android.ugc.aweme:push 69 | KILL com.ss.android.ugc.aweme:sandboxed_process1 70 | KILL com.ss.android.ugc.aweme:pushservice 71 | #快手 || quick hand 72 | KILL com.smile.gifmaker:messagesdk 73 | #微信 || weixin 74 | KILL com.tencent.mm:toolsmp 75 | KILL com.tencent.mm:tools 76 | #美团 || meituan 77 | KILL com.sankuai.meituan:miniApp0 78 | KILL com.sankuai.meituan:MgcProcess 79 | KILL com.sankuai.meituan.takeoutnew:download 80 | KILL com.sankuai.youxuan:download 81 | KILL com.sankuai.meituan:dppushservice 82 | KILL com.sankuai.meituan.takeoutnew:dppushservice 83 | #网易云 || Netease Music 84 | KILL com.netease.cloudmusic:videoplay 85 | KILL com.netease.cloudmusic:viewer 86 | KILL com.netease.cloudmusic:mp1 87 | KILL com.netease.cloudmusic:browser 88 | #喜马拉雅 || Himalaya 89 | KILL com.ximalaya.ting.android:pushservice 90 | #百度网盘 || Baidu Baohe 91 | KILL com.baidu.netdisk:operator_thumbnail 92 | KILL com.baidu.netdisk:p2p 93 | #百度贴吧 || Baidu Post Bar 94 | KILL com.baidu.tieba:media 95 | KILL com.baidu.tieba:swan0 96 | KILL com.baidu.tieba:remote 97 | #知乎 || Quora 98 | KILL com.zhihu.android:channel 99 | KILL com.zhihu.android:pushservice 100 | #番茄小说 || dragon 101 | KILL com.dragon.read:push 102 | KILL com.dragon.read:pushservice 103 | KILL com.dragon.read:sandboxed_process1 104 | KILL com.dragon.read:sandboxed_process2 105 | KILL com.dragon.read:sandboxed_process3 106 | #淘宝 || taobao 107 | KILL com.taobao.taobao:channel 108 | KILL com.taobao.taobao:sandboxed_privilege_process0 109 | KILL com.taobao.taobao:gpu_process 110 | #闲鱼 || coco 111 | KILL com.taobao.idlefish:wml1 112 | KILL com.taobao.idlefish:channel 113 | #支付宝 || Alipay 114 | KILL com.eg.android.AlipayGphone:tools 115 | KILL com.eg.android.AlipayGphone:push 116 | KILL com.eg.android.AlipayGphone:lite1 117 | #QQ邮箱 || qq mail 118 | KILL com.tencent.androidqqmail 119 | KILL com.tencent.androidqqmail:Push 120 | #饿了么 || ele 121 | KILL me.ele:sandboxed_privilege_process0 122 | KILL me.ele:gpu_process 123 | KILL me.ele:channel 124 | } 125 | -------------------------------------------------------------------------------- /module/config/Language/language.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": [ 3 | { 4 | "name": "简体中文", 5 | "path": "/data/adb/modules/Hc_memory/config/Language/list/zh-CN.json" 6 | }, 7 | { 8 | "name": "English", 9 | "path": "/data/adb/modules/Hc_memory/config/Language/list/en-US.json" 10 | }, 11 | { 12 | "name": "Русский", 13 | "path": "/data/adb/modules/Hc_memory/config/Language/list/ru-RU.json" 14 | }, 15 | { 16 | "name": "Deutsch", 17 | "path": "/data/adb/modules/Hc_memory/config/Language/list/de-DE.json" 18 | }, 19 | { 20 | "name": "Español", 21 | "path": "/data/adb/modules/Hc_memory/config/Language/list/es-ES.json" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /module/config/Language/list/de-DE.json: -------------------------------------------------------------------------------- 1 | { 2 | "htop": { 3 | "cpu_usage": "Gesamte CPU-Auslastung: ", 4 | "network": "Netzwerk [MiB/s] [Hoch/Runter]", 5 | "ram": "Speicher [%]", 6 | "ram_usage": "Physische Speicherauslastung", 7 | "swap_usage": "Virtuelle Speicherauslastung", 8 | "title": "Startseite" 9 | }, 10 | "fswitch": { 11 | "title": "Funktionen", 12 | "function_switch": { 13 | "title": "Funktionsumschalter", 14 | "clever": "Clever-Modus", 15 | "a1Memory": "A1-Speicherverwaltung", 16 | "CutMemoryFreed": "Speicherfreigabe", 17 | "appSleep": "App-Schlaf", 18 | "crazyKill": "Prozessbeendigung", 19 | "injection": "Injektion in Aktivität", 20 | "memThreshold": "Speicherschwelle" 21 | }, 22 | "numerical_parameter": { 23 | "title": "Numerische Parameter", 24 | "memThreshold_value": "Schwelle: ", 25 | "memThreshold_slider": "Schwellen-Schieberegler" 26 | } 27 | }, 28 | "other": { 29 | "save": "[Speichern]", 30 | "quit": "[Beenden]", 31 | "teffect": "[Sofort anwenden]", 32 | "join": "[TG-Kanal beitreten]", 33 | "github": "[GitHub-Projekt]" 34 | }, 35 | "feature_Description": { 36 | "clever": { 37 | "Description_title": "Schlauer Modus", 38 | "Description": "Beendet benutzerdefinierte Prozesse, um Speicher freizugeben; diese werden nur beendet, wenn sie nicht im Vordergrund laufen." 39 | }, 40 | "a1Memory": { 41 | "Description_title": "A1 Speicherverwaltung", 42 | "Description": "Verwaltet den Speicher automatisch und wählt je nach Situation aus, ob ein Teil des Speichers eines Prozesses freigegeben oder die Prozesse bei Bedarf direkt beendet werden." 43 | }, 44 | "CutMemoryFreed": { 45 | "Description_title": "Speicherfreigabe", 46 | "Description": "Standardmäßig wird der Speicherverbrauch von zwischengespeicherten Prozessen reduziert. Aber keine Sorge, dies dient nur dazu, sie speichereffizienter zu machen und beendet diese Prozesse nicht wirklich." 47 | }, 48 | "appSleep": { 49 | "Description_title": "App Schlafmodus", 50 | "Description": "Diese Funktion verhindert, dass Unterprozesse einer App nach ihrer Beendigung neu gestartet werden. Obwohl sie nicht zu 100% den Neustart von Unterprozessen verhindern kann, hilft sie auch, den Speicher- und CPU-Verbrauch zu reduzieren." 51 | }, 52 | "crazyKill": { 53 | "Description_title": "Intensives Beenden", 54 | "Description": "Ruft eine Kernel-Schnittstelle auf, um Speicher freizugeben, auch wenn die spezifischen Kriterien nicht sehr klar sind. Basierend auf aktuellen Überprüfungen hilft es jedoch, das Telefon flüssiger laufen zu lassen. Beachten Sie jedoch, dass einige Hintergrund-App-Prozesse möglicherweise beendet werden." 55 | }, 56 | "injection": { 57 | "Description_title": "lmkd verhindern", 58 | "Description": "Verknüpft und injiziert in lmkd, modifiziert seine Ausführungslogik und verhindert so, dass es Hintergrund-App-Prozesse beendet. Das bedeutet, dass Sie viele App-Prozesse ausführen können, ohne sich Gedanken darüber zu machen, dass sie beendet werden. Seien Sie jedoch vorsichtig, da zu viele App-Prozesse dazu führen könnten, dass das Telefon weniger flüssig läuft." 59 | }, 60 | "memThreshold": { 61 | "Description_title": "Speicherschwelle", 62 | "Description": "Wenn diese Funktion aktiviert ist und der physische Speicherverbrauch einen bestimmten Schwellenwert erreicht, darf lmkd App-Prozesse beenden, wodurch Telefonverzögerungen oder erzwungene Neustarts verhindert werden. Bitte beachten Sie, dass diese Funktion nur aktiv wird, wenn lmkd verhindert ist." 63 | } 64 | }, 65 | "tag": { 66 | "content": "Bitte schließen Sie die Memory-Management-Benutzeroberfläche, um unnötigen Batterieverbrauch zu vermeiden. Nach dem Speichern der Konfiguration in der Benutzeroberfläche sollten Sie diese unbedingt beenden.", 67 | "title": "Bitte speichern Sie die Konfiguration und starten Sie das Telefon neu, Prozess: UI_memory" 68 | } 69 | } -------------------------------------------------------------------------------- /module/config/Language/list/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "htop": { 3 | "cpu_usage": "Total CPU usage: ", 4 | "network": "Network [MiB/s] [Up/Down]", 5 | "ram": "Memory [%]", 6 | "ram_usage": "Physical memory usage", 7 | "swap_usage": "Virtual memory usage", 8 | "title": "Home" 9 | }, 10 | "fswitch": { 11 | "title": "Functions", 12 | "function_switch": { 13 | "title": "Function switches", 14 | "clever": "Clever mode", 15 | "a1Memory": "A1 memory management", 16 | "CutMemoryFreed": "Memory release", 17 | "appSleep": "App sleep", 18 | "crazyKill": "Process killing", 19 | "injection": "Injection to lmkd", 20 | "memThreshold": "Memory threshold" 21 | }, 22 | "numerical_parameter": { 23 | "title": "Numerical parameters", 24 | "memThreshold_value": "Threshold: ", 25 | "memThreshold_slider": "Threshold slider" 26 | } 27 | }, 28 | "other": { 29 | "save": "[Save]", 30 | "quit": "[Quit]", 31 | "teffect": "[Apply immediately]", 32 | "join": "[Join TG channel]", 33 | "github": "[GitHub Project]" 34 | }, 35 | "feature_Description": { 36 | "clever": { 37 | "Description_title": "Clever Mode", 38 | "Description": "Ends custom-added processes to free up memory; these will only be terminated if they aren't in the foreground." 39 | }, 40 | "a1Memory": { 41 | "Description_title": "A1 Memory Management", 42 | "Description": "Automatically manages memory, choosing to release part of a process's memory based on the situation, or terminate those processes when necessary." 43 | }, 44 | "CutMemoryFreed": { 45 | "Description_title": "Memory Release", 46 | "Description": "By default, it reduces the memory usage of cached processes. However, there's no need to worry, this is only to make them more memory-efficient and won't actually terminate these processes." 47 | }, 48 | "appSleep": { 49 | "Description_title": "App Sleep", 50 | "Description": "This feature prevents an app's subprocesses from restarting after being terminated. While it can't guarantee a 100% prevention of subprocess restart, it also helps reduce memory and CPU usage." 51 | }, 52 | "crazyKill": { 53 | "Description_title": "Intensive Termination", 54 | "Description": "Invokes a kernel interface to free up memory, even if its specific criteria aren't very clear. However, based on current validations, it indeed helps the phone run more smoothly. But be aware, it might terminate some background app processes." 55 | }, 56 | "injection": { 57 | "Description_title": "Prevent lmkd", 58 | "Description": "Hooks and injects into lmkd, modifying its execution logic, thereby preventing it from terminating background app processes. This means you can run many app processes without worrying about them being killed. However, be cautious as running too many app processes might make the phone run less smoothly." 59 | }, 60 | "memThreshold": { 61 | "Description_title": "Memory Threshold", 62 | "Description": "When activated, if physical memory usage reaches a specified threshold, lmkd is allowed to terminate app processes, thus preventing phone lags or force restarts. Please note, this feature only becomes active after lmkd prevention is enabled." 63 | } 64 | }, 65 | "tag": { 66 | "content": "Please close the memory management UI to avoid unnecessary battery consumption. After saving the configuration in the UI, be sure to exit.", 67 | "title": "Please save the configuration and restart the phone, process: UI_memory" 68 | } 69 | } -------------------------------------------------------------------------------- /module/config/Language/list/es-ES.json: -------------------------------------------------------------------------------- 1 | { 2 | "htop": { 3 | "cpu_usage": "Uso total de CPU: ", 4 | "network": "Red [MiB/s] [Subir/Descargar]", 5 | "ram": "Memoria [%]", 6 | "ram_usage": "Uso de memoria física", 7 | "swap_usage": "Uso de memoria virtual", 8 | "title": "Inicio" 9 | }, 10 | "fswitch": { 11 | "title": "Función", 12 | "function_switch": { 13 | "title": "Interruptor de función", 14 | "clever": "Modo astuto", 15 | "a1Memory": "Gestión de memoria A1", 16 | "CutMemoryFreed": "Liberación de memoria", 17 | "appSleep": "Hibernación de aplicación", 18 | "crazyKill": "Proceso de eliminación masiva", 19 | "injection": "Prevenir lmkd", 20 | "memThreshold": "Umbral de memoria" 21 | }, 22 | "numerical_parameter": { 23 | "title": "Parámetros numéricos", 24 | "memThreshold_value": "Umbral: ", 25 | "memThreshold_slider": "Deslizador de umbral" 26 | } 27 | }, 28 | "other": { 29 | "save": "[Guardar]", 30 | "quit": "[Salir]", 31 | "teffect": "[Aplicar ahora]", 32 | "join": "[Unirse al canal TG]", 33 | "github": "[Proyecto de GitHub]" 34 | }, 35 | "feature_Description": { 36 | "clever": { 37 | "Description_title": "Modo Astuto", 38 | "Description": "Termina los procesos agregados personalizados para liberar memoria, solo se finalizarán si no están en primer plano." 39 | }, 40 | "a1Memory": { 41 | "Description_title": "Gestión de memoria A1", 42 | "Description": "Administra automáticamente la memoria, eligiendo liberar parte de la memoria del proceso o, si es necesario, finalizar estos procesos directamente." 43 | }, 44 | "CutMemoryFreed": { 45 | "Description_title": "Liberación de memoria", 46 | "Description": "Por defecto reduce el uso de memoria de los procesos en caché. Pero no te preocupes, esto solo es para que sean más eficientes en el uso de memoria y no finalizará estos procesos." 47 | }, 48 | "appSleep": { 49 | "Description_title": "Suspensión de la aplicación", 50 | "Description": "Esta función evita que los subprocesos de la aplicación se reinicien después de ser finalizados. Aunque no garantiza un 100% de prevención de reinicio, también ayuda a reducir el uso de memoria y CPU." 51 | }, 52 | "crazyKill": { 53 | "Description_title": "Finalización intensiva", 54 | "Description": "Invoca una interfaz del núcleo para liberar memoria, aunque los criterios exactos aún no están claros. Sin embargo, según las pruebas actuales, puede hacer que el teléfono funcione más fluidamente. Pero ten en cuenta que puede finalizar algunos procesos de aplicaciones en segundo plano." 55 | }, 56 | "injection": { 57 | "Description_title": "Bloqueo de lmkd", 58 | "Description": "Inyección hook en lmkd, modificando su lógica de ejecución, evitando que finalice procesos de aplicaciones en segundo plano. Esto significa que puedes tener muchos procesos de aplicaciones ejecutándose sin preocuparte de que sean finalizados. Sin embargo, ten en cuenta que tener demasiados procesos puede hacer que el teléfono funcione con menos fluidez." 59 | }, 60 | "memThreshold": { 61 | "Description_title": "Umbral de memoria", 62 | "Description": "Al activar esta función, cuando el uso de memoria física alcance un umbral especificado, lmkd puede finalizar procesos de la aplicación, evitando así bloqueos o reinicios del teléfono. Es importante saber que esta función solo estará activa si se bloquea lmkd." 63 | } 64 | }, 65 | "tag": { 66 | "content": "Por favor, cierre la interfaz de gestión de memoria para evitar un consumo innecesario de energía en segundo plano. Una vez que haya guardado la configuración en la interfaz, salga.", 67 | "title": "Por favor, guarde la configuración y reinicie el teléfono. Proceso: UI_memory" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /module/config/Language/list/ru-RU.json: -------------------------------------------------------------------------------- 1 | { 2 | "htop": { 3 | "cpu_usage": "Общее использование ЦП: ", 4 | "network": "Сеть [MiB/s] [Вверх/Вниз]", 5 | "ram": "Память [%]", 6 | "ram_usage": "Использование физической памяти", 7 | "swap_usage": "Использование виртуальной памяти", 8 | "title": "Главная" 9 | }, 10 | "fswitch": { 11 | "title": "Функции", 12 | "function_switch": { 13 | "title": "Переключатели функций", 14 | "clever": "Режим умной оптимизации", 15 | "a1Memory": "Управление памятью A1", 16 | "CutMemoryFreed": "Освобождение памяти", 17 | "appSleep": "Сон приложений", 18 | "crazyKill": "Убийство процессов", 19 | "injection": "Инъекция в активность", 20 | "memThreshold": "Порог памяти" 21 | }, 22 | "numerical_parameter": { 23 | "title": "Числовые параметры", 24 | "memThreshold_value": "Порог: ", 25 | "memThreshold_slider": "Ползунок порога" 26 | } 27 | }, 28 | "other": { 29 | "save": "[Сохранить]", 30 | "quit": "[Выход]", 31 | "teffect": "[Применить сейчас]", 32 | "join": "[Присоединиться к TG-каналу]", 33 | "github": "[GitHub проект]" 34 | }, 35 | "feature_Description": { 36 | "clever": { 37 | "Description_title": "Умный режим", 38 | "Description": "Завершает процессы, добавленные пользователем, чтобы освободить память. Завершает только в фоновом режиме." 39 | }, 40 | "a1Memory": { 41 | "Description_title": "Управление памятью A1", 42 | "Description": "Автоматическое управление памятью. Освобождает часть памяти процесса или завершает процессы при необходимости." 43 | }, 44 | "CutMemoryFreed": { 45 | "Description_title": "Освобождение памяти", 46 | "Description": "По умолчанию уменьшает использование памяти кэш-процессами. Не беспокойтесь, это только для экономии памяти, не завершая эти процессы." 47 | }, 48 | "appSleep": { 49 | "Description_title": "Сон приложения", 50 | "Description": "Эта функция предотвращает перезапуск дочерних процессов приложения после их завершения. Хотя она не может гарантировать предотвращение перезапуска, она также помогает уменьшить использование памяти и CPU." 51 | }, 52 | "crazyKill": { 53 | "Description_title": "Безумное завершение", 54 | "Description": "Вызывает ядерный интерфейс для освобождения памяти, хотя конкретные критерии еще не совсем ясны. Однако, на основе текущей проверки, он действительно может сделать работу телефона более плавной. Но стоит помнить, что это может привести к завершению некоторых фоновых приложений." 55 | }, 56 | "injection": { 57 | "Description_title": "Блокировка lmkd", 58 | "Description": "Hook-инъекция в lmkd, изменяя его логику выполнения, предотвращая завершение фоновых приложений. Это означает, что вы можете запустить множество процессов приложений, не боясь, что их убьют. Однако следует помнить, что запуск слишком многих процессов может замедлить работу телефона." 59 | }, 60 | "memThreshold": { 61 | "Description_title": "Порог памяти", 62 | "Description": "При включении этой функции, когда физическая память достигает определенного уровня использования, lmkd может завершить процессы приложения, предотвращая торможение или перезагрузку устройства. Стоит помнить, что это будет работать только при блокировке lmkd." 63 | } 64 | }, 65 | "tag": { 66 | "content": "Пожалуйста, закройте интерфейс управления памятью, чтобы избежать ненужного потребления заряда батареи. После сохранения конфигурации в интерфейсе обязательно выйдите из него.", 67 | "title": "Пожалуйста, сохраните конфигурацию и перезагрузите телефон. Процесс: UI_memory" 68 | } 69 | } -------------------------------------------------------------------------------- /module/config/Language/list/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "htop": { 3 | "cpu_usage": "CPU 总使用率: ", 4 | "network": "网络 [MiB/s] [上/下]", 5 | "ram": "内存 [%]", 6 | "ram_usage": "物理内存使用率", 7 | "swap_usage": "虚拟内存使用率", 8 | "title": "主页" 9 | }, 10 | "fswitch": { 11 | "title": "功能", 12 | "function_switch": { 13 | "title": "功能开关", 14 | "clever": "乖巧模式", 15 | "a1Memory": "A1内存管理", 16 | "CutMemoryFreed": "内存释放", 17 | "appSleep": "应用休眠", 18 | "crazyKill": "狂杀进程", 19 | "injection": "阻止lmkd", 20 | "memThreshold": "内存阈值" 21 | }, 22 | "numerical_parameter": { 23 | "title": "数值参数", 24 | "memThreshold_value": "阈值: ", 25 | "memThreshold_slider": "阈值滑块" 26 | } 27 | }, 28 | "other": { 29 | "save": "[保存]", 30 | "quit": "[退出]", 31 | "teffect": "[立刻生效]", 32 | "join": "[加入TG频道]", 33 | "github": "[GitHub项目]" 34 | }, 35 | "feature_Description": { 36 | "clever": { 37 | "Description_title": "乖巧模式-说明", 38 | "Description": "结束自定义添加的进程来释放内存,非前台状态下才会结束。" 39 | }, 40 | "a1Memory": { 41 | "Description_title": "A1内存管理-说明", 42 | "Description": "自动管理内存根据情况选择释放 进程的部分内存,或者在必要时 直接结束这些进程。" 43 | }, 44 | "CutMemoryFreed": { 45 | "Description_title": "内存释放-说明", 46 | "Description": "默认是减少缓存进程的内存占用。不过 不用担心,这只是为了让它们更加节省 内存,并不会真的结束这些进程。" 47 | }, 48 | "appSleep": { 49 | "Description_title": "应用休眠-说明", 50 | "Description": "该功能为了防止应用的子进程在被杀死后重新启动。虽然不能百分百保 证阻止子进程重启,但同时它们也帮助减少了内存和CPU的使用。" 51 | }, 52 | "crazyKill": { 53 | "Description_title": "狂杀进程-说明", 54 | "Description": "调用了内核接口来释放内存,尽管它的具体判定条件还不太清楚。但根 据目前的验证,它确实可以让手机运行得更加流畅。不过,需要注意的 是,这可能会导致一些后台应用进程被结束。" 55 | }, 56 | "injection": { 57 | "Description_title": "阻止lmkd-说明", 58 | "Description": "hook注入lmkd,修改了其运行逻辑, 从而避免了它结束后台的应用进程. 这意味着你可以开启很多应用进程 而不用担心它们被杀。但要注意, 开启过多的应用进程不杀可能会使 手机不流畅。" 59 | }, 60 | "memThreshold": { 61 | "Description_title": "内存阈值-说明", 62 | "Description": "开启此功能,当物理内存使用率 达到指定的阈后,将允许lmkd结 束应用进程,从而避免手机出现 卡顿或死机重启的情况。需要注 意的是,只有在开启阻止lmkd后, 这个功能才会生效。" 63 | } 64 | }, 65 | "tag": { 66 | "content": "请关闭内存管理UI避免造成意外的后台耗电,使用UI保存配置后一定要退出。", 67 | "title": "请保存配置后重启手机,进程:UI_memory" 68 | } 69 | } -------------------------------------------------------------------------------- /module/customize.sh: -------------------------------------------------------------------------------- 1 | # 2 | #Copyright (C) 2022-2023 OneB1ank 3 | # 4 | #This program is free module: you can redistribute it and/or modify 5 | #it under the terms of the GNU General Public License as published by 6 | #the Free Software Foundation, either version 3 of the License, or 7 | #(at your option) any later version. 8 | # 9 | #This program is distributed in the hope that it will be useful, 10 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | #GNU General Public License for more details. 13 | # 14 | #You should have received a copy of the GNU General Public License 15 | #along with this program. If not, see . 16 | # 17 | 18 | CONFIG_PATH="/sdcard/Android/HChai/HC_memory" 19 | MODULE_PATH="/data/adb/modules/Hc_memory" 20 | LANGUAGE_PATH="$MODPATH/config/Language" 21 | LANGUAGE_PATH_MODULE="$MODULE_PATH/config/Language" 22 | LOCALE=$(getprop persist.sys.locale) 23 | LOCALE_JSON_PATH="$LANGUAGE_PATH/list/${LOCALE}.json" 24 | LOCALE_JSON_PATH_MODULE="$LANGUAGE_PATH_MODULE/list/${LOCALE}.json" 25 | LMKDRC_PATH="/system/etc/init/lmkd.rc" 26 | 27 | config() { 28 | [ ! -d "$CONFIG_PATH" ] && mkdir -p "$CONFIG_PATH" 29 | [ ! -f "$CONFIG_PATH/名单列表.conf" ] && cp "$MODPATH/config/HC_memory/名单列表.conf" "$CONFIG_PATH" 30 | rm -rf "$MODPATH/config/HC_memory" 31 | [ -f "$MODULE_PATH/config/memory.json" ] && cp "$MODULE_PATH/config/memory.json" "$MODPATH/config/memory.json" 32 | cp "$MODPATH/system/bin/amui" "$CONFIG_PATH/terminal.sh" 33 | ui_print "- update configuration" 34 | if [ -f "${LOCALE_JSON_PATH}" ]; then 35 | echo "${LOCALE_JSON_PATH_MODULE}" > "$LANGUAGE_PATH/lg.txt" 36 | else 37 | echo "$LANGUAGE_PATH_MODULE/list/en-US.json" > "$LANGUAGE_PATH/lg.txt" 38 | fi 39 | if [ -f "$LMKDRC_PATH" ]; then 40 | sed -e '/group/{ /system/ s/system/root/; /root/! s/$/ root/ }' "$LMKDRC_PATH" > "${MODPATH}${LMKDRC_PATH}" 41 | else 42 | echo "File not found: $LMKDRC_PATH" 43 | fi 44 | ui_print "- update language" 45 | } 46 | 47 | xp() { 48 | pm install -r "$MODPATH/app/app-release.apk" 49 | rm -rf "$MODPATH/app" 50 | ui_print "- install com.hchai.rescueplan" 51 | } 52 | 53 | if [ "$ARCH" != "arm64" ]; then 54 | abort "Not compatible with this platform: $ARCH" 55 | else 56 | ui_print "- Your platform can use A1 Memory" 57 | config 58 | xp 59 | fi 60 | 61 | set_perm_recursive "$MODPATH" 0 0 0755 0777 62 | 63 | ui_print "- Restart and enjoy A1 Memory immediately" -------------------------------------------------------------------------------- /module/lib/arm64-v8a/libhook_lmkd.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/module/lib/arm64-v8a/libhook_lmkd.so -------------------------------------------------------------------------------- /module/module.prop: -------------------------------------------------------------------------------- 1 | id=Hc_memory 2 | name=A1-内存管理 [Richard] 3 | version=v4 (2023.11.26) 4 | versionCode=439 5 | author=HChai 6 | description=Third-party memory management, support Android 8 ~ 14. project: https://github.com/OneB1ank/A1Memory 7 | updateJson=https://ghproxy.com/https://raw.githubusercontent.com/OneB1ank/A1Memory/main/version.json 8 | originalAuthor=HChai -------------------------------------------------------------------------------- /module/service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | #Copyright (C) 2022-2023 OneB1ank 4 | # 5 | #This program is free module: you can redistribute it and/or modify 6 | #it under the terms of the GNU General Public License as published by 7 | #the Free Software Foundation, either version 3 of the License, or 8 | #(at your option) any later version. 9 | # 10 | #This program is distributed in the hope that it will be useful, 11 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | #GNU General Public License for more details. 14 | # 15 | #You should have received a copy of the GNU General Public License 16 | #along with this program. If not, see . 17 | # 18 | 19 | # 定义模块目录 20 | MODDIR="$(dirname "$0")" 21 | COUNT=0 22 | 23 | # 等待设备完成引导 24 | while [ "$(getprop sys.boot_completed)" != "1" ] && [ $COUNT -lt 3]; do 25 | sleep 10 26 | COUNT=$((COUNT+1)) 27 | done 28 | 29 | adjustPermissions() { 30 | local dir="$1" 31 | chmod u+r,u+w,g+r,g+w,o+r,o+w "$dir" 32 | } 33 | 34 | init() { 35 | cd $MODDIR 36 | logfile_path=$(grep -A 3 '"log":' config/memory.json | grep '"path":' | awk -F'"path": "' '{print $2}' | awk -F'"' '{print $1}') 37 | } 38 | 39 | memory() { 40 | rm -rf "$logfile_path" 41 | touch "$logfile_path" 42 | $MODDIR/HC_memory 43 | sleep 60 44 | memory 45 | } 46 | 47 | init 48 | adjustPermissions "/data/media/0/Android/HChai/HC_memory" 49 | memory -------------------------------------------------------------------------------- /module/system.prop: -------------------------------------------------------------------------------- 1 | persist.vendor.qti.memory.enable=false 2 | persist.sys.spc.enabled=false 3 | ro.lmk.kill_heaviest_task=false 4 | ro.lmk.debug=false -------------------------------------------------------------------------------- /module/system/bin/UI_memory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneB1ank/A1Memory/a54e53ddd91a34caf3670e52638179162b3948fb/module/system/bin/UI_memory -------------------------------------------------------------------------------- /module/system/bin/amui: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # 3 | #Copyright (C) 2022-2023 OneB1ank 4 | # 5 | #This program is free module: you can redistribute it and/or modify 6 | #it under the terms of the GNU General Public License as published by 7 | #the Free Software Foundation, either version 3 of the License, or 8 | #(at your option) any later version. 9 | # 10 | #This program is distributed in the hope that it will be useful, 11 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | #GNU General Public License for more details. 14 | # 15 | #You should have received a copy of the GNU General Public License 16 | #along with this program. If not, see . 17 | # 18 | 19 | if [ "$(id -u)" != 0 ]; then 20 | echo "正在获取root权限" 21 | exec su -c sh "$0" "$@" 22 | else 23 | kill -9 $(ps -ef | grep 'UI_memory' |grep -v 'grep' | awk '{print $2}') >/dev/null 2>&1 24 | UI_memory 25 | fi -------------------------------------------------------------------------------- /module/uninstall.sh: -------------------------------------------------------------------------------- 1 | # 2 | #Copyright (C) 2022-2023 OneB1ank 3 | # 4 | #This program is free module: you can redistribute it and/or modify 5 | #it under the terms of the GNU General Public License as published by 6 | #the Free Software Foundation, either version 3 of the License, or 7 | #(at your option) any later version. 8 | # 9 | #This program is distributed in the hope that it will be useful, 10 | #but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | #GNU General Public License for more details. 13 | # 14 | #You should have received a copy of the GNU General Public License 15 | #along with this program. If not, see . 16 | # 17 | 18 | rm -rf /sdcard/Android/HChai/HC_memory 19 | rm -rf /data/HC_memory 20 | rm -rf /data/HC_language 21 | pm uninstall com.hchai.rescueplan -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4 (2023.11.26)", 3 | "versionCode": 439, 4 | "zipUrl": "https://ghproxy.com/https://github.com/OneB1ank/A1Memory/releases/download/Richard8/A1Memory-2023-11-26.zip", 5 | "changelog": "https://ghproxy.com/https://raw.githubusercontent.com/OneB1ank/A1Memory/main/changelog.md" 6 | } --------------------------------------------------------------------------------