├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── io
│ │ └── github
│ │ └── mthli
│ │ └── mount
│ │ ├── app
│ │ ├── MainActivity.java
│ │ ├── MountActivity.java
│ │ ├── MountApplication.java
│ │ ├── MountReceiver.java
│ │ ├── MountService.java
│ │ ├── NotificationService.java
│ │ └── SettingsActivity.java
│ │ ├── model
│ │ └── PackageRecord.java
│ │ ├── util
│ │ ├── DisplayUtils.java
│ │ ├── ImageUtils.java
│ │ ├── IntentUtils.java
│ │ ├── PolicyUtils.java
│ │ ├── PreferenceUtils.java
│ │ ├── RxUtils.java
│ │ └── ToastUtils.java
│ │ └── widget
│ │ ├── PackageItemAdapter.java
│ │ ├── PackageItemLayout.java
│ │ ├── PackageSettingLayout.java
│ │ └── PolicyHintLayout.java
│ └── res
│ ├── drawable-xhdpi
│ ├── ic_eject.png
│ └── ic_notification_android.png
│ ├── drawable-xxhdpi
│ ├── ic_eject.png
│ └── ic_notification_android.png
│ ├── drawable-xxxhdpi
│ ├── ic_eject.png
│ └── ic_notification_android.png
│ ├── layout
│ ├── activity_main.xml
│ ├── activity_settings.xml
│ ├── layout_action_bar_loading.xml
│ ├── layout_device_hint.xml
│ ├── layout_package_item.xml
│ └── layout_package_setting.xml
│ ├── menu
│ └── menu_main.xml
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-v23
│ └── styles.xml
│ ├── values-zh-rCN
│ └── strings.xml
│ ├── values-zh-rTW
│ └── strings.xml
│ ├── values
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ ├── device_policy.xml
│ └── preferences.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── mount.sketch
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
34 | # Others
35 | .idea/
36 | *.DS_Store
37 | *.iml
--------------------------------------------------------------------------------
/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 | App Mount, mount/umount apps that you don't like on Android, without root.
635 | Copyright (C) 2017 Matthew Lee
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 | App Mount Copyright (C) 2017 Matthew Lee
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | App Mount
2 | ===
3 |
4 | 
5 |
6 | mount/umount apps that you don't like on Android, **without** root.
7 |
8 | mount: available for use as normal.
9 |
10 | umount: unavailable for use, but the data and actual package file remain.
11 |
12 | You can run app temporary, when screen off app will be automatically umounted.
13 |
14 | **Support Android Lollipop+**.
15 |
16 | ## Tutorial | 教程
17 |
18 | 0. [Download](https://github.com/mthli/Mount/releases "mthli/Mount/releases") and install App Mount;
19 |
20 | [下载](https://github.com/mthli/Mount/releases "mthli/Mount/releases")并安装应用挂载器;
21 |
22 | 1. System Settings > Accounts, remove all accounts here;
23 |
24 | 系统设置 > 帐号,移除当前所有帐号;
25 |
26 | 2. Run adb command below in your computer, once and for all:
27 |
28 | 在电脑上运行如下 adb 命令,除非卸载重装,否则只需要授权一次即可:
29 |
30 | `adb shell dpm set-device-owner io.github.mthli.mount/.app.MountReceiver`
31 |
32 | 3. Goto App Mount's settings, allow UsageAccess/NotificationAccess for ignore;
33 |
34 | 前往应用挂载器的设置界面,为忽略选项进行授权;
35 |
36 | 4. In App Mount, click list item, dialog right-top switch mount/umount.
37 |
38 | 在应用挂载器中点击列表项,在出现的对话框右上角进行挂载/弹出操作。
39 |
40 | Cheers🍻
41 |
42 | ## Thanks
43 |
44 | - [ReactiveX/RxJava](https://github.com/ReactiveX/RxJava "ReactiveX/RxJava"), *Apache License, Version 2.0*.
45 |
46 | - [ReactiveX/RxAndroid](https://github.com/ReactiveX/RxAndroid "ReactiveX/RxAndroid"), *Apache License, Version 2.0*.
47 |
48 | - [satyan/sugar](https://github.com/satyan/sugar "satyan/sugar"), *The MIT License*.
49 |
50 | ## License
51 |
52 | App Mount, mount/umount apps that you don't like on Android, without root.
53 | Copyright (C) 2017 Matthew Lee
54 |
55 | This program is free software: you can redistribute it and/or modify
56 | it under the terms of the GNU General Public License as published by
57 | the Free Software Foundation, either version 3 of the License, or
58 | (at your option) any later version.
59 |
60 | This program is distributed in the hope that it will be useful,
61 | but WITHOUT ANY WARRANTY; without even the implied warranty of
62 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 | GNU General Public License for more details.
64 |
65 | You should have received a copy of the GNU General Public License
66 | along with this program. If not, see .
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | apply plugin: 'com.android.application'
20 |
21 | android {
22 | compileSdkVersion 25
23 | buildToolsVersion "25.0.2"
24 |
25 | defaultConfig {
26 | applicationId "io.github.mthli.mount"
27 | minSdkVersion 21
28 | targetSdkVersion 25
29 | versionCode 8
30 | versionName "1.1.1"
31 | }
32 |
33 | buildTypes {
34 | release {
35 | minifyEnabled true
36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37 | }
38 | }
39 |
40 | lintOptions {
41 | disable 'MissingTranslation'
42 | }
43 | }
44 |
45 | dependencies {
46 | compile fileTree(include: ['*.jar'], dir: 'libs')
47 | compile 'com.android.support:support-annotations:25.2.0'
48 | compile 'io.reactivex.rxjava2:rxjava:2.0.6'
49 | compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
50 | compile 'com.github.satyan:sugar:1.5'
51 | }
52 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/matthew/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # SugarORM
20 | -keep class io.github.mthli.mount.model.** { *; }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
52 |
53 |
54 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
70 |
71 |
72 |
73 |
77 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.Activity;
22 | import android.content.Intent;
23 | import android.os.Bundle;
24 | import android.text.TextUtils;
25 |
26 | import io.github.mthli.mount.R;
27 | import io.github.mthli.mount.util.IntentUtils;
28 | import io.github.mthli.mount.util.PolicyUtils;
29 | import io.github.mthli.mount.util.ToastUtils;
30 |
31 | public class MainActivity extends Activity {
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | IntentUtils.startCocaService(this);
36 |
37 | if (getIntent() == null || getIntent().getData() == null
38 | || TextUtils.isEmpty(getIntent().getData().toString())
39 | || !PolicyUtils.isDeviceOwnerApp(this)) {
40 | IntentUtils.startCocaActivity(this);
41 | finish();
42 | return;
43 | }
44 |
45 | if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_MAIN)
46 | && (getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
47 | || getIntent().hasCategory(Intent.CATEGORY_LEANBACK_LAUNCHER))) {
48 | IntentUtils.startCocaActivity(this);
49 | finish();
50 | return;
51 | }
52 |
53 | // deal with schema
54 | String data = getIntent().getData().toString();
55 | if (TextUtils.equals(data, IntentUtils.SCHEMA_MOUNT_NOTIFICATION)) {
56 | PolicyUtils.umountAll(this, null);
57 | ToastUtils.showWithShortTime(this, R.string.toast_umount_all_ok);
58 | } else if (data.startsWith(IntentUtils.SCHEMA_MOUNT_SHORTCUT)) {
59 | String packageName = data.substring(IntentUtils.SCHEMA_MOUNT_SHORTCUT.length(), data.length());
60 | IntentUtils.runApplication(this, packageName);
61 | } else {
62 | IntentUtils.startCocaActivity(this);
63 | }
64 |
65 | finish();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/MountActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.Activity;
22 | import android.app.AlertDialog;
23 | import android.content.ClipData;
24 | import android.content.ClipboardManager;
25 | import android.content.DialogInterface;
26 | import android.content.Intent;
27 | import android.content.pm.ApplicationInfo;
28 | import android.content.pm.ResolveInfo;
29 | import android.graphics.Bitmap;
30 | import android.os.Bundle;
31 | import android.text.TextUtils;
32 | import android.view.Menu;
33 | import android.view.MenuItem;
34 | import android.view.View;
35 | import android.view.WindowManager;
36 | import android.widget.AbsListView;
37 | import android.widget.AdapterView;
38 | import android.widget.ListView;
39 |
40 | import java.text.Collator;
41 | import java.util.ArrayList;
42 | import java.util.Collections;
43 | import java.util.Comparator;
44 | import java.util.HashSet;
45 | import java.util.List;
46 | import java.util.Set;
47 | import java.util.concurrent.TimeUnit;
48 |
49 | import io.github.mthli.mount.R;
50 | import io.github.mthli.mount.model.PackageRecord;
51 | import io.github.mthli.mount.util.DisplayUtils;
52 | import io.github.mthli.mount.util.ImageUtils;
53 | import io.github.mthli.mount.util.IntentUtils;
54 | import io.github.mthli.mount.util.PolicyUtils;
55 | import io.github.mthli.mount.util.RxUtils;
56 | import io.github.mthli.mount.util.ToastUtils;
57 | import io.github.mthli.mount.widget.PackageSettingLayout;
58 | import io.github.mthli.mount.widget.PolicyHintLayout;
59 | import io.github.mthli.mount.widget.PackageItemAdapter;
60 | import io.reactivex.Observable;
61 | import io.reactivex.ObservableEmitter;
62 | import io.reactivex.ObservableOnSubscribe;
63 | import io.reactivex.android.schedulers.AndroidSchedulers;
64 | import io.reactivex.disposables.Disposable;
65 | import io.reactivex.functions.Consumer;
66 | import io.reactivex.schedulers.Schedulers;
67 |
68 | public class MountActivity extends Activity implements AbsListView.OnScrollListener,
69 | AdapterView.OnItemClickListener, PackageSettingLayout.PackageSettingLayoutListener {
70 | private ListView mListView;
71 | private PolicyHintLayout mHeaderView;
72 | private PackageItemAdapter mPackageAdapter;
73 | private List mPackageList;
74 |
75 | private AlertDialog mSettingDialog;
76 | private MenuItem mLoadingItem;
77 | private MenuItem mSettingsItem;
78 | private MenuItem mDonateItem;
79 |
80 | private PackageRecord mCurrentRecord;
81 | private Disposable mFastScrollDisposable;
82 | private Disposable mFetchPackageRecordDisposable;
83 | private Disposable mHeaderViewDisposable;
84 |
85 | @Override
86 | protected void onCreate(Bundle savedInstanceState) {
87 | super.onCreate(savedInstanceState);
88 | setContentView(R.layout.activity_main);
89 |
90 | setupListView();
91 | setupHeaderView();
92 | }
93 |
94 | private void setupListView() {
95 | mListView = (ListView) findViewById(R.id.list);
96 |
97 | mPackageList = new ArrayList<>();
98 | mPackageAdapter = new PackageItemAdapter(this, mPackageList);
99 | mListView.setAdapter(mPackageAdapter);
100 | mListView.setHeaderDividersEnabled(false);
101 |
102 | mListView.setOnScrollListener(this); // not show fast scroll always
103 | mListView.setOnItemClickListener(this);
104 | }
105 |
106 | @Override
107 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
108 | // DO NOTHING
109 | }
110 |
111 | @Override
112 | public void onScrollStateChanged(final AbsListView view, int scrollState) {
113 | RxUtils.disposeSafety(mFastScrollDisposable);
114 | if (scrollState != SCROLL_STATE_IDLE) {
115 | view.setFastScrollAlwaysVisible(true);
116 | return;
117 | }
118 |
119 | mFastScrollDisposable = Observable.timer(1000L, TimeUnit.MILLISECONDS)
120 | .observeOn(AndroidSchedulers.mainThread())
121 | .subscribe(new Consumer() {
122 | @Override
123 | public void accept(Long aLong) throws Exception {
124 | view.setFastScrollAlwaysVisible(false);
125 | }
126 | });
127 | }
128 |
129 | @Override
130 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
131 | dismissSettingDialogSafety();
132 | if (!PolicyUtils.isDeviceOwnerApp(this)) {
133 | IntentUtils.showTutorial(this);
134 | return;
135 | }
136 |
137 | mCurrentRecord = mPackageList.get(position);
138 | PackageSettingLayout layout = (PackageSettingLayout) getLayoutInflater()
139 | .inflate(R.layout.layout_package_setting, null, false);
140 | layout.setPackageRecord(mCurrentRecord);
141 | layout.setPackageSettingLayoutListener(this);
142 |
143 | mSettingDialog = new AlertDialog.Builder(this)
144 | .setCancelable(true)
145 | .setView(layout)
146 | .create();
147 | mSettingDialog.setOnShowListener(new DialogInterface.OnShowListener() {
148 | @Override
149 | public void onShow(DialogInterface dialog) {
150 | mSettingDialog.getWindow().setLayout(DisplayUtils.dp2px(MountActivity.this, 322.0F),
151 | WindowManager.LayoutParams.WRAP_CONTENT);
152 | }
153 | });
154 | mSettingDialog.show();
155 | }
156 |
157 | private void dismissSettingDialogSafety() {
158 | if (mSettingDialog != null && mSettingDialog.isShowing()) {
159 | mSettingDialog.dismiss();
160 | }
161 | }
162 |
163 | @Override
164 | public void onMountSwitchChanged(boolean umount) {
165 | if (umount) {
166 | mCurrentRecord.umount = true;
167 | mCurrentRecord.update();
168 | } else {
169 | mCurrentRecord.umount = false;
170 | mCurrentRecord.delete();
171 | }
172 |
173 | mPackageAdapter.notifyDataSetChanged();
174 | PolicyUtils.setApplicationMount(this, mCurrentRecord.name, !umount);
175 | ToastUtils.showWithShortTime(this, getString(umount ? R.string.toast_umount
176 | : R.string.toast_mount, mCurrentRecord.label));
177 | }
178 |
179 | @Override
180 | public void onClickRunView() {
181 | dismissSettingDialogSafety();
182 | IntentUtils.runApplication(this, mCurrentRecord.name);
183 | }
184 |
185 | @Override
186 | public void onClickInfoView() {
187 | dismissSettingDialogSafety();
188 | IntentUtils.showApplicationInfo(this, mCurrentRecord.name);
189 | }
190 |
191 | @Override
192 | public void onClickAddToLauncher() {
193 | dismissSettingDialogSafety();
194 |
195 | Bitmap icon = ImageUtils.bytes2Bitmap(mCurrentRecord.icon);
196 | float width = icon.getWidth();
197 | float height = icon.getHeight();
198 | float max = width > height ? width : height;
199 | if (max > ImageUtils.LAUNCHER_ICON_MAX_SIZE) {
200 | float ratio = ImageUtils.LAUNCHER_ICON_MAX_SIZE / max;
201 | icon = ImageUtils.resize(icon, (int) (width * ratio), (int) (height * ratio));
202 | }
203 |
204 | IntentUtils.createShortcut(this, mCurrentRecord.name, icon, mCurrentRecord.label);
205 | ToastUtils.showWithShortTime(this, getString(R.string.toast_add_to_launcher, mCurrentRecord.label));
206 | }
207 |
208 | private void setupHeaderView() {
209 | mHeaderView = (PolicyHintLayout) getLayoutInflater().inflate(R.layout.layout_device_hint,
210 | mListView, false);
211 | if (!PolicyUtils.isDeviceOwnerApp(this)) {
212 | mListView.addHeaderView(mHeaderView);
213 | hideOptions();
214 | }
215 |
216 | RxUtils.disposeSafety(mHeaderViewDisposable);
217 | mHeaderViewDisposable = Observable.interval(200L, TimeUnit.MILLISECONDS)
218 | .observeOn(AndroidSchedulers.mainThread())
219 | .subscribe(new Consumer() {
220 | @Override
221 | public void accept(Long aLong) throws Exception {
222 | if (!PolicyUtils.isDeviceOwnerApp(MountActivity.this)) {
223 | hideOptions();
224 | if (mListView.getHeaderViewsCount() <= 0){
225 | mListView.addHeaderView(mHeaderView);
226 | }
227 | } else {
228 | showOptions();
229 | if (mListView.getHeaderViewsCount() > 0) {
230 | mListView.removeHeaderView(mHeaderView);
231 | }
232 | }
233 | }
234 | });
235 | }
236 |
237 | @Override
238 | public boolean onCreateOptionsMenu(Menu menu) {
239 | getMenuInflater().inflate(R.menu.menu_main, menu);
240 |
241 | mLoadingItem = menu.findItem(R.id.loading);
242 | mSettingsItem = menu.findItem(R.id.settings);
243 | mDonateItem = menu.findItem(R.id.donate);
244 |
245 | showLoading();
246 | hideOptions();
247 |
248 | return true;
249 | }
250 |
251 | private void showLoading() {
252 | if (mLoadingItem != null) {
253 | mLoadingItem.setVisible(true);
254 | }
255 | }
256 |
257 | public void hideLoading() {
258 | if (mLoadingItem != null) {
259 | mLoadingItem.setVisible(false);
260 | }
261 | }
262 |
263 | private void showOptions() {
264 | if (mSettingsItem != null) {
265 | mSettingsItem.setVisible(true);
266 | }
267 |
268 | if (mDonateItem != null) {
269 | mDonateItem.setVisible(true);
270 | }
271 | }
272 |
273 | private void hideOptions() {
274 | if (mSettingsItem != null) {
275 | mSettingsItem.setVisible(false);
276 | }
277 |
278 | if (mDonateItem != null) {
279 | mDonateItem.setVisible(false);
280 | }
281 | }
282 |
283 | @Override
284 | public boolean onOptionsItemSelected(MenuItem item) {
285 | switch (item.getItemId()) {
286 | case R.id.settings:
287 | IntentUtils.startSettingsActivity(this);
288 | break;
289 | case R.id.donate:
290 | showDonateDialog();
291 | break;
292 | default:
293 | break;
294 | }
295 |
296 | return true;
297 | }
298 |
299 | private void showDonateDialog() {
300 | final AlertDialog dialog = new AlertDialog.Builder(this)
301 | .setCancelable(true)
302 | .setTitle(R.string.donate_dialog_title)
303 | .setMessage(R.string.alipay_account)
304 | .setPositiveButton(R.string.donate_dialog_positive, new DialogInterface.OnClickListener() {
305 | @Override
306 | public void onClick(DialogInterface dialog, int which) {
307 | ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
308 | ClipData data = ClipData.newPlainText("", getString(R.string.alipay_account));
309 | manager.setPrimaryClip(data);
310 | ToastUtils.showWithShortTime(MountActivity.this, R.string.toast_copied);
311 | }
312 | })
313 | .create();
314 | dialog.setOnShowListener(new DialogInterface.OnShowListener() {
315 | @Override
316 | public void onShow(DialogInterface dialogInterface) {
317 | dialog.getWindow().setLayout(DisplayUtils.dp2px(MountActivity.this, 322.0F),
318 | WindowManager.LayoutParams.WRAP_CONTENT);
319 | }
320 | });
321 | dialog.show();
322 | }
323 |
324 | @Override
325 | public void onResume() {
326 | super.onResume();
327 | fetchPackageRecord();
328 | }
329 |
330 | private void fetchPackageRecord() {
331 | RxUtils.disposeSafety(mFetchPackageRecordDisposable);
332 | showLoading();
333 |
334 | mFetchPackageRecordDisposable = Observable.create(
335 | new ObservableOnSubscribe>() {
336 | @Override
337 | public void subscribe(ObservableEmitter> e) throws Exception {
338 | // list all umount apps first
339 | List recordList = PackageRecord.listAll(PackageRecord.class);
340 | Set nameSet = new HashSet<>();
341 | for (PackageRecord record : recordList) {
342 | nameSet.add(record.name);
343 | }
344 |
345 | // query all apps can launched from launcher
346 | Intent intent = new Intent(Intent.ACTION_MAIN);
347 | intent.addCategory(Intent.CATEGORY_LAUNCHER);
348 | List resolveInfoList = getPackageManager().queryIntentActivities(intent, 0);
349 |
350 | // get all apps' application info
351 | List applicationInfoList = new ArrayList<>();
352 | for (ResolveInfo info : resolveInfoList) {
353 | applicationInfoList.add(info.activityInfo.applicationInfo);
354 | }
355 |
356 | // filter we don't want
357 | for (ApplicationInfo info : applicationInfoList) {
358 | if (TextUtils.equals(info.packageName, getPackageName())
359 | || nameSet.contains(info.packageName)) {
360 | continue;
361 | }
362 |
363 | nameSet.add(info.packageName);
364 | recordList.add(new PackageRecord(info.packageName,
365 | ImageUtils.drawable2Bytes(info.loadIcon(getPackageManager())),
366 | info.loadLabel(getPackageManager()).toString(),
367 | getPackageManager().getPackageInfo(info.packageName, 0).versionName,
368 | false));
369 | }
370 |
371 | // sort by language
372 | Collections.sort(recordList, new Comparator() {
373 | @Override
374 | public int compare(PackageRecord record1, PackageRecord record2) {
375 | return Collator.getInstance().compare(record1.label, record2.label);
376 | }
377 | });
378 |
379 | e.onNext(recordList);
380 | e.onComplete();
381 | }
382 | })
383 | .subscribeOn(Schedulers.newThread())
384 | .observeOn(AndroidSchedulers.mainThread())
385 | .subscribe(new Consumer>() {
386 | @Override
387 | public void accept(List list) throws Exception {
388 | mPackageList.clear();
389 | mPackageList.addAll(list);
390 | mPackageAdapter.notifyDataSetChanged();
391 | hideLoading();
392 | }
393 | });
394 | }
395 |
396 | @Override
397 | public void onDestroy() {
398 | super.onDestroy();
399 |
400 | RxUtils.disposeSafety(mFastScrollDisposable);
401 | RxUtils.disposeSafety(mFetchPackageRecordDisposable);
402 | RxUtils.disposeSafety(mHeaderViewDisposable);
403 | }
404 | }
405 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/MountApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.Application;
22 | import android.app.Notification;
23 | import android.service.notification.StatusBarNotification;
24 |
25 | import com.orm.SugarContext;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | public class MountApplication extends Application {
31 | private NotificationService mNotificationService;
32 |
33 | @Override
34 | public void onCreate() {
35 | super.onCreate();
36 | SugarContext.init(this);
37 | }
38 |
39 | @Override
40 | public void onTerminate() {
41 | super.onTerminate();
42 | SugarContext.terminate();
43 | }
44 |
45 | public void registerNotificationService(NotificationService service) {
46 | mNotificationService = service;
47 | }
48 |
49 | public void unregisterNotificationService() {
50 | mNotificationService = null;
51 | }
52 |
53 | public List getForegroundServiceList() {
54 | List list = new ArrayList<>();
55 |
56 | if (mNotificationService != null) {
57 | StatusBarNotification[] notifications = mNotificationService.getActiveNotifications();
58 | for (StatusBarNotification notification : notifications) {
59 | int mask = Notification.FLAG_FOREGROUND_SERVICE;
60 | if ((notification.getNotification().flags & mask) != 0) {
61 | list.add(notification.getPackageName());
62 | }
63 | }
64 | }
65 |
66 | return list;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/MountReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.admin.DeviceAdminReceiver;
22 | import android.content.Context;
23 | import android.content.Intent;
24 | import android.text.TextUtils;
25 |
26 | import java.util.List;
27 |
28 | import io.github.mthli.mount.model.PackageRecord;
29 | import io.github.mthli.mount.util.IntentUtils;
30 | import io.github.mthli.mount.util.PolicyUtils;
31 | import io.reactivex.Observable;
32 | import io.reactivex.ObservableEmitter;
33 | import io.reactivex.ObservableOnSubscribe;
34 | import io.reactivex.functions.Consumer;
35 | import io.reactivex.schedulers.Schedulers;
36 |
37 | public class MountReceiver extends DeviceAdminReceiver {
38 | @Override
39 | public void onReceive(Context context, Intent intent) {
40 | super.onReceive(context, intent);
41 |
42 | if (TextUtils.equals(intent.getAction(), Intent.ACTION_BOOT_COMPLETED)) {
43 | onBootCompleted(context);
44 | } else if (TextUtils.equals(intent.getAction(), Intent.ACTION_PACKAGE_FULLY_REMOVED)) {
45 | onActionPackageFullyRemoved(intent);
46 | } else if (TextUtils.equals(intent.getAction(), Intent.ACTION_SHUTDOWN)) {
47 | onActionShutdown(context);
48 | }
49 | }
50 |
51 | private void onBootCompleted(final Context context) {
52 | PolicyUtils.umountAll(context, new Consumer() {
53 | @Override
54 | public void accept(Boolean aBoolean) throws Exception {
55 | IntentUtils.startCocaService(context);
56 | }
57 | });
58 | }
59 |
60 | private void onActionPackageFullyRemoved(final Intent intent) {
61 | Observable.create(
62 | new ObservableOnSubscribe() {
63 | @Override
64 | public void subscribe(ObservableEmitter e) throws Exception {
65 | // prefix "package:"
66 | String packageName = intent.getData().toString().substring(8);
67 | List list = PackageRecord.listAll(PackageRecord.class);
68 | for (PackageRecord record : list) {
69 | if (TextUtils.equals(record.name, packageName)) {
70 | record.delete();
71 | }
72 | }
73 |
74 | e.onNext(true);
75 | e.onComplete();
76 | }
77 | })
78 | .subscribeOn(Schedulers.newThread())
79 | .subscribe();
80 | }
81 |
82 | private void onActionShutdown(Context context) {
83 | PolicyUtils.umountAll(context, null);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/MountService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.Notification;
22 | import android.app.Service;
23 | import android.content.BroadcastReceiver;
24 | import android.content.Context;
25 | import android.content.Intent;
26 | import android.content.IntentFilter;
27 | import android.content.SharedPreferences;
28 | import android.os.IBinder;
29 | import android.text.TextUtils;
30 |
31 | import io.github.mthli.mount.R;
32 | import io.github.mthli.mount.util.IntentUtils;
33 | import io.github.mthli.mount.util.PolicyUtils;
34 | import io.github.mthli.mount.util.PreferenceUtils;
35 |
36 | public class MountService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener {
37 | private static final int NOTIFICATION_ID = 0x01;
38 |
39 | private BroadcastReceiver mScreenOffReceiver;
40 |
41 | @Override
42 | public IBinder onBind(Intent intent) {
43 | return null;
44 | }
45 |
46 | @Override
47 | public void onCreate() {
48 | mScreenOffReceiver = new BroadcastReceiver() {
49 | @Override
50 | public void onReceive(Context context, Intent intent) {
51 | if (TextUtils.equals(intent.getAction(), Intent.ACTION_SCREEN_OFF)) {
52 | PolicyUtils.umountAll(MountService.this, null);
53 | }
54 | }
55 | };
56 |
57 | registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
58 | PreferenceUtils.register(this, this);
59 | }
60 |
61 | @Override
62 | public int onStartCommand(Intent intent, int flags, int startId) {
63 | updateForeground();
64 | return START_STICKY;
65 | }
66 |
67 | @Override
68 | public void onDestroy() {
69 | unregisterReceiver(mScreenOffReceiver);
70 | PreferenceUtils.unregister(this, this);
71 | }
72 |
73 | @Override
74 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
75 | if (TextUtils.equals(key, getString(R.string.preference_key_notification_quick_action))) {
76 | updateForeground();
77 | }
78 | }
79 |
80 | private void updateForeground() {
81 | if (!PolicyUtils.isDeviceOwnerApp(this) || !PreferenceUtils.isNotificationQuickAction(this)) {
82 | stopForeground(true);
83 | return;
84 | }
85 |
86 | Notification notification = new Notification.Builder(this)
87 | .setAutoCancel(false)
88 | .setPriority(Notification.PRIORITY_MIN)
89 | .setSmallIcon(R.drawable.ic_notification_android)
90 | .setContentTitle(getString(R.string.mount_service_notification_title))
91 | .setContentText(getString(R.string.mount_service_notification_text))
92 | .setContentIntent(IntentUtils.createNotificationIntent(this))
93 | .build();
94 | startForeground(NOTIFICATION_ID, notification);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/NotificationService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.content.Intent;
22 | import android.os.IBinder;
23 | import android.service.notification.NotificationListenerService;
24 |
25 | public class NotificationService extends NotificationListenerService {
26 | @Override
27 | public IBinder onBind(Intent intent) {
28 | ((MountApplication) getApplication()).registerNotificationService(this);
29 | return super.onBind(intent);
30 | }
31 |
32 | @Override
33 | public boolean onUnbind(Intent intent) {
34 | ((MountApplication) getApplication()).unregisterNotificationService();
35 | return super.onUnbind(intent);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/app/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.app;
20 |
21 | import android.app.Activity;
22 | import android.app.FragmentTransaction;
23 | import android.app.ProgressDialog;
24 | import android.os.Bundle;
25 | import android.preference.Preference;
26 | import android.preference.PreferenceFragment;
27 | import android.preference.PreferenceScreen;
28 |
29 | import io.github.mthli.mount.BuildConfig;
30 | import io.github.mthli.mount.R;
31 | import io.github.mthli.mount.util.IntentUtils;
32 | import io.github.mthli.mount.util.PolicyUtils;
33 | import io.github.mthli.mount.util.ToastUtils;
34 | import io.reactivex.functions.Consumer;
35 |
36 | public class SettingsActivity extends Activity {
37 | public static class SettingsFragment extends PreferenceFragment {
38 | private ProgressDialog mProgressDialog;
39 | private boolean mIsProgressDialogShowing;
40 |
41 | public boolean isProgressDialogShowing() {
42 | return mIsProgressDialogShowing;
43 | }
44 |
45 | @Override
46 | public void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | addPreferencesFromResource(R.xml.preferences);
49 | }
50 |
51 | @Override
52 | public void onResume() {
53 | super.onResume();
54 |
55 | // update version
56 | Preference preference = findPreference(getString(R.string.preference_key_version));
57 | preference.setSummary(BuildConfig.VERSION_NAME);
58 | }
59 |
60 | @Override
61 | public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
62 | switch (preference.getTitleRes()) {
63 | case R.string.preference_title_ignore_foreground_app:
64 | IntentUtils.showUsageStatsAccess(getActivity());
65 | break;
66 | case R.string.preference_title_ignore_foreground_service:
67 | IntentUtils.showNotificationAccess(getActivity());
68 | break;
69 | case R.string.preference_title_mount_all_temporary:
70 | onClickMountAllTemporary();
71 | break;
72 | case R.string.preference_title_pre_uninstall:
73 | onClickPreUninstall();
74 | break;
75 | case R.string.preference_title_version:
76 | IntentUtils.showVersion(getActivity());
77 | break;
78 | case R.string.preference_title_tutorial:
79 | IntentUtils.showTutorial(getActivity());
80 | break;
81 | default:
82 | break;
83 | }
84 |
85 | return super.onPreferenceTreeClick(preferenceScreen, preference);
86 | }
87 |
88 | private void onClickMountAllTemporary() {
89 | showProgressDialog();
90 | PolicyUtils.mountAll(getActivity(), true, new Consumer() {
91 | @Override
92 | public void accept(Boolean aBoolean) throws Exception {
93 | hideProgressDialog();
94 | ToastUtils.showWithShortTime(getActivity(), R.string.toast_mount_all_temporary_ok);
95 | }
96 | });
97 | }
98 |
99 | private void onClickPreUninstall() {
100 | showProgressDialog();
101 | PolicyUtils.mountAll(getActivity(), false, new Consumer() {
102 | @Override
103 | public void accept(Boolean aBoolean) throws Exception {
104 | hideProgressDialog();
105 | PolicyUtils.clearDeviceOwnerApp(getActivity());
106 | ToastUtils.showWithShortTime(getActivity(), R.string.toast_pre_uninstall_ok);
107 | }
108 | });
109 | }
110 |
111 | private void showProgressDialog() {
112 | mIsProgressDialogShowing = true;
113 | if (mProgressDialog != null) {
114 | mProgressDialog.dismiss();
115 | }
116 |
117 | mProgressDialog = new ProgressDialog(getActivity());
118 | mProgressDialog.setMessage(getString(R.string.dialog_message_wait_a_minute));
119 | mProgressDialog.setCancelable(false);
120 | mProgressDialog.show();
121 | }
122 |
123 | private void hideProgressDialog() {
124 | mIsProgressDialogShowing = false;
125 | if (mProgressDialog != null) {
126 | mProgressDialog.dismiss();
127 | }
128 | }
129 | }
130 |
131 | private SettingsFragment mSettingsFragment;
132 |
133 | @Override
134 | protected void onCreate(Bundle savedInstanceState) {
135 | super.onCreate(savedInstanceState);
136 | setContentView(R.layout.activity_settings);
137 |
138 | FragmentTransaction transaction = getFragmentManager().beginTransaction();
139 | mSettingsFragment = new SettingsFragment();
140 | transaction.replace(R.id.content, mSettingsFragment);
141 | transaction.commit();
142 | }
143 |
144 | @Override
145 | public void onBackPressed() {
146 | if (!mSettingsFragment.isProgressDialogShowing()) {
147 | super.onBackPressed();
148 | }
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/model/PackageRecord.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.model;
20 |
21 | import com.orm.SugarRecord;
22 | import com.orm.dsl.Unique;
23 |
24 | public class PackageRecord extends SugarRecord {
25 | @Unique
26 | public String name;
27 | public byte[] icon;
28 | public String label;
29 | public String version;
30 | public boolean umount;
31 |
32 | public PackageRecord() {}
33 |
34 | public PackageRecord(String name, byte[] icon, String label, String version, boolean umount) {
35 | this.name = name;
36 | this.icon = icon;
37 | this.label = label;
38 | this.version = version;
39 | this.umount = umount;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/DisplayUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.content.Context;
22 |
23 | public class DisplayUtils {
24 | public static float getScreenDensity(Context context) {
25 | return context.getResources().getDisplayMetrics().density;
26 | }
27 |
28 | public static int dp2px(Context context, float dp) {
29 | return (int) (getScreenDensity(context) * dp + 0.5F);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/ImageUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.graphics.Bitmap;
22 | import android.graphics.BitmapFactory;
23 | import android.graphics.Canvas;
24 | import android.graphics.Matrix;
25 | import android.graphics.drawable.Drawable;
26 |
27 | import java.io.ByteArrayOutputStream;
28 | import java.io.IOException;
29 |
30 | public class ImageUtils {
31 | public static final int LAUNCHER_ICON_MAX_SIZE = 192; // px
32 |
33 | public static Bitmap drawable2Bitmap(Drawable drawable) {
34 | Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(),
35 | Bitmap.Config.ARGB_8888);
36 | Canvas canvas = new Canvas(bitmap);
37 | drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
38 | drawable.draw(canvas);
39 | return bitmap;
40 | }
41 |
42 | public static byte[] bitmap2Bytes(Bitmap bitmap) {
43 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
44 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
45 |
46 | byte[] bytes = stream.toByteArray();
47 | try {
48 | stream.close();
49 | } catch (IOException e) {
50 | e.printStackTrace();
51 | }
52 |
53 | return bytes;
54 | }
55 |
56 | public static byte[] drawable2Bytes(Drawable drawable) {
57 | return bitmap2Bytes(drawable2Bitmap(drawable));
58 | }
59 |
60 | public static Bitmap bytes2Bitmap(byte[] bytes) {
61 | return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
62 | }
63 |
64 | public static Bitmap resize(Bitmap bitmap, int newWidth, int newHeight) {
65 | bitmap = bitmap.copy(bitmap.getConfig(), true);
66 |
67 | int bitmapWidth = bitmap.getWidth();
68 | int bitmapHeight = bitmap.getHeight();
69 | float scaleWidth = ((float) newWidth) / bitmapWidth;
70 | float scaleHeight = ((float) newHeight) / bitmapHeight;
71 | Matrix matrix = new Matrix();
72 | matrix.postScale(scaleWidth, scaleHeight);
73 |
74 | Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0,
75 | bitmapWidth, bitmapHeight, matrix, false);
76 | bitmap.recycle();
77 | return resizedBitmap;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/IntentUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.app.PendingIntent;
22 | import android.content.Context;
23 | import android.content.Intent;
24 | import android.graphics.Bitmap;
25 | import android.net.Uri;
26 | import android.provider.Settings;
27 |
28 | import io.github.mthli.mount.app.MountActivity;
29 | import io.github.mthli.mount.app.MountService;
30 | import io.github.mthli.mount.app.MainActivity;
31 | import io.github.mthli.mount.app.SettingsActivity;
32 |
33 | public class IntentUtils {
34 | // historical issues, should be "mount://"
35 | public static final String SCHEMA_MOUNT = "coca://";
36 | public static final String SCHEMA_MOUNT_NOTIFICATION = SCHEMA_MOUNT + "notification/";
37 | public static final String SCHEMA_MOUNT_SHORTCUT = SCHEMA_MOUNT + "shortcut/";
38 |
39 | public static PendingIntent createNotificationIntent(Context context) {
40 | Intent intent = new Intent(context, MainActivity.class);
41 | intent.setData(Uri.parse(IntentUtils.SCHEMA_MOUNT_NOTIFICATION));
42 | return PendingIntent.getActivity(context, 0, intent, 0);
43 | }
44 |
45 | public static void createShortcut(Context context, String packageName, Bitmap icon, String label) {
46 | Intent shortcutIntent = new Intent(context, MainActivity.class);
47 | shortcutIntent.setData(Uri.parse(SCHEMA_MOUNT_SHORTCUT + packageName));
48 |
49 | Intent addIntent = new Intent();
50 | addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
51 | addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
52 | addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
53 | addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
54 | context.sendBroadcast(addIntent);
55 | }
56 |
57 | public static void runApplication(Context context, String packageName) {
58 | if (!PolicyUtils.isApplicationMount(context, packageName)) {
59 | PolicyUtils.setApplicationMount(context, packageName, true);
60 | }
61 |
62 | try {
63 | Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
64 | intent.addCategory(Intent.CATEGORY_LAUNCHER);
65 | context.startActivity(intent);
66 | } catch (Exception e) {
67 | e.printStackTrace();
68 | }
69 | }
70 |
71 | public static void showApplicationInfo(Context context, String packageName) {
72 | Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
73 | intent.setData(Uri.parse("package:" + packageName));
74 | context.startActivity(intent);
75 | }
76 |
77 | public static void showUsageStatsAccess(Context context) {
78 | context.startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));
79 | }
80 |
81 | public static void showNotificationAccess(Context context) {
82 | context.startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
83 | }
84 |
85 | public static void showVersion(Context context) {
86 | context.startActivity(new Intent(Intent.ACTION_VIEW,
87 | Uri.parse("https://github.com/mthli/Mount/releases")));
88 | }
89 |
90 | public static void showTutorial(Context context) {
91 | context.startActivity(new Intent(Intent.ACTION_VIEW,
92 | Uri.parse("https://github.com/mthli/Mount/blob/master/README.md")));
93 | }
94 |
95 | public static void startCocaActivity(Context context) {
96 | context.startActivity(new Intent(context, MountActivity.class));
97 | }
98 |
99 | public static void startCocaService(Context context) {
100 | context.startService(new Intent(context, MountService.class));
101 | }
102 |
103 | public static void startSettingsActivity(Context context) {
104 | context.startActivity(new Intent(context, SettingsActivity.class));
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/PolicyUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.app.admin.DevicePolicyManager;
22 | import android.app.usage.UsageStats;
23 | import android.app.usage.UsageStatsManager;
24 | import android.content.ComponentName;
25 | import android.content.Context;
26 | import android.content.pm.ApplicationInfo;
27 | import android.text.TextUtils;
28 |
29 | import java.util.List;
30 | import java.util.SortedMap;
31 | import java.util.TreeMap;
32 |
33 | import io.github.mthli.mount.app.MountApplication;
34 | import io.github.mthli.mount.app.MountReceiver;
35 | import io.github.mthli.mount.model.PackageRecord;
36 | import io.reactivex.Observable;
37 | import io.reactivex.ObservableEmitter;
38 | import io.reactivex.ObservableOnSubscribe;
39 | import io.reactivex.android.schedulers.AndroidSchedulers;
40 | import io.reactivex.functions.Consumer;
41 | import io.reactivex.schedulers.Schedulers;
42 |
43 | public class PolicyUtils {
44 | public static boolean isDeviceOwnerApp(Context context) {
45 | DevicePolicyManager manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
46 | return manager.isDeviceOwnerApp(context.getPackageName());
47 | }
48 |
49 | public static void clearDeviceOwnerApp(Context context) {
50 | try {
51 | DevicePolicyManager manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
52 | manager.clearDeviceOwnerApp(context.getPackageName());
53 | } catch (SecurityException e) {
54 | e.printStackTrace();
55 | }
56 | }
57 |
58 | // http://stackoverflow.com/a/14665381/4696820
59 | public static boolean isSystemApp(ApplicationInfo info) {
60 | int mask = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
61 | return (info.flags & mask) != 0;
62 | }
63 |
64 | public static boolean isApplicationMount(Context context, String packageName) {
65 | DevicePolicyManager manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
66 | return !manager.isApplicationHidden(new ComponentName(context, MountReceiver.class), packageName);
67 | }
68 |
69 | public static void setApplicationMount(Context context, String packageName, boolean mount) {
70 | DevicePolicyManager manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
71 | ComponentName admin = new ComponentName(context, MountReceiver.class);
72 | manager.setApplicationHidden(admin, packageName, !mount);
73 | manager.setUninstallBlocked(admin, packageName, !mount);
74 | }
75 |
76 | public static void mountAll(final Context context, final boolean temporary, Consumer consumer) {
77 | if (consumer == null) {
78 | consumer = new Consumer() {
79 | @Override
80 | public void accept(Boolean aBoolean) throws Exception {
81 | // DO NOTHING
82 | }
83 | };
84 | }
85 |
86 | Observable.create(
87 | new ObservableOnSubscribe() {
88 | @Override
89 | public void subscribe(ObservableEmitter e) throws Exception {
90 | List list = PackageRecord.listAll(PackageRecord.class);
91 | for (PackageRecord record : list) {
92 | setApplicationMount(context, record.name, true);
93 | if (!temporary) {
94 | record.delete();
95 | }
96 | }
97 |
98 | e.onNext(true);
99 | e.onComplete();
100 | }
101 | })
102 | .subscribeOn(Schedulers.newThread())
103 | .observeOn(AndroidSchedulers.mainThread())
104 | .subscribe(consumer);
105 | }
106 |
107 | public static void umountAll(final Context context, Consumer consumer) {
108 | if (consumer == null) {
109 | consumer = new Consumer() {
110 | @Override
111 | public void accept(Boolean aBoolean) throws Exception {
112 | // DO NOTHING
113 | }
114 | };
115 | }
116 |
117 | final String foregroundPackageName = getForegroundAppPackageName(context);
118 | final List foregroundServiceList = getForegroundServiceList(context);
119 | Observable.create(
120 | new ObservableOnSubscribe() {
121 | @Override
122 | public void subscribe(ObservableEmitter e) throws Exception {
123 | List list = PackageRecord.listAll(PackageRecord.class);
124 | for (PackageRecord record : list) {
125 | if (!TextUtils.equals(record.name, foregroundPackageName)
126 | && !foregroundServiceList.contains(record.name)) {
127 | setApplicationMount(context, record.name, false);
128 | }
129 | }
130 |
131 | e.onNext(true);
132 | e.onComplete();
133 | }
134 | })
135 | .subscribeOn(Schedulers.newThread())
136 | .observeOn(AndroidSchedulers.mainThread())
137 | .subscribe(consumer);
138 | }
139 |
140 | @SuppressWarnings("WrongConstant")
141 | public static String getForegroundAppPackageName(Context context) {
142 | UsageStatsManager manager = (UsageStatsManager) context.getSystemService("usagestats");
143 | long time = System.currentTimeMillis();
144 | List list = manager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY,
145 | time - 1000 * 1000, time);
146 | if (list != null && !list.isEmpty()) {
147 | SortedMap map = new TreeMap<>();
148 | for (UsageStats stats : list) {
149 | map.put(stats.getLastTimeUsed(), stats);
150 | }
151 |
152 | if (!map.isEmpty()) {
153 | return map.get(map.lastKey()).getPackageName();
154 | }
155 | }
156 |
157 | return null;
158 | }
159 |
160 | public static List getForegroundServiceList(Context context) {
161 | return ((MountApplication) context.getApplicationContext()).getForegroundServiceList();
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/PreferenceUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.content.Context;
22 | import android.content.SharedPreferences;
23 | import android.preference.PreferenceManager;
24 |
25 | import io.github.mthli.mount.R;
26 |
27 | public class PreferenceUtils {
28 | public static void register(Context context, SharedPreferences.OnSharedPreferenceChangeListener listener) {
29 | PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(listener);
30 | }
31 |
32 | public static void unregister(Context context, SharedPreferences.OnSharedPreferenceChangeListener listener) {
33 | PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(listener);
34 | }
35 |
36 | public static boolean isNotificationQuickAction(Context context) {
37 | String key = context.getString(R.string.preference_key_notification_quick_action);
38 | return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(key, false);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/RxUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import io.reactivex.disposables.Disposable;
22 |
23 | public class RxUtils {
24 | public static void disposeSafety(Disposable disposable) {
25 | if (disposable != null && !disposable.isDisposed()) {
26 | disposable.dispose();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/util/ToastUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.util;
20 |
21 | import android.content.Context;
22 | import android.widget.Toast;
23 |
24 | import java.util.concurrent.TimeUnit;
25 |
26 | import io.reactivex.Observable;
27 | import io.reactivex.android.schedulers.AndroidSchedulers;
28 | import io.reactivex.disposables.Disposable;
29 | import io.reactivex.functions.Consumer;
30 |
31 | public class ToastUtils {
32 | private static final long SHORT_DELAY = 2000L; // ms; Toast.LENGTH_SHORT
33 | private static final long LONG_DELAY = 3500L; // ms; Toast.LENGTH_LONG
34 |
35 | private static Toast sToast;
36 | private static Disposable sDisposable;
37 |
38 | public static void showWithShortTime(Context context, int stringResId) {
39 | showWithShortTime(context, context.getString(stringResId));
40 | }
41 |
42 | public static void showWithShortTime(Context context, String text) {
43 | show(context, text, false);
44 | }
45 |
46 | public static void showWithLongTime(Context context, int stringResId) {
47 | showWithLongTime(context, context.getString(stringResId));
48 | }
49 |
50 | public static void showWithLongTime(Context context, String text) {
51 | show(context, text, true);
52 | }
53 |
54 | private static void show(Context context, String text, boolean isLong) {
55 | RxUtils.disposeSafety(sDisposable);
56 |
57 | if (sToast != null) {
58 | sToast.setText(text);
59 | } else {
60 | sToast = Toast.makeText(context, text, !isLong ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG);
61 | }
62 |
63 | sToast.show();
64 | sDisposable = Observable.timer(!isLong ? SHORT_DELAY : LONG_DELAY, TimeUnit.MILLISECONDS)
65 | .observeOn(AndroidSchedulers.mainThread())
66 | .subscribe(new Consumer() {
67 | @Override
68 | public void accept(Long aLong) throws Exception {
69 | sToast.cancel();
70 | }
71 | }, new Consumer() {
72 | @Override
73 | public void accept(Throwable throwable) throws Exception {
74 | throwable.printStackTrace();
75 | }
76 | });
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/widget/PackageItemAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.widget;
20 |
21 | import android.content.Context;
22 | import android.support.annotation.NonNull;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.widget.ArrayAdapter;
27 | import android.widget.SectionIndexer;
28 |
29 | import java.text.Collator;
30 | import java.util.ArrayList;
31 | import java.util.Collections;
32 | import java.util.Comparator;
33 | import java.util.LinkedHashMap;
34 | import java.util.List;
35 | import java.util.Map;
36 |
37 | import io.github.mthli.mount.R;
38 | import io.github.mthli.mount.model.PackageRecord;
39 |
40 | public class PackageItemAdapter extends ArrayAdapter implements SectionIndexer {
41 | private Context mContext;
42 | private List mPackageList;
43 | private Map mSectionMap;
44 | private String[] mSectionArray;
45 |
46 | public PackageItemAdapter(Context context, List list) {
47 | super(context, R.layout.layout_package_item, list);
48 |
49 | mContext = context;
50 | mPackageList = list;
51 | mSectionMap = new LinkedHashMap<>();
52 | mSectionArray = new String[0];
53 |
54 | buildSection();
55 | }
56 |
57 | @NonNull
58 | @Override
59 | public View getView(int position, View convertView, @NonNull ViewGroup parent) {
60 | View view = convertView;
61 | if (!(view instanceof PackageItemLayout)) {
62 | view = LayoutInflater.from(mContext).inflate(R.layout.layout_package_item, parent, false);
63 | }
64 |
65 | ((PackageItemLayout) view).setPackageRecord(mPackageList.get(position));
66 |
67 | return view;
68 | }
69 |
70 | // =============================================================================================
71 |
72 | @Override
73 | public int getPositionForSection(int sectionIndex) {
74 | return mSectionMap.get(mSectionArray[sectionIndex]);
75 | }
76 |
77 | @Override
78 | public int getSectionForPosition(int position) {
79 | return 0;
80 | }
81 |
82 | @Override
83 | public Object[] getSections() {
84 | return mSectionArray;
85 | }
86 |
87 | @Override
88 | public void notifyDataSetChanged() {
89 | super.notifyDataSetChanged();
90 | buildSection();
91 | }
92 |
93 | private void buildSection() {
94 | mSectionMap.clear();
95 | for (int index = 0; index < mPackageList.size(); index++) {
96 | mSectionMap.put(mPackageList.get(index).label.substring(0, 1).toUpperCase(), index);
97 | }
98 |
99 | List sectionList = new ArrayList<>(mSectionMap.keySet());
100 | Collections.sort(sectionList, new Comparator() {
101 | @Override
102 | public int compare(String o1, String o2) {
103 | return Collator.getInstance().compare(o1, o2);
104 | }
105 | });
106 |
107 | mSectionArray = new String[sectionList.size()];
108 | sectionList.toArray(mSectionArray);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/widget/PackageItemLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.widget;
20 |
21 | import android.content.Context;
22 | import android.graphics.PorterDuff;
23 | import android.util.AttributeSet;
24 | import android.util.TypedValue;
25 | import android.widget.ImageView;
26 | import android.widget.RelativeLayout;
27 | import android.widget.TextView;
28 |
29 | import io.github.mthli.mount.R;
30 | import io.github.mthli.mount.model.PackageRecord;
31 | import io.github.mthli.mount.util.ImageUtils;
32 |
33 | public class PackageItemLayout extends RelativeLayout {
34 | private ImageView mIconView;
35 | private ImageView mUmountView;
36 | private TextView mLabelView;
37 | private TextView mVersionView;
38 |
39 | public PackageItemLayout(Context context) {
40 | super(context);
41 | }
42 |
43 | public PackageItemLayout(Context context, AttributeSet attrs) {
44 | super(context, attrs);
45 | }
46 |
47 | public PackageItemLayout(Context context, AttributeSet attrs, int defStyleAttr) {
48 | super(context, attrs, defStyleAttr);
49 | }
50 |
51 | @Override
52 | protected void onFinishInflate() {
53 | super.onFinishInflate();
54 |
55 | mIconView = (ImageView) findViewById(R.id.icon);
56 | mUmountView = (ImageView) findViewById(R.id.umount);
57 | mLabelView = (TextView) findViewById(R.id.label);
58 | mVersionView = (TextView) findViewById(R.id.version);
59 |
60 | setupUmountView();
61 | }
62 |
63 | private void setupUmountView() {
64 | TypedValue value = new TypedValue();
65 | getContext().getTheme().resolveAttribute(android.R.attr.colorControlActivated, value, true);
66 | mUmountView.getDrawable().mutate().setColorFilter(value.data, PorterDuff.Mode.SRC_IN);
67 | }
68 |
69 | public void setPackageRecord(PackageRecord record) {
70 | mIconView.setImageBitmap(ImageUtils.bytes2Bitmap(record.icon));
71 | mUmountView.setVisibility(record.umount ? VISIBLE : GONE);
72 | mLabelView.setText(record.label);
73 | mVersionView.setText(record.version);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/widget/PackageSettingLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.widget;
20 |
21 | import android.content.Context;
22 | import android.util.AttributeSet;
23 | import android.view.View;
24 | import android.widget.CompoundButton;
25 | import android.widget.ImageView;
26 | import android.widget.LinearLayout;
27 | import android.widget.Switch;
28 | import android.widget.TextView;
29 |
30 | import io.github.mthli.mount.R;
31 | import io.github.mthli.mount.model.PackageRecord;
32 | import io.github.mthli.mount.util.ImageUtils;
33 |
34 | public class PackageSettingLayout extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
35 | View.OnClickListener {
36 | public interface PackageSettingLayoutListener {
37 | void onMountSwitchChanged(boolean umount);
38 | void onClickRunView();
39 | void onClickInfoView();
40 | void onClickAddToLauncher();
41 | }
42 |
43 | private ImageView mIconView;
44 | private Switch mMountSwitch;
45 | private TextView mLabelView;
46 | private TextView mVersionView;
47 | private TextView mRunView;
48 | private TextView mInfoView;
49 | private TextView mAddToLauncherView;
50 |
51 | private PackageSettingLayoutListener mListener;
52 |
53 | public PackageSettingLayout(Context context) {
54 | super(context);
55 | }
56 |
57 | public PackageSettingLayout(Context context, AttributeSet attrs) {
58 | super(context, attrs);
59 | }
60 |
61 | public PackageSettingLayout(Context context, AttributeSet attrs, int defStyleAttr) {
62 | super(context, attrs, defStyleAttr);
63 | }
64 |
65 | public void setPackageSettingLayoutListener(PackageSettingLayoutListener listener) {
66 | mListener = listener;
67 | }
68 |
69 | public void setPackageRecord(PackageRecord record) {
70 | mIconView.setImageBitmap(ImageUtils.bytes2Bitmap(record.icon));
71 | mMountSwitch.setOnCheckedChangeListener(null);
72 | mMountSwitch.setChecked(record.umount);
73 | mMountSwitch.setOnCheckedChangeListener(this);
74 | mLabelView.setText(record.label);
75 | mVersionView.setText(record.version);
76 | }
77 |
78 | @Override
79 | protected void onFinishInflate() {
80 | super.onFinishInflate();
81 |
82 | mIconView = (ImageView) findViewById(R.id.icon);
83 | mMountSwitch = (Switch) findViewById(R.id.mount_switch);
84 | mLabelView = (TextView) findViewById(R.id.label);
85 | mVersionView = (TextView) findViewById(R.id.version);
86 | mRunView = (TextView) findViewById(R.id.run);
87 | mInfoView = (TextView) findViewById(R.id.info);
88 | mAddToLauncherView = (TextView) findViewById(R.id.add_to_launcher);
89 |
90 | mMountSwitch.setOnCheckedChangeListener(this);
91 | mRunView.setOnClickListener(this);
92 | mInfoView.setOnClickListener(this);
93 | mAddToLauncherView.setOnClickListener(this);
94 | }
95 |
96 | @Override
97 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
98 | if (buttonView == mMountSwitch && mListener != null) {
99 | mListener.onMountSwitchChanged(isChecked);
100 | }
101 | }
102 |
103 | @Override
104 | public void onClick(View view) {
105 | if (view == mRunView && mListener != null) {
106 | mListener.onClickRunView();
107 | } else if (view == mInfoView && mListener != null) {
108 | mListener.onClickInfoView();
109 | } else if (view == mAddToLauncherView && mListener != null) {
110 | mListener.onClickAddToLauncher();
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/mthli/mount/widget/PolicyHintLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | package io.github.mthli.mount.widget;
20 |
21 | import android.content.Context;
22 | import android.text.Html;
23 | import android.util.AttributeSet;
24 | import android.view.View;
25 | import android.widget.RelativeLayout;
26 | import android.widget.TextView;
27 |
28 | import io.github.mthli.mount.R;
29 | import io.github.mthli.mount.util.IntentUtils;
30 |
31 | public class PolicyHintLayout extends RelativeLayout {
32 | public PolicyHintLayout(Context context) {
33 | super(context);
34 | }
35 |
36 | public PolicyHintLayout(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public PolicyHintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | protected void onFinishInflate() {
46 | super.onFinishInflate();
47 |
48 | ((TextView) findViewById(R.id.hint)).setText(Html.fromHtml(
49 | getContext().getString(R.string.device_policy_hint)));
50 |
51 | findViewById(R.id.button).setOnClickListener(new OnClickListener() {
52 | @Override
53 | public void onClick(View v) {
54 | IntentUtils.showTutorial(getContext());
55 | }
56 | });
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_eject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xhdpi/ic_eject.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_notification_android.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xhdpi/ic_notification_android.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_eject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xxhdpi/ic_eject.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_notification_android.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xxhdpi/ic_notification_android.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_eject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xxxhdpi/ic_eject.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_notification_android.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/drawable-xxxhdpi/ic_notification_android.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
28 |
29 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_action_bar_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_device_hint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
27 |
28 |
37 |
38 |
39 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_package_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
27 |
28 |
35 |
36 |
37 |
47 |
48 |
49 |
57 |
58 |
65 |
66 |
67 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_package_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
28 |
29 |
32 |
33 |
42 |
43 |
44 |
52 |
53 |
54 |
62 |
63 |
70 |
71 |
72 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
95 |
96 |
97 |
107 |
108 |
109 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v23/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 | 应用挂载器
24 |
25 | 加载中
26 | 设置
27 | 赞助
28 | 支付宝
29 | 复制帐号
30 | 已复制
31 |
32 | 运行
33 | 应用信息
34 | 添加到桌面
35 | 挂载 %1$s
36 | 弹出 %1$s
37 | 添加 %1$s 到桌面
38 |
39 | 应用挂载器
40 | 管理在后台运行的所有被选中的应用。
41 | 当屏幕关闭时,将所有被选中的应用弹出。
42 |
43 | 为了管理在后台运行的应用,你需要把应用挂载器设置为<b>系统管理员</b>。
44 |
45 | → 查看教程
46 |
47 | 应用弹出服务
48 | 接收屏幕关闭事件,用于应用弹出。
49 | 随时等待命令
50 | 手动将所有被选中的应用弹出。
51 | 通知服务
52 | 忽略可能被弹出的前台服务。
53 | 弹出完毕
54 |
55 | 设置
56 | 稍等片刻…
57 | 已临时挂载所有被选中的应用
58 | 预备卸载操作完毕
59 | 功能
60 | 通知栏快捷操作
61 | 点击通知弹出所有被选中的应用。
62 | 忽略当前屏幕应用
63 | 点击前往设置使用情况访问权限。
64 | 忽略前台服务
65 |
66 | 比如正在播放音乐等情况,\n点击前往设置通知使用权限。
67 |
68 | 临时挂载所有应用
69 | 用于更新应用等情况。
70 | 预备卸载
71 | 将所有被弹出的应用挂载,接着你可以卸载这款应用。
72 | 其他
73 | 版本
74 | 教程
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rTW/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 | 應用挂載器
24 |
25 | 加載中
26 | 設置
27 | 贊助
28 | 支付寶
29 | 複制帳號
30 | 已複制
31 |
32 | 運行
33 | 應用信息
34 | 添加到桌面
35 | 挂載 %1$s
36 | 彈出 %1$s
37 | 添加 %1$s 到桌面
38 |
39 | 應用挂載器
40 | 管理在後台運行的所有被選中的應用。
41 | 當屏幕關閉時,將所有被選中的應用彈出。
42 |
43 | 爲了管理在後台運行的應用,你需要把應用挂載器設置爲<b>系統管理員</b>。
44 |
45 | → 查看教程
46 |
47 | 應用彈出服務
48 | 接收屏幕關閉事件,用于應用彈出。
49 | 隨時等待命令
50 | 手動將所有被選中的應用彈出。
51 | 通知服務
52 | 忽略可能被彈出的前台服務。
53 | 彈出完畢
54 |
55 | 設置
56 | 稍等片刻…
57 | 已臨時挂載所有被選中的應用
58 | 預備卸載操作完畢
59 | 功能
60 | 通知欄快捷操作
61 | 點擊通知彈出所有被選中的應用。
62 | 忽略當前屏幕應用
63 | 點擊前往設置使用情況訪問權限。
64 | 忽略前台服務
65 |
66 | 比如正在播放音樂等情況,\n點擊前往設置通知使用權限。
67 |
68 | 臨時挂載所有應用
69 | 用于更新應用等情況。
70 | 預備卸載
71 | 將所有被彈出的應用挂載,接著你可以卸載這款應用。
72 | 其他
73 | 版本
74 | 教程
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 | App Mount
22 | matthewlee0725@gmail.com
23 |
24 | Loading
25 | Settings
26 | Donate
27 | AliPay
28 | Copy account
29 | Copied
30 |
31 | Run
32 | App info
33 | Add to launcher
34 | mount %1$s
35 | umount %1$s
36 | Add %1$s to launcher
37 |
38 | App Mount Manager
39 | Manage chosen apps\ run in background.
40 | umount chosen apps when screen off.
41 |
42 | To manage apps run in background, you need to set App Mount as <b>Device Administrator</b>.
43 |
44 | → Show tutorial
45 |
46 | App Mount Service
47 | Receive screen off event to umount apps.
48 | Waiting for the command
49 | Tap to umount chosen apps.
50 | Notification Service
51 | Ignore foreground service when umount apps.
52 | umount all OK
53 |
54 | Settings
55 | Wait a minute…
56 | mount all temporary OK
57 | Pre uninstall OK
58 | Function
59 | preference_key_show_notification
60 | Notification quick action
61 | umount apps manual though notification.
62 | preference_key_ignore_foreground_app
63 | Ignore foreground app
64 |
65 | Ignore current app on screen.\nClick to enable at Usage Access.
66 |
67 | preference_key_ignore_foreground_service
68 | Ignore foreground service
69 |
70 | When music app playing, etc.\nClick to enable at Notification Access.
71 |
72 | preference_key_mount_all_temporary
73 | mount all temporary
74 | To upgrade apps, etc.
75 | preference_key_pre_uninstall
76 | Pre uninstall
77 | mount all apps, and then you can uninstall App Mount.
78 | Others
79 | preference_key_version
80 | Version
81 | preference_key_tutorial
82 | Tutorial
83 |
84 |
85 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/device_policy.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
36 |
37 |
38 |
42 |
43 |
44 |
48 |
49 |
50 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | buildscript {
20 | repositories {
21 | jcenter()
22 | }
23 |
24 | dependencies {
25 | classpath 'com.android.tools.build:gradle:2.2.3'
26 | }
27 | }
28 |
29 | allprojects {
30 | repositories {
31 | jcenter()
32 | }
33 | }
34 |
35 | task clean(type: Delete) {
36 | delete rootProject.buildDir
37 | }
38 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # App Mount, mount/umount apps that you don't like on Android, without root.
3 | # Copyright (C) 2017 Matthew Lee
4 | #
5 | # This program is free software: 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 | # Project-wide Gradle settings.
20 |
21 | # IDE (e.g. Android Studio) users:
22 | # Gradle settings configured through the IDE *will override*
23 | # any settings specified in this file.
24 |
25 | # For more details on how to configure your build environment visit
26 | # http://www.gradle.org/docs/current/userguide/build_environment.html
27 |
28 | # Specifies the JVM arguments used for the daemon process.
29 | # The setting is particularly useful for tweaking memory settings.
30 | org.gradle.jvmargs=-Xmx1536m
31 |
32 | # When configured, Gradle will run in incubating parallel mode.
33 | # This option should only be used with decoupled projects. More details, visit
34 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
35 | # org.gradle.parallel=true
36 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # App Mount, mount/umount apps that you don't like on Android, without root.
3 | # Copyright (C) 2017 Matthew Lee
4 | #
5 | # This program is free software: 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 | #Mon Dec 28 10:00:20 PST 2015
20 | distributionBase=GRADLE_USER_HOME
21 | distributionPath=wrapper/dists
22 | zipStoreBase=GRADLE_USER_HOME
23 | zipStorePath=wrapper/dists
24 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
25 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/mount.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mthli/Mount/522a82c692d11da6f23addb767d4ade3f4efd521/mount.sketch
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * App Mount, mount/umount apps that you don't like on Android, without root.
3 | * Copyright (C) 2017 Matthew Lee
4 | *
5 | * This program is free software: 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 | include ':app'
20 |
--------------------------------------------------------------------------------