diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..4c889e0f4edc24810a0688025fbbaaa03afe6536
Binary files /dev/null and b/.DS_Store differ
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 5da13087b23f2398c796923c5d47fd8e5c95574c..0000000000000000000000000000000000000000
--- a/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index bf4d987723aa2dc9b5490a330d4359dce3ae4cc9..0000000000000000000000000000000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,28 +0,0 @@
-# Built application files
-build/
-
-# Crashlytics configuations
-com_crashlytics_export_strings.xml
-
-# Local configuration file (sdk path, etc)
-local.properties
-
-# Gradle generated files
-.gradle/
-build/
-
-# Signing files
-.signing/
-
-# User-specific configurations
-.idea/
-*.iml
-
-# OS-specific files
-.DS_Store
-.DS_Store?
-._*
-.Spotlight-V100
-.Trashes
-ehthumbs.db
-Thumbs.db
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index efd23aaecf44426d29add75466f695ee8bedf3aa..0000000000000000000000000000000000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-language: android
-sudo: required
-
-android:
- components:
- # Uncomment the lines below if you want to
- # use the latest revision of Android SDK Tools
- - platform-tools
- - tools
-
- # The BuildTools version used by your project
- - build-tools-23.0.2
-
- # The SDK version used to compile your project
- - android-22
-
- # Additional components
- - extra-google-google_play_services
- - extra-google-m2repository
- - extra-android-m2repository
-
-jdk:
- - oraclejdk8
-
-before_install:
- - export JAVA8_HOME=$JAVA_HOME
-
-script:
- - ./gradlew clean
- - ./gradlew build
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 9cecc1d4669ee8af2ca727a5d8cde10cd8b2d7cc..0000000000000000000000000000000000000000
--- a/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- {one line to give the program's name and a brief idea of what it does.}
- Copyright (C) {year} {name of author}
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- {project} Copyright (C) {year} {fullname}
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/QKSMS/build.gradle b/QKSMS/build.gradle
deleted file mode 100644
index 0ea70822d61c0fc4990cbb666d5f95f57648d871..0000000000000000000000000000000000000000
--- a/QKSMS/build.gradle
+++ /dev/null
@@ -1,116 +0,0 @@
-apply plugin: 'com.android.application'
-apply plugin: 'me.tatarka.retrolambda'
-apply plugin: 'io.fabric'
-
-repositories {
- mavenCentral()
- jcenter()
- maven { url 'https://maven.fabric.io/public' }
- maven { url 'https://clojars.org/repo/' }
-}
-
-android {
- flavorDimensions "analytics"
-
- productFlavors {
- withAnalytics {
- dimension "analytics"
- }
- noAnalytics {
- dimension "analytics"
- }
- }
-
- lintOptions {
- checkReleaseBuilds false
- abortOnError false
- disable 'InvalidPackage'
- }
-
- compileSdkVersion 22
- buildToolsVersion '25.0.0'
-
- defaultConfig {
- versionCode 135
- versionName "2.7.3"
- minSdkVersion 15
- targetSdkVersion 22
- multiDexEnabled true
- }
-
- buildTypes {
- release {
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'qksms-proguard.pro'
- }
- debug {
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'qksms-proguard.pro'
- }
- }
-
- compileOptions {
- // Use Java 1.7, requires minSdk 8
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- lintOptions {
- checkReleaseBuilds false
- abortOnError false
-
- // Translations are crowd-sourced
- disable 'MissingTranslation'
- }
-
-}
-
-buildscript {
- repositories {
- mavenCentral()
- maven { url 'https://maven.fabric.io/public' }
- }
-
- dependencies {
- classpath 'me.tatarka:gradle-retrolambda:3.2.2'
- classpath 'io.fabric.tools:gradle:1.21.5'
- }
-}
-
-String leakCanaryVersion = '1.4-beta2'
-
-dependencies {
- // Open source libraries
- compile 'com.mcxiaoke.volley:library:1.0.19'
- compile 'com.melnykov:floatingactionbutton:1.3.0'
- compile 'com.pushbullet:android-extensions:1.0.4'
- compile 'com.jakewharton:butterknife:7.0.1'
- compile 'com.klinkerapps:android-chips:1.0.0'
- compile 'com.googlecode.libphonenumber:libphonenumber:6.2'
- compile 'com.nispok:snackbar:2.10.6'
- compile 'com.github.lzyzsd:circleprogress:1.1.0'
- debugCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
- releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
- compile 'com.vdurmont:emoji-java:3.1.3'
- compile 'me.leolin:ShortcutBadger:1.1.1'
- compile 'com.googlecode.ez-vcard:ez-vcard:0.9.6'
- compile 'com.google.code.gson:gson:2.4'
- compile 'com.koushikdutta.ion:ion:1.1.7'
- compile 'org.ligi:snackengage:0.4'
- compile 'frankiesardo:icepick:3.2.0'
- provided 'frankiesardo:icepick-processor:3.2.0'
-
- // Google libraries
- compile 'com.android.support:multidex:1.0.1'
- compile 'com.android.support:appcompat-v7:22.2.1'
- compile 'com.android.support:support-v13:22.2.1'
- compile 'com.android.support:recyclerview-v7:22.2.1'
- withAnalyticsCompile 'com.google.android.gms:play-services-analytics:8.3.0'
-
- // External services
- withAnalyticsCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
- transitive = true;
- }
-}
diff --git a/QKSMS/qksms-proguard.pro b/QKSMS/qksms-proguard.pro
deleted file mode 100644
index 8dbb0eed1d11c685324482f724cb8effbe6b3ab5..0000000000000000000000000000000000000000
--- a/QKSMS/qksms-proguard.pro
+++ /dev/null
@@ -1,99 +0,0 @@
--dontobfuscate
-
-#
-# To fix an error to do with android.location.Country. We may be able to optimize
-# more parts of the android.location package.
-#
--keep class android.location.** { *; }
-
-#
-# See com.moez.QKSMS.ui.mms.PresenterFactory---it uses reflect
-#
--keep class com.moez.QKSMS.ui.mms.MmsThumbnailPresenter { *; }
--keep class com.moez.QKSMS.ui.mms.SlideshowPresenter { *; }
--keep class com.android.internal.util.ArrayUtils { *; }
-
-#
-# Klinker's MMS code uses reflection on android.net.ConnectivityManager (and subclasses).
-#
--keep class android.net.** { *; }
-
-#
-# SlidingMenu
-#
--keep class android.view.Display { *; }
-
-#
-# SystemBarTint
-#
--keep class android.os.SystemProperties { *; }
-
-#
-# libphonenumber
-#
--keep class com.google.i18n.phonenumbers.** { *; }
-
-#
-# Android Volley
-# see: http://stackoverflow.com/questions/21816643/volley-seems-not-working-after-proguard-obfuscate
-#
--keep class org.apache.commons.logging.** { *; }
-
-#
-# Google Play Services proguard
-# see: http://developer.android.com/google/play-services/setup.html#Proguard
-#
--keep class * extends java.util.ListResourceBundle {
- protected Object[][] getContents();
-}
-
--keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
- public static final *** NULL;
-}
-
--keepnames @com.google.android.gms.common.annotation.KeepName class *
--keepclassmembernames class * {
- @com.google.android.gms.common.annotation.KeepName *;
-}
-
--keepnames class * implements android.os.Parcelable {
- public static final ** CREATOR;
-}
-
-#
-# Crittercism
-# see: http://docs.crittercism.com/android/android.html
-#
--keep public class com.crittercism.**
--keepclassmembers public class com.crittercism.* {
- *;
-}
-
-# To get line numbers, source files from Crittercism:
--keepattributes SourceFile, LineNumberTable
-
-# ez-vcard
-# https://github.com/nickel-chrome/CucumberSync/blob/master/proguard-project.txt
--dontwarn com.fasterxml.jackson.** # Jackson JSON Processor (for jCards) not used
--dontwarn freemarker.** # freemarker templating library (for creating hCards) not used
--dontwarn org.jsoup.** # jsoup library (for hCard parsing) not used
--dontwarn sun.misc.Perf
--keep class ezvcard.property.** { *; } # keep all VCard properties (created at runtime)
-
-# ButterKnife
-# http://jakewharton.github.io/butterknife/
--keep class butterknife.** { *; }
--dontwarn butterknife.internal.**
--keep class **$$ViewBinder { *; }
-
--keepclasseswithmembernames class * {
- @butterknife.* ;
-}
-
--keepclasseswithmembernames class * {
- @butterknife.* ;
-}
-
-# RetroLambda
-# https://github.com/evant/gradle-retrolambda
--dontwarn java.lang.invoke.*
diff --git a/QKSMS/src/androidTest/java/com/moez/QKSMS/common/emoji/EmojiRegistryTest.java b/QKSMS/src/androidTest/java/com/moez/QKSMS/common/emoji/EmojiRegistryTest.java
deleted file mode 100644
index 6f991a38ef638ae415aa57582b4a2668f02d7dc8..0000000000000000000000000000000000000000
--- a/QKSMS/src/androidTest/java/com/moez/QKSMS/common/emoji/EmojiRegistryTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.moez.QKSMS.common.emoji;
-
-import com.vdurmont.emoji.EmojiParser;
-
-import junit.framework.TestCase;
-
-public class EmojiRegistryTest extends TestCase {
- public void testWhitespaceBothSides() {
- String src = " :) ";
- String expected = EmojiParser.parseToUnicode(" :" + Emojis.SMILEY + ": ");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testJustEmoji() {
- String src = ":)";
- String expected = EmojiParser.parseToUnicode(":" + Emojis.SMILEY + ":");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testPunctuationNothing() {
- String src = ".:)";
- String expected = EmojiParser.parseToUnicode(".:" + Emojis.SMILEY + ":");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testNothingPunctuation() {
- String src = ":)!";
- String expected = EmojiParser.parseToUnicode(":" + Emojis.SMILEY + ":!");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testPunctuationPunctuation() {
- String src = ".:)!!!";
- String expected = EmojiParser.parseToUnicode(".:" + Emojis.SMILEY + ":!!!");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testUrlsWork() {
- String src = "http://github.com/srcreigh";
- assertEquals(src, EmojiRegistry.parseEmojis(src));
- }
-
- public void testMultipleEmojisOnlyReplaceFirst() {
- String src = ":):):)";
- String expected = EmojiParser.parseToUnicode(":" + Emojis.SMILEY + "::):)");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testEmojiWithWordDoesntReplace() {
- String src = "hey:)";
- assertEquals(src, EmojiRegistry.parseEmojis(src));
- }
-
- public void testPoop() {
- String src = ":poop:";
- assertEquals(EmojiParser.parseToUnicode(src), EmojiRegistry.parseEmojis(src));
- }
-
- public void testNewlineAfter() {
- String src = ":)\n";
- String expected = EmojiParser.parseToUnicode(":" + Emojis.SMILEY + ":\n");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-
- public void testNewlineNewline() {
- String src = "\n:)\n";
- String expected = EmojiParser.parseToUnicode("\n:" + Emojis.SMILEY + ":\n");
- assertEquals(EmojiParser.parseToUnicode(expected), EmojiRegistry.parseEmojis(src));
- }
-}
diff --git a/QKSMS/src/androidTest/java/com/moez/QKSMS/common/utils/DateFormatterTest.java b/QKSMS/src/androidTest/java/com/moez/QKSMS/common/utils/DateFormatterTest.java
deleted file mode 100644
index 47f9213a536af263fa8f84a913d861f4669a47b3..0000000000000000000000000000000000000000
--- a/QKSMS/src/androidTest/java/com/moez/QKSMS/common/utils/DateFormatterTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.moez.QKSMS.common.utils;
-
-import android.test.AndroidTestCase;
-
-import java.text.SimpleDateFormat;
-
-public class DateFormatterTest extends AndroidTestCase {
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testDateSymbolsAPI(){
- assertEquals(new SimpleDateFormat("H:mm a").toPattern(), "H:mm a");
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-}
diff --git a/QKSMS/src/androidTest/java/com/qklabs/qkms/test/ApnTest.java b/QKSMS/src/androidTest/java/com/qklabs/qkms/test/ApnTest.java
deleted file mode 100644
index fc815755c17ac1bee5d81b7afa6a0a2edc2135e4..0000000000000000000000000000000000000000
--- a/QKSMS/src/androidTest/java/com/qklabs/qkms/test/ApnTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.qklabs.qkms.test;
-
-import android.content.Context;
-import android.test.InstrumentationTestCase;
-
-import com.moez.QKSMS.mmssms.Apn;
-import com.moez.QKSMS.mmssms.ApnUtils;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class ApnTest extends InstrumentationTestCase {
- Context context;
-
- public void setUp() {
- context = getInstrumentation().getContext();
- }
-
- public void testQueryPortInsteadOfMmsPort() {
- List actual = ApnUtils.query(context, "310", "012");
- List expected = Arrays.asList(
- new Apn("Verizon", "http://mms.vtext.com/servlets/mms", null, "80")
- );
- assertEquals(expected, actual);
- }
-
- public void testQueryMultipleMatching() {
- List actual = ApnUtils.query(context, "310", "240");
- List expected = Arrays.asList(
- new Apn("T-Mobile US 240", "http://mms.msg.eng.t-mobile.com/mms/wapenc", null, null),
- new Apn("MetroPCS 240", "http://metropcs.mmsmvno.com/mms/wapenc", null, null)
- );
- assertEquals(expected, actual);
- }
-
- public void testQueryLeadingZero() {
- List actual = ApnUtils.query(context, "724", "019");
- List expected = Arrays.asList(
- new Apn("Vivo MMS", "http://termnat.vivomms.com.br:8088/mms", "200.142.130.104", "80")
- );
- assertEquals(expected, actual);
- }
-
- public void testQueryNonLeadingZeroDoesntMatchLeadingZero() {
- List actual = ApnUtils.query(context, "724", "19");
- List expected = Arrays.asList(
- new Apn("Vivo MMS", "http://termnat.vivomms.com.br:8088/mms", "200.142.130.104", "80")
- );
- assertEquals(expected, actual);
- }
-
- public void testQueryBoostMobile() {
- List actual = ApnUtils.query(context, "311", "870");
- List expected = Arrays.asList(
- new Apn("Boost Mobile", "http://mm.myboostmobile.com", "68.28.31.7", "80")
- );
- assertEquals(expected, actual);
- }
-
- public void test311480Verizon() {
- List actual = ApnUtils.query(context, "311", "480");
- List expected = Arrays.asList(
- new Apn("Verizon", "http://mms.vtext.com/servlets/mms", null, null)
- );
- assertEquals(expected, actual);
- }
-
- public void test310260TMobile() {
- List actual = ApnUtils.query(context, "310", "260");
- Apn expected = new Apn("T-Mobile", "http://mms.msg.eng.t-mobile.com/mms/wapenc", null, null);
- assertTrue(actual.contains(expected));
- }
-
- public void test310120Sprint() {
- List actual = ApnUtils.query(context, "310", "120");
- List expected = Arrays.asList(
- new Apn("Sprint", "http://mms.sprintpcs.com", "68.28.31.7", "80")
- );
- assertEquals(expected, actual);
- }
-
- public void test26806TMN() {
- List actual = ApnUtils.query(context, "268", "06");
- List expected = Arrays.asList(
- new Apn("TMN", "http://mmsc/", "10.111.2.16", "8080")
- );
- assertEquals(expected, actual);
- }
-
- public void test311490VirginMobile() {
- List actual = ApnUtils.query(context, "311", "490");
- Apn expected = new Apn("Virgin Mobile", "http://mmsc.vmobl.com:8088/mms?", "205.239.233.136", "81");
- assertTrue(actual.contains(expected));
- }
-
- public void test23410O2() {
- List actual = ApnUtils.query(context, "234", "10");
- List expected = Arrays.asList(
- new Apn("O2", "http://mmsc.mms.o2.co.uk:8002", "82.132.254.1", "8080"),
- new Apn("TESCO", "http://mmsc.mms.o2.co.uk:8002", "193.113.200.195", "8080")
- );
- assertEquals(expected, actual);
- }
-
- public void testSolaveiBlank() {
- List actual = ApnUtils.query(context, "310", "260");
- Apn expected = new Apn("Solavei", "http://solavei.mmsmvno.com/mms/wapenc", null, null);
- assertTrue(actual.contains(expected));
- }
-
- public void testNet10() {
- List actual = ApnUtils.query(context, "310", "410");
- Apn expected = new Apn("net10", "http://mms.tracfone.com", null, null);
- assertTrue(actual.contains(expected));
- }
-
- public void testATTApnSettings() {
- List actual = ApnUtils.query(context, "310", "410");
- Apn expected1 = new Apn("AT&T 4G", "http://mmsc.mobile.att.net", "proxy.mobile.att.net", "80");
- Apn expected2 = new Apn("AT&T 3G/WAP", "http://mmsc.cingular.com/", "wireless.cingular.com", "80");
- assertTrue(actual.contains(expected1));
- assertTrue(actual.contains(expected2));
- }
-
- public void testGrameenPhone() {
- List actual = ApnUtils.query(context, "470", "01");
- Apn expected = new Apn("Grameenphone", "http://mmsc.grameenphone.com/servlets/mms", null, null);
- assertTrue(actual.contains(expected));
- }
-
- public void testAirtel() {
- List actual = ApnUtils.query(context, "470", "07");
- Apn expected = new Apn("Airtel", "http://100.1.201.171:10021/mmsc", "100.1.201.172", "8799");
- assertTrue(actual.contains(expected));
- }
-
- public void testSMARTFREN() {
- List actual = ApnUtils.query(context, "510", "09");
- Apn expected1 = new Apn("SMARTFREN 0881, 0882", "http://mmsc-jkt.smart-telecom.co.id", "10.17.27.250", "8080");
- Apn expected2 = new Apn("SMARTFREN 0887, 0888, 0889", "http://mmsc2.smartfren.com", "10.17.27.250", "8080");
- assertTrue(actual.contains(expected1));
- assertTrue(actual.contains(expected2));
- }
-
- public void testStraightTalk() {
- List actual = ApnUtils.query(context, "310", "410");
- Apn expected = new Apn("Straight Talk", "http://mms-tf.net", "mms3.tracfone.com", "80");
- assertTrue(actual.contains(expected));
- }
-
- public void testCricket310410() {
- List actual = ApnUtils.query(context, "310", "410");
- Apn expected = new Apn("Cricket", "http://mmsc.aiowireless.net", "proxy.aiowireless.net", "80");
- assertTrue(actual.contains(expected));
- }
-
- public void testCricket310150() {
- List actual = ApnUtils.query(context, "310", "150");
- Apn expected = new Apn("Cricket", "http://mmsc.aiowireless.net", "proxy.aiowireless.net", "80");
- assertTrue(actual.contains(expected));
- }
-
- public void testTIGO() {
- List actual = ApnUtils.query(context, "640", "02");
- Apn expected = new Apn("TIGO", "http://mms", "10.16.17.12", "8888");
- assertTrue(actual.contains(expected));
- }
-
- public void testDSTCom() {
- List actual = ApnUtils.query(context, "528", "11");
- Apn expected = new Apn("DSTCom", "http://mms.dst.com.bn/mmsc", "10.100.6.101", "3130");
- assertTrue(actual.contains(expected));
- }
-
- public void testVodacomMozambique() {
- List actual = ApnUtils.query(context, "643", "04");
- Apn expected = new Apn("Vodacom", "http://mms.vm.co.mz", "10.201.47.14", "9201");
- assertTrue(actual.contains(expected));
- }
-
- public void testVirginMobileMms() {
- List actual = ApnUtils.query(context, "310", "000");
- Apn expected = new Apn("Virgin Mobile", "http://mmsc.vmobl.com:8088/mms?", "205.239.233.136", "81");
- assertTrue(actual.contains(expected));
- }
-
- public void testH2O() {
- List actual = ApnUtils.query(context, "310", "410");
- Apn expected = new Apn("H2O", "http://mmsc.cingular.com", "66.209.11.33", "80");
- assertTrue(actual.contains(expected));
- }
-
- public void testSpeakOut() {
- List actual = ApnUtils.query(context, "302", "720");
- Apn expected = new Apn("SpeakOut", "http://mms.gprs.rogers.com", "mmsproxy.rogers.com", "80");
- assertTrue(actual.contains(expected));
- }
-
- public void testApnEquals() {
- assertEquals(new Apn(null, null, null, null), new Apn(null, null, null, null));
- assertEquals(new Apn("Test", null, null, null), new Apn("Test", null, null, null));
- assertEquals(new Apn("A", "B", null, null), new Apn("A", "B", null, null));
- assertEquals(new Apn("A", "B", "C", null), new Apn("A", "B", "C", null));
- assertEquals(new Apn("A", "B", "C", "D"), new Apn("A", "B", "C", "D"));
- assertEquals(new Apn("", "B", "", "D"), new Apn("", "B", "", "D"));
- }
-
- public void testApnEmptyConstructor() {
- assertEquals(new Apn(), new Apn(null, null, null, null));
- }
-
- public void testApnManuallyConstructed() {
- Apn manual;
- manual = new Apn();
- manual.name = "A"; manual.mmsc = "B"; manual.proxy = "C"; manual.port = "D";
- assertEquals(new Apn("A", "B", "C", "D"), manual);
-
- manual = new Apn();
- manual.name = "A"; manual.proxy = "C";
- assertEquals(new Apn("A", null, "C", null), manual);
- }
-}
diff --git a/QKSMS/src/main/AndroidManifest.xml b/QKSMS/src/main/AndroidManifest.xml
deleted file mode 100644
index 290fb33c572b75d130dd811dc23fd6262049a3e1..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,577 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/QKSMS/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl b/QKSMS/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl
deleted file mode 100644
index 2a492f784545221cab9710ccd85350057a9a228c..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.vending.billing;
-
-import android.os.Bundle;
-
-/**
- * InAppBillingService is the service that provides in-app billing version 3 and beyond.
- * This service provides the following features:
- * 1. Provides a new API to get details of in-app items published for the app including
- * price, type, title and description.
- * 2. The purchase flow is synchronous and purchase information is available immediately
- * after it completes.
- * 3. Purchase information of in-app purchases is maintained within the Google Play system
- * till the purchase is consumed.
- * 4. An API to consume a purchase of an inapp item. All purchases of one-time
- * in-app items are consumable and thereafter can be purchased again.
- * 5. An API to get current purchases of the user immediately. This will not contain any
- * consumed purchases.
- *
- * All calls will give a response code with the following possible values
- * RESULT_OK = 0 - success
- * RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog
- * RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested
- * RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase
- * RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API
- * RESULT_ERROR = 6 - Fatal error during the API action
- * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
- * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
- */
-interface IInAppBillingService {
- /**
- * Checks support for the requested billing API version, package and in-app type.
- * Minimum API version supported by this interface is 3.
- * @param apiVersion the billing version which the app is using
- * @param packageName the package name of the calling app
- * @param type type of the in-app item being purchased "inapp" for one-time purchases
- * and "subs" for subscription.
- * @return RESULT_OK(0) on success, corresponding result code on failures
- */
- int isBillingSupported(int apiVersion, String packageName, String type);
-
- /**
- * Provides details of a list of SKUs
- * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
- * with a list JSON strings containing the productId, price, title and description.
- * This API can be called with a maximum of 20 SKUs.
- * @param apiVersion billing API version that the Third-party is using
- * @param packageName the package name of the calling app
- * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "DETAILS_LIST" with a StringArrayList containing purchase information
- * in JSON format similar to:
- * '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
- * "title : "Example Title", "description" : "This is an example description" }'
- */
- Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);
-
- /**
- * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
- * the type, a unique purchase token and an optional developer payload.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param sku the SKU of the in-app item as published in the developer console
- * @param type the type of the in-app item ("inapp" for one-time purchases
- * and "subs" for subscription).
- * @param developerPayload optional argument to be sent back with the purchase information
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "BUY_INTENT" - PendingIntent to start the purchase flow
- *
- * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
- * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
- * If the purchase is successful, the result data will contain the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_DATA" - String in JSON format similar to
- * '{"orderId":"12999763169054705758.1371079406387615",
- * "packageName":"com.example.app",
- * "productId":"exampleSku",
- * "purchaseTime":1345678900000,
- * "purchaseToken" : "122333444455555",
- * "developerPayload":"example developer payload" }'
- * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
- * was signed with the private key of the developer
- * TODO: change this to app-specific keys.
- */
- Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,
- String developerPayload);
-
- /**
- * Returns the current SKUs owned by the user of the type and package name specified along with
- * purchase information and a signature of the data to be validated.
- * This will return all SKUs that have been purchased in V3 and managed items purchased using
- * V1 and V2 that have not been consumed.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param type the type of the in-app items being requested
- * ("inapp" for one-time purchases and "subs" for subscription).
- * @param continuationToken to be set as null for the first call, if the number of owned
- * skus are too many, a continuationToken is returned in the response bundle.
- * This method can be called again with the continuation token to get the next set of
- * owned skus.
- * @return Bundle containing the following key-value pairs
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
- * failure as listed above.
- * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
- * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
- * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
- * of the purchase information
- * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
- * next set of in-app purchases. Only set if the
- * user has more owned skus than the current list.
- */
- Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
-
- /**
- * Consume the last purchase of the given SKU. This will result in this item being removed
- * from all subsequent responses to getPurchases() and allow re-purchase of this item.
- * @param apiVersion billing API version that the app is using
- * @param packageName package name of the calling app
- * @param purchaseToken token in the purchase information JSON that identifies the purchase
- * to be consumed
- * @return 0 if consumption succeeded. Appropriate error values for failures.
- */
- int consumePurchase(int apiVersion, String packageName, String purchaseToken);
-}
diff --git a/QKSMS/src/main/assets/fonts/Roboto-Light.ttf b/QKSMS/src/main/assets/fonts/Roboto-Light.ttf
deleted file mode 100644
index aa4534075781ca6567452f1ae8ed0d4f6cb453c7..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/Roboto-Light.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf b/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf
deleted file mode 100644
index a3c1a1f1702ebf8f5771ae96197539ddc507f04a..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/Roboto-Medium.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf b/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf
deleted file mode 100644
index 0e58508a64bf413a58c24bf60a0e8a90d663f304..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/Roboto-Regular.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf b/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf
deleted file mode 100644
index 8779333b1a25df32c4397c4ab587fead14c2cde0..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/Roboto-Thin.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf
deleted file mode 100644
index 3e06c7cdc4ce17d888391503e4c64fcfe78d566a..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Bold.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf
deleted file mode 100644
index d4eb1980614ecb06a773971ca51a17e5ac0251a6..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Light.ttf and /dev/null differ
diff --git a/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf b/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf
deleted file mode 100644
index b9fc49c95b0675c7bf972da903c7409b03c350b9..0000000000000000000000000000000000000000
Binary files a/QKSMS/src/main/assets/fonts/RobotoCondensed-Regular.ttf and /dev/null differ
diff --git a/QKSMS/src/main/java/android/annotation/SdkConstant.java b/QKSMS/src/main/java/android/annotation/SdkConstant.java
deleted file mode 100644
index 8fcefb5718cfcbd83f8de983cf9389b7b215f919..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/annotation/SdkConstant.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates a constant field value should be exported to be used in the SDK tools.
- *
- * @hide
- */
-@Target({ElementType.FIELD})
-@Retention(RetentionPolicy.SOURCE)
-public @interface SdkConstant {
- public enum SdkConstantType {
- ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE
- }
-
- SdkConstantType value();
-}
diff --git a/QKSMS/src/main/java/android/database/sqlite/SqliteWrapper.java b/QKSMS/src/main/java/android/database/sqlite/SqliteWrapper.java
deleted file mode 100644
index f0ed1a714c8c7ed1e7a72594fa58711dc9f3011f..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/database/sqlite/SqliteWrapper.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.database.sqlite;
-
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-import android.util.Log;
-import android.widget.Toast;
-
-/**
- * @hide
- */
-
-public final class SqliteWrapper {
- private static final String TAG = "SqliteWrapper";
- private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
- = "unable to open database file";
-
- private SqliteWrapper() {
- // Forbidden being instantiated.
- }
-
- // FIXME: need to optimize this method.
- private static boolean isLowMemory(SQLiteException e) {
- return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
- }
-
- public static void checkSQLiteException(Context context, SQLiteException e) {
- if (isLowMemory(e)) {
- Toast.makeText(context, "Low Memory",
- Toast.LENGTH_SHORT).show();
- } else {
- throw e;
- }
- }
-
- public static Cursor query(Context context, ContentResolver resolver, Uri uri,
- String[] projection, String selection, String[] selectionArgs, String sortOrder) {
- try {
- return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
- } catch (SQLiteException e) {
- Log.e(TAG, "Catch a SQLiteException when query: ", e);
- checkSQLiteException(context, e);
- return null;
- }
- }
-
- @SuppressWarnings("deprecation")
- public static boolean requery(Context context, Cursor cursor) {
- try {
- return cursor.requery();
- } catch (SQLiteException e) {
- Log.e(TAG, "Catch a SQLiteException when requery: ", e);
- checkSQLiteException(context, e);
- return false;
- }
- }
-
- public static int update(Context context, ContentResolver resolver, Uri uri,
- ContentValues values, String where, String[] selectionArgs) {
- try {
- return resolver.update(uri, values, where, selectionArgs);
- } catch (SQLiteException e) {
- Log.e(TAG, "Catch a SQLiteException when update: ", e);
- checkSQLiteException(context, e);
- return -1;
- }
- }
-
- public static int delete(Context context, ContentResolver resolver, Uri uri,
- String where, String[] selectionArgs) {
- try {
- return resolver.delete(uri, where, selectionArgs);
- } catch (SQLiteException e) {
- Log.e(TAG, "Catch a SQLiteException when delete: ", e);
- checkSQLiteException(context, e);
- return -1;
- }
- }
-
- public static Uri insert(Context context, ContentResolver resolver,
- Uri uri, ContentValues values) {
- try {
- return resolver.insert(uri, values);
- } catch (SQLiteException e) {
- Log.e(TAG, "Catch a SQLiteException when insert: ", e);
- checkSQLiteException(context, e);
- return null;
- }
- }
-}
diff --git a/QKSMS/src/main/java/android/location/Country.java b/QKSMS/src/main/java/android/location/Country.java
deleted file mode 100644
index 7c1485d88a3eeef2fd205f477c95a82821208839..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/location/Country.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.location;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.SystemClock;
-
-import java.util.Locale;
-
-/**
- * This class wraps the country information.
- *
- * @hide
- */
-public class Country implements Parcelable {
- /**
- * The country code came from the mobile network
- */
- public static final int COUNTRY_SOURCE_NETWORK = 0;
-
- /**
- * The country code came from the location service
- */
- public static final int COUNTRY_SOURCE_LOCATION = 1;
-
- /**
- * The country code was read from the SIM card
- */
- public static final int COUNTRY_SOURCE_SIM = 2;
-
- /**
- * The country code came from the system locale setting
- */
- public static final int COUNTRY_SOURCE_LOCALE = 3;
-
- /**
- * The ISO 3166-1 two letters country code.
- */
- private final String mCountryIso;
-
- /**
- * Where the country code came from.
- */
- private final int mSource;
-
- private int mHashCode;
-
- /**
- * Time that this object was created (which we assume to be the time that the source was
- * consulted). This time is in milliseconds since boot up.
- */
- private final long mTimestamp;
-
- /**
- * @param countryIso the ISO 3166-1 two letters country code.
- * @param source where the countryIso came from, could be one of below
- * values
- *
- *
- *
{@link #COUNTRY_SOURCE_NETWORK}
- *
{@link #COUNTRY_SOURCE_LOCATION}
- *
{@link #COUNTRY_SOURCE_SIM}
- *
{@link #COUNTRY_SOURCE_LOCALE}
- *
- */
- public Country(final String countryIso, final int source) {
- if (countryIso == null || source < COUNTRY_SOURCE_NETWORK
- || source > COUNTRY_SOURCE_LOCALE) {
- throw new IllegalArgumentException();
- }
- mCountryIso = countryIso.toUpperCase(Locale.US);
- mSource = source;
- mTimestamp = SystemClock.elapsedRealtime();
- }
-
- private Country(final String countryIso, final int source, long timestamp) {
- if (countryIso == null || source < COUNTRY_SOURCE_NETWORK
- || source > COUNTRY_SOURCE_LOCALE) {
- throw new IllegalArgumentException();
- }
- mCountryIso = countryIso.toUpperCase(Locale.US);
- mSource = source;
- mTimestamp = timestamp;
- }
-
- public Country(Country country) {
- mCountryIso = country.mCountryIso;
- mSource = country.mSource;
- mTimestamp = country.mTimestamp;
- }
-
- /**
- * @return the ISO 3166-1 two letters country code
- */
- public final String getCountryIso() {
- return mCountryIso;
- }
-
- /**
- * @return where the country code came from, could be one of below values
- *
- *
- *
{@link #COUNTRY_SOURCE_NETWORK}
- *
{@link #COUNTRY_SOURCE_LOCATION}
- *
{@link #COUNTRY_SOURCE_SIM}
- *
{@link #COUNTRY_SOURCE_LOCALE}
- *
- */
- public final int getSource() {
- return mSource;
- }
-
- /**
- * Returns the time that this object was created (which we assume to be the time that the source
- * was consulted).
- */
- public final long getTimestamp() {
- return mTimestamp;
- }
-
- public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
- public Country createFromParcel(Parcel in) {
- return new Country(in.readString(), in.readInt(), in.readLong());
- }
-
- public Country[] newArray(int size) {
- return new Country[size];
- }
- };
-
- public int describeContents() {
- return 0;
- }
-
- public void writeToParcel(Parcel parcel, int flags) {
- parcel.writeString(mCountryIso);
- parcel.writeInt(mSource);
- parcel.writeLong(mTimestamp);
- }
-
- /**
- * Returns true if this {@link Country} is equivalent to the given object. This ignores
- * the timestamp value and just checks for equivalence of countryIso and source values.
- * Returns false otherwise.
- */
- @Override
- public boolean equals(Object object) {
- if (object == this) {
- return true;
- }
- if (object instanceof Country) {
- Country c = (Country) object;
- // No need to check the equivalence of the timestamp
- return mCountryIso.equals(c.getCountryIso()) && mSource == c.getSource();
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int hash = mHashCode;
- if (hash == 0) {
- hash = 17;
- hash = hash * 13 + mCountryIso.hashCode();
- hash = hash * 13 + mSource;
- mHashCode = hash;
- }
- return mHashCode;
- }
-
- /**
- * Compare the specified country to this country object ignoring the source
- * and timestamp fields, return true if the countryIso fields are equal
- *
- * @param country the country to compare
- * @return true if the specified country's countryIso field is equal to this
- * country's, false otherwise.
- */
- public boolean equalsIgnoreSource(Country country) {
- return country != null && mCountryIso.equals(country.getCountryIso());
- }
-
- @Override
- public String toString() {
- return "Country {ISO=" + mCountryIso + ", source=" + mSource + ", time=" + mTimestamp + "}";
- }
-}
diff --git a/QKSMS/src/main/java/android/location/CountryDetector.java b/QKSMS/src/main/java/android/location/CountryDetector.java
deleted file mode 100644
index a90a318552edcdb775da16b3180c48d50599846f..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/location/CountryDetector.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2010, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.location;
-
-import android.os.Handler;
-import android.os.Looper;
-
-import java.util.HashMap;
-
-/**
- * This class provides access to the system country detector service. This
- * service allows applications to obtain the country that the user is in.
- *
- * The country will be detected in order of reliability, like
- *
- *
Mobile network
- *
Location
- *
SIM's country
- *
Phone's locale
- *
- *
- * Call the {@link #detectCountry()} to get the available country immediately.
- *
- * To be notified of the future country change, use the
- * {@link #addCountryListener}
- *
- *
- * You do not instantiate this class directly; instead, retrieve it through
- * {@link android.content.Context#getSystemService
- * Context.getSystemService(Context.COUNTRY_DETECTOR)}.
- *
- * Both ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions are needed.
- *
- * @hide
- */
-public class CountryDetector {
-
- /**
- * The class to wrap the ICountryListener.Stub and CountryListener objects
- * together. The CountryListener will be notified through the specific
- * looper once the country changed and detected.
- */
- private final static class ListenerTransport implements ICountryListener {
-
- private final CountryListener mListener;
-
- private final Handler mHandler;
-
- public ListenerTransport(CountryListener listener, Looper looper) {
- mListener = listener;
- if (looper != null) {
- mHandler = new Handler(looper);
- } else {
- mHandler = new Handler();
- }
- }
-
- public void onCountryDetected(final Country country) {
- mHandler.post(new Runnable() {
- public void run() {
- mListener.onCountryDetected(country);
- }
- });
- }
- }
-
- private final static String TAG = "CountryDetector";
- private final ICountryDetector mService;
- private final HashMap mListeners;
-
- /**
- * @hide - hide this constructor because it has a parameter of type
- * ICountryDetector, which is a system private class. The right way to
- * create an instance of this class is using the factory
- * Context.getSystemService.
- */
- public CountryDetector(ICountryDetector service) {
- mService = service;
- mListeners = new HashMap<>();
- }
-
- /**
- * Start detecting the country that the user is in.
- *
- * @return the country if it is available immediately, otherwise null will
- * be returned.
- */
- public Country detectCountry() {
- return mService.detectCountry();
- }
-
- /**
- * Add a listener to receive the notification when the country is detected
- * or changed.
- *
- * @param listener will be called when the country is detected or changed.
- * @param looper a Looper object whose message queue will be used to
- * implement the callback mechanism. If looper is null then the
- * callbacks will be called on the main thread.
- */
- public void addCountryListener(CountryListener listener, Looper looper) {
- synchronized (mListeners) {
- if (!mListeners.containsKey(listener)) {
- ListenerTransport transport = new ListenerTransport(listener, looper);
- mService.addCountryListener(transport);
- mListeners.put(listener, transport);
- }
- }
- }
-
- /**
- * Remove the listener
- */
- public void removeCountryListener(CountryListener listener) {
- synchronized (mListeners) {
- ListenerTransport transport = mListeners.get(listener);
- if (transport != null) {
- mListeners.remove(listener);
- mService.removeCountryListener(transport);
- }
- }
- }
-}
diff --git a/QKSMS/src/main/java/android/location/CountryListener.java b/QKSMS/src/main/java/android/location/CountryListener.java
deleted file mode 100644
index e36db412eaec5ce8fc92d7f6f991fe29b7edde28..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/location/CountryListener.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package android.location;
-
-/**
- * The listener for receiving the notification when the country is detected or
- * changed
- *
- * @hide
- */
-public interface CountryListener {
- /**
- * @param country the changed or detected country.
- */
- void onCountryDetected(Country country);
-}
diff --git a/QKSMS/src/main/java/android/location/ICountryDetector.java b/QKSMS/src/main/java/android/location/ICountryDetector.java
deleted file mode 100644
index 99aca864734a2fa4b1e6451c628556ef58308446..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/location/ICountryDetector.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.location;
-
-/**
- * The API for detecting the country where the user is.
- *
- * {@hide}
- */
-interface ICountryDetector
-{
- /**
- * Start detecting the country that the user is in.
- * @return the country if it is available immediately, otherwise null will be returned.
- */
- Country detectCountry();
-
- /**
- * Add a listener to receive the notification when the country is detected or changed.
- */
- void addCountryListener(ICountryListener listener);
-
- /**
- * Remove the listener
- */
- void removeCountryListener(ICountryListener listener);
-}
diff --git a/QKSMS/src/main/java/android/location/ICountryListener.java b/QKSMS/src/main/java/android/location/ICountryListener.java
deleted file mode 100644
index d211b4db97cd60e669e2ea1276b5cc048d837940..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/location/ICountryListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2010, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.location;
-
-/**
- * {@hide}
- */
-
-interface ICountryListener
-{
- void onCountryDetected(Country country);
-}
diff --git a/QKSMS/src/main/java/android/net/ConnectivityManager.java b/QKSMS/src/main/java/android/net/ConnectivityManager.java
deleted file mode 100644
index 671ea25ebad2ca1e04d8562ba032b06392d988ed..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/ConnectivityManager.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.annotation.SdkConstant;
-import android.annotation.SdkConstant.SdkConstantType;
-import android.content.Context;
-import android.os.Binder;
-import android.os.Build.VERSION_CODES;
-import android.os.RemoteException;
-import android.provider.Settings;
-
-import java.net.InetAddress;
-
-import static com.android.internal.util.Preconditions.checkNotNull;
-
-/**
- * Class that answers queries about the state of network connectivity. It also
- * notifies applications when network connectivity changes. Get an instance
- * of this class by calling
- * {@link android.content.Context#getSystemService(String) Context.getSystemService(Context.CONNECTIVITY_SERVICE)}.
- *
- * The primary responsibilities of this class are to:
- *
- *
Send broadcast intents when network connectivity changes
- *
Attempt to "fail over" to another network when connectivity to a network
- * is lost
- *
Provide an API that allows applications to query the coarse-grained or fine-grained
- * state of the available networks
- *
- */
-public class ConnectivityManager {
- /**
- * A change in network connectivity has occurred. A connection has either
- * been established or lost. The NetworkInfo for the affected network is
- * sent as an extra; it should be consulted to see what kind of
- * connectivity event occurred.
- *
- * If this is a connection that was the result of failing over from a
- * disconnected network, then the FAILOVER_CONNECTION boolean extra is
- * set to true.
- *
- * For a loss of connectivity, if the connectivity manager is attempting
- * to connect (or has already connected) to another network, the
- * NetworkInfo for the new network is also passed as an extra. This lets
- * any receivers of the broadcast know that they should not necessarily
- * tell the user that no data traffic will be possible. Instead, the
- * reciever should expect another broadcast soon, indicating either that
- * the failover attempt succeeded (and so there is still overall data
- * connectivity), or that the failover attempt failed, meaning that all
- * connectivity has been lost.
- *
- * For a disconnect event, the boolean extra EXTRA_NO_CONNECTIVITY
- * is set to {@code true} if there are no connected networks at all.
- */
- public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
-
- /**
- * Identical to {@link #CONNECTIVITY_ACTION} broadcast, but sent without any
- * applicable {@link Settings.Secure#CONNECTIVITY_CHANGE_DELAY}.
- *
- * @hide
- */
- public static final String CONNECTIVITY_ACTION_IMMEDIATE =
- "android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE";
-
- /**
- * The lookup key for a {@link NetworkInfo} object. Retrieve with
- * {@link android.content.Intent#getParcelableExtra(String)}.
- *
- * @see #EXTRA_NETWORK_TYPE
- * @deprecated Since {@link NetworkInfo} can vary based on UID, applications
- * should always obtain network information through
- * {@link #getActiveNetworkInfo()} or
- * {@link #getAllNetworkInfo()}.
- */
- @Deprecated
- public static final String EXTRA_NETWORK_INFO = "networkInfo";
-
- /**
- * Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast.
- * Can be used with {@link #getNetworkInfo(int)} to get {@link NetworkInfo}
- * state based on the calling application.
- *
- * @see android.content.Intent#getIntExtra(String, int)
- */
- public static final String EXTRA_NETWORK_TYPE = "networkType";
-
- /**
- * The lookup key for a boolean that indicates whether a connect event
- * is for a network to which the connectivity manager was failing over
- * following a disconnect on another network.
- * Retrieve it with {@link android.content.Intent#getBooleanExtra(String, boolean)}.
- */
- public static final String EXTRA_IS_FAILOVER = "isFailover";
- /**
- * The lookup key for a {@link NetworkInfo} object. This is supplied when
- * there is another network that it may be possible to connect to. Retrieve with
- * {@link android.content.Intent#getParcelableExtra(String)}.
- */
- public static final String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
- /**
- * The lookup key for a boolean that indicates whether there is a
- * complete lack of connectivity, i.e., no network is available.
- * Retrieve it with {@link android.content.Intent#getBooleanExtra(String, boolean)}.
- */
- public static final String EXTRA_NO_CONNECTIVITY = "noConnectivity";
- /**
- * The lookup key for a string that indicates why an attempt to connect
- * to a network failed. The string has no particular structure. It is
- * intended to be used in notifications presented to users. Retrieve
- * it with {@link android.content.Intent#getStringExtra(String)}.
- */
- public static final String EXTRA_REASON = "reason";
- /**
- * The lookup key for a string that provides optionally supplied
- * extra information about the network state. The information
- * may be passed up from the lower networking layers, and its
- * meaning may be specific to a particular network type. Retrieve
- * it with {@link android.content.Intent#getStringExtra(String)}.
- */
- public static final String EXTRA_EXTRA_INFO = "extraInfo";
- /**
- * The lookup key for an int that provides information about
- * our connection to the internet at large. 0 indicates no connection,
- * 100 indicates a great connection. Retrieve it with
- * {@link android.content.Intent#getIntExtra(String, int)}.
- * {@hide}
- */
- public static final String EXTRA_INET_CONDITION = "inetCondition";
-
- /**
- * Broadcast action to indicate the change of data activity status
- * (idle or active) on a network in a recent period.
- * The network becomes active when data transimission is started, or
- * idle if there is no data transimition for a period of time.
- * {@hide}
- */
- @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_DATA_ACTIVITY_CHANGE = "android.net.conn.DATA_ACTIVITY_CHANGE";
- /**
- * The lookup key for an enum that indicates the network device type on which this data activity
- * change happens.
- * {@hide}
- */
- public static final String EXTRA_DEVICE_TYPE = "deviceType";
- /**
- * The lookup key for a boolean that indicates the device is active or not. {@code true} means
- * it is actively sending or receiving data and {@code false} means it is idle.
- * {@hide}
- */
- public static final String EXTRA_IS_ACTIVE = "isActive";
-
- /**
- * Broadcast Action: The setting for background data usage has changed
- * values. Use {@link #getBackgroundDataSetting()} to get the current value.
- *
- * If an application uses the network in the background, it should listen
- * for this broadcast and stop using the background data if the value is
- * {@code false}.
- *
- *
- * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, availability
- * of background data depends on several combined factors, and
- * this broadcast is no longer sent. Instead, when background
- * data is unavailable, {@link #getActiveNetworkInfo()} will now
- * appear disconnected. During first boot after a platform
- * upgrade, this broadcast will be sent once if
- * {@link #getBackgroundDataSetting()} was {@code false} before
- * the upgrade.
- */
- @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- @Deprecated
- public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED =
- "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
-
- /**
- * Broadcast Action: The network connection may not be good
- * uses {@code ConnectivityManager.EXTRA_INET_CONDITION} and
- * {@code ConnectivityManager.EXTRA_NETWORK_INFO} to specify
- * the network and it's condition.
- *
- * @hide
- */
- public static final String INET_CONDITION_ACTION =
- "android.net.conn.INET_CONDITION_ACTION";
-
- /**
- * Broadcast Action: A tetherable connection has come or gone
- * TODO - finish the doc
- *
- * @hide
- */
- public static final String ACTION_TETHER_STATE_CHANGED =
- "android.net.conn.TETHER_STATE_CHANGED";
-
- /**
- * @hide gives a String[]
- */
- public static final String EXTRA_AVAILABLE_TETHER = "availableArray";
-
- /**
- * @hide gives a String[]
- */
- public static final String EXTRA_ACTIVE_TETHER = "activeArray";
-
- /**
- * @hide gives a String[]
- */
- public static final String EXTRA_ERRORED_TETHER = "erroredArray";
-
- /**
- * The absence of APN..
- *
- * @hide
- */
- public static final int TYPE_NONE = -1;
-
- /**
- * The Default Mobile data connection. When active, all data traffic
- * will use this connection by default.
- */
- public static final int TYPE_MOBILE = 0;
- /**
- * The Default WIFI data connection. When active, all data traffic
- * will use this connection by default.
- */
- public static final int TYPE_WIFI = 1;
- /**
- * An MMS-specific Mobile data connection. This connection may be the
- * same as {@link #TYPE_MOBILE} but it may be different. This is used
- * by applications needing to talk to the carrier's Multimedia Messaging
- * Service servers. It may coexist with default data connections.
- */
- public static final int TYPE_MOBILE_MMS = 2;
- /**
- * A SUPL-specific Mobile data connection. This connection may be the
- * same as {@link #TYPE_MOBILE} but it may be different. This is used
- * by applications needing to talk to the carrier's Secure User Plane
- * Location servers for help locating the device. It may coexist with
- * default data connections.
- */
- public static final int TYPE_MOBILE_SUPL = 3;
- /**
- * A DUN-specific Mobile data connection. This connection may be the
- * same as {@link #TYPE_MOBILE} but it may be different. This is used
- * by applicaitons performing a Dial Up Networking bridge so that
- * the carrier is aware of DUN traffic. It may coexist with default data
- * connections.
- */
- public static final int TYPE_MOBILE_DUN = 4;
- /**
- * A High Priority Mobile data connection. This connection is typically
- * the same as {@link #TYPE_MOBILE} but the routing setup is different.
- * Only requesting processes will have access to the Mobile DNS servers
- * and only IP's explicitly requested via {@link #requestRouteToHost}
- * will route over this interface if a default route exists.
- */
- public static final int TYPE_MOBILE_HIPRI = 5;
- /**
- * The Default WiMAX data connection. When active, all data traffic
- * will use this connection by default.
- */
- public static final int TYPE_WIMAX = 6;
-
- /**
- * The Default Bluetooth data connection. When active, all data traffic
- * will use this connection by default.
- */
- public static final int TYPE_BLUETOOTH = 7;
-
- /**
- * Dummy data connection. This should not be used on shipping devices.
- */
- public static final int TYPE_DUMMY = 8;
-
- /**
- * The Default Ethernet data connection. When active, all data traffic
- * will use this connection by default.
- */
- public static final int TYPE_ETHERNET = 9;
-
- /**
- * Over the air Adminstration.
- * {@hide}
- */
- public static final int TYPE_MOBILE_FOTA = 10;
-
- /**
- * IP Multimedia Subsystem
- * {@hide}
- */
- public static final int TYPE_MOBILE_IMS = 11;
-
- /**
- * Carrier Branded Services
- * {@hide}
- */
- public static final int TYPE_MOBILE_CBS = 12;
-
- /**
- * A Wi-Fi p2p connection. Only requesting processes will have access to
- * the peers connected.
- * {@hide}
- */
- public static final int TYPE_WIFI_P2P = 13;
-
- /**
- * {@hide}
- */
- public static final int MAX_RADIO_TYPE = TYPE_WIFI_P2P;
-
- /**
- * {@hide}
- */
- public static final int MAX_NETWORK_TYPE = TYPE_WIFI_P2P;
-
- public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI;
-
- /**
- * Default value for {@link Settings.Global#CONNECTIVITY_CHANGE_DELAY} in
- * milliseconds.
- *
- * @hide
- */
- public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000;
-
- private final IConnectivityManager mService;
-
- public static boolean isNetworkTypeValid(int networkType) {
- return networkType >= 0 && networkType <= MAX_NETWORK_TYPE;
- }
-
-
- /**
- * {@hide}
- */
- public static String getNetworkTypeName(int type) {
- switch (type) {
- case TYPE_MOBILE:
- return "MOBILE";
- case TYPE_WIFI:
- return "WIFI";
- case TYPE_MOBILE_MMS:
- return "MOBILE_MMS";
- case TYPE_MOBILE_SUPL:
- return "MOBILE_SUPL";
- case TYPE_MOBILE_DUN:
- return "MOBILE_DUN";
- case TYPE_MOBILE_HIPRI:
- return "MOBILE_HIPRI";
- case TYPE_WIMAX:
- return "WIMAX";
- case TYPE_BLUETOOTH:
- return "BLUETOOTH";
- case TYPE_DUMMY:
- return "DUMMY";
- case TYPE_ETHERNET:
- return "ETHERNET";
- case TYPE_MOBILE_FOTA:
- return "MOBILE_FOTA";
- case TYPE_MOBILE_IMS:
- return "MOBILE_IMS";
- case TYPE_MOBILE_CBS:
- return "MOBILE_CBS";
- case TYPE_WIFI_P2P:
- return "WIFI_P2P";
- default:
- return Integer.toString(type);
- }
- }
-
- /**
- * {@hide}
- */
- public static boolean isNetworkTypeMobile(int networkType) {
- switch (networkType) {
- case TYPE_MOBILE:
- case TYPE_MOBILE_MMS:
- case TYPE_MOBILE_SUPL:
- case TYPE_MOBILE_DUN:
- case TYPE_MOBILE_HIPRI:
- case TYPE_MOBILE_FOTA:
- case TYPE_MOBILE_IMS:
- case TYPE_MOBILE_CBS:
- return true;
- default:
- return false;
- }
- }
-
- public void setNetworkPreference(int preference) {
- try {
- mService.setNetworkPreference(preference);
- } catch (RemoteException e) {
- }
- }
-
- public int getNetworkPreference() {
- try {
- return mService.getNetworkPreference();
- } catch (RemoteException e) {
- return -1;
- }
- }
-
- /**
- * Returns details about the currently active data network. When connected,
- * this network is the default route for outgoing connections. You should
- * always check {@link NetworkInfo#isConnected()} before initiating network
- * traffic. This may return {@code null} when no networks are available.
- *
This method requires the caller to hold the permission
- * {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
- *
- * @param networkType specifies which network the request pertains to
- * @param feature the name of the feature to be used
- * @return an integer value representing the outcome of the request.
- * The interpretation of this value is specific to each networking
- * implementation+feature combination, except that the value {@code -1}
- * always indicates failure.
- */
- public int startUsingNetworkFeature(int networkType, String feature) {
- try {
- return mService.startUsingNetworkFeature(networkType, feature,
- new Binder());
- } catch (RemoteException e) {
- return -1;
- }
- }
-
- /**
- * Tells the underlying networking system that the caller is finished
- * using the named feature. The interpretation of {@code feature}
- * is completely up to each networking implementation.
- *
This method requires the caller to hold the permission
- * {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
- *
- * @param networkType specifies which network the request pertains to
- * @param feature the name of the feature that is no longer needed
- * @return an integer value representing the outcome of the request.
- * The interpretation of this value is specific to each networking
- * implementation+feature combination, except that the value {@code -1}
- * always indicates failure.
- */
- public int stopUsingNetworkFeature(int networkType, String feature) {
- try {
- return mService.stopUsingNetworkFeature(networkType, feature);
- } catch (RemoteException e) {
- return -1;
- }
- }
-
- /**
- * Ensure that a network route exists to deliver traffic to the specified
- * host via the specified network interface. An attempt to add a route that
- * already exists is ignored, but treated as successful.
- *
This method requires the caller to hold the permission
- * {@link android.Manifest.permission#CHANGE_NETWORK_STATE}.
- *
- * @param networkType the type of the network over which traffic to the specified
- * host is to be routed
- * @param hostAddress the IP address of the host to which the route is desired
- * @return {@code true} on success, {@code false} on failure
- */
- public boolean requestRouteToHost(int networkType, int hostAddress) {
- InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress);
-
- return inetAddress != null && requestRouteToHostAddress(networkType, inetAddress);
-
- }
-
- /**
- * Ensure that a network route exists to deliver traffic to the specified
- * host via the specified network interface. An attempt to add a route that
- * already exists is ignored, but treated as successful.
- *
- * @param networkType the type of the network over which traffic to the specified
- * host is to be routed
- * @param hostAddress the IP address of the host to which the route is desired
- * @return {@code true} on success, {@code false} on failure
- * @hide
- */
- public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
- byte[] address = hostAddress.getAddress();
- try {
- return mService.requestRouteToHostAddress(networkType, address);
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * Returns the value of the setting for background data usage. If false,
- * applications should not use the network if the application is not in the
- * foreground. Developers should respect this setting, and check the value
- * of this before performing any background data operations.
- *
- * All applications that have background services that use the network
- * should listen to {@link #ACTION_BACKGROUND_DATA_SETTING_CHANGED}.
- *
- *
- * @return Whether background data usage is allowed.
- * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, availability of
- * background data depends on several combined factors, and this method will
- * always return {@code true}. Instead, when background data is unavailable,
- * {@link #getActiveNetworkInfo()} will now appear disconnected.
- */
- @Deprecated
- public boolean getBackgroundDataSetting() {
- // assume that background data is allowed; final authority is
- // NetworkInfo which may be blocked.
- return true;
- }
-
- /**
- * Sets the value of the setting for background data usage.
- *
- * @param allowBackgroundData Whether an application should use data while
- * it is in the background.
- * @attr ref android.Manifest.permission#CHANGE_BACKGROUND_DATA_SETTING
- * @hide
- * @see #getBackgroundDataSetting()
- */
- @Deprecated
- public void setBackgroundDataSetting(boolean allowBackgroundData) {
- // ignored
- }
-
- /**
- * Return quota status for the current active network, or {@code null} if no
- * network is active. Quota status can change rapidly, so these values
- * shouldn't be cached.
- *
- * @hide
- */
- public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
- try {
- return mService.getActiveNetworkQuotaInfo();
- } catch (RemoteException e) {
- return null;
- }
- }
-
- /**
- * Gets the value of the setting for enabling Mobile data.
- *
- * @return Whether mobile data is enabled.
- * @hide
- */
- public boolean getMobileDataEnabled() {
- try {
- return mService.getMobileDataEnabled();
- } catch (RemoteException e) {
- return true;
- }
- }
-
- /**
- * Sets the persisted value for enabling/disabling Mobile data.
- *
- * @param enabled Whether the mobile data connection should be
- * used or not.
- * @hide
- */
- public void setMobileDataEnabled(boolean enabled) {
- try {
- mService.setMobileDataEnabled(enabled);
- } catch (RemoteException e) {
- }
- }
-
- /**
- * {@hide}
- */
- public ConnectivityManager(IConnectivityManager service) {
- mService = checkNotNull(service, "missing IConnectivityManager");
- }
-
- /**
- * {@hide}
- */
- public static ConnectivityManager from(Context context) {
- return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- }
-
- /**
- * {@hide}
- */
- public String[] getTetherableIfaces() {
- try {
- return mService.getTetherableIfaces();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * {@hide}
- */
- public String[] getTetheredIfaces() {
- try {
- return mService.getTetheredIfaces();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * {@hide}
- */
- public String[] getTetheringErroredIfaces() {
- try {
- return mService.getTetheringErroredIfaces();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * @return error A TETHER_ERROR value indicating success or failure type
- * {@hide}
- */
- public int tether(String iface) {
- try {
- return mService.tether(iface);
- } catch (RemoteException e) {
- return TETHER_ERROR_SERVICE_UNAVAIL;
- }
- }
-
- /**
- * @return error A TETHER_ERROR value indicating success or failure type
- * {@hide}
- */
- public int untether(String iface) {
- try {
- return mService.untether(iface);
- } catch (RemoteException e) {
- return TETHER_ERROR_SERVICE_UNAVAIL;
- }
- }
-
- /**
- * {@hide}
- */
- public boolean isTetheringSupported() {
- try {
- return mService.isTetheringSupported();
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * {@hide}
- */
- public String[] getTetherableUsbRegexs() {
- try {
- return mService.getTetherableUsbRegexs();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * {@hide}
- */
- public String[] getTetherableWifiRegexs() {
- try {
- return mService.getTetherableWifiRegexs();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * {@hide}
- */
- public String[] getTetherableBluetoothRegexs() {
- try {
- return mService.getTetherableBluetoothRegexs();
- } catch (RemoteException e) {
- return new String[0];
- }
- }
-
- /**
- * {@hide}
- */
- public int setUsbTethering(boolean enable) {
- try {
- return mService.setUsbTethering(enable);
- } catch (RemoteException e) {
- return TETHER_ERROR_SERVICE_UNAVAIL;
- }
- }
-
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_NO_ERROR = 0;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_UNKNOWN_IFACE = 1;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_SERVICE_UNAVAIL = 2;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_UNSUPPORTED = 3;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_UNAVAIL_IFACE = 4;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_MASTER_ERROR = 5;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_TETHER_IFACE_ERROR = 6;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR = 7;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_ENABLE_NAT_ERROR = 8;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_DISABLE_NAT_ERROR = 9;
- /**
- * {@hide}
- */
- public static final int TETHER_ERROR_IFACE_CFG_ERROR = 10;
-
- /**
- * @param iface The name of the interface we're interested in
- * @return error The error code of the last error tethering or untethering the named
- * interface
- * {@hide}
- */
- public int getLastTetherError(String iface) {
- try {
- return mService.getLastTetherError(iface);
- } catch (RemoteException e) {
- return TETHER_ERROR_SERVICE_UNAVAIL;
- }
- }
-
- /**
- * Ensure the device stays awake until we connect with the next network
- *
- * @param forWhome The name of the network going down for logging purposes
- * @return {@code true} on success, {@code false} on failure
- * {@hide}
- */
- public boolean requestNetworkTransitionWakelock(String forWhom) {
- try {
- mService.requestNetworkTransitionWakelock(forWhom);
- return true;
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * @param networkType The type of network you want to report on
- * @param percentage The quality of the connection 0 is bad, 100 is good
- * {@hide}
- */
- public void reportInetCondition(int networkType, int percentage) {
- try {
- mService.reportInetCondition(networkType, percentage);
- } catch (RemoteException e) {
- }
- }
-
- /**
- * @param proxyProperties The definition for the new global http proxy
- * {@hide}
- */
- public void setGlobalProxy(ProxyProperties p) {
- try {
- mService.setGlobalProxy(p);
- } catch (RemoteException e) {
- }
- }
-
- /**
- * @return proxyProperties for the current global proxy
- * {@hide}
- */
- public ProxyProperties getGlobalProxy() {
- try {
- return mService.getGlobalProxy();
- } catch (RemoteException e) {
- return null;
- }
- }
-
- /**
- * @return proxyProperties for the current proxy (global if set, network specific if not)
- * {@hide}
- */
- public ProxyProperties getProxy() {
- try {
- return mService.getProxy();
- } catch (RemoteException e) {
- return null;
- }
- }
-
- /**
- * @param networkType The network who's dependence has changed
- * @param met Boolean - true if network use is ok, false if not
- * {@hide}
- */
- public void setDataDependency(int networkType, boolean met) {
- try {
- mService.setDataDependency(networkType, met);
- } catch (RemoteException e) {
- }
- }
-
- /**
- * Returns true if the hardware supports the given network type
- * else it returns false. This doesn't indicate we have coverage
- * or are authorized onto a network, just whether or not the
- * hardware supports it. For example a gsm phone without a sim
- * should still return true for mobile data, but a wifi only tablet
- * would return false.
- *
- * @param networkType The nework type we'd like to check
- * @return true if supported, else false
- * @hide
- */
- public boolean isNetworkSupported(int networkType) {
- try {
- return mService.isNetworkSupported(networkType);
- } catch (RemoteException e) {
- }
- return false;
- }
-
- /**
- * Returns if the currently active data network is metered. A network is
- * classified as metered when the user is sensitive to heavy data usage on
- * that connection. You should check this before doing large data transfers,
- * and warn the user or delay the operation until another network is
- * available.
- */
- public boolean isActiveNetworkMetered() {
- try {
- return mService.isActiveNetworkMetered();
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * {@hide}
- */
- public boolean updateLockdownVpn() {
- try {
- return mService.updateLockdownVpn();
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * {@hide}
- */
- public void captivePortalCheckComplete(NetworkInfo info) {
- try {
- mService.captivePortalCheckComplete(info);
- } catch (RemoteException e) {
- }
- }
-
-}
diff --git a/QKSMS/src/main/java/android/net/DhcpInfoInternal.java b/QKSMS/src/main/java/android/net/DhcpInfoInternal.java
deleted file mode 100644
index 1e383dbaa07899d45fb8740f18947107c82fd3c2..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/DhcpInfoInternal.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * A simple object for retrieving the results of a DHCP request.
- * Replaces (internally) the IPv4-only DhcpInfo class.
- *
- * @hide
- */
-public class DhcpInfoInternal {
- private static final String TAG = "DhcpInfoInternal";
-
- private static final boolean LOCAL_LOGV = false;
- public String ipAddress;
- public int prefixLength;
-
- public String dns1;
- public String dns2;
-
- public String serverAddress;
- public int leaseDuration;
-
- /**
- * Vendor specific information (from RFC 2132).
- */
- public String vendorInfo;
-
- private Collection mRoutes;
-
- public DhcpInfoInternal() {
- mRoutes = new ArrayList<>();
- }
-
- public void addRoute(RouteInfo routeInfo) {
- mRoutes.add(routeInfo);
- }
-
- public Collection getRoutes() {
- return Collections.unmodifiableCollection(mRoutes);
- }
-
- private int convertToInt(String addr) {
- if (addr != null) {
- try {
- InetAddress inetAddress = NetworkUtils.numericToInetAddress(addr);
- if (inetAddress instanceof Inet4Address) {
- return NetworkUtils.inetAddressToInt(inetAddress);
- }
- } catch (IllegalArgumentException e) {
- }
- }
- return 0;
- }
-
- public DhcpInfo makeDhcpInfo() {
- DhcpInfo info = new DhcpInfo();
- info.ipAddress = convertToInt(ipAddress);
- for (RouteInfo route : mRoutes) {
- if (route.isDefaultRoute()) {
- info.gateway = convertToInt(route.getGateway().getHostAddress());
- break;
- }
- }
- try {
- info.netmask = NetworkUtils.prefixLengthToNetmaskInt(prefixLength);
- } catch (IllegalArgumentException e) {
- }
- info.dns1 = convertToInt(dns1);
- info.dns2 = convertToInt(dns2);
- info.serverAddress = convertToInt(serverAddress);
- info.leaseDuration = leaseDuration;
- return info;
- }
-
- public LinkAddress makeLinkAddress() {
- if (TextUtils.isEmpty(ipAddress)) {
- Log.e(TAG, "makeLinkAddress with empty ipAddress");
- return null;
- }
- return new LinkAddress(NetworkUtils.numericToInetAddress(ipAddress), prefixLength);
- }
-
- public LinkProperties makeLinkProperties() {
- LinkProperties p = new LinkProperties();
- p.addLinkAddress(makeLinkAddress());
- for (RouteInfo route : mRoutes) {
- p.addRoute(route);
- }
- //if empty, connectivity configures default DNS
- if (!TextUtils.isEmpty(dns1)) {
- p.addDns(NetworkUtils.numericToInetAddress(dns1));
- } else {
- if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns1!");
- }
- if (!TextUtils.isEmpty(dns2)) {
- p.addDns(NetworkUtils.numericToInetAddress(dns2));
- } else {
- if (LOCAL_LOGV) Log.v(TAG, "makeLinkProperties with empty dns2!");
- }
- return p;
- }
-
- /* Updates the DHCP fields that need to be retained from
- * original DHCP request if the DHCP renewal shows them as
- * being empty
- */
- public void updateFromDhcpRequest(DhcpInfoInternal orig) {
- if (orig == null) return;
-
- if (TextUtils.isEmpty(dns1)) {
- dns1 = orig.dns1;
- }
-
- if (TextUtils.isEmpty(dns2)) {
- dns2 = orig.dns2;
- }
-
- if (mRoutes.isEmpty()) {
- for (RouteInfo route : orig.getRoutes()) {
- addRoute(route);
- }
- }
- }
-
- /**
- * Test if this DHCP lease includes vendor hint that network link is
- * metered, and sensitive to heavy data transfers.
- */
- public boolean hasMeteredHint() {
- return vendorInfo != null && vendorInfo.contains("ANDROID_METERED");
- }
-
- public String toString() {
- String routeString = "";
- for (RouteInfo route : mRoutes) routeString += route.toString() + " | ";
- return "addr: " + ipAddress + "/" + prefixLength +
- " mRoutes: " + routeString +
- " dns: " + dns1 + "," + dns2 +
- " dhcpServer: " + serverAddress +
- " leaseDuration: " + leaseDuration;
- }
-}
diff --git a/QKSMS/src/main/java/android/net/IConnectivityManager.java b/QKSMS/src/main/java/android/net/IConnectivityManager.java
deleted file mode 100644
index 906c2fb44cdc6744cb3ee79230be4efc86520bb7..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/IConnectivityManager.java
+++ /dev/null
@@ -1,1536 +0,0 @@
-/*
- * This file is auto-generated. DO NOT MODIFY.
- * Original file: frameworks/base/core/java/android/net/IConnectivityManager.aidl
- */
-package android.net;
-/**
- * Interface that answers queries about, and allows changing, the
- * state of network connectivity.
- */
-
-/**
- * {@hide}
- */
-public interface IConnectivityManager extends android.os.IInterface {
- /**
- * Local-side IPC implementation stub class.
- */
- public abstract static class Stub extends android.os.Binder implements android.net.IConnectivityManager {
- private static final String DESCRIPTOR = "android.net.IConnectivityManager";
-
- /**
- * Construct the stub at attach it to the interface.
- */
- public Stub() {
- this.attachInterface(this, DESCRIPTOR);
- }
-
- /**
- * Cast an IBinder object into an android.net.IConnectivityManager interface,
- * generating a proxy if needed.
- */
- public static android.net.IConnectivityManager asInterface(android.os.IBinder obj) {
- if ((obj == null)) {
- return null;
- }
- android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
- if (((iin != null) && (iin instanceof android.net.IConnectivityManager))) {
- return ((android.net.IConnectivityManager) iin);
- }
- return new android.net.IConnectivityManager.Stub.Proxy(obj);
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return this;
- }
-
- @Override
- public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
- switch (code) {
- case INTERFACE_TRANSACTION: {
- reply.writeString(DESCRIPTOR);
- return true;
- }
- case TRANSACTION_setNetworkPreference: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- this.setNetworkPreference(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getNetworkPreference: {
- data.enforceInterface(DESCRIPTOR);
- int _result = this.getNetworkPreference();
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_getActiveNetworkInfo: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkInfo _result = this.getActiveNetworkInfo();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_getActiveNetworkInfoForUid: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- android.net.NetworkInfo _result = this.getActiveNetworkInfoForUid(_arg0);
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_getNetworkInfo: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- android.net.NetworkInfo _result = this.getNetworkInfo(_arg0);
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_getAllNetworkInfo: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkInfo[] _result = this.getAllNetworkInfo();
- reply.writeNoException();
- reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- return true;
- }
- case TRANSACTION_isNetworkSupported: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- boolean _result = this.isNetworkSupported(_arg0);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_getActiveLinkProperties: {
- data.enforceInterface(DESCRIPTOR);
- android.net.LinkProperties _result = this.getActiveLinkProperties();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_getLinkProperties: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- android.net.LinkProperties _result = this.getLinkProperties(_arg0);
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_getAllNetworkState: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkState[] _result = this.getAllNetworkState();
- reply.writeNoException();
- reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- return true;
- }
- case TRANSACTION_getActiveNetworkQuotaInfo: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkQuotaInfo _result = this.getActiveNetworkQuotaInfo();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_isActiveNetworkMetered: {
- data.enforceInterface(DESCRIPTOR);
- boolean _result = this.isActiveNetworkMetered();
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_setRadios: {
- data.enforceInterface(DESCRIPTOR);
- boolean _arg0;
- _arg0 = (0 != data.readInt());
- boolean _result = this.setRadios(_arg0);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_setRadio: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- boolean _arg1;
- _arg1 = (0 != data.readInt());
- boolean _result = this.setRadio(_arg0, _arg1);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_startUsingNetworkFeature: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- String _arg1;
- _arg1 = data.readString();
- android.os.IBinder _arg2;
- _arg2 = data.readStrongBinder();
- int _result = this.startUsingNetworkFeature(_arg0, _arg1, _arg2);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_stopUsingNetworkFeature: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- String _arg1;
- _arg1 = data.readString();
- int _result = this.stopUsingNetworkFeature(_arg0, _arg1);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_requestRouteToHost: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int _arg1;
- _arg1 = data.readInt();
- boolean _result = this.requestRouteToHost(_arg0, _arg1);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_requestRouteToHostAddress: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- byte[] _arg1;
- _arg1 = data.createByteArray();
- boolean _result = this.requestRouteToHostAddress(_arg0, _arg1);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_getMobileDataEnabled: {
- data.enforceInterface(DESCRIPTOR);
- boolean _result = this.getMobileDataEnabled();
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_setMobileDataEnabled: {
- data.enforceInterface(DESCRIPTOR);
- boolean _arg0;
- _arg0 = (0 != data.readInt());
- this.setMobileDataEnabled(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_setPolicyDataEnable: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- boolean _arg1;
- _arg1 = (0 != data.readInt());
- this.setPolicyDataEnable(_arg0, _arg1);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_tether: {
- data.enforceInterface(DESCRIPTOR);
- String _arg0;
- _arg0 = data.readString();
- int _result = this.tether(_arg0);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_untether: {
- data.enforceInterface(DESCRIPTOR);
- String _arg0;
- _arg0 = data.readString();
- int _result = this.untether(_arg0);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_getLastTetherError: {
- data.enforceInterface(DESCRIPTOR);
- String _arg0;
- _arg0 = data.readString();
- int _result = this.getLastTetherError(_arg0);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_isTetheringSupported: {
- data.enforceInterface(DESCRIPTOR);
- boolean _result = this.isTetheringSupported();
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_getTetherableIfaces: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetherableIfaces();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetheredIfaces: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetheredIfaces();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetheredIfacePairs: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetheredIfacePairs();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetheringErroredIfaces: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetheringErroredIfaces();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetherableUsbRegexs: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetherableUsbRegexs();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetherableWifiRegexs: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetherableWifiRegexs();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_getTetherableBluetoothRegexs: {
- data.enforceInterface(DESCRIPTOR);
- String[] _result = this.getTetherableBluetoothRegexs();
- reply.writeNoException();
- reply.writeStringArray(_result);
- return true;
- }
- case TRANSACTION_setUsbTethering: {
- data.enforceInterface(DESCRIPTOR);
- boolean _arg0;
- _arg0 = (0 != data.readInt());
- int _result = this.setUsbTethering(_arg0);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_requestNetworkTransitionWakelock: {
- data.enforceInterface(DESCRIPTOR);
- String _arg0;
- _arg0 = data.readString();
- this.requestNetworkTransitionWakelock(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_reportInetCondition: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int _arg1;
- _arg1 = data.readInt();
- this.reportInetCondition(_arg0, _arg1);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getGlobalProxy: {
- data.enforceInterface(DESCRIPTOR);
- android.net.ProxyProperties _result = this.getGlobalProxy();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_setGlobalProxy: {
- data.enforceInterface(DESCRIPTOR);
- android.net.ProxyProperties _arg0;
- if ((0 != data.readInt())) {
- _arg0 = android.net.ProxyProperties.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- this.setGlobalProxy(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getProxy: {
- data.enforceInterface(DESCRIPTOR);
- android.net.ProxyProperties _result = this.getProxy();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_setDataDependency: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- boolean _arg1;
- _arg1 = (0 != data.readInt());
- this.setDataDependency(_arg0, _arg1);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_protectVpn: {
- data.enforceInterface(DESCRIPTOR);
- android.os.ParcelFileDescriptor _arg0;
- if ((0 != data.readInt())) {
- _arg0 = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- boolean _result = this.protectVpn(_arg0);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_prepareVpn: {
- data.enforceInterface(DESCRIPTOR);
- String _arg0;
- _arg0 = data.readString();
- String _arg1;
- _arg1 = data.readString();
- boolean _result = this.prepareVpn(_arg0, _arg1);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_establishVpn: {
- data.enforceInterface(DESCRIPTOR);
- com.android.internal.net.VpnConfig _arg0;
- if ((0 != data.readInt())) {
- _arg0 = com.android.internal.net.VpnConfig.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- android.os.ParcelFileDescriptor _result = this.establishVpn(_arg0);
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_startLegacyVpn: {
- data.enforceInterface(DESCRIPTOR);
- com.android.internal.net.VpnProfile _arg0;
- if ((0 != data.readInt())) {
- _arg0 = com.android.internal.net.VpnProfile.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- this.startLegacyVpn(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getLegacyVpnInfo: {
- data.enforceInterface(DESCRIPTOR);
- com.android.internal.net.LegacyVpnInfo _result = this.getLegacyVpnInfo();
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_updateLockdownVpn: {
- data.enforceInterface(DESCRIPTOR);
- boolean _result = this.updateLockdownVpn();
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_captivePortalCheckComplete: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkInfo _arg0;
- if ((0 != data.readInt())) {
- _arg0 = null;
- } else {
- _arg0 = null;
- }
- this.captivePortalCheckComplete(_arg0);
- reply.writeNoException();
- return true;
- }
- }
- return super.onTransact(code, data, reply, flags);
- }
-
- private static class Proxy implements android.net.IConnectivityManager {
- private android.os.IBinder mRemote;
-
- Proxy(android.os.IBinder remote) {
- mRemote = remote;
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return mRemote;
- }
-
- @Override
- public void setNetworkPreference(int pref) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(pref);
- mRemote.transact(Stub.TRANSACTION_setNetworkPreference, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public int getNetworkPreference() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getNetworkPreference, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkInfo getActiveNetworkInfo() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getActiveNetworkInfo, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = null;
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkInfo getActiveNetworkInfoForUid(int uid) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(uid);
- mRemote.transact(Stub.TRANSACTION_getActiveNetworkInfoForUid, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = null;
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkInfo getNetworkInfo(int networkType) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- mRemote.transact(Stub.TRANSACTION_getNetworkInfo, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = null;
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkInfo[] getAllNetworkInfo() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkInfo[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getAllNetworkInfo, _data, _reply, 0);
- _reply.readException();
- _result = null;
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean isNetworkSupported(int networkType) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- mRemote.transact(Stub.TRANSACTION_isNetworkSupported, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.LinkProperties getActiveLinkProperties() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.LinkProperties _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getActiveLinkProperties, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.LinkProperties.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.LinkProperties getLinkProperties(int networkType) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.LinkProperties _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- mRemote.transact(Stub.TRANSACTION_getLinkProperties, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.LinkProperties.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkState[] getAllNetworkState() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkState[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getAllNetworkState, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createTypedArray(android.net.NetworkState.CREATOR);
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkQuotaInfo getActiveNetworkQuotaInfo() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkQuotaInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getActiveNetworkQuotaInfo, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.NetworkQuotaInfo.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean isActiveNetworkMetered() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_isActiveNetworkMetered, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean setRadios(boolean onOff) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((onOff) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setRadios, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean setRadio(int networkType, boolean turnOn) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeInt(((turnOn) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setRadio, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int startUsingNetworkFeature(int networkType, String feature, android.os.IBinder binder) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeString(feature);
- _data.writeStrongBinder(binder);
- mRemote.transact(Stub.TRANSACTION_startUsingNetworkFeature, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int stopUsingNetworkFeature(int networkType, String feature) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeString(feature);
- mRemote.transact(Stub.TRANSACTION_stopUsingNetworkFeature, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean requestRouteToHost(int networkType, int hostAddress) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeInt(hostAddress);
- mRemote.transact(Stub.TRANSACTION_requestRouteToHost, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeByteArray(hostAddress);
- mRemote.transact(Stub.TRANSACTION_requestRouteToHostAddress, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean getMobileDataEnabled() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getMobileDataEnabled, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void setMobileDataEnabled(boolean enabled) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((enabled) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setMobileDataEnabled, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- /**
- * Policy control over specific {@link NetworkStateTracker}.
- */
- @Override
- public void setPolicyDataEnable(int networkType, boolean enabled) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeInt(((enabled) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setPolicyDataEnable, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public int tether(String iface) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeString(iface);
- mRemote.transact(Stub.TRANSACTION_tether, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int untether(String iface) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeString(iface);
- mRemote.transact(Stub.TRANSACTION_untether, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int getLastTetherError(String iface) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeString(iface);
- mRemote.transact(Stub.TRANSACTION_getLastTetherError, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean isTetheringSupported() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_isTetheringSupported, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetherableIfaces() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetherableIfaces, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetheredIfaces() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetheredIfaces, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- /**
- * Return list of interface pairs that are actively tethered. Even indexes are
- * remote interface, and odd indexes are corresponding local interfaces.
- */
- @Override
- public String[] getTetheredIfacePairs() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetheredIfacePairs, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetheringErroredIfaces() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetheringErroredIfaces, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetherableUsbRegexs() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetherableUsbRegexs, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetherableWifiRegexs() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetherableWifiRegexs, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public String[] getTetherableBluetoothRegexs() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- String[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getTetherableBluetoothRegexs, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createStringArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int setUsbTethering(boolean enable) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((enable) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setUsbTethering, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void requestNetworkTransitionWakelock(String forWhom) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeString(forWhom);
- mRemote.transact(Stub.TRANSACTION_requestNetworkTransitionWakelock, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public void reportInetCondition(int networkType, int percentage) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeInt(percentage);
- mRemote.transact(Stub.TRANSACTION_reportInetCondition, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public android.net.ProxyProperties getGlobalProxy() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.ProxyProperties _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getGlobalProxy, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.ProxyProperties.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void setGlobalProxy(android.net.ProxyProperties p) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((p != null)) {
- _data.writeInt(1);
- p.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_setGlobalProxy, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public android.net.ProxyProperties getProxy() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.ProxyProperties _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getProxy, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.ProxyProperties.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void setDataDependency(int networkType, boolean met) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(networkType);
- _data.writeInt(((met) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setDataDependency, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public boolean protectVpn(android.os.ParcelFileDescriptor socket) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((socket != null)) {
- _data.writeInt(1);
- socket.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_protectVpn, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean prepareVpn(String oldPackage, String newPackage) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeString(oldPackage);
- _data.writeString(newPackage);
- mRemote.transact(Stub.TRANSACTION_prepareVpn, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.os.ParcelFileDescriptor establishVpn(com.android.internal.net.VpnConfig config) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.os.ParcelFileDescriptor _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((config != null)) {
- _data.writeInt(1);
- config.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_establishVpn, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void startLegacyVpn(com.android.internal.net.VpnProfile profile) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((profile != null)) {
- _data.writeInt(1);
- profile.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_startLegacyVpn, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public com.android.internal.net.LegacyVpnInfo getLegacyVpnInfo() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- com.android.internal.net.LegacyVpnInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getLegacyVpnInfo, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = com.android.internal.net.LegacyVpnInfo.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean updateLockdownVpn() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_updateLockdownVpn, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void captivePortalCheckComplete(android.net.NetworkInfo info) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((info != null)) {
- _data.writeInt(1);
- info.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_captivePortalCheckComplete, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
- }
-
- static final int TRANSACTION_setNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION);
- static final int TRANSACTION_getNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
- static final int TRANSACTION_getActiveNetworkInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
- static final int TRANSACTION_getActiveNetworkInfoForUid = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
- static final int TRANSACTION_getNetworkInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
- static final int TRANSACTION_getAllNetworkInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
- static final int TRANSACTION_isNetworkSupported = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
- static final int TRANSACTION_getActiveLinkProperties = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
- static final int TRANSACTION_getLinkProperties = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
- static final int TRANSACTION_getAllNetworkState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9);
- static final int TRANSACTION_getActiveNetworkQuotaInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 10);
- static final int TRANSACTION_isActiveNetworkMetered = (android.os.IBinder.FIRST_CALL_TRANSACTION + 11);
- static final int TRANSACTION_setRadios = (android.os.IBinder.FIRST_CALL_TRANSACTION + 12);
- static final int TRANSACTION_setRadio = (android.os.IBinder.FIRST_CALL_TRANSACTION + 13);
- static final int TRANSACTION_startUsingNetworkFeature = (android.os.IBinder.FIRST_CALL_TRANSACTION + 14);
- static final int TRANSACTION_stopUsingNetworkFeature = (android.os.IBinder.FIRST_CALL_TRANSACTION + 15);
- static final int TRANSACTION_requestRouteToHost = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16);
- static final int TRANSACTION_requestRouteToHostAddress = (android.os.IBinder.FIRST_CALL_TRANSACTION + 17);
- static final int TRANSACTION_getMobileDataEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 18);
- static final int TRANSACTION_setMobileDataEnabled = (android.os.IBinder.FIRST_CALL_TRANSACTION + 19);
- static final int TRANSACTION_setPolicyDataEnable = (android.os.IBinder.FIRST_CALL_TRANSACTION + 20);
- static final int TRANSACTION_tether = (android.os.IBinder.FIRST_CALL_TRANSACTION + 21);
- static final int TRANSACTION_untether = (android.os.IBinder.FIRST_CALL_TRANSACTION + 22);
- static final int TRANSACTION_getLastTetherError = (android.os.IBinder.FIRST_CALL_TRANSACTION + 23);
- static final int TRANSACTION_isTetheringSupported = (android.os.IBinder.FIRST_CALL_TRANSACTION + 24);
- static final int TRANSACTION_getTetherableIfaces = (android.os.IBinder.FIRST_CALL_TRANSACTION + 25);
- static final int TRANSACTION_getTetheredIfaces = (android.os.IBinder.FIRST_CALL_TRANSACTION + 26);
- static final int TRANSACTION_getTetheredIfacePairs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 27);
- static final int TRANSACTION_getTetheringErroredIfaces = (android.os.IBinder.FIRST_CALL_TRANSACTION + 28);
- static final int TRANSACTION_getTetherableUsbRegexs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 29);
- static final int TRANSACTION_getTetherableWifiRegexs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 30);
- static final int TRANSACTION_getTetherableBluetoothRegexs = (android.os.IBinder.FIRST_CALL_TRANSACTION + 31);
- static final int TRANSACTION_setUsbTethering = (android.os.IBinder.FIRST_CALL_TRANSACTION + 32);
- static final int TRANSACTION_requestNetworkTransitionWakelock = (android.os.IBinder.FIRST_CALL_TRANSACTION + 33);
- static final int TRANSACTION_reportInetCondition = (android.os.IBinder.FIRST_CALL_TRANSACTION + 34);
- static final int TRANSACTION_getGlobalProxy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 35);
- static final int TRANSACTION_setGlobalProxy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 36);
- static final int TRANSACTION_getProxy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 37);
- static final int TRANSACTION_setDataDependency = (android.os.IBinder.FIRST_CALL_TRANSACTION + 38);
- static final int TRANSACTION_protectVpn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 39);
- static final int TRANSACTION_prepareVpn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 40);
- static final int TRANSACTION_establishVpn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 41);
- static final int TRANSACTION_startLegacyVpn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 42);
- static final int TRANSACTION_getLegacyVpnInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 43);
- static final int TRANSACTION_updateLockdownVpn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 44);
- static final int TRANSACTION_captivePortalCheckComplete = (android.os.IBinder.FIRST_CALL_TRANSACTION + 45);
- }
-
- public void setNetworkPreference(int pref) throws android.os.RemoteException;
-
- public int getNetworkPreference() throws android.os.RemoteException;
-
- public android.net.NetworkInfo getActiveNetworkInfo() throws android.os.RemoteException;
-
- public android.net.NetworkInfo getActiveNetworkInfoForUid(int uid) throws android.os.RemoteException;
-
- public android.net.NetworkInfo getNetworkInfo(int networkType) throws android.os.RemoteException;
-
- public android.net.NetworkInfo[] getAllNetworkInfo() throws android.os.RemoteException;
-
- public boolean isNetworkSupported(int networkType) throws android.os.RemoteException;
-
- public android.net.LinkProperties getActiveLinkProperties() throws android.os.RemoteException;
-
- public android.net.LinkProperties getLinkProperties(int networkType) throws android.os.RemoteException;
-
- public android.net.NetworkState[] getAllNetworkState() throws android.os.RemoteException;
-
- public android.net.NetworkQuotaInfo getActiveNetworkQuotaInfo() throws android.os.RemoteException;
-
- public boolean isActiveNetworkMetered() throws android.os.RemoteException;
-
- public boolean setRadios(boolean onOff) throws android.os.RemoteException;
-
- public boolean setRadio(int networkType, boolean turnOn) throws android.os.RemoteException;
-
- public int startUsingNetworkFeature(int networkType, String feature, android.os.IBinder binder) throws android.os.RemoteException;
-
- public int stopUsingNetworkFeature(int networkType, String feature) throws android.os.RemoteException;
-
- public boolean requestRouteToHost(int networkType, int hostAddress) throws android.os.RemoteException;
-
- public boolean requestRouteToHostAddress(int networkType, byte[] hostAddress) throws android.os.RemoteException;
-
- public boolean getMobileDataEnabled() throws android.os.RemoteException;
-
- public void setMobileDataEnabled(boolean enabled) throws android.os.RemoteException;
-
- /**
- * Policy control over specific {@link NetworkStateTracker}.
- */
- public void setPolicyDataEnable(int networkType, boolean enabled) throws android.os.RemoteException;
-
- public int tether(String iface) throws android.os.RemoteException;
-
- public int untether(String iface) throws android.os.RemoteException;
-
- public int getLastTetherError(String iface) throws android.os.RemoteException;
-
- public boolean isTetheringSupported() throws android.os.RemoteException;
-
- public String[] getTetherableIfaces() throws android.os.RemoteException;
-
- public String[] getTetheredIfaces() throws android.os.RemoteException;
-
- /**
- * Return list of interface pairs that are actively tethered. Even indexes are
- * remote interface, and odd indexes are corresponding local interfaces.
- */
- public String[] getTetheredIfacePairs() throws android.os.RemoteException;
-
- public String[] getTetheringErroredIfaces() throws android.os.RemoteException;
-
- public String[] getTetherableUsbRegexs() throws android.os.RemoteException;
-
- public String[] getTetherableWifiRegexs() throws android.os.RemoteException;
-
- public String[] getTetherableBluetoothRegexs() throws android.os.RemoteException;
-
- public int setUsbTethering(boolean enable) throws android.os.RemoteException;
-
- public void requestNetworkTransitionWakelock(String forWhom) throws android.os.RemoteException;
-
- public void reportInetCondition(int networkType, int percentage) throws android.os.RemoteException;
-
- public android.net.ProxyProperties getGlobalProxy() throws android.os.RemoteException;
-
- public void setGlobalProxy(android.net.ProxyProperties p) throws android.os.RemoteException;
-
- public android.net.ProxyProperties getProxy() throws android.os.RemoteException;
-
- public void setDataDependency(int networkType, boolean met) throws android.os.RemoteException;
-
- public boolean protectVpn(android.os.ParcelFileDescriptor socket) throws android.os.RemoteException;
-
- public boolean prepareVpn(String oldPackage, String newPackage) throws android.os.RemoteException;
-
- public android.os.ParcelFileDescriptor establishVpn(com.android.internal.net.VpnConfig config) throws android.os.RemoteException;
-
- public void startLegacyVpn(com.android.internal.net.VpnProfile profile) throws android.os.RemoteException;
-
- public com.android.internal.net.LegacyVpnInfo getLegacyVpnInfo() throws android.os.RemoteException;
-
- public boolean updateLockdownVpn() throws android.os.RemoteException;
-
- public void captivePortalCheckComplete(android.net.NetworkInfo info) throws android.os.RemoteException;
-}
diff --git a/QKSMS/src/main/java/android/net/INetworkPolicyListener.java b/QKSMS/src/main/java/android/net/INetworkPolicyListener.java
deleted file mode 100644
index 1e98ae57ee0114f897ecc412b2f14192a2870393..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/INetworkPolicyListener.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * This file is auto-generated. DO NOT MODIFY.
- * Original file: frameworks/base/core/java/android/net/INetworkPolicyListener.aidl
- */
-package android.net;
-
-/**
- * {@hide}
- */
-public interface INetworkPolicyListener extends android.os.IInterface {
- /**
- * Local-side IPC implementation stub class.
- */
- public abstract static class Stub extends android.os.Binder implements android.net.INetworkPolicyListener {
- private static final String DESCRIPTOR = "android.net.INetworkPolicyListener";
-
- /**
- * Construct the stub at attach it to the interface.
- */
- public Stub() {
- this.attachInterface(this, DESCRIPTOR);
- }
-
- /**
- * Cast an IBinder object into an android.net.INetworkPolicyListener interface,
- * generating a proxy if needed.
- */
- public static android.net.INetworkPolicyListener asInterface(android.os.IBinder obj) {
- if ((obj == null)) {
- return null;
- }
- android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
- if (((iin != null) && (iin instanceof android.net.INetworkPolicyListener))) {
- return ((android.net.INetworkPolicyListener) iin);
- }
- return new android.net.INetworkPolicyListener.Stub.Proxy(obj);
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return this;
- }
-
- @Override
- public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
- switch (code) {
- case INTERFACE_TRANSACTION: {
- reply.writeString(DESCRIPTOR);
- return true;
- }
- case TRANSACTION_onUidRulesChanged: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int _arg1;
- _arg1 = data.readInt();
- this.onUidRulesChanged(_arg0, _arg1);
- return true;
- }
- case TRANSACTION_onMeteredIfacesChanged: {
- data.enforceInterface(DESCRIPTOR);
- String[] _arg0;
- _arg0 = data.createStringArray();
- this.onMeteredIfacesChanged(_arg0);
- return true;
- }
- case TRANSACTION_onRestrictBackgroundChanged: {
- data.enforceInterface(DESCRIPTOR);
- boolean _arg0;
- _arg0 = (0 != data.readInt());
- this.onRestrictBackgroundChanged(_arg0);
- return true;
- }
- }
- return super.onTransact(code, data, reply, flags);
- }
-
- private static class Proxy implements android.net.INetworkPolicyListener {
- private android.os.IBinder mRemote;
-
- Proxy(android.os.IBinder remote) {
- mRemote = remote;
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return mRemote;
- }
-
- @Override
- public void onUidRulesChanged(int uid, int uidRules) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(uid);
- _data.writeInt(uidRules);
- mRemote.transact(Stub.TRANSACTION_onUidRulesChanged, _data, null, android.os.IBinder.FLAG_ONEWAY);
- } finally {
- _data.recycle();
- }
- }
-
- @Override
- public void onMeteredIfacesChanged(String[] meteredIfaces) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeStringArray(meteredIfaces);
- mRemote.transact(Stub.TRANSACTION_onMeteredIfacesChanged, _data, null, android.os.IBinder.FLAG_ONEWAY);
- } finally {
- _data.recycle();
- }
- }
-
- @Override
- public void onRestrictBackgroundChanged(boolean restrictBackground) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((restrictBackground) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_onRestrictBackgroundChanged, _data, null, android.os.IBinder.FLAG_ONEWAY);
- } finally {
- _data.recycle();
- }
- }
- }
-
- static final int TRANSACTION_onUidRulesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION);
- static final int TRANSACTION_onMeteredIfacesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
- static final int TRANSACTION_onRestrictBackgroundChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
- }
-
- public void onUidRulesChanged(int uid, int uidRules) throws android.os.RemoteException;
-
- public void onMeteredIfacesChanged(String[] meteredIfaces) throws android.os.RemoteException;
-
- public void onRestrictBackgroundChanged(boolean restrictBackground) throws android.os.RemoteException;
-}
diff --git a/QKSMS/src/main/java/android/net/INetworkPolicyManager.java b/QKSMS/src/main/java/android/net/INetworkPolicyManager.java
deleted file mode 100644
index 09dd0fce45aab319bae7c4afe64a48017384ce9e..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/INetworkPolicyManager.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * This file is auto-generated. DO NOT MODIFY.
- * Original file: frameworks/base/core/java/android/net/INetworkPolicyManager.aidl
- */
-package android.net;
-
-/**
- * Interface that creates and modifies network policy rules.
- *
- * {@hide}
- */
-public interface INetworkPolicyManager extends android.os.IInterface {
- /**
- * Local-side IPC implementation stub class.
- */
- public abstract static class Stub extends android.os.Binder implements android.net.INetworkPolicyManager {
- private static final String DESCRIPTOR = "android.net.INetworkPolicyManager";
-
- /**
- * Construct the stub at attach it to the interface.
- */
- public Stub() {
- this.attachInterface(this, DESCRIPTOR);
- }
-
- /**
- * Cast an IBinder object into an android.net.INetworkPolicyManager interface,
- * generating a proxy if needed.
- */
- public static android.net.INetworkPolicyManager asInterface(android.os.IBinder obj) {
- if ((obj == null)) {
- return null;
- }
- android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
- if (((iin != null) && (iin instanceof android.net.INetworkPolicyManager))) {
- return ((android.net.INetworkPolicyManager) iin);
- }
- return new android.net.INetworkPolicyManager.Stub.Proxy(obj);
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return this;
- }
-
- @Override
- public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException {
- switch (code) {
- case INTERFACE_TRANSACTION: {
- reply.writeString(DESCRIPTOR);
- return true;
- }
- case TRANSACTION_setUidPolicy: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int _arg1;
- _arg1 = data.readInt();
- this.setUidPolicy(_arg0, _arg1);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getUidPolicy: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int _result = this.getUidPolicy(_arg0);
- reply.writeNoException();
- reply.writeInt(_result);
- return true;
- }
- case TRANSACTION_getUidsWithPolicy: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- int[] _result = this.getUidsWithPolicy(_arg0);
- reply.writeNoException();
- reply.writeIntArray(_result);
- return true;
- }
- case TRANSACTION_isUidForeground: {
- data.enforceInterface(DESCRIPTOR);
- int _arg0;
- _arg0 = data.readInt();
- boolean _result = this.isUidForeground(_arg0);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_registerListener: {
- data.enforceInterface(DESCRIPTOR);
- android.net.INetworkPolicyListener _arg0;
- _arg0 = android.net.INetworkPolicyListener.Stub.asInterface(data.readStrongBinder());
- this.registerListener(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_unregisterListener: {
- data.enforceInterface(DESCRIPTOR);
- android.net.INetworkPolicyListener _arg0;
- _arg0 = android.net.INetworkPolicyListener.Stub.asInterface(data.readStrongBinder());
- this.unregisterListener(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_setNetworkPolicies: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkPolicy[] _arg0;
- _arg0 = data.createTypedArray(android.net.NetworkPolicy.CREATOR);
- this.setNetworkPolicies(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getNetworkPolicies: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkPolicy[] _result = this.getNetworkPolicies();
- reply.writeNoException();
- reply.writeTypedArray(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- return true;
- }
- case TRANSACTION_snoozeLimit: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkTemplate _arg0;
- if ((0 != data.readInt())) {
- _arg0 = android.net.NetworkTemplate.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- this.snoozeLimit(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_setRestrictBackground: {
- data.enforceInterface(DESCRIPTOR);
- boolean _arg0;
- _arg0 = (0 != data.readInt());
- this.setRestrictBackground(_arg0);
- reply.writeNoException();
- return true;
- }
- case TRANSACTION_getRestrictBackground: {
- data.enforceInterface(DESCRIPTOR);
- boolean _result = this.getRestrictBackground();
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- case TRANSACTION_getNetworkQuotaInfo: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkState _arg0;
- if ((0 != data.readInt())) {
- _arg0 = android.net.NetworkState.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- android.net.NetworkQuotaInfo _result = this.getNetworkQuotaInfo(_arg0);
- reply.writeNoException();
- if ((_result != null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- } else {
- reply.writeInt(0);
- }
- return true;
- }
- case TRANSACTION_isNetworkMetered: {
- data.enforceInterface(DESCRIPTOR);
- android.net.NetworkState _arg0;
- if ((0 != data.readInt())) {
- _arg0 = android.net.NetworkState.CREATOR.createFromParcel(data);
- } else {
- _arg0 = null;
- }
- boolean _result = this.isNetworkMetered(_arg0);
- reply.writeNoException();
- reply.writeInt(((_result) ? (1) : (0)));
- return true;
- }
- }
- return super.onTransact(code, data, reply, flags);
- }
-
- private static class Proxy implements android.net.INetworkPolicyManager {
- private android.os.IBinder mRemote;
-
- Proxy(android.os.IBinder remote) {
- mRemote = remote;
- }
-
- @Override
- public android.os.IBinder asBinder() {
- return mRemote;
- }
-
- /**
- * Control UID policies.
- */
- @Override
- public void setUidPolicy(int uid, int policy) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(uid);
- _data.writeInt(policy);
- mRemote.transact(Stub.TRANSACTION_setUidPolicy, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public int getUidPolicy(int uid) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(uid);
- mRemote.transact(Stub.TRANSACTION_getUidPolicy, _data, _reply, 0);
- _reply.readException();
- _result = _reply.readInt();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public int[] getUidsWithPolicy(int policy) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- int[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(policy);
- mRemote.transact(Stub.TRANSACTION_getUidsWithPolicy, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createIntArray();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean isUidForeground(int uid) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(uid);
- mRemote.transact(Stub.TRANSACTION_isUidForeground, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public void registerListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeStrongBinder((((listener != null)) ? (listener.asBinder()) : (null)));
- mRemote.transact(Stub.TRANSACTION_registerListener, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public void unregisterListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeStrongBinder((((listener != null)) ? (listener.asBinder()) : (null)));
- mRemote.transact(Stub.TRANSACTION_unregisterListener, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- /**
- * Control network policies atomically.
- */
- @Override
- public void setNetworkPolicies(android.net.NetworkPolicy[] policies) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeTypedArray(policies, 0);
- mRemote.transact(Stub.TRANSACTION_setNetworkPolicies, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public android.net.NetworkPolicy[] getNetworkPolicies() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkPolicy[] _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getNetworkPolicies, _data, _reply, 0);
- _reply.readException();
- _result = _reply.createTypedArray(android.net.NetworkPolicy.CREATOR);
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- /**
- * Snooze limit on policy matching given template.
- */
- @Override
- public void snoozeLimit(android.net.NetworkTemplate template) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((template != null)) {
- _data.writeInt(1);
- template.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_snoozeLimit, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- /**
- * Control if background data is restricted system-wide.
- */
- @Override
- public void setRestrictBackground(boolean restrictBackground) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((restrictBackground) ? (1) : (0)));
- mRemote.transact(Stub.TRANSACTION_setRestrictBackground, _data, _reply, 0);
- _reply.readException();
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- }
-
- @Override
- public boolean getRestrictBackground() throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- mRemote.transact(Stub.TRANSACTION_getRestrictBackground, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public android.net.NetworkQuotaInfo getNetworkQuotaInfo(android.net.NetworkState state) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- android.net.NetworkQuotaInfo _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((state != null)) {
- _data.writeInt(1);
- state.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_getNetworkQuotaInfo, _data, _reply, 0);
- _reply.readException();
- if ((0 != _reply.readInt())) {
- _result = android.net.NetworkQuotaInfo.CREATOR.createFromParcel(_reply);
- } else {
- _result = null;
- }
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
-
- @Override
- public boolean isNetworkMetered(android.net.NetworkState state) throws android.os.RemoteException {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- boolean _result;
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- if ((state != null)) {
- _data.writeInt(1);
- state.writeToParcel(_data, 0);
- } else {
- _data.writeInt(0);
- }
- mRemote.transact(Stub.TRANSACTION_isNetworkMetered, _data, _reply, 0);
- _reply.readException();
- _result = (0 != _reply.readInt());
- } finally {
- _reply.recycle();
- _data.recycle();
- }
- return _result;
- }
- }
-
- static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION);
- static final int TRANSACTION_getUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
- static final int TRANSACTION_getUidsWithPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
- static final int TRANSACTION_isUidForeground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
- static final int TRANSACTION_registerListener = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
- static final int TRANSACTION_unregisterListener = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
- static final int TRANSACTION_setNetworkPolicies = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
- static final int TRANSACTION_getNetworkPolicies = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
- static final int TRANSACTION_snoozeLimit = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
- static final int TRANSACTION_setRestrictBackground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9);
- static final int TRANSACTION_getRestrictBackground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 10);
- static final int TRANSACTION_getNetworkQuotaInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 11);
- static final int TRANSACTION_isNetworkMetered = (android.os.IBinder.FIRST_CALL_TRANSACTION + 12);
- }
-
- /**
- * Control UID policies.
- */
- public void setUidPolicy(int uid, int policy) throws android.os.RemoteException;
-
- public int getUidPolicy(int uid) throws android.os.RemoteException;
-
- public int[] getUidsWithPolicy(int policy) throws android.os.RemoteException;
-
- public boolean isUidForeground(int uid) throws android.os.RemoteException;
-
- public void registerListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException;
-
- public void unregisterListener(android.net.INetworkPolicyListener listener) throws android.os.RemoteException;
-
- /**
- * Control network policies atomically.
- */
- public void setNetworkPolicies(android.net.NetworkPolicy[] policies) throws android.os.RemoteException;
-
- public android.net.NetworkPolicy[] getNetworkPolicies() throws android.os.RemoteException;
-
- /**
- * Snooze limit on policy matching given template.
- */
- public void snoozeLimit(android.net.NetworkTemplate template) throws android.os.RemoteException;
-
- /**
- * Control if background data is restricted system-wide.
- */
- public void setRestrictBackground(boolean restrictBackground) throws android.os.RemoteException;
-
- public boolean getRestrictBackground() throws android.os.RemoteException;
-
- public android.net.NetworkQuotaInfo getNetworkQuotaInfo(android.net.NetworkState state) throws android.os.RemoteException;
-
- public boolean isNetworkMetered(android.net.NetworkState state) throws android.os.RemoteException;
-}
diff --git a/QKSMS/src/main/java/android/net/LinkAddress.java b/QKSMS/src/main/java/android/net/LinkAddress.java
deleted file mode 100644
index 21a5fe3fbe96cfb7f5c84b0fcae1b290f39ebbbb..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/LinkAddress.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.InterfaceAddress;
-import java.net.UnknownHostException;
-
-/**
- * Identifies an address of a network link
- *
- * @hide
- */
-public class LinkAddress implements Parcelable {
- /**
- * IPv4 or IPv6 address.
- */
- private final InetAddress address;
-
- /**
- * Network prefix length
- */
- private final int prefixLength;
-
- public LinkAddress(InetAddress address, int prefixLength) {
- if (address == null || prefixLength < 0 ||
- ((address instanceof Inet4Address) && prefixLength > 32) ||
- (prefixLength > 128)) {
- throw new IllegalArgumentException("Bad LinkAddress haloParams " + address +
- prefixLength);
- }
- this.address = address;
- this.prefixLength = prefixLength;
- }
-
- public LinkAddress(InterfaceAddress interfaceAddress) {
- this.address = interfaceAddress.getAddress();
- this.prefixLength = interfaceAddress.getNetworkPrefixLength();
- }
-
- @Override
- public String toString() {
- return (address == null ? "" : (address.getHostAddress() + "/" + prefixLength));
- }
-
- /**
- * Compares this {@code LinkAddress} instance against the specified address
- * in {@code obj}. Two addresses are equal if their InetAddress and prefixLength
- * are equal
- *
- * @param obj the object to be tested for equality.
- * @return {@code true} if both objects are equal, {@code false} otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LinkAddress)) {
- return false;
- }
- LinkAddress linkAddress = (LinkAddress) obj;
- return this.address.equals(linkAddress.address) &&
- this.prefixLength == linkAddress.prefixLength;
- }
-
- @Override
- /*
- * generate hashcode based on significant fields
- */
- public int hashCode() {
- return ((null == address) ? 0 : address.hashCode()) + prefixLength;
- }
-
- /**
- * Returns the InetAddress for this address.
- */
- public InetAddress getAddress() {
- return address;
- }
-
- /**
- * Get network prefix length
- */
- public int getNetworkPrefixLength() {
- return prefixLength;
- }
-
- /**
- * Implement the Parcelable interface
- *
- * @hide
- */
- public int describeContents() {
- return 0;
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public void writeToParcel(Parcel dest, int flags) {
- if (address != null) {
- dest.writeByte((byte) 1);
- dest.writeByteArray(address.getAddress());
- dest.writeInt(prefixLength);
- } else {
- dest.writeByte((byte) 0);
- }
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public static final Creator CREATOR =
- new Creator() {
- public LinkAddress createFromParcel(Parcel in) {
- InetAddress address = null;
- int prefixLength = 0;
- if (in.readByte() == 1) {
- try {
- address = InetAddress.getByAddress(in.createByteArray());
- prefixLength = in.readInt();
- } catch (UnknownHostException e) {
- }
- }
- return new LinkAddress(address, prefixLength);
- }
-
- public LinkAddress[] newArray(int size) {
- return new LinkAddress[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/LinkCapabilities.java b/QKSMS/src/main/java/android/net/LinkCapabilities.java
deleted file mode 100644
index ad17464e53141c02d20283e867f7618031738333..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/LinkCapabilities.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * A class representing the capabilities of a link
- *
- * @hide
- */
-public class LinkCapabilities implements Parcelable {
- private static final String TAG = "LinkCapabilities";
- private static final boolean LOCAL_LOGV = false;
-
- /**
- * The Map of Keys to Values
- */
- private HashMap mCapabilities;
-
-
- /**
- * The set of keys defined for a links capabilities.
- *
- * Keys starting with RW are read + write, i.e. the application
- * can request for a certain requirement corresponding to that key.
- * Keys starting with RO are read only, i.e. the the application
- * can read the value of that key from the socket but cannot request
- * a corresponding requirement.
- *
- * TODO: Provide a documentation technique for concisely and precisely
- * define the syntax for each value string associated with a key.
- */
- public static final class Key {
- /**
- * No constructor
- */
- private Key() {
- }
-
- /**
- * An integer representing the network type.
- *
- * @see ConnectivityManager
- */
- public static final int RO_NETWORK_TYPE = 1;
-
- /**
- * Desired minimum forward link (download) bandwidth for the
- * in kilobits per second (kbps). Values should be strings such
- * "50", "100", "1500", etc.
- */
- public static final int RW_DESIRED_FWD_BW = 2;
-
- /**
- * Required minimum forward link (download) bandwidth, in
- * per second (kbps), below which the socket cannot function.
- * Values should be strings such as "50", "100", "1500", etc.
- */
- public static final int RW_REQUIRED_FWD_BW = 3;
-
- /**
- * Available forward link (download) bandwidth for the socket.
- * This value is in kilobits per second (kbps).
- * Values will be strings such as "50", "100", "1500", etc.
- */
- public static final int RO_AVAILABLE_FWD_BW = 4;
-
- /**
- * Desired minimum reverse link (upload) bandwidth for the socket
- * in kilobits per second (kbps).
- * Values should be strings such as "50", "100", "1500", etc.
- *
- * This key is set via the needs map.
- */
- public static final int RW_DESIRED_REV_BW = 5;
-
- /**
- * Required minimum reverse link (upload) bandwidth, in kilobits
- * per second (kbps), below which the socket cannot function.
- * If a rate is not specified, the default rate of kbps will be
- * Values should be strings such as "50", "100", "1500", etc.
- */
- public static final int RW_REQUIRED_REV_BW = 6;
-
- /**
- * Available reverse link (upload) bandwidth for the socket.
- * This value is in kilobits per second (kbps).
- * Values will be strings such as "50", "100", "1500", etc.
- */
- public static final int RO_AVAILABLE_REV_BW = 7;
-
- /**
- * Maximum latency for the socket, in milliseconds, above which
- * socket cannot function.
- * Values should be strings such as "50", "300", "500", etc.
- */
- public static final int RW_MAX_ALLOWED_LATENCY = 8;
-
- /**
- * Interface that the socket is bound to. This can be a virtual
- * interface (e.g. VPN or Mobile IP) or a physical interface
- * (e.g. wlan0 or rmnet0).
- * Values will be strings such as "wlan0", "rmnet0"
- */
- public static final int RO_BOUND_INTERFACE = 9;
-
- /**
- * Physical interface that the socket is routed on.
- * This can be different from BOUND_INTERFACE in cases such as
- * VPN or Mobile IP. The physical interface may change over time
- * if seamless mobility is supported.
- * Values will be strings such as "wlan0", "rmnet0"
- */
- public static final int RO_PHYSICAL_INTERFACE = 10;
- }
-
- /**
- * Role informs the LinkSocket about the data usage patterns of your
- * application.
- *
- * {@code Role.DEFAULT} is the default role, and is used whenever
- * a role isn't set.
- */
- public static final class Role {
- /**
- * No constructor
- */
- private Role() {
- }
-
- // examples only, discuss which roles should be defined, and then
- // code these to match
-
- /**
- * Default Role
- */
- public static final String DEFAULT = "default";
- /**
- * Bulk down load
- */
- public static final String BULK_DOWNLOAD = "bulk.download";
- /**
- * Bulk upload
- */
- public static final String BULK_UPLOAD = "bulk.upload";
-
- /**
- * VoIP Application at 24kbps
- */
- public static final String VOIP_24KBPS = "voip.24k";
- /**
- * VoIP Application at 32kbps
- */
- public static final String VOIP_32KBPS = "voip.32k";
-
- /**
- * Video Streaming at 480p
- */
- public static final String VIDEO_STREAMING_480P = "video.streaming.480p";
- /**
- * Video Streaming at 720p
- */
- public static final String VIDEO_STREAMING_720I = "video.streaming.720i";
-
- /**
- * Video Chat Application at 360p
- */
- public static final String VIDEO_CHAT_360P = "video.chat.360p";
- /**
- * Video Chat Application at 480p
- */
- public static final String VIDEO_CHAT_480P = "video.chat.480i";
- }
-
- /**
- * Constructor
- */
- public LinkCapabilities() {
- mCapabilities = new HashMap<>();
- }
-
- /**
- * Copy constructor.
- *
- * @param source
- */
- public LinkCapabilities(LinkCapabilities source) {
- if (source != null) {
- mCapabilities = new HashMap<>(source.mCapabilities);
- } else {
- mCapabilities = new HashMap<>();
- }
- }
-
- /**
- * Create the {@code LinkCapabilities} with values depending on role type.
- *
- * @param applicationRole a {@code LinkSocket.Role}
- * @return the {@code LinkCapabilities} associated with the applicationRole, empty if none
- */
- public static LinkCapabilities createNeedsMap(String applicationRole) {
- log("createNeededCapabilities(applicationRole) EX");
- return new LinkCapabilities();
- }
-
- /**
- * Remove all capabilities
- */
- public void clear() {
- mCapabilities.clear();
- }
-
- /**
- * Returns whether this map is empty.
- */
- public boolean isEmpty() {
- return mCapabilities.isEmpty();
- }
-
- /**
- * Returns the number of elements in this map.
- *
- * @return the number of elements in this map.
- */
- public int size() {
- return mCapabilities.size();
- }
-
- /**
- * Given the key return the capability string
- *
- * @param key
- * @return the capability string
- */
- public String get(int key) {
- return mCapabilities.get(key);
- }
-
- /**
- * Store the key/value capability pair
- *
- * @param key
- * @param value
- */
- public void put(int key, String value) {
- mCapabilities.put(key, value);
- }
-
- /**
- * Returns whether this map contains the specified key.
- *
- * @param key to search for.
- * @return {@code true} if this map contains the specified key,
- * {@code false} otherwise.
- */
- public boolean containsKey(int key) {
- return mCapabilities.containsKey(key);
- }
-
- /**
- * Returns whether this map contains the specified value.
- *
- * @param value to search for.
- * @return {@code true} if this map contains the specified value,
- * {@code false} otherwise.
- */
- public boolean containsValue(String value) {
- return mCapabilities.containsValue(value);
- }
-
- /**
- * Returns a set containing all of the mappings in this map. Each mapping is
- * an instance of {@link java.util.Map.Entry}. As the set is backed by this map,
- * changes in one will be reflected in the other.
- *
- * @return a set of the mappings.
- */
- public Set> entrySet() {
- return mCapabilities.entrySet();
- }
-
- /**
- * @return the set of the keys.
- */
- public Set keySet() {
- return mCapabilities.keySet();
- }
-
- /**
- * @return the set of values
- */
- public Collection values() {
- return mCapabilities.values();
- }
-
- /**
- * Implement the Parcelable interface
- *
- * @hide
- */
- public int describeContents() {
- return 0;
- }
-
- /**
- * Convert to string for debugging
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("{");
- boolean firstTime = true;
- for (Entry entry : mCapabilities.entrySet()) {
- if (firstTime) {
- firstTime = false;
- } else {
- sb.append(",");
- }
- sb.append(entry.getKey());
- sb.append(":\"");
- sb.append(entry.getValue());
- sb.append("\"");
- return mCapabilities.toString();
- }
- return sb.toString();
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mCapabilities.size());
- for (Entry entry : mCapabilities.entrySet()) {
- dest.writeInt(entry.getKey());
- dest.writeString(entry.getValue());
- }
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public static final Creator CREATOR =
- new Creator() {
- public LinkCapabilities createFromParcel(Parcel in) {
- LinkCapabilities capabilities = new LinkCapabilities();
- int size = in.readInt();
- while (size-- != 0) {
- int key = in.readInt();
- String value = in.readString();
- capabilities.mCapabilities.put(key, value);
- }
- return capabilities;
- }
-
- public LinkCapabilities[] newArray(int size) {
- return new LinkCapabilities[size];
- }
- };
-
- /**
- * Debug logging
- */
- protected static void log(String s) {
- if (LOCAL_LOGV) Log.v(TAG, s);
- }
-}
diff --git a/QKSMS/src/main/java/android/net/LinkProperties.java b/QKSMS/src/main/java/android/net/LinkProperties.java
deleted file mode 100644
index bc0ec65d680479a2dccc49a1219c2efd1c53da30..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/LinkProperties.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.TextUtils;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Describes the properties of a network link.
- *
- * A link represents a connection to a network.
- * It may have multiple addresses and multiple gateways,
- * multiple dns servers but only one http proxy.
- *
- * Because it's a single network, the dns's
- * are interchangeable and don't need associating with
- * particular addresses. The gateways similarly don't
- * need associating with particular addresses.
- *
- * A dual stack interface works fine in this model:
- * each address has it's own prefix length to describe
- * the local network. The dns servers all return
- * both v4 addresses and v6 addresses regardless of the
- * address family of the server itself (rfc4213) and we
- * don't care which is used. The gateways will be
- * selected based on the destination address and the
- * source address has no relavence.
- *
- * @hide
- */
-public class LinkProperties implements Parcelable {
-
- String mIfaceName;
- private Collection mLinkAddresses = new ArrayList<>();
- private Collection mDnses = new ArrayList<>();
- private Collection mRoutes = new ArrayList<>();
- private ProxyProperties mHttpProxy;
-
- public static class CompareResult {
- public Collection removed = new ArrayList<>();
- public Collection added = new ArrayList<>();
-
- @Override
- public String toString() {
- String retVal = "removed=[";
- for (T addr : removed) retVal += addr.toString() + ",";
- retVal += "] added=[";
- for (T addr : added) retVal += addr.toString() + ",";
- retVal += "]";
- return retVal;
- }
- }
-
- public LinkProperties() {
- clear();
- }
-
- // copy constructor instead of clone
- public LinkProperties(LinkProperties source) {
- if (source != null) {
- mIfaceName = source.getInterfaceName();
- for (LinkAddress l : source.getLinkAddresses()) mLinkAddresses.add(l);
- for (InetAddress i : source.getDnses()) mDnses.add(i);
- for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
- mHttpProxy = (source.getHttpProxy() == null) ?
- null : new ProxyProperties(source.getHttpProxy());
- }
- }
-
- public void setInterfaceName(String iface) {
- mIfaceName = iface;
- }
-
- public String getInterfaceName() {
- return mIfaceName;
- }
-
- public Collection getAddresses() {
- Collection addresses = new ArrayList<>();
- for (LinkAddress linkAddress : mLinkAddresses) {
- addresses.add(linkAddress.getAddress());
- }
- return Collections.unmodifiableCollection(addresses);
- }
-
- public void addLinkAddress(LinkAddress address) {
- if (address != null) mLinkAddresses.add(address);
- }
-
- public Collection getLinkAddresses() {
- return Collections.unmodifiableCollection(mLinkAddresses);
- }
-
- public void addDns(InetAddress dns) {
- if (dns != null) mDnses.add(dns);
- }
-
- public Collection getDnses() {
- return Collections.unmodifiableCollection(mDnses);
- }
-
- public void addRoute(RouteInfo route) {
- if (route != null) mRoutes.add(route);
- }
-
- public Collection getRoutes() {
- return Collections.unmodifiableCollection(mRoutes);
- }
-
- public void setHttpProxy(ProxyProperties proxy) {
- mHttpProxy = proxy;
- }
-
- public ProxyProperties getHttpProxy() {
- return mHttpProxy;
- }
-
- public void clear() {
- mIfaceName = null;
- mLinkAddresses.clear();
- mDnses.clear();
- mRoutes.clear();
- mHttpProxy = null;
- }
-
- /**
- * Implement the Parcelable interface
- *
- * @hide
- */
- public int describeContents() {
- return 0;
- }
-
- @Override
- public String toString() {
- String ifaceName = (mIfaceName == null ? "" : "InterfaceName: " + mIfaceName + " ");
-
- String linkAddresses = "LinkAddresses: [";
- for (LinkAddress addr : mLinkAddresses) linkAddresses += addr.toString() + ",";
- linkAddresses += "] ";
-
- String dns = "DnsAddresses: [";
- for (InetAddress addr : mDnses) dns += addr.getHostAddress() + ",";
- dns += "] ";
-
- String routes = "Routes: [";
- for (RouteInfo route : mRoutes) routes += route.toString() + ",";
- routes += "] ";
- String proxy = (mHttpProxy == null ? "" : "HttpProxy: " + mHttpProxy.toString() + " ");
-
- return ifaceName + linkAddresses + routes + dns + proxy;
- }
-
- /**
- * Compares this {@code LinkProperties} interface name against the target
- *
- * @param target LinkProperties to compare.
- * @return {@code true} if both are identical, {@code false} otherwise.
- */
- public boolean isIdenticalInterfaceName(LinkProperties target) {
- return TextUtils.equals(getInterfaceName(), target.getInterfaceName());
- }
-
- /**
- * Compares this {@code LinkProperties} interface name against the target
- *
- * @param target LinkProperties to compare.
- * @return {@code true} if both are identical, {@code false} otherwise.
- */
- public boolean isIdenticalAddresses(LinkProperties target) {
- Collection targetAddresses = target.getAddresses();
- Collection sourceAddresses = getAddresses();
- return (sourceAddresses.size() == targetAddresses.size()) && sourceAddresses.containsAll(targetAddresses);
- }
-
- /**
- * Compares this {@code LinkProperties} DNS addresses against the target
- *
- * @param target LinkProperties to compare.
- * @return {@code true} if both are identical, {@code false} otherwise.
- */
- public boolean isIdenticalDnses(LinkProperties target) {
- Collection targetDnses = target.getDnses();
- return (mDnses.size() == targetDnses.size()) && mDnses.containsAll(targetDnses);
- }
-
- /**
- * Compares this {@code LinkProperties} Routes against the target
- *
- * @param target LinkProperties to compare.
- * @return {@code true} if both are identical, {@code false} otherwise.
- */
- public boolean isIdenticalRoutes(LinkProperties target) {
- Collection targetRoutes = target.getRoutes();
- return (mRoutes.size() == targetRoutes.size()) && mRoutes.containsAll(targetRoutes);
- }
-
- /**
- * Compares this {@code LinkProperties} HttpProxy against the target
- *
- * @param target LinkProperties to compare.
- * @return {@code true} if both are identical, {@code false} otherwise.
- */
- public boolean isIdenticalHttpProxy(LinkProperties target) {
- return getHttpProxy() == null ? target.getHttpProxy() == null :
- getHttpProxy().equals(target.getHttpProxy());
- }
-
- @Override
- /**
- * Compares this {@code LinkProperties} instance against the target
- * LinkProperties in {@code obj}. Two LinkPropertieses are equal if
- * all their fields are equal in values.
- *
- * For collection fields, such as mDnses, containsAll() is used to check
- * if two collections contains the same elements, independent of order.
- * There are two thoughts regarding containsAll()
- * 1. Duplicated elements. eg, (A, B, B) and (A, A, B) are equal.
- * 2. Worst case performance is O(n^2).
- *
- * @param obj the object to be tested for equality.
- * @return {@code true} if both objects are equal, {@code false} otherwise.
- */
- public boolean equals(Object obj) {
- if (this == obj) return true;
-
- if (!(obj instanceof LinkProperties)) return false;
-
- LinkProperties target = (LinkProperties) obj;
-
- return isIdenticalInterfaceName(target) &&
- isIdenticalAddresses(target) &&
- isIdenticalDnses(target) &&
- isIdenticalRoutes(target) &&
- isIdenticalHttpProxy(target);
- }
-
- /**
- * Return two lists, a list of addresses that would be removed from
- * mLinkAddresses and a list of addresses that would be added to
- * mLinkAddress which would then result in target and mLinkAddresses
- * being the same list.
- *
- * @param target is a LinkProperties with the new list of addresses
- * @return the removed and added lists.
- */
- public CompareResult compareAddresses(LinkProperties target) {
- /*
- * Duplicate the LinkAddresses into removed, we will be removing
- * address which are common between mLinkAddresses and target
- * leaving the addresses that are different. And address which
- * are in target but not in mLinkAddresses are placed in the
- * addedAddresses.
- */
- CompareResult result = new CompareResult<>();
- result.removed = new ArrayList<>(mLinkAddresses);
- result.added.clear();
- if (target != null) {
- for (LinkAddress newAddress : target.getLinkAddresses()) {
- if (!result.removed.remove(newAddress)) {
- result.added.add(newAddress);
- }
- }
- }
- return result;
- }
-
- /**
- * Return two lists, a list of dns addresses that would be removed from
- * mDnses and a list of addresses that would be added to
- * mDnses which would then result in target and mDnses
- * being the same list.
- *
- * @param target is a LinkProperties with the new list of dns addresses
- * @return the removed and added lists.
- */
- public CompareResult compareDnses(LinkProperties target) {
- /*
- * Duplicate the InetAddresses into removed, we will be removing
- * dns address which are common between mDnses and target
- * leaving the addresses that are different. And dns address which
- * are in target but not in mDnses are placed in the
- * addedAddresses.
- */
- CompareResult result = new CompareResult<>();
-
- result.removed = new ArrayList<>(mDnses);
- result.added.clear();
- if (target != null) {
- for (InetAddress newAddress : target.getDnses()) {
- if (!result.removed.remove(newAddress)) {
- result.added.add(newAddress);
- }
- }
- }
- return result;
- }
-
- /**
- * Return two lists, a list of routes that would be removed from
- * mRoutes and a list of routes that would be added to
- * mRoutes which would then result in target and mRoutes
- * being the same list.
- *
- * @param target is a LinkProperties with the new list of routes
- * @return the removed and added lists.
- */
- public CompareResult compareRoutes(LinkProperties target) {
- /*
- * Duplicate the RouteInfos into removed, we will be removing
- * routes which are common between mDnses and target
- * leaving the routes that are different. And route address which
- * are in target but not in mRoutes are placed in added.
- */
- CompareResult result = new CompareResult<>();
-
- result.removed = new ArrayList<>(mRoutes);
- result.added.clear();
- if (target != null) {
- for (RouteInfo r : target.getRoutes()) {
- if (!result.removed.remove(r)) {
- result.added.add(r);
- }
- }
- }
- return result;
- }
-
-
- @Override
- /**
- * generate hashcode based on significant fields
- * Equal objects must produce the same hash code, while unequal objects
- * may have the same hash codes.
- */
- public int hashCode() {
- return ((null == mIfaceName) ? 0 : mIfaceName.hashCode()
- + mLinkAddresses.size() * 31
- + mDnses.size() * 37
- + mRoutes.size() * 41
- + ((null == mHttpProxy) ? 0 : mHttpProxy.hashCode()));
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(getInterfaceName());
- dest.writeInt(mLinkAddresses.size());
- for (LinkAddress linkAddress : mLinkAddresses) {
- dest.writeParcelable(linkAddress, flags);
- }
-
- dest.writeInt(mDnses.size());
- for (InetAddress d : mDnses) {
- dest.writeByteArray(d.getAddress());
- }
-
- dest.writeInt(mRoutes.size());
- for (RouteInfo route : mRoutes) {
- dest.writeParcelable(route, flags);
- }
-
- if (mHttpProxy != null) {
- dest.writeByte((byte) 1);
- dest.writeParcelable(mHttpProxy, flags);
- } else {
- dest.writeByte((byte) 0);
- }
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public static final Creator CREATOR =
- new Creator() {
- public LinkProperties createFromParcel(Parcel in) {
- LinkProperties netProp = new LinkProperties();
- String iface = in.readString();
- if (iface != null) {
- try {
- netProp.setInterfaceName(iface);
- } catch (Exception e) {
- return null;
- }
- }
- int addressCount = in.readInt();
- for (int i = 0; i < addressCount; i++) {
- netProp.addLinkAddress((LinkAddress) in.readParcelable(null));
- }
- addressCount = in.readInt();
- for (int i = 0; i < addressCount; i++) {
- try {
- netProp.addDns(InetAddress.getByAddress(in.createByteArray()));
- } catch (UnknownHostException e) {
- }
- }
- addressCount = in.readInt();
- for (int i = 0; i < addressCount; i++) {
- netProp.addRoute((RouteInfo) in.readParcelable(null));
- }
- if (in.readByte() == 1) {
- netProp.setHttpProxy((ProxyProperties) in.readParcelable(null));
- }
- return netProp;
- }
-
- public LinkProperties[] newArray(int size) {
- return new LinkProperties[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkIdentity.java b/QKSMS/src/main/java/android/net/NetworkIdentity.java
deleted file mode 100644
index 430a60e975559c6c013803dc720c6f69b612eddb..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkIdentity.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.content.Context;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-import android.telephony.TelephonyManager;
-
-import com.android.internal.util.Objects;
-
-import static android.net.ConnectivityManager.TYPE_WIFI;
-
-/**
- * Network definition that includes strong identity. Analogous to combining
- * {@link NetworkInfo} and an IMSI.
- *
- * @hide
- */
-public class NetworkIdentity {
- /**
- * When enabled, combine all {@link #mSubType} together under
- * {@link #SUBTYPE_COMBINED}.
- */
- public static final boolean COMBINE_SUBTYPE_ENABLED = true;
-
- public static final int SUBTYPE_COMBINED = -1;
-
- final int mType;
- final int mSubType;
- final String mSubscriberId;
- final String mNetworkId;
- final boolean mRoaming;
-
- public NetworkIdentity(
- int type, int subType, String subscriberId, String networkId, boolean roaming) {
- mType = type;
- mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType;
- mSubscriberId = subscriberId;
- mNetworkId = networkId;
- mRoaming = roaming;
- }
-
- /**
- * {@hide}
- */
- public static String getNetworkTypeName(int type) {
- switch (type) {
- case 0:
- return "MOBILE";
- case TYPE_WIFI:
- return "WIFI";
- case 2:
- return "MOBILE_MMS";
- case 3:
- return "MOBILE_SUPL";
- case 4:
- return "MOBILE_DUN";
- case 5:
- return "MOBILE_HIPRI";
- case 6:
- return "WIMAX";
- case 7:
- return "BLUETOOTH";
- case 8:
- return "DUMMY";
- case 9:
- return "ETHERNET";
- case 10:
- return "MOBILE_FOTA";
- case 11:
- return "MOBILE_IMS";
- case 12:
- return "MOBILE_CBS";
- case 13:
- return "WIFI_P2P";
- default:
- return Integer.toString(type);
- }
- }
-
- /**
- * {@hide}
- */
- public static boolean isNetworkTypeMobile(int networkType) {
- switch (networkType) {
- case 0:
- case 2:
- case 3:
- case 4:
- case 5:
- case 10:
- case 11:
- case 12:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(mType, mSubType, mSubscriberId, mNetworkId, mRoaming);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof NetworkIdentity) {
- final NetworkIdentity ident = (NetworkIdentity) obj;
- return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
- && Objects.equal(mSubscriberId, ident.mSubscriberId)
- && Objects.equal(mNetworkId, ident.mNetworkId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder("[");
- builder.append("type=").append(getNetworkTypeName(mType));
- builder.append(", subType=");
- if (COMBINE_SUBTYPE_ENABLED) {
- builder.append("COMBINED");
- } else if (isNetworkTypeMobile(mType)) {
- builder.append(getNetworkTypeName(mSubType));
- } else {
- builder.append(mSubType);
- }
- if (mSubscriberId != null) {
- builder.append(", subscriberId=").append(scrubSubscriberId(mSubscriberId));
- }
- if (mNetworkId != null) {
- builder.append(", networkId=").append(mNetworkId);
- }
- if (mRoaming) {
- builder.append(", ROAMING");
- }
- return builder.append("]").toString();
- }
-
- public int getType() {
- return mType;
- }
-
- public int getSubType() {
- return mSubType;
- }
-
- public String getSubscriberId() {
- return mSubscriberId;
- }
-
- public String getNetworkId() {
- return mNetworkId;
- }
-
- public boolean getRoaming() {
- return mRoaming;
- }
-
- /**
- * Scrub given IMSI on production builds.
- */
- public static String scrubSubscriberId(String subscriberId) {
- if ("eng".equals(Build.TYPE)) {
- return subscriberId;
- } else if (subscriberId != null) {
- // TODO: parse this as MCC+MNC instead of hard-coding
- return subscriberId.substring(0, Math.min(6, subscriberId.length())) + "...";
- } else {
- return "null";
- }
- }
-
- /**
- * Build a {@link android.net.NetworkIdentity} from the given {@link NetworkState},
- * assuming that any mobile networks are using the current IMSI.
- */
- public static NetworkIdentity buildNetworkIdentity(Context context, NetworkState state) {
- final int type = state.networkInfo.getType();
- final int subType = state.networkInfo.getSubtype();
-
- // TODO: consider moving subscriberId over to LinkCapabilities, so it
- // comes from an authoritative source.
-
- String subscriberId = null;
- String networkId = null;
- boolean roaming = false;
-
- if (isNetworkTypeMobile(type)) {
- final TelephonyManager telephony = (TelephonyManager) context.getSystemService(
- Context.TELEPHONY_SERVICE);
- roaming = telephony.isNetworkRoaming();
- if (state.subscriberId != null) {
- subscriberId = state.subscriberId;
- } else {
- subscriberId = telephony.getSubscriberId();
- }
-
- } else if (type == TYPE_WIFI) {
- if (state.networkId != null) {
- networkId = state.networkId;
- } else {
- final WifiManager wifi = (WifiManager) context.getSystemService(
- Context.WIFI_SERVICE);
- final WifiInfo info = wifi.getConnectionInfo();
- networkId = info != null ? info.getSSID() : null;
- }
- }
-
- return new NetworkIdentity(type, subType, subscriberId, networkId, roaming);
- }
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkPolicy.java b/QKSMS/src/main/java/android/net/NetworkPolicy.java
deleted file mode 100644
index 9d46b7974393c907c0138d744aae4beb123e92b7..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkPolicy.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.android.internal.util.Objects;
-
-import static com.android.internal.util.Preconditions.checkNotNull;
-
-/**
- * Policy for networks matching a {@link NetworkTemplate}, including usage cycle
- * and limits to be enforced.
- *
- * @hide
- */
-public class NetworkPolicy implements Parcelable, Comparable {
- public static final int CYCLE_NONE = -1;
- public static final long WARNING_DISABLED = -1;
- public static final long LIMIT_DISABLED = -1;
- public static final long SNOOZE_NEVER = -1;
-
- public final NetworkTemplate template;
- public int cycleDay;
- public String cycleTimezone;
- public long warningBytes;
- public long limitBytes;
- public long lastWarningSnooze;
- public long lastLimitSnooze;
- public boolean metered;
- public boolean inferred;
-
- private static final long DEFAULT_MTU = 1500;
-
- @Deprecated
- public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
- long warningBytes, long limitBytes, boolean metered) {
- this(template, cycleDay, cycleTimezone, warningBytes, limitBytes, SNOOZE_NEVER,
- SNOOZE_NEVER, metered, false);
- }
-
- public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
- long warningBytes, long limitBytes, long lastWarningSnooze, long lastLimitSnooze,
- boolean metered, boolean inferred) {
- this.template = checkNotNull(template, "missing NetworkTemplate");
- this.cycleDay = cycleDay;
- this.cycleTimezone = checkNotNull(cycleTimezone, "missing cycleTimezone");
- this.warningBytes = warningBytes;
- this.limitBytes = limitBytes;
- this.lastWarningSnooze = lastWarningSnooze;
- this.lastLimitSnooze = lastLimitSnooze;
- this.metered = metered;
- this.inferred = inferred;
- }
-
- public NetworkPolicy(Parcel in) {
- template = in.readParcelable(null);
- cycleDay = in.readInt();
- cycleTimezone = in.readString();
- warningBytes = in.readLong();
- limitBytes = in.readLong();
- lastWarningSnooze = in.readLong();
- lastLimitSnooze = in.readLong();
- metered = in.readInt() != 0;
- inferred = in.readInt() != 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeParcelable(template, flags);
- dest.writeInt(cycleDay);
- dest.writeString(cycleTimezone);
- dest.writeLong(warningBytes);
- dest.writeLong(limitBytes);
- dest.writeLong(lastWarningSnooze);
- dest.writeLong(lastLimitSnooze);
- dest.writeInt(metered ? 1 : 0);
- dest.writeInt(inferred ? 1 : 0);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Test if given measurement is over {@link #warningBytes}.
- */
- public boolean isOverWarning(long totalBytes) {
- return warningBytes != WARNING_DISABLED && totalBytes >= warningBytes;
- }
-
- /**
- * Test if given measurement is near enough to {@link #limitBytes} to be
- * considered over-limit.
- */
- public boolean isOverLimit(long totalBytes) {
- // over-estimate, since kernel will trigger limit once first packet
- // trips over limit.
- totalBytes += 2 * DEFAULT_MTU;
- return limitBytes != LIMIT_DISABLED && totalBytes >= limitBytes;
- }
-
- /**
- * Clear any existing snooze values, setting to {@link #SNOOZE_NEVER}.
- */
- public void clearSnooze() {
- lastWarningSnooze = SNOOZE_NEVER;
- lastLimitSnooze = SNOOZE_NEVER;
- }
-
- /**
- * Test if this policy has a cycle defined, after which usage should reset.
- */
- public boolean hasCycle() {
- return cycleDay != CYCLE_NONE;
- }
-
- @Override
- public int compareTo(NetworkPolicy another) {
- if (another == null || another.limitBytes == LIMIT_DISABLED) {
- // other value is missing or disabled; we win
- return -1;
- }
- if (limitBytes == LIMIT_DISABLED || another.limitBytes < limitBytes) {
- // we're disabled or other limit is smaller; they win
- return 1;
- }
- return 0;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(template, cycleDay, cycleTimezone, warningBytes, limitBytes,
- lastWarningSnooze, lastLimitSnooze, metered, inferred);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof NetworkPolicy) {
- final NetworkPolicy other = (NetworkPolicy) obj;
- return cycleDay == other.cycleDay && warningBytes == other.warningBytes
- && limitBytes == other.limitBytes
- && lastWarningSnooze == other.lastWarningSnooze
- && lastLimitSnooze == other.lastLimitSnooze && metered == other.metered
- && inferred == other.inferred
- && Objects.equal(cycleTimezone, other.cycleTimezone)
- && Objects.equal(template, other.template);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "NetworkPolicy" + "[" + template + "]:" + " cycleDay=" + cycleDay + ", cycleTimezone=" + cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes + ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze=" + lastLimitSnooze + ", metered=" + metered + ", inferred=" + inferred;
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public NetworkPolicy createFromParcel(Parcel in) {
- return new NetworkPolicy(in);
- }
-
- @Override
- public NetworkPolicy[] newArray(int size) {
- return new NetworkPolicy[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkPolicyManager.java b/QKSMS/src/main/java/android/net/NetworkPolicyManager.java
deleted file mode 100644
index c734cd5e6e483109aadcf7cc459b684efaf58a87..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkPolicyManager.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.Signature;
-import android.os.RemoteException;
-import android.text.format.Time;
-
-import com.google.android.collect.Sets;
-
-import java.io.PrintWriter;
-import java.util.HashSet;
-
-import static android.content.pm.PackageManager.GET_SIGNATURES;
-import static android.net.NetworkPolicy.CYCLE_NONE;
-import static android.text.format.Time.MONTH_DAY;
-
-/**
- * Manager for creating and modifying network policy rules.
- *
- * {@hide}
- */
-public class NetworkPolicyManager {
-
- /**
- * No specific network policy, use system default.
- */
- public static final int POLICY_NONE = 0x0;
- /**
- * Reject network usage on metered networks when application in background.
- */
- public static final int POLICY_REJECT_METERED_BACKGROUND = 0x1;
-
- /**
- * All network traffic should be allowed.
- */
- public static final int RULE_ALLOW_ALL = 0x0;
- /**
- * Reject traffic on metered networks.
- */
- public static final int RULE_REJECT_METERED = 0x1;
-
- private static final boolean ALLOW_PLATFORM_APP_POLICY = true;
-
- /**
- * {@link Intent} extra that indicates which {@link NetworkTemplate} rule it
- * applies to.
- */
- public static final String EXTRA_NETWORK_TEMPLATE = "android.net.NETWORK_TEMPLATE";
-
- private INetworkPolicyManager mService;
-
- public NetworkPolicyManager(INetworkPolicyManager service) {
- if (service == null) {
- throw new IllegalArgumentException("missing INetworkPolicyManager");
- }
- mService = service;
- }
-
- public static NetworkPolicyManager from(Context context) {
- return (NetworkPolicyManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- }
-
- /**
- * Set policy flags for specific UID.
- *
- * @param policy {@link #POLICY_NONE} or combination of flags like
- * {@link #POLICY_REJECT_METERED_BACKGROUND}.
- */
- public void setUidPolicy(int uid, int policy) {
- try {
- mService.setUidPolicy(uid, policy);
- } catch (RemoteException e) {
- }
- }
-
- public int getUidPolicy(int uid) {
- try {
- return mService.getUidPolicy(uid);
- } catch (RemoteException e) {
- return POLICY_NONE;
- }
- }
-
- public int[] getUidsWithPolicy(int policy) {
- try {
- return mService.getUidsWithPolicy(policy);
- } catch (RemoteException e) {
- return new int[0];
- }
- }
-
- public void registerListener(INetworkPolicyListener listener) {
- try {
- mService.registerListener(listener);
- } catch (RemoteException e) {
- }
- }
-
- public void unregisterListener(INetworkPolicyListener listener) {
- try {
- mService.unregisterListener(listener);
- } catch (RemoteException e) {
- }
- }
-
- public void setNetworkPolicies(NetworkPolicy[] policies) {
- try {
- mService.setNetworkPolicies(policies);
- } catch (RemoteException e) {
- }
- }
-
- public NetworkPolicy[] getNetworkPolicies() {
- try {
- return mService.getNetworkPolicies();
- } catch (RemoteException e) {
- return null;
- }
- }
-
- public void setRestrictBackground(boolean restrictBackground) {
- try {
- mService.setRestrictBackground(restrictBackground);
- } catch (RemoteException e) {
- }
- }
-
- public boolean getRestrictBackground() {
- try {
- return mService.getRestrictBackground();
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * Compute the last cycle boundary for the given {@link NetworkPolicy}. For
- * example, if cycle day is 20th, and today is June 15th, it will return May
- * 20th. When cycle day doesn't exist in current month, it snaps to the 1st
- * of following month.
- *
- * @hide
- */
- public static long computeLastCycleBoundary(long currentTime, NetworkPolicy policy) {
- if (policy.cycleDay == CYCLE_NONE) {
- throw new IllegalArgumentException("Unable to compute boundary without cycleDay");
- }
-
- final Time now = new Time(policy.cycleTimezone);
- now.set(currentTime);
-
- // first, find cycle boundary for current month
- final Time cycle = new Time(now);
- cycle.hour = cycle.minute = cycle.second = 0;
- snapToCycleDay(cycle, policy.cycleDay);
-
- if (Time.compare(cycle, now) >= 0) {
- // cycle boundary is beyond now, use last cycle boundary; start by
- // pushing ourselves squarely into last month.
- final Time lastMonth = new Time(now);
- lastMonth.hour = lastMonth.minute = lastMonth.second = 0;
- lastMonth.monthDay = 1;
- lastMonth.month -= 1;
- lastMonth.normalize(true);
-
- cycle.set(lastMonth);
- snapToCycleDay(cycle, policy.cycleDay);
- }
-
- return cycle.toMillis(true);
- }
-
- /**
- * {@hide}
- */
- public static long computeNextCycleBoundary(long currentTime, NetworkPolicy policy) {
- if (policy.cycleDay == CYCLE_NONE) {
- throw new IllegalArgumentException("Unable to compute boundary without cycleDay");
- }
-
- final Time now = new Time(policy.cycleTimezone);
- now.set(currentTime);
-
- // first, find cycle boundary for current month
- final Time cycle = new Time(now);
- cycle.hour = cycle.minute = cycle.second = 0;
- snapToCycleDay(cycle, policy.cycleDay);
-
- if (Time.compare(cycle, now) <= 0) {
- // cycle boundary is before now, use next cycle boundary; start by
- // pushing ourselves squarely into next month.
- final Time nextMonth = new Time(now);
- nextMonth.hour = nextMonth.minute = nextMonth.second = 0;
- nextMonth.monthDay = 1;
- nextMonth.month += 1;
- nextMonth.normalize(true);
-
- cycle.set(nextMonth);
- snapToCycleDay(cycle, policy.cycleDay);
- }
-
- return cycle.toMillis(true);
- }
-
- /**
- * Snap to the cycle day for the current month given; when cycle day doesn't
- * exist, it snaps to last second of current month.
- *
- * @hide
- */
- public static void snapToCycleDay(Time time, int cycleDay) {
- if (cycleDay > time.getActualMaximum(MONTH_DAY)) {
- // cycle day isn't valid this month; snap to last second of month
- time.month += 1;
- time.monthDay = 1;
- time.second = -1;
- } else {
- time.monthDay = cycleDay;
- }
- time.normalize(true);
- }
-
- /**
- * Check if given UID can have a {@link #setUidPolicy(int, int)} defined,
- * usually to protect critical system services.
- */
- @Deprecated
- public static boolean isUidValidForPolicy(Context context, int uid) {
-
- if (!ALLOW_PLATFORM_APP_POLICY) {
- final PackageManager pm = context.getPackageManager();
- final HashSet systemSignature;
- try {
- systemSignature = Sets.newHashSet(
- pm.getPackageInfo("android", GET_SIGNATURES).signatures);
- } catch (NameNotFoundException e) {
- throw new RuntimeException("problem finding system signature", e);
- }
-
- try {
- // reject apps signed with platform cert
- for (String packageName : pm.getPackagesForUid(uid)) {
- final HashSet packageSignature = Sets.newHashSet(
- pm.getPackageInfo(packageName, GET_SIGNATURES).signatures);
- if (packageSignature.containsAll(systemSignature)) {
- return false;
- }
- }
- } catch (NameNotFoundException e) {
- }
- }
-
- // nothing found above; we can apply policy to UID
- return true;
- }
-
- /**
- * {@hide}
- */
- public static void dumpPolicy(PrintWriter fout, int policy) {
- fout.write("[");
- if ((policy & POLICY_REJECT_METERED_BACKGROUND) != 0) {
- fout.write("REJECT_METERED_BACKGROUND");
- }
- fout.write("]");
- }
-
- /**
- * {@hide}
- */
- public static void dumpRules(PrintWriter fout, int rules) {
- fout.write("[");
- if ((rules & RULE_REJECT_METERED) != 0) {
- fout.write("REJECT_METERED");
- }
- fout.write("]");
- }
-
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkQuotaInfo.java b/QKSMS/src/main/java/android/net/NetworkQuotaInfo.java
deleted file mode 100644
index b67d41c7bda50776bea82159feda033da5721306..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkQuotaInfo.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Information about quota status on a specific network.
- *
- * @hide
- */
-public class NetworkQuotaInfo implements Parcelable {
- private final long mEstimatedBytes;
- private final long mSoftLimitBytes;
- private final long mHardLimitBytes;
-
- public static final long NO_LIMIT = -1;
-
- /**
- * {@hide}
- */
- public NetworkQuotaInfo(long estimatedBytes, long softLimitBytes, long hardLimitBytes) {
- mEstimatedBytes = estimatedBytes;
- mSoftLimitBytes = softLimitBytes;
- mHardLimitBytes = hardLimitBytes;
- }
-
- /**
- * {@hide}
- */
- public NetworkQuotaInfo(Parcel in) {
- mEstimatedBytes = in.readLong();
- mSoftLimitBytes = in.readLong();
- mHardLimitBytes = in.readLong();
- }
-
- public long getEstimatedBytes() {
- return mEstimatedBytes;
- }
-
- public long getSoftLimitBytes() {
- return mSoftLimitBytes;
- }
-
- public long getHardLimitBytes() {
- return mHardLimitBytes;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeLong(mEstimatedBytes);
- out.writeLong(mSoftLimitBytes);
- out.writeLong(mHardLimitBytes);
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public NetworkQuotaInfo createFromParcel(Parcel in) {
- return new NetworkQuotaInfo(in);
- }
-
- @Override
- public NetworkQuotaInfo[] newArray(int size) {
- return new NetworkQuotaInfo[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkState.java b/QKSMS/src/main/java/android/net/NetworkState.java
deleted file mode 100644
index 30f13701072fcae722c629b6e38bf7eca5c0b2db..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkState.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Snapshot of network state.
- *
- * @hide
- */
-public class NetworkState implements Parcelable {
-
- public final NetworkInfo networkInfo;
- public final LinkProperties linkProperties;
- public final LinkCapabilities linkCapabilities;
- /**
- * Currently only used by testing.
- */
- public final String subscriberId;
- public final String networkId;
-
- public NetworkState(NetworkInfo networkInfo, LinkProperties linkProperties,
- LinkCapabilities linkCapabilities) {
- this(networkInfo, linkProperties, linkCapabilities, null, null);
- }
-
- public NetworkState(NetworkInfo networkInfo, LinkProperties linkProperties,
- LinkCapabilities linkCapabilities, String subscriberId, String networkId) {
- this.networkInfo = networkInfo;
- this.linkProperties = linkProperties;
- this.linkCapabilities = linkCapabilities;
- this.subscriberId = subscriberId;
- this.networkId = networkId;
- }
-
- public NetworkState(Parcel in) {
- networkInfo = in.readParcelable(null);
- linkProperties = in.readParcelable(null);
- linkCapabilities = in.readParcelable(null);
- subscriberId = in.readString();
- networkId = in.readString();
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeParcelable(networkInfo, flags);
- out.writeParcelable(linkProperties, flags);
- out.writeParcelable(linkCapabilities, flags);
- out.writeString(subscriberId);
- out.writeString(networkId);
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public NetworkState createFromParcel(Parcel in) {
- return new NetworkState(in);
- }
-
- @Override
- public NetworkState[] newArray(int size) {
- return new NetworkState[size];
- }
- };
-
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkTemplate.java b/QKSMS/src/main/java/android/net/NetworkTemplate.java
deleted file mode 100644
index 8a2cd6261b2c01cbd8f33997afeae202deea5ae1..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkTemplate.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.Objects;
-
-import static android.net.ConnectivityManager.TYPE_ETHERNET;
-import static android.net.ConnectivityManager.TYPE_WIFI;
-import static android.net.ConnectivityManager.TYPE_WIMAX;
-import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
-import static android.net.NetworkIdentity.scrubSubscriberId;
-import static com.android.internal.util.ArrayUtils.contains;
-
-/**
- * Template definition used to generically match {@link NetworkIdentity},
- * usually when collecting statistics.
- *
- * @hide
- */
-public class NetworkTemplate implements Parcelable {
-
- public static final int MATCH_MOBILE_ALL = 1;
- public static final int MATCH_MOBILE_3G_LOWER = 2;
- public static final int MATCH_MOBILE_4G = 3;
- public static final int MATCH_WIFI = 4;
- public static final int MATCH_ETHERNET = 5;
- public static final int MATCH_MOBILE_WILDCARD = 6;
- public static final int MATCH_WIFI_WILDCARD = 7;
-
- /**
- * Network type is unknown
- */
- public static final int NETWORK_TYPE_UNKNOWN = 0;
- /**
- * Current network is GPRS
- */
- public static final int NETWORK_TYPE_GPRS = 1;
- /**
- * Current network is EDGE
- */
- public static final int NETWORK_TYPE_EDGE = 2;
- /**
- * Current network is UMTS
- */
- public static final int NETWORK_TYPE_UMTS = 3;
- /**
- * Current network is CDMA: Either IS95A or IS95B
- */
- public static final int NETWORK_TYPE_CDMA = 4;
- /**
- * Current network is EVDO revision 0
- */
- public static final int NETWORK_TYPE_EVDO_0 = 5;
- /**
- * Current network is EVDO revision A
- */
- public static final int NETWORK_TYPE_EVDO_A = 6;
- /**
- * Current network is 1xRTT
- */
- public static final int NETWORK_TYPE_1xRTT = 7;
- /**
- * Current network is HSDPA
- */
- public static final int NETWORK_TYPE_HSDPA = 8;
- /**
- * Current network is HSUPA
- */
- public static final int NETWORK_TYPE_HSUPA = 9;
- /**
- * Current network is HSPA
- */
- public static final int NETWORK_TYPE_HSPA = 10;
- /**
- * Current network is iDen
- */
- public static final int NETWORK_TYPE_IDEN = 11;
- /**
- * Current network is EVDO revision B
- */
- public static final int NETWORK_TYPE_EVDO_B = 12;
- /**
- * Current network is LTE
- */
- public static final int NETWORK_TYPE_LTE = 13;
- /**
- * Current network is eHRPD
- */
- public static final int NETWORK_TYPE_EHRPD = 14;
- /**
- * Current network is HSPA+
- */
- public static final int NETWORK_TYPE_HSPAP = 15;
-
- /**
- * Unknown network class. {@hide}
- */
- public static final int NETWORK_CLASS_UNKNOWN = 0;
- /**
- * Class of broadly defined "2G" networks. {@hide}
- */
- public static final int NETWORK_CLASS_2_G = 1;
- /**
- * Class of broadly defined "3G" networks. {@hide}
- */
- public static final int NETWORK_CLASS_3_G = 2;
- /**
- * Class of broadly defined "4G" networks. {@hide}
- */
- public static final int NETWORK_CLASS_4_G = 3;
-
- /**
- * Return general class of network type, such as "3G" or "4G". In cases
- * where classification is contentious, this method is conservative.
- *
- * @hide
- */
- public static int getNetworkClass(int networkType) {
- switch (networkType) {
- case NETWORK_TYPE_GPRS:
- case NETWORK_TYPE_EDGE:
- case NETWORK_TYPE_CDMA:
- case NETWORK_TYPE_1xRTT:
- case NETWORK_TYPE_IDEN:
- return NETWORK_CLASS_2_G;
- case NETWORK_TYPE_UMTS:
- case NETWORK_TYPE_EVDO_0:
- case NETWORK_TYPE_EVDO_A:
- case NETWORK_TYPE_HSDPA:
- case NETWORK_TYPE_HSUPA:
- case NETWORK_TYPE_HSPA:
- case NETWORK_TYPE_EVDO_B:
- case NETWORK_TYPE_EHRPD:
- case NETWORK_TYPE_HSPAP:
- return NETWORK_CLASS_3_G;
- case NETWORK_TYPE_LTE:
- return NETWORK_CLASS_4_G;
- default:
- return NETWORK_CLASS_UNKNOWN;
- }
- }
-
- /**
- * Set of {@link NetworkInfo#getType()} that reflect data usage.
- */
- private static final int[] DATA_USAGE_NETWORK_TYPES = {0};
-
- private static boolean sForceAllNetworkTypes = false;
-
- @VisibleForTesting
- public static void forceAllNetworkTypes() {
- sForceAllNetworkTypes = true;
- }
-
- /**
- * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
- * the given IMSI.
- */
- public static NetworkTemplate buildTemplateMobileAll(String subscriberId) {
- return new NetworkTemplate(MATCH_MOBILE_ALL, subscriberId, null);
- }
-
- /**
- * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
- * the given IMSI that roughly meet a "3G" definition, or lower.
- */
- @Deprecated
- public static NetworkTemplate buildTemplateMobile3gLower(String subscriberId) {
- return new NetworkTemplate(MATCH_MOBILE_3G_LOWER, subscriberId, null);
- }
-
- /**
- * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
- * the given IMSI that roughly meet a "4G" definition.
- */
- @Deprecated
- public static NetworkTemplate buildTemplateMobile4g(String subscriberId) {
- return new NetworkTemplate(MATCH_MOBILE_4G, subscriberId, null);
- }
-
- /**
- * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks,
- * regardless of IMSI.
- */
- public static NetworkTemplate buildTemplateMobileWildcard() {
- return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
- }
-
- /**
- * Template to match all {@link ConnectivityManager#TYPE_WIFI} networks,
- * regardless of SSID.
- */
- public static NetworkTemplate buildTemplateWifiWildcard() {
- return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
- }
-
- @Deprecated
- public static NetworkTemplate buildTemplateWifi() {
- return buildTemplateWifiWildcard();
- }
-
- /**
- * Template to match {@link ConnectivityManager#TYPE_WIFI} networks with the
- * given SSID.
- */
- public static NetworkTemplate buildTemplateWifi(String networkId) {
- return new NetworkTemplate(MATCH_WIFI, null, networkId);
- }
-
- /**
- * Template to combine all {@link ConnectivityManager#TYPE_ETHERNET} style
- * networks together.
- */
- public static NetworkTemplate buildTemplateEthernet() {
- return new NetworkTemplate(MATCH_ETHERNET, null, null);
- }
-
- private final int mMatchRule;
- private final String mSubscriberId;
- private final String mNetworkId;
-
- public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
- mMatchRule = matchRule;
- mSubscriberId = subscriberId;
- mNetworkId = networkId;
- }
-
- private NetworkTemplate(Parcel in) {
- mMatchRule = in.readInt();
- mSubscriberId = in.readString();
- mNetworkId = in.readString();
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mMatchRule);
- dest.writeString(mSubscriberId);
- dest.writeString(mNetworkId);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder("NetworkTemplate: ");
- builder.append("matchRule=").append(getMatchRuleName(mMatchRule));
- if (mSubscriberId != null) {
- builder.append(", subscriberId=").append(scrubSubscriberId(mSubscriberId));
- }
- if (mNetworkId != null) {
- builder.append(", networkId=").append(mNetworkId);
- }
- return builder.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(mMatchRule, mSubscriberId, mNetworkId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof NetworkTemplate) {
- final NetworkTemplate other = (NetworkTemplate) obj;
- return mMatchRule == other.mMatchRule
- && Objects.equal(mSubscriberId, other.mSubscriberId)
- && Objects.equal(mNetworkId, other.mNetworkId);
- }
- return false;
- }
-
- public int getMatchRule() {
- return mMatchRule;
- }
-
- public String getSubscriberId() {
- return mSubscriberId;
- }
-
- public String getNetworkId() {
- return mNetworkId;
- }
-
- /**
- * Test if given {@link NetworkIdentity} matches this template.
- */
- public boolean matches(NetworkIdentity ident) {
- switch (mMatchRule) {
- case MATCH_MOBILE_ALL:
- return matchesMobile(ident);
- case MATCH_MOBILE_3G_LOWER:
- return matchesMobile3gLower(ident);
- case MATCH_MOBILE_4G:
- return matchesMobile4g(ident);
- case MATCH_WIFI:
- return matchesWifi(ident);
- case MATCH_ETHERNET:
- return matchesEthernet(ident);
- case MATCH_MOBILE_WILDCARD:
- return matchesMobileWildcard(ident);
- case MATCH_WIFI_WILDCARD:
- return matchesWifiWildcard(ident);
- default:
- throw new IllegalArgumentException("unknown network template");
- }
- }
-
- /**
- * Check if mobile network with matching IMSI.
- */
- private boolean matchesMobile(NetworkIdentity ident) {
- // TODO: consider matching against WiMAX subscriber identity
- return ident.mType == TYPE_WIMAX || ((sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType)) && Objects.equal(mSubscriberId, ident.mSubscriberId));
- }
-
- /**
- * Check if mobile network classified 3G or lower with matching IMSI.
- */
- private boolean matchesMobile3gLower(NetworkIdentity ident) {
- ensureSubtypeAvailable();
- if (ident.mType == TYPE_WIMAX) {
- return false;
- } else if (matchesMobile(ident)) {
- switch (getNetworkClass(ident.mSubType)) {
- case 0:
- case 1:
- case 2:
- return true;
- }
- }
- return false;
- }
-
- /**
- * Check if mobile network classified 4G with matching IMSI.
- */
- private boolean matchesMobile4g(NetworkIdentity ident) {
- ensureSubtypeAvailable();
- if (ident.mType == TYPE_WIMAX) {
- // TODO: consider matching against WiMAX subscriber identity
- return true;
- } else if (matchesMobile(ident)) {
- switch (getNetworkClass(ident.mSubType)) {
- case 3:
- return true;
- }
- }
- return false;
- }
-
- /**
- * Check if matches Wi-Fi network template.
- */
- private boolean matchesWifi(NetworkIdentity ident) {
- switch (ident.mType) {
- case TYPE_WIFI:
- return Objects.equal(mNetworkId, ident.mNetworkId);
- default:
- return false;
- }
- }
-
- /**
- * Check if matches Ethernet network template.
- */
- private boolean matchesEthernet(NetworkIdentity ident) {
- return ident.mType == TYPE_ETHERNET;
- }
-
- private boolean matchesMobileWildcard(NetworkIdentity ident) {
- return ident.mType == TYPE_WIMAX || sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType);
- }
-
- private boolean matchesWifiWildcard(NetworkIdentity ident) {
- switch (ident.mType) {
- case TYPE_WIFI:
- case 13:
- return true;
- default:
- return false;
- }
- }
-
- private static String getMatchRuleName(int matchRule) {
- switch (matchRule) {
- case MATCH_MOBILE_3G_LOWER:
- return "MOBILE_3G_LOWER";
- case MATCH_MOBILE_4G:
- return "MOBILE_4G";
- case MATCH_MOBILE_ALL:
- return "MOBILE_ALL";
- case MATCH_WIFI:
- return "WIFI";
- case MATCH_ETHERNET:
- return "ETHERNET";
- case MATCH_MOBILE_WILDCARD:
- return "MOBILE_WILDCARD";
- case MATCH_WIFI_WILDCARD:
- return "WIFI_WILDCARD";
- default:
- return "UNKNOWN";
- }
- }
-
- private static void ensureSubtypeAvailable() {
- if (COMBINE_SUBTYPE_ENABLED) {
- throw new IllegalArgumentException(
- "Unable to enforce 3G_LOWER template on combined data.");
- }
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public NetworkTemplate createFromParcel(Parcel in) {
- return new NetworkTemplate(in);
- }
-
- @Override
- public NetworkTemplate[] newArray(int size) {
- return new NetworkTemplate[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/NetworkUtils.java b/QKSMS/src/main/java/android/net/NetworkUtils.java
deleted file mode 100644
index 7beb6a3cc270c297530c790e90498fb13369eaed..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/NetworkUtils.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.util.Log;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-
-/**
- * Native methods for managing network interfaces.
- *
- * {@hide}
- */
-public class NetworkUtils {
-
- private static final String TAG = "NetworkUtils";
-
- /**
- * Bring the named network interface up.
- */
- public native static int enableInterface(String interfaceName);
-
- /**
- * Bring the named network interface down.
- */
- public native static int disableInterface(String interfaceName);
-
- /**
- * Setting bit 0 indicates reseting of IPv4 addresses required
- */
- public static final int RESET_IPV4_ADDRESSES = 0x01;
-
- /**
- * Setting bit 1 indicates reseting of IPv4 addresses required
- */
- public static final int RESET_IPV6_ADDRESSES = 0x02;
-
- /**
- * Reset all addresses
- */
- public static final int RESET_ALL_ADDRESSES = RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES;
-
- /**
- * Reset IPv6 or IPv4 sockets that are connected via the named interface.
- *
- * @param interfaceName is the interface to reset
- * @param mask {@see #RESET_IPV4_ADDRESSES} and {@see #RESET_IPV6_ADDRESSES}
- */
- public native static int resetConnections(String interfaceName, int mask);
-
- /**
- * Start the DHCP client daemon, in order to have it request addresses
- * for the named interface, and then configure the interface with those
- * addresses. This call blocks until it obtains a result (either success
- * or failure) from the daemon.
- *
- * @param interfaceName the name of the interface to configure
- * @param ipInfo if the request succeeds, this object is filled in with
- * the IP address information.
- * @return {@code true} for success, {@code false} for failure
- */
- public native static boolean runDhcp(String interfaceName, DhcpInfoInternal ipInfo);
-
- /**
- * Initiate renewal on the Dhcp client daemon. This call blocks until it obtains
- * a result (either success or failure) from the daemon.
- *
- * @param interfaceName the name of the interface to configure
- * @param ipInfo if the request succeeds, this object is filled in with
- * the IP address information.
- * @return {@code true} for success, {@code false} for failure
- */
- public native static boolean runDhcpRenew(String interfaceName, DhcpInfoInternal ipInfo);
-
- /**
- * Shut down the DHCP client daemon.
- *
- * @param interfaceName the name of the interface for which the daemon
- * should be stopped
- * @return {@code true} for success, {@code false} for failure
- */
- public native static boolean stopDhcp(String interfaceName);
-
- /**
- * Release the current DHCP lease.
- *
- * @param interfaceName the name of the interface for which the lease should
- * be released
- * @return {@code true} for success, {@code false} for failure
- */
- public native static boolean releaseDhcpLease(String interfaceName);
-
- /**
- * Return the last DHCP-related error message that was recorded.
- * NOTE: This string is not localized, but currently it is only
- * used in logging.
- *
- * @return the most recent error message, if any
- */
- public native static String getDhcpError();
-
- /**
- * Convert a IPv4 address from an integer to an InetAddress.
- *
- * @param hostAddress an int corresponding to the IPv4 address in network byte order
- */
- public static InetAddress intToInetAddress(int hostAddress) {
- byte[] addressBytes = {(byte) (0xff & hostAddress),
- (byte) (0xff & (hostAddress >> 8)),
- (byte) (0xff & (hostAddress >> 16)),
- (byte) (0xff & (hostAddress >> 24))};
-
- try {
- return InetAddress.getByAddress(addressBytes);
- } catch (UnknownHostException e) {
- throw new AssertionError();
- }
- }
-
- /**
- * Convert a IPv4 address from an InetAddress to an integer
- *
- * @param inetAddr is an InetAddress corresponding to the IPv4 address
- * @return the IP address as an integer in network byte order
- */
- public static int inetAddressToInt(InetAddress inetAddr)
- throws IllegalArgumentException {
- byte[] addr = inetAddr.getAddress();
- if (addr.length != 4) {
- throw new IllegalArgumentException("Not an IPv4 address");
- }
- return ((addr[3] & 0xff) << 24) | ((addr[2] & 0xff) << 16) |
- ((addr[1] & 0xff) << 8) | (addr[0] & 0xff);
- }
-
- /**
- * Convert a network prefix length to an IPv4 netmask integer
- *
- * @param prefixLength
- * @return the IPv4 netmask as an integer in network byte order
- */
- public static int prefixLengthToNetmaskInt(int prefixLength)
- throws IllegalArgumentException {
- if (prefixLength < 0 || prefixLength > 32) {
- throw new IllegalArgumentException("Invalid prefix length (0 <= prefix <= 32)");
- }
- int value = 0xffffffff << (32 - prefixLength);
- return Integer.reverseBytes(value);
- }
-
- /**
- * Convert a IPv4 netmask integer to a prefix length
- *
- * @param netmask as an integer in network byte order
- * @return the network prefix length
- */
- public static int netmaskIntToPrefixLength(int netmask) {
- return Integer.bitCount(netmask);
- }
-
- /**
- * Create an InetAddress from a string where the string must be a standard
- * representation of a V4 or V6 address. Avoids doing a DNS lookup on failure
- * but it will throw an IllegalArgumentException in that case.
- *
- * @param addrString
- * @return the InetAddress
- * @hide
- */
- public static InetAddress numericToInetAddress(String addrString)
- throws IllegalArgumentException {
- return null;
- }
-
- /**
- * Get InetAddress masked with prefixLength. Will never return null.
- *
- * @param IP address which will be masked with specified prefixLength
- * @param prefixLength the prefixLength used to mask the IP
- */
- public static InetAddress getNetworkPart(InetAddress address, int prefixLength) {
- if (address == null) {
- throw new RuntimeException("getNetworkPart doesn't accept null address");
- }
-
- byte[] array = address.getAddress();
-
- if (prefixLength < 0 || prefixLength > array.length * 8) {
- throw new RuntimeException("getNetworkPart - bad prefixLength");
- }
-
- int offset = prefixLength / 8;
- int reminder = prefixLength % 8;
- byte mask = (byte) (0xFF << (8 - reminder));
-
- if (offset < array.length) array[offset] = (byte) (array[offset] & mask);
-
- offset++;
-
- for (; offset < array.length; offset++) {
- array[offset] = 0;
- }
-
- InetAddress netPart = null;
- try {
- netPart = InetAddress.getByAddress(array);
- } catch (UnknownHostException e) {
- throw new RuntimeException("getNetworkPart error - " + e.toString());
- }
- return netPart;
- }
-
- /**
- * Check if IP address type is consistent between two InetAddress.
- *
- * @return true if both are the same type. False otherwise.
- */
- public static boolean addressTypeMatches(InetAddress left, InetAddress right) {
- return (((left instanceof Inet4Address) && (right instanceof Inet4Address)) ||
- ((left instanceof Inet6Address) && (right instanceof Inet6Address)));
- }
-
- /**
- * Convert a 32 char hex string into a Inet6Address.
- * throws a runtime exception if the string isn't 32 chars, isn't hex or can't be
- * made into an Inet6Address
- *
- * @param addrHexString a 32 character hex string representing an IPv6 addr
- * @return addr an InetAddress representation for the string
- */
- public static InetAddress hexToInet6Address(String addrHexString)
- throws IllegalArgumentException {
- try {
- return numericToInetAddress(String.format("%s:%s:%s:%s:%s:%s:%s:%s",
- addrHexString.substring(0, 4), addrHexString.substring(4, 8),
- addrHexString.substring(8, 12), addrHexString.substring(12, 16),
- addrHexString.substring(16, 20), addrHexString.substring(20, 24),
- addrHexString.substring(24, 28), addrHexString.substring(28, 32)));
- } catch (Exception e) {
- Log.e("NetworkUtils", "error in hexToInet6Address(" + addrHexString + "): " + e);
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Create a string array of host addresses from a collection of InetAddresses
- *
- * @param addrs a Collection of InetAddresses
- * @return an array of Strings containing their host addresses
- */
- public static String[] makeStrings(Collection addrs) {
- String[] result = new String[addrs.size()];
- int i = 0;
- for (InetAddress addr : addrs) {
- result[i++] = addr.getHostAddress();
- }
- return result;
- }
-
- /**
- * Trim leading zeros from IPv4 address strings
- * Our base libraries will interpret that as octel..
- * Must leave non v4 addresses and host names alone.
- * For example, 192.168.000.010 -> 192.168.0.10
- * TODO - fix base libraries and remove this function
- *
- * @param addr a string representing an ip addr
- * @return a string propertly trimmed
- */
- public static String trimV4AddrZeros(String addr) {
- if (addr == null) return null;
- String[] octets = addr.split("\\.");
- if (octets.length != 4) return addr;
- StringBuilder builder = new StringBuilder(16);
- String result = null;
- for (int i = 0; i < 4; i++) {
- try {
- if (octets[i].length() > 3) return addr;
- builder.append(Integer.parseInt(octets[i]));
- } catch (NumberFormatException e) {
- return addr;
- }
- if (i < 3) builder.append('.');
- }
- result = builder.toString();
- return result;
- }
-}
diff --git a/QKSMS/src/main/java/android/net/ProxyProperties.java b/QKSMS/src/main/java/android/net/ProxyProperties.java
deleted file mode 100644
index 962a46c977c36590e40e6d25c7cb4ef1b2c0de63..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/ProxyProperties.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-
-import android.annotation.SuppressLint;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.text.TextUtils;
-
-import java.net.InetSocketAddress;
-
-/**
- * A container class for the http proxy info
- *
- * @hide
- */
-public class ProxyProperties implements Parcelable {
-
- private String mHost;
- private int mPort;
- private String mExclusionList;
- private String[] mParsedExclusionList;
-
- public ProxyProperties(String host, int port, String exclList) {
- mHost = host;
- mPort = port;
- setExclusionList(exclList);
- }
-
- private ProxyProperties(String host, int port, String exclList, String[] parsedExclList) {
- mHost = host;
- mPort = port;
- mExclusionList = exclList;
- mParsedExclusionList = parsedExclList;
- }
-
- // copy constructor instead of clone
- public ProxyProperties(ProxyProperties source) {
- if (source != null) {
- mHost = source.getHost();
- mPort = source.getPort();
- mExclusionList = source.getExclusionList();
- mParsedExclusionList = source.mParsedExclusionList;
- }
- }
-
- public InetSocketAddress getSocketAddress() {
- InetSocketAddress inetSocketAddress = null;
- try {
- inetSocketAddress = new InetSocketAddress(mHost, mPort);
- } catch (IllegalArgumentException e) {
- }
- return inetSocketAddress;
- }
-
- public String getHost() {
- return mHost;
- }
-
- public int getPort() {
- return mPort;
- }
-
- // comma separated
- public String getExclusionList() {
- return mExclusionList;
- }
-
- // comma separated
- @SuppressLint("DefaultLocale")
- private void setExclusionList(String exclusionList) {
- mExclusionList = exclusionList;
- if (mExclusionList == null) {
- mParsedExclusionList = new String[0];
- } else {
- String splitExclusionList[] = exclusionList.toLowerCase().split(",");
- mParsedExclusionList = new String[splitExclusionList.length * 2];
- for (int i = 0; i < splitExclusionList.length; i++) {
- String s = splitExclusionList[i].trim();
- if (s.startsWith(".")) s = s.substring(1);
- mParsedExclusionList[i * 2] = s;
- mParsedExclusionList[(i * 2) + 1] = "." + s;
- }
- }
- }
-
- public boolean isExcluded(String url) {
- if (TextUtils.isEmpty(url) || mParsedExclusionList == null ||
- mParsedExclusionList.length == 0) return false;
-
- Uri u = Uri.parse(url);
- String urlDomain = u.getHost();
- if (urlDomain == null) return false;
- for (int i = 0; i < mParsedExclusionList.length; i += 2) {
- if (urlDomain.equals(mParsedExclusionList[i]) ||
- urlDomain.endsWith(mParsedExclusionList[i + 1])) {
- return true;
- }
- }
- return false;
- }
-
- public java.net.Proxy makeProxy() {
- java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
- if (mHost != null) {
- try {
- InetSocketAddress inetSocketAddress = new InetSocketAddress(mHost, mPort);
- proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, inetSocketAddress);
- } catch (IllegalArgumentException e) {
- }
- }
- return proxy;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (mHost != null) {
- sb.append("[");
- sb.append(mHost);
- sb.append("] ");
- sb.append(Integer.toString(mPort));
- if (mExclusionList != null) {
- sb.append(" xl=").append(mExclusionList);
- }
- } else {
- sb.append("[ProxyProperties.mHost == null]");
- }
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof ProxyProperties)) return false;
- ProxyProperties p = (ProxyProperties) o;
- if (mExclusionList != null && !mExclusionList.equals(p.getExclusionList())) return false;
- if (mHost != null && p.getHost() != null && !mHost.equals(p.getHost())) {
- return false;
- }
- if (mHost != null && p.mHost == null) return false;
- return !(mHost == null && p.mHost != null) && mPort == p.mPort;
- }
-
- /**
- * Implement the Parcelable interface
- *
- * @hide
- */
- public int describeContents() {
- return 0;
- }
-
- @Override
- /*
- * generate hashcode based on significant fields
- */
- public int hashCode() {
- return ((null == mHost) ? 0 : mHost.hashCode())
- + ((null == mExclusionList) ? 0 : mExclusionList.hashCode())
- + mPort;
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public void writeToParcel(Parcel dest, int flags) {
- if (mHost != null) {
- dest.writeByte((byte) 1);
- dest.writeString(mHost);
- dest.writeInt(mPort);
- } else {
- dest.writeByte((byte) 0);
- }
- dest.writeString(mExclusionList);
- dest.writeStringArray(mParsedExclusionList);
- }
-
- /**
- * Implement the Parcelable interface.
- *
- * @hide
- */
- public static final Creator CREATOR =
- new Creator() {
- public ProxyProperties createFromParcel(Parcel in) {
- String host = null;
- int port = 0;
- if (in.readByte() == 1) {
- host = in.readString();
- port = in.readInt();
- }
- String exclList = in.readString();
- //String[] parsedExclList = in.readStringArray();
- ProxyProperties proxyProperties =
- new ProxyProperties(host, port, exclList, null);
- return proxyProperties;
- }
-
- public ProxyProperties[] newArray(int size) {
- return new ProxyProperties[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/android/net/RouteInfo.java b/QKSMS/src/main/java/android/net/RouteInfo.java
deleted file mode 100644
index 6f67e39a3c142b99ee93ae3f1f4121d7071fa78e..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/net/RouteInfo.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-
-/**
- * A simple container for route information.
- *
- * @hide
- */
-public class RouteInfo implements Parcelable {
- private static final String TAG = "RouteInfo";
- /**
- * The IP destination address for this route.
- */
- private final LinkAddress mDestination;
-
- /**
- * The gateway address for this route.
- */
- private final InetAddress mGateway;
-
- private final boolean mIsDefault;
- private final boolean mIsHost;
-
- public RouteInfo(LinkAddress destination, InetAddress gateway) {
- if (destination == null) {
- if (gateway != null) {
- if (gateway instanceof Inet4Address) {
- try {
- destination = new LinkAddress(Inet4Address.getLocalHost(), 0);
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- Log.e(TAG, "exception thrown", e);
- }
- } else {
- try {
- destination = new LinkAddress(Inet6Address.getLocalHost(), 0);
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- Log.e(TAG, "exception thrown", e);
- }
- }
- } else {
- // no destination, no gateway. invalid.
- throw new RuntimeException("Invalid arguments passed in.");
- }
- }
- if (gateway == null) {
- if (destination.getAddress() instanceof Inet4Address) {
- try {
- gateway = Inet4Address.getLocalHost();
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- Log.e(TAG, "exception thrown", e);
- }
- } else {
- try {
- gateway = Inet6Address.getLocalHost();
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- Log.e(TAG, "exception thrown", e);
- }
- }
- }
- mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(),
- destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength());
- mGateway = gateway;
- mIsDefault = isDefault();
- mIsHost = isHost();
- }
-
- public RouteInfo(InetAddress gateway) {
- this(null, gateway);
- }
-
- public static RouteInfo makeHostRoute(InetAddress host) {
- return makeHostRoute(host, null);
- }
-
- public static RouteInfo makeHostRoute(InetAddress host, InetAddress gateway) {
- if (host == null) return null;
-
- if (host instanceof Inet4Address) {
- return new RouteInfo(new LinkAddress(host, 32), gateway);
- } else {
- return new RouteInfo(new LinkAddress(host, 128), gateway);
- }
- }
-
- private boolean isHost() {
- try {
- return (mGateway.equals(Inet4Address.getLocalHost()) || mGateway.equals(Inet6Address.getLocalHost()));
- } catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- return false;
- }
- }
-
- private boolean isDefault() {
- boolean val = false;
- if (mGateway != null) {
- if (mGateway instanceof Inet4Address) {
- val = (mDestination == null || mDestination.getNetworkPrefixLength() == 0);
- } else {
- val = (mDestination == null || mDestination.getNetworkPrefixLength() == 0);
- }
- }
- return val;
- }
-
-
- public LinkAddress getDestination() {
- return mDestination;
- }
-
- public InetAddress getGateway() {
- return mGateway;
- }
-
- public boolean isDefaultRoute() {
- return mIsDefault;
- }
-
- public boolean isHostRoute() {
- return mIsHost;
- }
-
- public String toString() {
- String val = "";
- if (mDestination != null) val = mDestination.toString();
- if (mGateway != null) val += " -> " + mGateway.getHostAddress();
- return val;
- }
-
- public int describeContents() {
- return 0;
- }
-
- public void writeToParcel(Parcel dest, int flags) {
- if (mDestination == null) {
- dest.writeByte((byte) 0);
- } else {
- dest.writeByte((byte) 1);
- dest.writeByteArray(mDestination.getAddress().getAddress());
- dest.writeInt(mDestination.getNetworkPrefixLength());
- }
-
- if (mGateway == null) {
- dest.writeByte((byte) 0);
- } else {
- dest.writeByte((byte) 1);
- dest.writeByteArray(mGateway.getAddress());
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
-
- if (!(obj instanceof RouteInfo)) return false;
-
- RouteInfo target = (RouteInfo) obj;
-
- boolean sameDestination = (mDestination == null) ?
- target.getDestination() == null
- : mDestination.equals(target.getDestination());
-
- boolean sameAddress = (mGateway == null) ?
- target.getGateway() == null
- : mGateway.equals(target.getGateway());
-
- return sameDestination && sameAddress
- && mIsDefault == target.mIsDefault;
- }
-
- @Override
- public int hashCode() {
- return (mDestination == null ? 0 : mDestination.hashCode())
- + (mGateway == null ? 0 : mGateway.hashCode())
- + (mIsDefault ? 3 : 7);
- }
-
- public static final Creator CREATOR =
- new Creator() {
- public RouteInfo createFromParcel(Parcel in) {
- InetAddress destAddr = null;
- int prefix = 0;
- InetAddress gateway = null;
-
- if (in.readByte() == 1) {
- byte[] addr = in.createByteArray();
- prefix = in.readInt();
-
- try {
- destAddr = InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- }
- }
-
- if (in.readByte() == 1) {
- byte[] addr = in.createByteArray();
-
- try {
- gateway = InetAddress.getByAddress(addr);
- } catch (UnknownHostException e) {
- }
- }
-
- LinkAddress dest = null;
-
- if (destAddr != null) {
- dest = new LinkAddress(destAddr, prefix);
- }
-
- return new RouteInfo(dest, gateway);
- }
-
- public RouteInfo[] newArray(int size) {
- return new RouteInfo[size];
- }
- };
-
- private boolean matches(InetAddress destination) {
- if (destination == null) return false;
-
- // if the destination is present and the route is default.
- // return true
- if (isDefault()) return true;
-
- // match the route destination and destination with prefix length
- InetAddress dstNet = NetworkUtils.getNetworkPart(destination,
- mDestination.getNetworkPrefixLength());
-
- return mDestination.getAddress().equals(dstNet);
- }
-
- /**
- * Find the route from a Collection of routes that best matches a given address.
- * May return null if no routes are applicable.
- *
- * @param routes a Collection of RouteInfos to chose from
- * @param dest the InetAddress your trying to get to
- * @return the RouteInfo from the Collection that best fits the given address
- */
- public static RouteInfo selectBestRoute(Collection routes, InetAddress dest) {
- if ((routes == null) || (dest == null)) return null;
-
- RouteInfo bestRoute = null;
- // pick a longest prefix match under same address type
- for (RouteInfo route : routes) {
- if (NetworkUtils.addressTypeMatches(route.mDestination.getAddress(), dest)) {
- if ((bestRoute != null) &&
- (bestRoute.mDestination.getNetworkPrefixLength() >=
- route.mDestination.getNetworkPrefixLength())) {
- continue;
- }
- if (route.matches(dest)) bestRoute = route;
- }
- }
- return bestRoute;
- }
-}
diff --git a/QKSMS/src/main/java/android/provider/Downloads.java b/QKSMS/src/main/java/android/provider/Downloads.java
deleted file mode 100644
index 8aca3b3dcc775de733dcb03a45a3db8221d21d0b..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/android/provider/Downloads.java
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.provider;
-
-import android.app.DownloadManager;
-import android.content.Context;
-import android.net.NetworkPolicyManager;
-import android.net.Uri;
-
-/**
- * The Download Manager
- *
- * @pending
- */
-public final class Downloads {
- private Downloads() {
- }
-
- /**
- * Implementation details
- *
- * Exposes constants used to interact with the download manager's
- * content provider.
- * The constants URI ... STATUS are the names of columns in the downloads table.
- *
- * @hide
- */
- public static final class Impl implements BaseColumns {
- private Impl() {
- }
-
- /**
- * The permission to access the download manager
- */
- public static final String PERMISSION_ACCESS = "android.permission.ACCESS_DOWNLOAD_MANAGER";
-
- /**
- * The permission to access the download manager's advanced functions
- */
- public static final String PERMISSION_ACCESS_ADVANCED =
- "android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED";
-
- /**
- * The permission to access the all the downloads in the manager.
- */
- public static final String PERMISSION_ACCESS_ALL =
- "android.permission.ACCESS_ALL_DOWNLOADS";
-
- /**
- * The permission to directly access the download manager's cache
- * directory
- */
- public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM";
-
- /**
- * The permission to send broadcasts on download completion
- */
- public static final String PERMISSION_SEND_INTENTS =
- "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS";
-
- /**
- * The permission to download files to the cache partition that won't be automatically
- * purged when space is needed.
- */
- public static final String PERMISSION_CACHE_NON_PURGEABLE =
- "android.permission.DOWNLOAD_CACHE_NON_PURGEABLE";
-
- /**
- * The permission to download files without any system notification being shown.
- */
- public static final String PERMISSION_NO_NOTIFICATION =
- "android.permission.DOWNLOAD_WITHOUT_NOTIFICATION";
-
- /**
- * The content:// URI to access downloads owned by the caller's UID.
- */
- public static final Uri CONTENT_URI =
- Uri.parse("content://downloads/my_downloads");
-
- /**
- * The content URI for accessing all downloads across all UIDs (requires the
- * ACCESS_ALL_DOWNLOADS permission).
- */
- public static final Uri ALL_DOWNLOADS_CONTENT_URI =
- Uri.parse("content://downloads/all_downloads");
-
- /**
- * URI segment to access a publicly accessible downloaded file
- */
- public static final String PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT = "public_downloads";
-
- /**
- * The content URI for accessing publicly accessible downloads (i.e., it requires no
- * permissions to access this downloaded file)
- */
- public static final Uri PUBLICLY_ACCESSIBLE_DOWNLOADS_URI =
- Uri.parse("content://downloads/" + PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT);
-
- /**
- * Broadcast Action: this is sent by the download manager to the app
- * that had initiated a download when that download completes. The
- * download's content: uri is specified in the intent's data.
- */
- public static final String ACTION_DOWNLOAD_COMPLETED =
- "android.intent.action.DOWNLOAD_COMPLETED";
-
- /**
- * Broadcast Action: this is sent by the download manager to the app
- * that had initiated a download when the user selects the notification
- * associated with that download. The download's content: uri is specified
- * in the intent's data if the click is associated with a single download,
- * or Downloads.CONTENT_URI if the notification is associated with
- * multiple downloads.
- * Note: this is not currently sent for downloads that have completed
- * successfully.
- */
- public static final String ACTION_NOTIFICATION_CLICKED =
- "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED";
-
- /**
- * The name of the column containing the URI of the data being downloaded.
- *
Type: TEXT
- *
Owner can Init/Read
- */
- public static final String COLUMN_URI = "uri";
-
- /**
- * The name of the column containing application-specific data.
- *
Type: TEXT
- *
Owner can Init/Read/Write
- */
- public static final String COLUMN_APP_DATA = "entity";
-
- /**
- * The name of the column containing the flags that indicates whether
- * the initiating application is capable of verifying the integrity of
- * the downloaded file. When this flag is set, the download manager
- * performs downloads and reports success even in some situations where
- * it can't guarantee that the download has completed (e.g. when doing
- * a byte-range request without an ETag, or when it can't determine
- * whether a download fully completed).
- *
Type: BOOLEAN
- *
Owner can Init
- */
- public static final String COLUMN_NO_INTEGRITY = "no_integrity";
-
- /**
- * The name of the column containing the filename that the initiating
- * application recommends. When possible, the download manager will attempt
- * to use this filename, or a variation, as the actual name for the file.
- *
Type: TEXT
- *
Owner can Init
- */
- public static final String COLUMN_FILE_NAME_HINT = "hint";
-
- /**
- * The name of the column containing the filename where the downloaded data
- * was actually stored.
- *
Type: TEXT
- *
Owner can Read
- */
- public static final String _DATA = "_data";
-
- /**
- * The name of the column containing the MIME type of the downloaded data.
- *
Type: TEXT
- *
Owner can Init/Read
- */
- public static final String COLUMN_MIME_TYPE = "mimetype";
-
- /**
- * The name of the column containing the flag that controls the destination
- * of the download. See the DESTINATION_* constants for a list of legal values.
- *
Type: INTEGER
- *
Owner can Init
- */
- public static final String COLUMN_DESTINATION = "destination";
-
- /**
- * The name of the column containing the flags that controls whether the
- * download is displayed by the UI. See the VISIBILITY_* constants for
- * a list of legal values.
- *
Type: INTEGER
- *
Owner can Init/Read/Write
- */
- public static final String COLUMN_VISIBILITY = "visibility";
-
- /**
- * The name of the column containing the current control state of the download.
- * Applications can write to this to control (pause/resume) the download.
- * the CONTROL_* constants for a list of legal values.
- *
Type: INTEGER
- *
Owner can Read
- */
- public static final String COLUMN_CONTROL = "control";
-
- /**
- * The name of the column containing the current status of the download.
- * Applications can read this to follow the progress of each download. See
- * the STATUS_* constants for a list of legal values.
- *
Type: INTEGER
- *
Owner can Read
- */
- public static final String COLUMN_STATUS = "status";
-
- /**
- * The name of the column containing the date at which some interesting
- * status changed in the download. Stored as a System.currentTimeMillis()
- * value.
- *
Type: BIGINT
- *
Owner can Read
- */
- public static final String COLUMN_LAST_MODIFICATION = "lastmod";
-
- /**
- * The name of the column containing the package name of the application
- * that initiating the download. The download manager will send
- * notifications to a component in this package when the download completes.
- *
Type: TEXT
- *
Owner can Init/Read
- */
- public static final String COLUMN_NOTIFICATION_PACKAGE = "notificationpackage";
-
- /**
- * The name of the column containing the component name of the class that
- * will receive notifications associated with the download. The
- * package/class combination is passed to
- * Intent.setClassName(String,String).
- *
Type: TEXT
- *
Owner can Init/Read
- */
- public static final String COLUMN_NOTIFICATION_CLASS = "notificationclass";
-
- /**
- * If extras are specified when requesting a download they will be provided in the intent that
- * is sent to the specified class and package when a download has finished.
- *
Type: TEXT
- *
Owner can Init
- */
- public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras";
-
- /**
- * The name of the column contain the values of the cookie to be used for
- * the download. This is used directly as the value for the Cookie: HTTP
- * header that gets sent with the request.
- *
Type: TEXT
- *
Owner can Init
- */
- public static final String COLUMN_COOKIE_DATA = "cookiedata";
-
- /**
- * The name of the column containing the user agent that the initiating
- * application wants the download manager to use for this download.
- *
Type: TEXT
- *
Owner can Init
- */
- public static final String COLUMN_USER_AGENT = "useragent";
-
- /**
- * The name of the column containing the referer (sic) that the initiating
- * application wants the download manager to use for this download.
- *
Type: TEXT
- *
Owner can Init
- */
- public static final String COLUMN_REFERER = "referer";
-
- /**
- * The name of the column containing the total size of the file being
- * downloaded.
- *
Type: INTEGER
- *
Owner can Read
- */
- public static final String COLUMN_TOTAL_BYTES = "total_bytes";
-
- /**
- * The name of the column containing the size of the part of the file that
- * has been downloaded so far.
- *
Type: INTEGER
- *
Owner can Read
- */
- public static final String COLUMN_CURRENT_BYTES = "current_bytes";
-
- /**
- * The name of the column where the initiating application can provide the
- * UID of another application that is allowed to access this download. If
- * multiple applications share the same UID, all those applications will be
- * allowed to access this download. This column can be updated after the
- * download is initiated. This requires the permission
- * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED.
- *
Type: INTEGER
- *
Owner can Init
- */
- public static final String COLUMN_OTHER_UID = "otheruid";
-
- /**
- * The name of the column where the initiating application can provided the
- * title of this download. The title will be displayed ito the user in the
- * list of downloads.
- *
Type: TEXT
- *
Owner can Init/Read/Write
- */
- public static final String COLUMN_TITLE = "title";
-
- /**
- * The name of the column where the initiating application can provide the
- * description of this download. The description will be displayed to the
- * user in the list of downloads.
- *
Type: TEXT
- *
Owner can Init/Read/Write
- */
- public static final String COLUMN_DESCRIPTION = "description";
-
- /**
- * The name of the column indicating whether the download was requesting through the public
- * API. This controls some differences in behavior.
- *
Type: BOOLEAN
- *
Owner can Init/Read
- */
- public static final String COLUMN_IS_PUBLIC_API = "is_public_api";
-
- /**
- * The name of the column holding a bitmask of allowed network types. This is only used for
- * public API downloads.
- *
Type: INTEGER
- *
Owner can Init/Read
- */
- public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
-
- /**
- * The name of the column indicating whether roaming connections can be used. This is only
- * used for public API downloads.
- *
Type: BOOLEAN
- *
Owner can Init/Read
- */
- public static final String COLUMN_ALLOW_ROAMING = "allow_roaming";
-
- /**
- * The name of the column indicating whether metered connections can be used. This is only
- * used for public API downloads.
- *
Type: BOOLEAN
- *
Owner can Init/Read
- */
- public static final String COLUMN_ALLOW_METERED = "allow_metered";
-
- /**
- * Whether or not this download should be displayed in the system's Downloads UI. Defaults
- * to true.
- *
Type: INTEGER
- *
Owner can Init/Read
- */
- public static final String COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI = "is_visible_in_downloads_ui";
-
- /**
- * If true, the user has confirmed that this download can proceed over the mobile network
- * even though it exceeds the recommended maximum size.
- *
Type: BOOLEAN
- */
- public static final String COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT =
- "bypass_recommended_size_limit";
-
- /**
- * Set to true if this download is deleted. It is completely removed from the database
- * when MediaProvider database also deletes the metadata asociated with this downloaded file.
- *
Type: BOOLEAN
- *
Owner can Read
- */
- public static final String COLUMN_DELETED = "deleted";
-
- /**
- * The URI to the corresponding entry in MediaProvider for this downloaded entry. It is
- * used to delete the entries from MediaProvider database when it is deleted from the
- * downloaded list.
- *
Type: TEXT
- *
Owner can Read
- */
- public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri";
-
- /**
- * The column that is used to remember whether the media scanner was invoked.
- * It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable).
- *
Type: TEXT
- */
- public static final String COLUMN_MEDIA_SCANNED = "scanned";
-
- /**
- * The column with errorMsg for a failed downloaded.
- * Used only for debugging purposes.
- *
Type: TEXT
- */
- public static final String COLUMN_ERROR_MSG = "errorMsg";
-
- /**
- * This column stores the source of the last update to this row.
- * This column is only for internal use.
- * Valid values are indicated by LAST_UPDATESRC_* constants.
- *
Type: INT
- */
- public static final String COLUMN_LAST_UPDATESRC = "lastUpdateSrc";
-
- /**
- * default value for {@link #COLUMN_LAST_UPDATESRC}.
- * This value is used when this column's value is not relevant.
- */
- public static final int LAST_UPDATESRC_NOT_RELEVANT = 0;
-
- /**
- * One of the values taken by {@link #COLUMN_LAST_UPDATESRC}.
- * This value is used when the update is NOT to be relayed to the DownloadService
- * (and thus spare DownloadService from scanning the database when this change occurs)
- */
- public static final int LAST_UPDATESRC_DONT_NOTIFY_DOWNLOADSVC = 1;
-
- /*
- * Lists the destinations that an application can specify for a download.
- */
-
- /**
- * This download will be saved to the external storage. This is the
- * default behavior, and should be used for any file that the user
- * can freely access, copy, delete. Even with that destination,
- * unencrypted DRM files are saved in secure internal storage.
- * Downloads to the external destination only write files for which
- * there is a registered handler. The resulting files are accessible
- * by filename to all applications.
- */
- public static final int DESTINATION_EXTERNAL = 0;
-
- /**
- * This download will be saved to the download manager's private
- * partition. This is the behavior used by applications that want to
- * download private files that are used and deleted soon after they
- * get downloaded. All file types are allowed, and only the initiating
- * application can access the file (indirectly through a content
- * provider). This requires the
- * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission.
- */
- public static final int DESTINATION_CACHE_PARTITION = 1;
-
- /**
- * This download will be saved to the download manager's private
- * partition and will be purged as necessary to make space. This is
- * for private files (similar to CACHE_PARTITION) that aren't deleted
- * immediately after they are used, and are kept around by the download
- * manager as long as space is available.
- */
- public static final int DESTINATION_CACHE_PARTITION_PURGEABLE = 2;
-
- /**
- * This download will be saved to the download manager's private
- * partition, as with DESTINATION_CACHE_PARTITION, but the download
- * will not proceed if the user is on a roaming data connection.
- */
- public static final int DESTINATION_CACHE_PARTITION_NOROAMING = 3;
-
- /**
- * This download will be saved to the location given by the file URI in
- * {@link #COLUMN_FILE_NAME_HINT}.
- */
- public static final int DESTINATION_FILE_URI = 4;
-
- /**
- * This download will be saved to the system cache ("/cache")
- * partition. This option is only used by system apps and so it requires
- * android.permission.ACCESS_CACHE_FILESYSTEM permission.
- */
- public static final int DESTINATION_SYSTEMCACHE_PARTITION = 5;
-
- /**
- * This download was completed by the caller (i.e., NOT downloadmanager)
- * and caller wants to have this download displayed in Downloads App.
- */
- public static final int DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD = 6;
-
- /**
- * This download is allowed to run.
- */
- public static final int CONTROL_RUN = 0;
-
- /**
- * This download must pause at the first opportunity.
- */
- public static final int CONTROL_PAUSED = 1;
-
- /*
- * Lists the states that the download manager can set on a download
- * to notify applications of the download progress.
- * The codes follow the HTTP families:
- * 1xx: informational
- * 2xx: success
- * 3xx: redirects (not used by the download manager)
- * 4xx: client errors
- * 5xx: server errors
- */
-
- /**
- * Returns whether the status is informational (i.e. 1xx).
- */
- public static boolean isStatusInformational(int status) {
- return (status >= 100 && status < 200);
- }
-
- /**
- * Returns whether the status is a success (i.e. 2xx).
- */
- public static boolean isStatusSuccess(int status) {
- return (status >= 200 && status < 300);
- }
-
- /**
- * Returns whether the status is an error (i.e. 4xx or 5xx).
- */
- public static boolean isStatusError(int status) {
- return (status >= 400 && status < 600);
- }
-
- /**
- * Returns whether the status is a client error (i.e. 4xx).
- */
- public static boolean isStatusClientError(int status) {
- return (status >= 400 && status < 500);
- }
-
- /**
- * Returns whether the status is a server error (i.e. 5xx).
- */
- public static boolean isStatusServerError(int status) {
- return (status >= 500 && status < 600);
- }
-
- /**
- * this method determines if a notification should be displayed for a
- * given {@link #COLUMN_VISIBILITY} value
- *
- * @param visibility the value of {@link #COLUMN_VISIBILITY}.
- * @return true if the notification should be displayed. false otherwise.
- */
- public static boolean isNotificationToBeDisplayed(int visibility) {
- return visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED ||
- visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION;
- }
-
- /**
- * Returns whether the download has completed (either with success or
- * error).
- */
- public static boolean isStatusCompleted(int status) {
- return (status >= 200 && status < 300) || (status >= 400 && status < 600);
- }
-
- /**
- * This download hasn't stated yet
- */
- public static final int STATUS_PENDING = 190;
-
- /**
- * This download has started
- */
- public static final int STATUS_RUNNING = 192;
-
- /**
- * This download has been paused by the owning app.
- */
- public static final int STATUS_PAUSED_BY_APP = 193;
-
- /**
- * This download encountered some network error and is waiting before retrying the request.
- */
- public static final int STATUS_WAITING_TO_RETRY = 194;
-
- /**
- * This download is waiting for network connectivity to proceed.
- */
- public static final int STATUS_WAITING_FOR_NETWORK = 195;
-
- /**
- * This download exceeded a size limit for mobile networks and is waiting for a Wi-Fi
- * connection to proceed.
- */
- public static final int STATUS_QUEUED_FOR_WIFI = 196;
-
- /**
- * This download couldn't be completed due to insufficient storage
- * space. Typically, this is because the SD card is full.
- */
- public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 198;
-
- /**
- * This download couldn't be completed because no external storage
- * device was found. Typically, this is because the SD card is not
- * mounted.
- */
- public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 199;
-
- /**
- * This download has successfully completed.
- * Warning: there might be other status values that indicate success
- * in the future.
- * Use isSucccess() to capture the entire category.
- */
- public static final int STATUS_SUCCESS = 200;
-
- /**
- * This request couldn't be parsed. This is also used when processing
- * requests with unknown/unsupported URI schemes.
- */
- public static final int STATUS_BAD_REQUEST = 400;
-
- /**
- * This download can't be performed because the content type cannot be
- * handled.
- */
- public static final int STATUS_NOT_ACCEPTABLE = 406;
-
- /**
- * This download cannot be performed because the length cannot be
- * determined accurately. This is the code for the HTTP error "Length
- * Required", which is typically used when making requests that require
- * a content length but don't have one, and it is also used in the
- * client when a response is received whose length cannot be determined
- * accurately (therefore making it impossible to know when a download
- * completes).
- */
- public static final int STATUS_LENGTH_REQUIRED = 411;
-
- /**
- * This download was interrupted and cannot be resumed.
- * This is the code for the HTTP error "Precondition Failed", and it is
- * also used in situations where the client doesn't have an ETag at all.
- */
- public static final int STATUS_PRECONDITION_FAILED = 412;
-
- /**
- * The lowest-valued error status that is not an actual HTTP status code.
- */
- public static final int MIN_ARTIFICIAL_ERROR_STATUS = 488;
-
- /**
- * The requested destination file already exists.
- */
- public static final int STATUS_FILE_ALREADY_EXISTS_ERROR = 488;
-
- /**
- * Some possibly transient error occurred, but we can't resume the download.
- */
- public static final int STATUS_CANNOT_RESUME = 489;
-
- /**
- * This download was canceled
- */
- public static final int STATUS_CANCELED = 490;
-
- /**
- * This download has completed with an error.
- * Warning: there will be other status values that indicate errors in
- * the future. Use isStatusError() to capture the entire category.
- */
- public static final int STATUS_UNKNOWN_ERROR = 491;
-
- /**
- * This download couldn't be completed because of a storage issue.
- * Typically, that's because the filesystem is missing or full.
- * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
- * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
- */
- public static final int STATUS_FILE_ERROR = 492;
-
- /**
- * This download couldn't be completed because of an HTTP
- * redirect response that the download manager couldn't
- * handle.
- */
- public static final int STATUS_UNHANDLED_REDIRECT = 493;
-
- /**
- * This download couldn't be completed because of an
- * unspecified unhandled HTTP code.
- */
- public static final int STATUS_UNHANDLED_HTTP_CODE = 494;
-
- /**
- * This download couldn't be completed because of an
- * error receiving or processing data at the HTTP level.
- */
- public static final int STATUS_HTTP_DATA_ERROR = 495;
-
- /**
- * This download couldn't be completed because of an
- * HttpException while setting up the request.
- */
- public static final int STATUS_HTTP_EXCEPTION = 496;
-
- /**
- * This download couldn't be completed because there were
- * too many redirects.
- */
- public static final int STATUS_TOO_MANY_REDIRECTS = 497;
-
- /**
- * This download has failed because requesting application has been
- * blocked by {@link NetworkPolicyManager}.
- *
- * @hide
- * @deprecated since behavior now uses
- * {@link #STATUS_WAITING_FOR_NETWORK}
- */
- @Deprecated
- public static final int STATUS_BLOCKED = 498;
-
- /**
- * {@hide}
- */
- public static String statusToString(int status) {
- switch (status) {
- case STATUS_PENDING:
- return "PENDING";
- case STATUS_RUNNING:
- return "RUNNING";
- case STATUS_PAUSED_BY_APP:
- return "PAUSED_BY_APP";
- case STATUS_WAITING_TO_RETRY:
- return "WAITING_TO_RETRY";
- case STATUS_WAITING_FOR_NETWORK:
- return "WAITING_FOR_NETWORK";
- case STATUS_QUEUED_FOR_WIFI:
- return "QUEUED_FOR_WIFI";
- case STATUS_INSUFFICIENT_SPACE_ERROR:
- return "INSUFFICIENT_SPACE_ERROR";
- case STATUS_DEVICE_NOT_FOUND_ERROR:
- return "DEVICE_NOT_FOUND_ERROR";
- case STATUS_SUCCESS:
- return "SUCCESS";
- case STATUS_BAD_REQUEST:
- return "BAD_REQUEST";
- case STATUS_NOT_ACCEPTABLE:
- return "NOT_ACCEPTABLE";
- case STATUS_LENGTH_REQUIRED:
- return "LENGTH_REQUIRED";
- case STATUS_PRECONDITION_FAILED:
- return "PRECONDITION_FAILED";
- case STATUS_FILE_ALREADY_EXISTS_ERROR:
- return "FILE_ALREADY_EXISTS_ERROR";
- case STATUS_CANNOT_RESUME:
- return "CANNOT_RESUME";
- case STATUS_CANCELED:
- return "CANCELED";
- case STATUS_UNKNOWN_ERROR:
- return "UNKNOWN_ERROR";
- case STATUS_FILE_ERROR:
- return "FILE_ERROR";
- case STATUS_UNHANDLED_REDIRECT:
- return "UNHANDLED_REDIRECT";
- case STATUS_UNHANDLED_HTTP_CODE:
- return "UNHANDLED_HTTP_CODE";
- case STATUS_HTTP_DATA_ERROR:
- return "HTTP_DATA_ERROR";
- case STATUS_HTTP_EXCEPTION:
- return "HTTP_EXCEPTION";
- case STATUS_TOO_MANY_REDIRECTS:
- return "TOO_MANY_REDIRECTS";
- case STATUS_BLOCKED:
- return "BLOCKED";
- default:
- return Integer.toString(status);
- }
- }
-
- /**
- * This download is visible but only shows in the notifications
- * while it's in progress.
- */
- public static final int VISIBILITY_VISIBLE = DownloadManager.Request.VISIBILITY_VISIBLE;
-
- /**
- * This download is visible and shows in the notifications while
- * in progress and after completion.
- */
- public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED =
- DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED;
-
- /**
- * This download doesn't show in the UI or in the notifications.
- */
- public static final int VISIBILITY_HIDDEN = DownloadManager.Request.VISIBILITY_HIDDEN;
-
- /**
- * Constants related to HTTP request headers associated with each download.
- */
- public static class RequestHeaders {
- public static final String HEADERS_DB_TABLE = "request_headers";
- public static final String COLUMN_DOWNLOAD_ID = "download_id";
- public static final String COLUMN_HEADER = "header";
- public static final String COLUMN_VALUE = "value";
-
- /**
- * Path segment to add to a download URI to retrieve request headers
- */
- public static final String URI_SEGMENT = "headers";
-
- /**
- * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
- * DownloadProvider.insert().
- */
- public static final String INSERT_KEY_PREFIX = "http_header_";
- }
- }
-
- /**
- * Query where clause for general querying.
- */
- private static final String QUERY_WHERE_CLAUSE = Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND "
- + Impl.COLUMN_NOTIFICATION_CLASS + "=?";
-
- /**
- * Delete all the downloads for a package/class pair.
- */
- public static final void removeAllDownloadsByPackage(
- Context context, String notification_package, String notification_class) {
- context.getContentResolver().delete(Impl.CONTENT_URI, QUERY_WHERE_CLAUSE,
- new String[]{notification_package, notification_class});
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/annotations/VisibleForTesting.java b/QKSMS/src/main/java/com/android/internal/annotations/VisibleForTesting.java
deleted file mode 100644
index f353d049b92105dcb13ff4f28d555220d49f7f00..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/annotations/VisibleForTesting.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Denotes that the class, method or field has its visibility relaxed so
- * that unit tests can access it.
- *
- * The visibility argument can be used to specific what the original
- * visibility should have been if it had not been made public or package-private for testing.
- * The default is to consider the element private.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface VisibleForTesting {
- /**
- * Intended visibility if the element had not been made public or package-private for
- * testing.
- */
- enum Visibility {
- /**
- * The element should be considered protected.
- */
- PROTECTED,
- /**
- * The element should be considered package-private.
- */
- PACKAGE,
- /**
- * The element should be considered private.
- */
- PRIVATE
- }
-
- /**
- * Intended visibility if the element had not been made public or package-private for testing.
- * If not specified, one should assume the element originally intended to be private.
- */
- Visibility visibility() default Visibility.PRIVATE;
-}
diff --git a/QKSMS/src/main/java/com/android/internal/net/LegacyVpnInfo.java b/QKSMS/src/main/java/com/android/internal/net/LegacyVpnInfo.java
deleted file mode 100644
index d852606c7971421fdf24a85bbe13aa985099d9a0..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/net/LegacyVpnInfo.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.net;
-
-import android.app.PendingIntent;
-import android.net.NetworkInfo;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-/**
- * A simple container used to carry information of the ongoing legacy VPN.
- * Internal use only.
- *
- * @hide
- */
-public class LegacyVpnInfo implements Parcelable {
- private static final String TAG = "LegacyVpnInfo";
-
- public static final int STATE_DISCONNECTED = 0;
- public static final int STATE_INITIALIZING = 1;
- public static final int STATE_CONNECTING = 2;
- public static final int STATE_CONNECTED = 3;
- public static final int STATE_TIMEOUT = 4;
- public static final int STATE_FAILED = 5;
-
- public String key;
- public int state = -1;
- public PendingIntent intent;
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(key);
- out.writeInt(state);
- out.writeParcelable(intent, flags);
- }
-
- public static final Parcelable.Creator CREATOR =
- new Parcelable.Creator() {
- @Override
- public LegacyVpnInfo createFromParcel(Parcel in) {
- LegacyVpnInfo info = new LegacyVpnInfo();
- info.key = in.readString();
- info.state = in.readInt();
- info.intent = in.readParcelable(null);
- return info;
- }
-
- @Override
- public LegacyVpnInfo[] newArray(int size) {
- return new LegacyVpnInfo[size];
- }
- };
-
- /**
- * Return best matching {@link com.android.internal.net.LegacyVpnInfo} state based on given
- * {@link NetworkInfo}.
- */
- public static int stateFromNetworkInfo(NetworkInfo info) {
- switch (info.getDetailedState()) {
- case CONNECTING:
- return STATE_CONNECTING;
- case CONNECTED:
- return STATE_CONNECTED;
- case DISCONNECTED:
- return STATE_DISCONNECTED;
- case FAILED:
- return STATE_FAILED;
- default:
- Log.w(TAG, "Unhandled state " + info.getDetailedState()
- + " ; treating as disconnected");
- return STATE_DISCONNECTED;
- }
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/net/VpnConfig.java b/QKSMS/src/main/java/com/android/internal/net/VpnConfig.java
deleted file mode 100644
index 3ee916a76fb3114ec2573928b8f86df1f7a162f5..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/net/VpnConfig.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.net;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.android.internal.util.Preconditions;
-
-import java.util.List;
-
-/**
- * A simple container used to carry information in VpnBuilder, VpnDialogs,
- * and com.android.server.connectivity.Vpn. Internal use only.
- *
- * @hide
- */
-public class VpnConfig implements Parcelable {
-
- public static final String SERVICE_INTERFACE = "android.net.VpnService";
-
- public static final String DIALOGS_PACKAGE = "com.android.vpndialogs";
-
- public static final String LEGACY_VPN = "[Legacy VPN]";
-
- public static Intent getIntentForConfirmation() {
- Intent intent = new Intent();
- intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ConfirmDialog");
- return intent;
- }
-
- public static PendingIntent getIntentForStatusPanel(Context context, VpnConfig config) {
- Preconditions.checkNotNull(config);
-
- Intent intent = new Intent();
- intent.setClassName(DIALOGS_PACKAGE, DIALOGS_PACKAGE + ".ManageDialog");
- intent.putExtra("config", config);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY |
- Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
- }
-
- public String user;
- public String interfaze;
- public String session;
- public int mtu = -1;
- public String addresses;
- public String routes;
- public List dnsServers;
- public List searchDomains;
- public PendingIntent configureIntent;
- public long startTime = -1;
- public boolean legacy;
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(user);
- out.writeString(interfaze);
- out.writeString(session);
- out.writeInt(mtu);
- out.writeString(addresses);
- out.writeString(routes);
- out.writeStringList(dnsServers);
- out.writeStringList(searchDomains);
- out.writeParcelable(configureIntent, flags);
- out.writeLong(startTime);
- out.writeInt(legacy ? 1 : 0);
- }
-
- public static final Parcelable.Creator CREATOR =
- new Parcelable.Creator() {
- @Override
- public VpnConfig createFromParcel(Parcel in) {
- VpnConfig config = new VpnConfig();
- config.user = in.readString();
- config.interfaze = in.readString();
- config.session = in.readString();
- config.mtu = in.readInt();
- config.addresses = in.readString();
- config.routes = in.readString();
- config.dnsServers = in.createStringArrayList();
- config.searchDomains = in.createStringArrayList();
- config.configureIntent = in.readParcelable(null);
- config.startTime = in.readLong();
- config.legacy = in.readInt() != 0;
- return config;
- }
-
- @Override
- public VpnConfig[] newArray(int size) {
- return new VpnConfig[size];
- }
- };
-}
diff --git a/QKSMS/src/main/java/com/android/internal/net/VpnProfile.java b/QKSMS/src/main/java/com/android/internal/net/VpnProfile.java
deleted file mode 100644
index 892e59b14e371f13213049a07b05362e6b1be8b0..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/net/VpnProfile.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.net;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-import java.nio.charset.Charset;
-
-/**
- * Parcel-like entity class for VPN profiles. To keep things simple, all
- * fields are package private. Methods are provided for serialization, so
- * storage can be implemented easily. Two rules are set for this class.
- * First, all fields must be kept non-null. Second, always make a copy
- * using clone() before modifying.
- *
- * @hide
- */
-public class VpnProfile implements Cloneable, Parcelable {
- private static final String TAG = "VpnProfile";
-
- // Match these constants with R.array.vpn_types.
- public static final int TYPE_PPTP = 0;
- public static final int TYPE_L2TP_IPSEC_PSK = 1;
- public static final int TYPE_L2TP_IPSEC_RSA = 2;
- public static final int TYPE_IPSEC_XAUTH_PSK = 3;
- public static final int TYPE_IPSEC_XAUTH_RSA = 4;
- public static final int TYPE_IPSEC_HYBRID_RSA = 5;
- public static final int TYPE_MAX = 5;
-
- // Entity fields.
- public final String key; // -1
- public String name = ""; // 0
- public int type = TYPE_PPTP; // 1
- public String server = ""; // 2
- public String username = ""; // 3
- public String password = ""; // 4
- public String dnsServers = ""; // 5
- public String searchDomains = ""; // 6
- public String routes = ""; // 7
- public boolean mppe = true; // 8
- public String l2tpSecret = ""; // 9
- public String ipsecIdentifier = "";// 10
- public String ipsecSecret = ""; // 11
- public String ipsecUserCert = ""; // 12
- public String ipsecCaCert = ""; // 13
- public String ipsecServerCert = "";// 14
-
- // Helper fields.
- public boolean saveLogin = false;
-
- public VpnProfile(String key) {
- this.key = key;
- }
-
- public VpnProfile(Parcel in) {
- key = in.readString();
- name = in.readString();
- type = in.readInt();
- server = in.readString();
- username = in.readString();
- password = in.readString();
- dnsServers = in.readString();
- searchDomains = in.readString();
- routes = in.readString();
- mppe = in.readInt() != 0;
- l2tpSecret = in.readString();
- ipsecIdentifier = in.readString();
- ipsecSecret = in.readString();
- ipsecUserCert = in.readString();
- ipsecCaCert = in.readString();
- ipsecServerCert = in.readString();
- saveLogin = in.readInt() != 0;
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(key);
- out.writeString(name);
- out.writeInt(type);
- out.writeString(server);
- out.writeString(username);
- out.writeString(password);
- out.writeString(dnsServers);
- out.writeString(searchDomains);
- out.writeString(routes);
- out.writeInt(mppe ? 1 : 0);
- out.writeString(l2tpSecret);
- out.writeString(ipsecIdentifier);
- out.writeString(ipsecSecret);
- out.writeString(ipsecUserCert);
- out.writeString(ipsecCaCert);
- out.writeString(ipsecServerCert);
- out.writeInt(saveLogin ? 1 : 0);
- }
-
- public static VpnProfile decode(String key, byte[] value) {
- try {
- if (key == null) {
- return null;
- }
-
- String[] values = new String(value, Charset.forName("UTF-8")).split("\0", -1);
- // There can be 14 or 15 values in ICS MR1.
- if (values.length < 14 || values.length > 15) {
- return null;
- }
-
- VpnProfile profile = new VpnProfile(key);
- profile.name = values[0];
- profile.type = Integer.valueOf(values[1]);
- if (profile.type < 0 || profile.type > TYPE_MAX) {
- return null;
- }
- profile.server = values[2];
- profile.username = values[3];
- profile.password = values[4];
- profile.dnsServers = values[5];
- profile.searchDomains = values[6];
- profile.routes = values[7];
- profile.mppe = Boolean.valueOf(values[8]);
- profile.l2tpSecret = values[9];
- profile.ipsecIdentifier = values[10];
- profile.ipsecSecret = values[11];
- profile.ipsecUserCert = values[12];
- profile.ipsecCaCert = values[13];
- profile.ipsecServerCert = (values.length > 14) ? values[14] : "";
-
- profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty();
- return profile;
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- public byte[] encode() {
- StringBuilder builder = new StringBuilder(name);
- builder.append('\0').append(type);
- builder.append('\0').append(server);
- builder.append('\0').append(saveLogin ? username : "");
- builder.append('\0').append(saveLogin ? password : "");
- builder.append('\0').append(dnsServers);
- builder.append('\0').append(searchDomains);
- builder.append('\0').append(routes);
- builder.append('\0').append(mppe);
- builder.append('\0').append(l2tpSecret);
- builder.append('\0').append(ipsecIdentifier);
- builder.append('\0').append(ipsecSecret);
- builder.append('\0').append(ipsecUserCert);
- builder.append('\0').append(ipsecCaCert);
- builder.append('\0').append(ipsecServerCert);
- return builder.toString().getBytes(Charset.forName("UTF-8"));
- }
-
- /**
- * Test if profile is valid for lockdown, which requires IPv4 address for
- * both server and DNS. Server hostnames would require using DNS before
- * connection.
- */
- public boolean isValidLockdownProfile() {
- try {
- return true;
-
- } catch (IllegalArgumentException e) {
- Log.w(TAG, "Invalid address", e);
- return false;
- }
- }
-
- public static final Creator CREATOR = new Creator() {
- @Override
- public VpnProfile createFromParcel(Parcel in) {
- return new VpnProfile(in);
- }
-
- @Override
- public VpnProfile[] newArray(int size) {
- return new VpnProfile[size];
- }
- };
-
- @Override
- public int describeContents() {
- return 0;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/EncodeException.java b/QKSMS/src/main/java/com/android/internal/telephony/EncodeException.java
deleted file mode 100644
index cd32803677ed4a6c1455395e01e82ae6d96385a6..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/EncodeException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-/**
- * {@hide}
- */
-@SuppressWarnings("serial")
-public class EncodeException extends Exception {
- public EncodeException() {
- super();
- }
-
- public EncodeException(String s) {
- super(s);
- }
-
- public EncodeException(char c) {
- super("Unencodable char: '" + c + "'");
- }
-}
-
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/GsmAlphabet.java b/QKSMS/src/main/java/com/android/internal/telephony/GsmAlphabet.java
deleted file mode 100644
index 3ad4aecc5f22361d9a91e0213f66823388a52f66..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/GsmAlphabet.java
+++ /dev/null
@@ -1,1500 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.SparseIntArray;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This class implements the character set mapping between
- * the GSM SMS 7-bit alphabet specified in TS 23.038 6.2.1
- * and UTF-16
- *
- * {@hide}
- */
-public class GsmAlphabet {
- private static final String TAG = "GSM";
-
- private GsmAlphabet() {
- }
-
- /**
- * This escapes extended characters, and when present indicates that the
- * following character should be looked up in the "extended" table.
- *
- * gsmToChar(GSM_EXTENDED_ESCAPE) returns 0xffff
- */
- public static final byte GSM_EXTENDED_ESCAPE = 0x1B;
-
- /**
- * User data header requires one octet for length. Count as one septet, because
- * all combinations of header elements below will have at least one free bit
- * when padding to the nearest septet boundary.
- */
- public static final int UDH_SEPTET_COST_LENGTH = 1;
-
- /**
- * Using a non-default language locking shift table OR single shift table
- * requires a user data header of 3 octets, or 4 septets, plus UDH length.
- */
- public static final int UDH_SEPTET_COST_ONE_SHIFT_TABLE = 4;
-
- /**
- * Using a non-default language locking shift table AND single shift table
- * requires a user data header of 6 octets, or 7 septets, plus UDH length.
- */
- public static final int UDH_SEPTET_COST_TWO_SHIFT_TABLES = 7;
-
- /**
- * Multi-part messages require a user data header of 5 octets, or 6 septets,
- * plus UDH length.
- */
- public static final int UDH_SEPTET_COST_CONCATENATED_MESSAGE = 6;
-
- /**
- * For a specific text string, this object describes protocol
- * properties of encoding it for transmission as message user
- * data.
- */
- public static class TextEncodingDetails {
- /**
- * The number of SMS's required to encode the text.
- */
- public int msgCount;
-
- /**
- * The number of code units consumed so far, where code units
- * are basically characters in the encoding -- for example,
- * septets for the standard ASCII and GSM encodings, and 16
- * bits for Unicode.
- */
- public int codeUnitCount;
-
- /**
- * How many code units are still available without spilling
- * into an additional message.
- */
- public int codeUnitsRemaining;
-
- /**
- * The encoding code unit size (specified using
- * android.telephony.SmsMessage ENCODING_*).
- */
- public int codeUnitSize;
-
- /**
- * The GSM national language table to use, or 0 for the default 7-bit alphabet.
- */
- public int languageTable;
-
- /**
- * The GSM national language shift table to use, or 0 for the default 7-bit extension table.
- */
- public int languageShiftTable;
-
- @Override
- public String toString() {
- return "TextEncodingDetails " +
- "{ msgCount=" + msgCount +
- ", codeUnitCount=" + codeUnitCount +
- ", codeUnitsRemaining=" + codeUnitsRemaining +
- ", codeUnitSize=" + codeUnitSize +
- ", languageTable=" + languageTable +
- ", languageShiftTable=" + languageShiftTable +
- " }";
- }
- }
-
- /**
- * Converts a char to a GSM 7 bit table index.
- * Returns ' ' in GSM alphabet if there's no possible match. Returns
- * GSM_EXTENDED_ESCAPE if this character is in the extended table.
- * In this case, you must call charToGsmExtended() for the value
- * that should follow GSM_EXTENDED_ESCAPE in the GSM alphabet string.
- *
- * @param c the character to convert
- * @return the GSM 7 bit table index for the specified character
- */
- public static int
- charToGsm(char c) {
- try {
- return charToGsm(c, false);
- } catch (EncodeException ex) {
- // this should never happen
- return sCharsToGsmTables[0].get(' ', ' ');
- }
- }
-
- /**
- * Converts a char to a GSM 7 bit table index.
- * Returns GSM_EXTENDED_ESCAPE if this character is in the extended table.
- * In this case, you must call charToGsmExtended() for the value that
- * should follow GSM_EXTENDED_ESCAPE in the GSM alphabet string.
- *
- * @param c the character to convert
- * @param throwException If true, throws EncodeException on invalid char.
- * If false, returns GSM alphabet ' ' char.
- * @return the GSM 7 bit table index for the specified character
- * @throws EncodeException encode error when throwException is true
- */
- public static int
- charToGsm(char c, boolean throwException) throws EncodeException {
- int ret;
-
- ret = sCharsToGsmTables[0].get(c, -1);
-
- if (ret == -1) {
- ret = sCharsToShiftTables[0].get(c, -1);
-
- if (ret == -1) {
- if (throwException) {
- throw new EncodeException(c);
- } else {
- return sCharsToGsmTables[0].get(' ', ' ');
- }
- } else {
- return GSM_EXTENDED_ESCAPE;
- }
- }
-
- return ret;
- }
-
- /**
- * Converts a char to an extended GSM 7 bit table index.
- * Extended chars should be escaped with GSM_EXTENDED_ESCAPE.
- * Returns ' ' in GSM alphabet if there's no possible match.
- *
- * @param c the character to convert
- * @return the GSM 7 bit extended table index for the specified character
- */
- public static int
- charToGsmExtended(char c) {
- int ret;
-
- ret = sCharsToShiftTables[0].get(c, -1);
-
- if (ret == -1) {
- return sCharsToGsmTables[0].get(' ', ' ');
- }
-
- return ret;
- }
-
- /**
- * Converts a character in the GSM alphabet into a char.
- *
- * If GSM_EXTENDED_ESCAPE is passed, 0xffff is returned. In this case,
- * the following character in the stream should be decoded with
- * gsmExtendedToChar().
- *
- * If an unmappable value is passed (one greater than 127), ' ' is returned.
- *
- * @param gsmChar the GSM 7 bit table index to convert
- * @return the decoded character
- */
- public static char
- gsmToChar(int gsmChar) {
- if (gsmChar >= 0 && gsmChar < 128) {
- return sLanguageTables[0].charAt(gsmChar);
- } else {
- return ' ';
- }
- }
-
- /**
- * Converts a character in the extended GSM alphabet into a char
- *
- * if GSM_EXTENDED_ESCAPE is passed, ' ' is returned since no second
- * extension page has yet been defined (see Note 1 in table 6.2.1.1 of
- * TS 23.038 v7.00)
- *
- * If an unmappable value is passed, the character from the GSM 7 bit
- * default table will be used (table 6.2.1.1 of TS 23.038).
- *
- * @param gsmChar the GSM 7 bit extended table index to convert
- * @return the decoded character
- */
- public static char
- gsmExtendedToChar(int gsmChar) {
- if (gsmChar == GSM_EXTENDED_ESCAPE) {
- return ' ';
- } else if (gsmChar >= 0 && gsmChar < 128) {
- char c = sLanguageShiftTables[0].charAt(gsmChar);
- if (c == ' ') {
- return sLanguageTables[0].charAt(gsmChar);
- } else {
- return c;
- }
- } else {
- return ' '; // out of range
- }
- }
-
- /**
- * Converts a String into a byte array containing the 7-bit packed
- * GSM Alphabet representation of the string. If a header is provided,
- * this is included in the returned byte array and padded to a septet
- * boundary. This method is used by OEM code.
- *
- * @param data The text string to encode.
- * @param header Optional header (including length byte) that precedes
- * the encoded data, padded to septet boundary.
- * @return Byte array containing header and encoded data.
- * @throws EncodeException if String is too large to encode
- * @see #stringToGsm7BitPackedWithHeader(String, byte[], int, int)
- */
- public static byte[] stringToGsm7BitPackedWithHeader(String data, byte[] header)
- throws EncodeException {
- return stringToGsm7BitPackedWithHeader(data, header, 0, 0);
- }
-
- /**
- * Converts a String into a byte array containing the 7-bit packed
- * GSM Alphabet representation of the string. If a header is provided,
- * this is included in the returned byte array and padded to a septet
- * boundary.
- *
- * Unencodable chars are encoded as spaces
- *
- * Byte 0 in the returned byte array is the count of septets used,
- * including the header and header padding. The returned byte array is
- * the minimum size required to store the packed septets. The returned
- * array cannot contain more than 255 septets.
- *
- * @param data The text string to encode.
- * @param header Optional header (including length byte) that precedes
- * the encoded data, padded to septet boundary.
- * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
- * @param languageShiftTable the 7 bit single shift language table, or 0 for the default
- * GSM extension table
- * @return Byte array containing header and encoded data.
- * @throws EncodeException if String is too large to encode
- */
- public static byte[] stringToGsm7BitPackedWithHeader(String data, byte[] header,
- int languageTable, int languageShiftTable)
- throws EncodeException {
- if (header == null || header.length == 0) {
- return stringToGsm7BitPacked(data, languageTable, languageShiftTable);
- }
-
- int headerBits = (header.length + 1) * 8;
- int headerSeptets = (headerBits + 6) / 7;
-
- byte[] ret = stringToGsm7BitPacked(data, headerSeptets, true, languageTable,
- languageShiftTable);
-
- // Paste in the header
- ret[1] = (byte) header.length;
- System.arraycopy(header, 0, ret, 2, header.length);
- return ret;
- }
-
- /**
- * Converts a String into a byte array containing
- * the 7-bit packed GSM Alphabet representation of the string.
- *
- * Unencodable chars are encoded as spaces
- *
- * Byte 0 in the returned byte array is the count of septets used
- * The returned byte array is the minimum size required to store
- * the packed septets. The returned array cannot contain more than 255
- * septets.
- *
- * @param data the data string to encode
- * @return the encoded string
- * @throws EncodeException if String is too large to encode
- */
- public static byte[] stringToGsm7BitPacked(String data)
- throws EncodeException {
- return stringToGsm7BitPacked(data, 0, true, 0, 0);
- }
-
- /**
- * Converts a String into a byte array containing
- * the 7-bit packed GSM Alphabet representation of the string.
- *
- * Unencodable chars are encoded as spaces
- *
- * Byte 0 in the returned byte array is the count of septets used
- * The returned byte array is the minimum size required to store
- * the packed septets. The returned array cannot contain more than 255
- * septets.
- *
- * @param data the data string to encode
- * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
- * @param languageShiftTable the 7 bit single shift language table, or 0 for the default
- * GSM extension table
- * @return the encoded string
- * @throws EncodeException if String is too large to encode
- */
- public static byte[] stringToGsm7BitPacked(String data, int languageTable,
- int languageShiftTable)
- throws EncodeException {
- return stringToGsm7BitPacked(data, 0, true, languageTable, languageShiftTable);
- }
-
- /**
- * Converts a String into a byte array containing
- * the 7-bit packed GSM Alphabet representation of the string.
- *
- * Byte 0 in the returned byte array is the count of septets used
- * The returned byte array is the minimum size required to store
- * the packed septets. The returned array cannot contain more than 255
- * septets.
- *
- * @param data the text to convert to septets
- * @param startingSeptetOffset the number of padding septets to put before
- * the character data at the beginning of the array
- * @param throwException If true, throws EncodeException on invalid char.
- * If false, replaces unencodable char with GSM alphabet space char.
- * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
- * @param languageShiftTable the 7 bit single shift language table, or 0 for the default
- * GSM extension table
- * @return the encoded message
- * @throws EncodeException if String is too large to encode
- */
- public static byte[] stringToGsm7BitPacked(String data, int startingSeptetOffset,
- boolean throwException, int languageTable, int languageShiftTable)
- throws EncodeException {
- int dataLen = data.length();
- int septetCount = countGsmSeptetsUsingTables(data, !throwException,
- languageTable, languageShiftTable);
- if (septetCount == -1) {
- throw new EncodeException("countGsmSeptetsUsingTables(): unencodable char");
- }
- septetCount += startingSeptetOffset;
- if (septetCount > 255) {
- throw new EncodeException("Payload cannot exceed 255 septets");
- }
- int byteCount = ((septetCount * 7) + 7) / 8;
- byte[] ret = new byte[byteCount + 1]; // Include space for one byte length prefix.
- SparseIntArray charToLanguageTable = sCharsToGsmTables[languageTable];
- SparseIntArray charToShiftTable = sCharsToShiftTables[languageShiftTable];
- for (int i = 0, septets = startingSeptetOffset, bitOffset = startingSeptetOffset * 7;
- i < dataLen && septets < septetCount;
- i++, bitOffset += 7) {
- char c = data.charAt(i);
- int v = charToLanguageTable.get(c, -1);
- if (v == -1) {
- v = charToShiftTable.get(c, -1); // Lookup the extended char.
- if (v == -1) {
- if (throwException) {
- throw new EncodeException("stringToGsm7BitPacked(): unencodable char");
- } else {
- v = charToLanguageTable.get(' ', ' '); // should return ASCII space
- }
- } else {
- packSmsChar(ret, bitOffset, GSM_EXTENDED_ESCAPE);
- bitOffset += 7;
- septets++;
- }
- }
- packSmsChar(ret, bitOffset, v);
- septets++;
- }
- ret[0] = (byte) (septetCount); // Validated by check above.
- return ret;
- }
-
- /**
- * Pack a 7-bit char into its appropriate place in a byte array
- *
- * @param packedChars the destination byte array
- * @param bitOffset the bit offset that the septet should be packed at
- * (septet index * 7)
- * @param value the 7-bit character to store
- */
- private static void
- packSmsChar(byte[] packedChars, int bitOffset, int value) {
- int byteOffset = bitOffset / 8;
- int shift = bitOffset % 8;
-
- packedChars[++byteOffset] |= value << shift;
-
- if (shift > 1) {
- packedChars[++byteOffset] = (byte) (value >> (8 - shift));
- }
- }
-
- /**
- * Convert a GSM alphabet 7 bit packed string (SMS string) into a
- * {@link String}.
- *
- * See TS 23.038 6.1.2.1 for SMS Character Packing
- *
- * @param pdu the raw data from the pdu_alt
- * @param offset the byte offset of
- * @param lengthSeptets string length in septets, not bytes
- * @return String representation or null on decoding exception
- */
- public static String gsm7BitPackedToString(byte[] pdu, int offset,
- int lengthSeptets) {
- return gsm7BitPackedToString(pdu, offset, lengthSeptets, 0, 0, 0);
- }
-
- /**
- * Convert a GSM alphabet 7 bit packed string (SMS string) into a
- * {@link String}.
- *
- * See TS 23.038 6.1.2.1 for SMS Character Packing
- *
- * @param pdu the raw data from the pdu_alt
- * @param offset the byte offset of
- * @param lengthSeptets string length in septets, not bytes
- * @param numPaddingBits the number of padding bits before the start of the
- * string in the first byte
- * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
- * @param shiftTable the 7 bit single shift language table, or 0 for the default
- * GSM extension table
- * @return String representation or null on decoding exception
- */
- public static String gsm7BitPackedToString(byte[] pdu, int offset,
- int lengthSeptets, int numPaddingBits, int languageTable, int shiftTable) {
- StringBuilder ret = new StringBuilder(lengthSeptets);
-
- if (languageTable < 0 || languageTable > sLanguageTables.length) {
- Log.w(TAG, "unknown language table " + languageTable + ", using default");
- languageTable = 0;
- }
- if (shiftTable < 0 || shiftTable > sLanguageShiftTables.length) {
- Log.w(TAG, "unknown single shift table " + shiftTable + ", using default");
- shiftTable = 0;
- }
-
- try {
- boolean prevCharWasEscape = false;
- String languageTableToChar = sLanguageTables[languageTable];
- String shiftTableToChar = sLanguageShiftTables[shiftTable];
-
- if (languageTableToChar.isEmpty()) {
- Log.w(TAG, "no language table for code " + languageTable + ", using default");
- languageTableToChar = sLanguageTables[0];
- }
- if (shiftTableToChar.isEmpty()) {
- Log.w(TAG, "no single shift table for code " + shiftTable + ", using default");
- shiftTableToChar = sLanguageShiftTables[0];
- }
-
- for (int i = 0; i < lengthSeptets; i++) {
- int bitOffset = (7 * i) + numPaddingBits;
-
- int byteOffset = bitOffset / 8;
- int shift = bitOffset % 8;
- int gsmVal;
-
- gsmVal = (0x7f & (pdu[offset + byteOffset] >> shift));
-
- // if it crosses a byte boundary
- if (shift > 1) {
- // set msb bits to 0
- gsmVal &= 0x7f >> (shift - 1);
-
- gsmVal |= 0x7f & (pdu[offset + byteOffset + 1] << (8 - shift));
- }
-
- if (prevCharWasEscape) {
- if (gsmVal == GSM_EXTENDED_ESCAPE) {
- ret.append(' '); // display ' ' for reserved double escape sequence
- } else {
- char c = shiftTableToChar.charAt(gsmVal);
- if (c == ' ') {
- ret.append(languageTableToChar.charAt(gsmVal));
- } else {
- ret.append(c);
- }
- }
- prevCharWasEscape = false;
- } else if (gsmVal == GSM_EXTENDED_ESCAPE) {
- prevCharWasEscape = true;
- } else {
- ret.append(languageTableToChar.charAt(gsmVal));
- }
- }
- } catch (RuntimeException ex) {
- Log.e(TAG, "Error GSM 7 bit packed: ", ex);
- return null;
- }
-
- return ret.toString();
- }
-
-
- /**
- * Convert a GSM alphabet string that's stored in 8-bit unpacked
- * format (as it often appears in SIM records) into a String
- *
- * Field may be padded with trailing 0xff's. The decode stops
- * at the first 0xff encountered.
- *
- * @param data the byte array to decode
- * @param offset array offset for the first character to decode
- * @param length the number of bytes to decode
- * @return the decoded string
- */
- public static String
- gsm8BitUnpackedToString(byte[] data, int offset, int length) {
- return gsm8BitUnpackedToString(data, offset, length, "");
- }
-
- /**
- * Convert a GSM alphabet string that's stored in 8-bit unpacked
- * format (as it often appears in SIM records) into a String
- *
- * Field may be padded with trailing 0xff's. The decode stops
- * at the first 0xff encountered.
- *
- * Additionally, in some country(ex. Korea), there are non-ASCII or MBCS characters.
- * If a character set is given, characters in data are treat as MBCS.
- */
- public static String
- gsm8BitUnpackedToString(byte[] data, int offset, int length, String characterset) {
- boolean isMbcs = false;
- Charset charset = null;
- ByteBuffer mbcsBuffer = null;
-
- if (!TextUtils.isEmpty(characterset)
- && !characterset.equalsIgnoreCase("us-ascii")
- && Charset.isSupported(characterset)) {
- isMbcs = true;
- charset = Charset.forName(characterset);
- mbcsBuffer = ByteBuffer.allocate(2);
- }
-
- // Always use GSM 7 bit default alphabet table for this method
- String languageTableToChar = sLanguageTables[0];
- String shiftTableToChar = sLanguageShiftTables[0];
-
- StringBuilder ret = new StringBuilder(length);
- boolean prevWasEscape = false;
- for (int i = offset; i < offset + length; i++) {
- // Never underestimate the pain that can be caused
- // by signed bytes
- int c = data[i] & 0xff;
-
- if (c == 0xff) {
- break;
- } else if (c == GSM_EXTENDED_ESCAPE) {
- if (prevWasEscape) {
- // Two escape chars in a row
- // We treat this as a space
- // See Note 1 in table 6.2.1.1 of TS 23.038 v7.00
- ret.append(' ');
- prevWasEscape = false;
- } else {
- prevWasEscape = true;
- }
- } else {
- if (prevWasEscape) {
- char shiftChar = shiftTableToChar.charAt(c);
- if (shiftChar == ' ') {
- // display character from main table if not present in shift table
- ret.append(languageTableToChar.charAt(c));
- } else {
- ret.append(shiftChar);
- }
- } else {
- if (!isMbcs || c < 0x80 || i + 1 >= offset + length) {
- ret.append(languageTableToChar.charAt(c));
- } else {
- // isMbcs must be true. So both mbcsBuffer and charset are initialized.
- mbcsBuffer.clear();
- mbcsBuffer.put(data, i++, 2);
- mbcsBuffer.flip();
- ret.append(charset.decode(mbcsBuffer).toString());
- }
- }
- prevWasEscape = false;
- }
- }
-
- return ret.toString();
- }
-
- /**
- * Convert a string into an 8-bit unpacked GSM alphabet byte array.
- * Always uses GSM default 7-bit alphabet and extension table.
- *
- * @param s the string to encode
- * @return the 8-bit GSM encoded byte array for the string
- */
- public static byte[]
- stringToGsm8BitPacked(String s) {
- byte[] ret;
-
- int septets = countGsmSeptetsUsingTables(s, true, 0, 0);
-
- // Enough for all the septets and the length byte prefix
- ret = new byte[septets];
-
- stringToGsm8BitUnpackedField(s, ret, 0, ret.length);
-
- return ret;
- }
-
-
- /**
- * Write a String into a GSM 8-bit unpacked field of
- * Field is padded with 0xff's, string is truncated if necessary
- *
- * @param s the string to encode
- * @param dest the destination byte array
- * @param offset the starting offset for the encoded string
- * @param length the maximum number of bytes to write
- */
- public static void
- stringToGsm8BitUnpackedField(String s, byte dest[], int offset, int length) {
- int outByteIndex = offset;
- SparseIntArray charToLanguageTable = sCharsToGsmTables[0];
- SparseIntArray charToShiftTable = sCharsToShiftTables[0];
-
- // Septets are stored in byte-aligned octets
- for (int i = 0, sz = s.length()
- ; i < sz && (outByteIndex - offset) < length
- ; i++
- ) {
- char c = s.charAt(i);
-
- int v = charToLanguageTable.get(c, -1);
-
- if (v == -1) {
- v = charToShiftTable.get(c, -1);
- if (v == -1) {
- v = charToLanguageTable.get(' ', ' '); // fall back to ASCII space
- } else {
- // make sure we can fit an escaped char
- if (!(outByteIndex + 1 - offset < length)) {
- break;
- }
-
- dest[outByteIndex++] = GSM_EXTENDED_ESCAPE;
- }
- }
-
- dest[outByteIndex++] = (byte) v;
- }
-
- // pad with 0xff's
- while ((outByteIndex - offset) < length) {
- dest[outByteIndex++] = (byte) 0xff;
- }
- }
-
- /**
- * Returns the count of 7-bit GSM alphabet characters
- * needed to represent this character. Counts unencodable char as 1 septet.
- *
- * @param c the character to examine
- * @return the number of septets for this character
- */
- public static int
- countGsmSeptets(char c) {
- try {
- return countGsmSeptets(c, false);
- } catch (EncodeException ex) {
- // This should never happen.
- return 0;
- }
- }
-
- /**
- * Returns the count of 7-bit GSM alphabet characters
- * needed to represent this character using the default 7 bit GSM alphabet.
- *
- * @param c the character to examine
- * @param throwsException If true, throws EncodeException if unencodable
- * char. Otherwise, counts invalid char as 1 septet.
- * @return the number of septets for this character
- * @throws EncodeException the character can't be encoded and throwsException is true
- */
- public static int
- countGsmSeptets(char c, boolean throwsException) throws EncodeException {
- if (sCharsToGsmTables[0].get(c, -1) != -1) {
- return 1;
- }
-
- if (sCharsToShiftTables[0].get(c, -1) != -1) {
- return 2;
- }
-
- if (throwsException) {
- throw new EncodeException(c);
- } else {
- // count as a space char
- return 1;
- }
- }
-
- /**
- * Returns the count of 7-bit GSM alphabet characters needed
- * to represent this string, using the specified 7-bit language table
- * and extension table (0 for GSM default tables).
- *
- * @param s the Unicode string that will be encoded
- * @param use7bitOnly allow using space in place of unencodable character if true,
- * otherwise, return -1 if any characters are unencodable
- * @param languageTable the 7 bit language table, or 0 for the default GSM alphabet
- * @param languageShiftTable the 7 bit single shift language table, or 0 for the default
- * GSM extension table
- * @return the septet count for s using the specified language tables, or -1 if any
- * characters are unencodable and use7bitOnly is false
- */
- public static int countGsmSeptetsUsingTables(CharSequence s, boolean use7bitOnly,
- int languageTable, int languageShiftTable) {
- int count = 0;
- int sz = s.length();
- SparseIntArray charToLanguageTable = sCharsToGsmTables[languageTable];
- SparseIntArray charToShiftTable = sCharsToShiftTables[languageShiftTable];
- for (int i = 0; i < sz; i++) {
- char c = s.charAt(i);
- if (c == GSM_EXTENDED_ESCAPE) {
- Log.w(TAG, "countGsmSeptets() string contains Escape character, skipping.");
- continue;
- }
- if (charToLanguageTable.get(c, -1) != -1) {
- count++;
- } else if (charToShiftTable.get(c, -1) != -1) {
- count += 2; // escape + shift table index
- } else if (use7bitOnly) {
- count++; // encode as space
- } else {
- return -1; // caller must check for this case
- }
- }
- return count;
- }
-
- /**
- * Returns the count of 7-bit GSM alphabet characters
- * needed to represent this string, and the language table and
- * language shift table used to achieve this result.
- * For multi-part text messages, each message part may use its
- * own language table encoding as specified in the message header
- * for that message. However, this method will only return the
- * optimal encoding for the message as a whole. When the individual
- * pieces are encoded, a more optimal encoding may be chosen for each
- * piece of the message, but the message will be split into pieces
- * based on the encoding chosen for the message as a whole.
- *
- * @param s the Unicode string that will be encoded
- * @param use7bitOnly allow using space in place of unencodable character if true,
- * using the language table pair with the fewest unencodable characters
- * @return a TextEncodingDetails object containing the message and
- * character counts for the most efficient 7-bit encoding,
- * or null if there are no suitable language tables to encode the string.
- */
- public static TextEncodingDetails
- countGsmSeptets(CharSequence s, boolean use7bitOnly) {
- // Load enabled language tables from config.xml, including any MCC overlays
- if (!sDisableCountryEncodingCheck) {
- enableCountrySpecificEncodings();
- }
- // fast path for common case where no national language shift tables are enabled
- if (sEnabledSingleShiftTables.length + sEnabledLockingShiftTables.length == 0) {
- TextEncodingDetails ted = new TextEncodingDetails();
- int septets = GsmAlphabet.countGsmSeptetsUsingTables(s, use7bitOnly, 0, 0);
- if (septets == -1) {
- return null;
- }
- ted.codeUnitSize = SmsConstants.ENCODING_7BIT;
- ted.codeUnitCount = septets;
- if (septets > SmsConstants.MAX_USER_DATA_SEPTETS) {
- ted.msgCount = (septets + (SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) /
- SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER;
- ted.codeUnitsRemaining = (ted.msgCount *
- SmsConstants.MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
- } else {
- ted.msgCount = 1;
- ted.codeUnitsRemaining = SmsConstants.MAX_USER_DATA_SEPTETS - septets;
- }
- ted.codeUnitSize = SmsConstants.ENCODING_7BIT;
- return ted;
- }
-
- int maxSingleShiftCode = sHighestEnabledSingleShiftCode;
- List lpcList = new ArrayList(
- sEnabledLockingShiftTables.length + 1);
-
- // Always add default GSM 7-bit alphabet table
- lpcList.add(new LanguagePairCount(0));
- for (int i : sEnabledLockingShiftTables) {
- // Avoid adding default table twice in case 0 is in the list of allowed tables
- if (i != 0 && !sLanguageTables[i].isEmpty()) {
- lpcList.add(new LanguagePairCount(i));
- }
- }
-
- int sz = s.length();
- // calculate septet count for each valid table / shift table pair
- for (int i = 0; i < sz && !lpcList.isEmpty(); i++) {
- char c = s.charAt(i);
- if (c == GSM_EXTENDED_ESCAPE) {
- Log.w(TAG, "countGsmSeptets() string contains Escape character, ignoring!");
- continue;
- }
- // iterate through enabled locking shift tables
- for (LanguagePairCount lpc : lpcList) {
- int tableIndex = sCharsToGsmTables[lpc.languageCode].get(c, -1);
- if (tableIndex == -1) {
- // iterate through single shift tables for this locking table
- for (int table = 0; table <= maxSingleShiftCode; table++) {
- if (lpc.septetCounts[table] != -1) {
- int shiftTableIndex = sCharsToShiftTables[table].get(c, -1);
- if (shiftTableIndex == -1) {
- if (use7bitOnly) {
- // can't encode char, use space instead
- lpc.septetCounts[table]++;
- lpc.unencodableCounts[table]++;
- } else {
- // can't encode char, remove language pair from list
- lpc.septetCounts[table] = -1;
- }
- } else {
- // encode as Escape + index into shift table
- lpc.septetCounts[table] += 2;
- }
- }
- }
- } else {
- // encode as index into locking shift table for all pairs
- for (int table = 0; table <= maxSingleShiftCode; table++) {
- if (lpc.septetCounts[table] != -1) {
- lpc.septetCounts[table]++;
- }
- }
- }
- }
- }
-
- // find the least cost encoding (lowest message count and most code units remaining)
- TextEncodingDetails ted = new TextEncodingDetails();
- ted.msgCount = Integer.MAX_VALUE;
- ted.codeUnitSize = SmsConstants.ENCODING_7BIT;
- int minUnencodableCount = Integer.MAX_VALUE;
- for (LanguagePairCount lpc : lpcList) {
- for (int shiftTable = 0; shiftTable <= maxSingleShiftCode; shiftTable++) {
- int septets = lpc.septetCounts[shiftTable];
- if (septets == -1) {
- continue;
- }
- int udhLength;
- if (lpc.languageCode != 0 && shiftTable != 0) {
- udhLength = UDH_SEPTET_COST_LENGTH + UDH_SEPTET_COST_TWO_SHIFT_TABLES;
- } else if (lpc.languageCode != 0 || shiftTable != 0) {
- udhLength = UDH_SEPTET_COST_LENGTH + UDH_SEPTET_COST_ONE_SHIFT_TABLE;
- } else {
- udhLength = 0;
- }
- int msgCount;
- int septetsRemaining;
- if (septets + udhLength > SmsConstants.MAX_USER_DATA_SEPTETS) {
- if (udhLength == 0) {
- udhLength = UDH_SEPTET_COST_LENGTH;
- }
- udhLength += UDH_SEPTET_COST_CONCATENATED_MESSAGE;
- int septetsPerMessage = SmsConstants.MAX_USER_DATA_SEPTETS - udhLength;
- msgCount = (septets + septetsPerMessage - 1) / septetsPerMessage;
- septetsRemaining = (msgCount * septetsPerMessage) - septets;
- } else {
- msgCount = 1;
- septetsRemaining = SmsConstants.MAX_USER_DATA_SEPTETS - udhLength - septets;
- }
- // for 7-bit only mode, use language pair with the least unencodable chars
- int unencodableCount = lpc.unencodableCounts[shiftTable];
- if (use7bitOnly && unencodableCount > minUnencodableCount) {
- continue;
- }
- if ((use7bitOnly && unencodableCount < minUnencodableCount)
- || msgCount < ted.msgCount || (msgCount == ted.msgCount
- && septetsRemaining > ted.codeUnitsRemaining)) {
- minUnencodableCount = unencodableCount;
- ted.msgCount = msgCount;
- ted.codeUnitCount = septets;
- ted.codeUnitsRemaining = septetsRemaining;
- ted.languageTable = lpc.languageCode;
- ted.languageShiftTable = shiftTable;
- }
- }
- }
-
- if (ted.msgCount == Integer.MAX_VALUE) {
- return null;
- }
-
- return ted;
- }
-
- /**
- * Returns the index into s of the first character
- * after limit septets have been reached, starting at
- * index start. This is used when dividing messages
- * into units within the SMS message size limit.
- *
- * @param s source string
- * @param start index of where to start counting septets
- * @param limit maximum septets to include,
- * e.g. MAX_USER_DATA_SEPTETS
- * @param langTable the 7 bit character table to use (0 for default GSM 7-bit alphabet)
- * @param langShiftTable the 7 bit shift table to use (0 for default GSM extension table)
- * @return index of first character that won't fit, or the length
- * of the entire string if everything fits
- */
- public static int
- findGsmSeptetLimitIndex(String s, int start, int limit, int langTable, int langShiftTable) {
- int accumulator = 0;
- int size = s.length();
-
- SparseIntArray charToLangTable = sCharsToGsmTables[langTable];
- SparseIntArray charToLangShiftTable = sCharsToShiftTables[langShiftTable];
- for (int i = start; i < size; i++) {
- int encodedSeptet = charToLangTable.get(s.charAt(i), -1);
- if (encodedSeptet == -1) {
- encodedSeptet = charToLangShiftTable.get(s.charAt(i), -1);
- if (encodedSeptet == -1) {
- // char not found, assume we're replacing with space
- accumulator++;
- } else {
- accumulator += 2; // escape character + shift table index
- }
- } else {
- accumulator++;
- }
- if (accumulator > limit) {
- return i;
- }
- }
- return size;
- }
-
- /**
- * Modify the array of enabled national language single shift tables for SMS
- * encoding. This is used for unit testing, but could also be used to
- * modify the enabled encodings based on the active MCC/MNC, for example.
- *
- * @param tables the new list of enabled single shift tables
- */
- static synchronized void setEnabledSingleShiftTables(int[] tables) {
- sEnabledSingleShiftTables = tables;
- sDisableCountryEncodingCheck = true;
-
- if (tables.length > 0) {
- sHighestEnabledSingleShiftCode = tables[tables.length - 1];
- } else {
- sHighestEnabledSingleShiftCode = 0;
- }
- }
-
- /**
- * Modify the array of enabled national language locking shift tables for SMS
- * encoding. This is used for unit testing, but could also be used to
- * modify the enabled encodings based on the active MCC/MNC, for example.
- *
- * @param tables the new list of enabled locking shift tables
- */
- static synchronized void setEnabledLockingShiftTables(int[] tables) {
- sEnabledLockingShiftTables = tables;
- sDisableCountryEncodingCheck = true;
- }
-
- /**
- * Return the array of enabled national language single shift tables for SMS
- * encoding. This is used for unit testing. The returned array is not a copy, so
- * the caller should be careful not to modify it.
- *
- * @return the list of enabled single shift tables
- */
- static synchronized int[] getEnabledSingleShiftTables() {
- return sEnabledSingleShiftTables;
- }
-
- /**
- * Return the array of enabled national language locking shift tables for SMS
- * encoding. This is used for unit testing. The returned array is not a copy, so
- * the caller should be careful not to modify it.
- *
- * @return the list of enabled locking shift tables
- */
- static synchronized int[] getEnabledLockingShiftTables() {
- return sEnabledLockingShiftTables;
- }
-
- /**
- * Enable country-specific language tables from MCC-specific overlays.
- *
- * @context the context to use to get the TelephonyManager
- */
- private static void enableCountrySpecificEncodings() {
- // See comments in frameworks/base/core/res/res/values/config.xml for allowed values
- sEnabledSingleShiftTables = new int[1];
- sEnabledLockingShiftTables = new int[1];
-
- if (sEnabledSingleShiftTables.length > 0) {
- sHighestEnabledSingleShiftCode =
- sEnabledSingleShiftTables[sEnabledSingleShiftTables.length - 1];
- } else {
- sHighestEnabledSingleShiftCode = 0;
- }
- }
-
- /**
- * Reverse mapping from Unicode characters to indexes into language tables.
- */
- private static final SparseIntArray[] sCharsToGsmTables;
-
- /**
- * Reverse mapping from Unicode characters to indexes into language shift tables.
- */
- private static final SparseIntArray[] sCharsToShiftTables;
-
- /**
- * OEM configured list of enabled national language single shift tables for encoding.
- */
- private static int[] sEnabledSingleShiftTables;
-
- /**
- * OEM configured list of enabled national language locking shift tables for encoding.
- */
- private static int[] sEnabledLockingShiftTables;
-
- /**
- * Highest language code to include in array of single shift counters.
- */
- private static int sHighestEnabledSingleShiftCode;
-
- /**
- * Flag to bypass check for country-specific overlays (for test cases only).
- */
- private static boolean sDisableCountryEncodingCheck = false;
-
- /**
- * Septet counter for a specific locking shift table and all of
- * the single shift tables that it can be paired with.
- */
- private static class LanguagePairCount {
- final int languageCode;
- final int[] septetCounts;
- final int[] unencodableCounts;
-
- LanguagePairCount(int code) {
- this.languageCode = code;
- int maxSingleShiftCode = sHighestEnabledSingleShiftCode;
- septetCounts = new int[maxSingleShiftCode + 1];
- unencodableCounts = new int[maxSingleShiftCode + 1];
- // set counters for disabled single shift tables to -1
- // (GSM default extension table index 0 is always enabled)
- for (int i = 1, tableOffset = 0; i <= maxSingleShiftCode; i++) {
- if (sEnabledSingleShiftTables[tableOffset] == i) {
- tableOffset++;
- } else {
- septetCounts[i] = -1; // disabled
- }
- }
- // exclude Turkish locking + Turkish single shift table and
- // Portuguese locking + Spanish single shift table (these
- // combinations will never be optimal for any input).
- if (code == 1 && maxSingleShiftCode >= 1) {
- septetCounts[1] = -1; // Turkish + Turkish
- } else if (code == 3 && maxSingleShiftCode >= 2) {
- septetCounts[2] = -1; // Portuguese + Spanish
- }
- }
- }
-
- /**
- * GSM default 7 bit alphabet plus national language locking shift character tables.
- * Comment lines above strings indicate the lower four bits of the table position.
- */
- private static final String[] sLanguageTables = {
- /* 3GPP TS 23.038 V9.1.1 section 6.2.1 - GSM 7 bit Default Alphabet
- 01.....23.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.E.....F.....0.....1 */
- "@\u00a3$\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\n\u00d8\u00f8\r\u00c5\u00e5\u0394_"
- // 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
- + "\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\uffff\u00c6\u00e6\u00df"
- // F.....012.34.....56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789A
- + "\u00c9 !\"#\u00a4%&'()*+,-./0123456789:;<=>?\u00a1ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- // B.....C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
- + "\u00c4\u00d6\u00d1\u00dc\u00a7\u00bfabcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1"
- // E.....F.....
- + "\u00fc\u00e0",
-
- /* A.3.1 Turkish National Language Locking Shift Table
- 01.....23.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.E.....F.....0.....1 */
- "@\u00a3$\u00a5\u20ac\u00e9\u00f9\u0131\u00f2\u00c7\n\u011e\u011f\r\u00c5\u00e5\u0394_"
- // 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
- + "\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\uffff\u015e\u015f\u00df"
- // F.....012.34.....56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789A
- + "\u00c9 !\"#\u00a4%&'()*+,-./0123456789:;<=>?\u0130ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- // B.....C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
- + "\u00c4\u00d6\u00d1\u00dc\u00a7\u00e7abcdefghijklmnopqrstuvwxyz\u00e4\u00f6\u00f1"
- // E.....F.....
- + "\u00fc\u00e0",
-
- /* A.3.2 Void (no locking shift table for Spanish) */
- "",
-
- /* A.3.3 Portuguese National Language Locking Shift Table
- 01.....23.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.E.....F.....0.....1 */
- "@\u00a3$\u00a5\u00ea\u00e9\u00fa\u00ed\u00f3\u00e7\n\u00d4\u00f4\r\u00c1\u00e1\u0394_"
- // 2.....3.....4.....5.....67.8.....9.....AB.....C.....D.....E.....F.....012.34.....
- + "\u00aa\u00c7\u00c0\u221e^\\\u20ac\u00d3|\uffff\u00c2\u00e2\u00ca\u00c9 !\"#\u00ba"
- // 56789ABCDEF0123456789ABCDEF0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
- + "%&'()*+,-./0123456789:;<=>?\u00cdABCDEFGHIJKLMNOPQRSTUVWXYZ\u00c3\u00d5\u00da\u00dc"
- // F.....0123456789ABCDEF0123456789AB.....C.....DE.....F.....
- + "\u00a7~abcdefghijklmnopqrstuvwxyz\u00e3\u00f5`\u00fc\u00e0",
-
- /* A.3.4 Bengali National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....CD.EF.....0..... */
- "\u0981\u0982\u0983\u0985\u0986\u0987\u0988\u0989\u098a\u098b\n\u098c \r \u098f\u0990"
- // 123.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
- + " \u0993\u0994\u0995\u0996\u0997\u0998\u0999\u099a\uffff\u099b\u099c\u099d\u099e"
- // 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
- + " !\u099f\u09a0\u09a1\u09a2\u09a3\u09a4)(\u09a5\u09a6,\u09a7.\u09a80123456789:; "
- // D.....E.....F0.....1.....2.....3.....4.....56.....789A.....B.....C.....D.....
- + "\u09aa\u09ab?\u09ac\u09ad\u09ae\u09af\u09b0 \u09b2 \u09b6\u09b7\u09b8\u09b9"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....789.....A.....BCD.....E.....
- + "\u09bc\u09bd\u09be\u09bf\u09c0\u09c1\u09c2\u09c3\u09c4 \u09c7\u09c8 \u09cb\u09cc"
- // F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
- + "\u09cd\u09ceabcdefghijklmnopqrstuvwxyz\u09d7\u09dc\u09dd\u09f0\u09f1",
-
- /* A.3.5 Gujarati National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.EF.....0.....*/
- "\u0a81\u0a82\u0a83\u0a85\u0a86\u0a87\u0a88\u0a89\u0a8a\u0a8b\n\u0a8c\u0a8d\r \u0a8f\u0a90"
- // 1.....23.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
- + "\u0a91 \u0a93\u0a94\u0a95\u0a96\u0a97\u0a98\u0a99\u0a9a\uffff\u0a9b\u0a9c\u0a9d"
- // F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789AB
- + "\u0a9e !\u0a9f\u0aa0\u0aa1\u0aa2\u0aa3\u0aa4)(\u0aa5\u0aa6,\u0aa7.\u0aa80123456789:;"
- // CD.....E.....F0.....1.....2.....3.....4.....56.....7.....89.....A.....B.....C.....
- + " \u0aaa\u0aab?\u0aac\u0aad\u0aae\u0aaf\u0ab0 \u0ab2\u0ab3 \u0ab5\u0ab6\u0ab7\u0ab8"
- // D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....
- + "\u0ab9\u0abc\u0abd\u0abe\u0abf\u0ac0\u0ac1\u0ac2\u0ac3\u0ac4\u0ac5 \u0ac7\u0ac8"
- // B.....CD.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
- + "\u0ac9 \u0acb\u0acc\u0acd\u0ad0abcdefghijklmnopqrstuvwxyz\u0ae0\u0ae1\u0ae2\u0ae3"
- // F.....
- + "\u0af1",
-
- /* A.3.6 Hindi National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.E.....F.....*/
- "\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090a\u090b\n\u090c\u090d\r\u090e\u090f"
- // 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....
- + "\u0910\u0911\u0912\u0913\u0914\u0915\u0916\u0917\u0918\u0919\u091a\uffff\u091b\u091c"
- // E.....F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....012345
- + "\u091d\u091e !\u091f\u0920\u0921\u0922\u0923\u0924)(\u0925\u0926,\u0927.\u0928012345"
- // 6789ABC.....D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....
- + "6789:;\u0929\u092a\u092b?\u092c\u092d\u092e\u092f\u0930\u0931\u0932\u0933\u0934"
- // 9.....A.....B.....C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....
- + "\u0935\u0936\u0937\u0938\u0939\u093c\u093d\u093e\u093f\u0940\u0941\u0942\u0943\u0944"
- // 7.....8.....9.....A.....B.....C.....D.....E.....F.....0.....123456789ABCDEF012345678
- + "\u0945\u0946\u0947\u0948\u0949\u094a\u094b\u094c\u094d\u0950abcdefghijklmnopqrstuvwx"
- // 9AB.....C.....D.....E.....F.....
- + "yz\u0972\u097b\u097c\u097e\u097f",
-
- /* A.3.7 Kannada National Language Locking Shift Table
- NOTE: TS 23.038 V9.1.1 shows code 0x24 as \u0caa, corrected to \u0ca1 (typo)
- 01.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....CD.E.....F.....0.....1 */
- " \u0c82\u0c83\u0c85\u0c86\u0c87\u0c88\u0c89\u0c8a\u0c8b\n\u0c8c \r\u0c8e\u0c8f\u0c90 "
- // 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
- + "\u0c92\u0c93\u0c94\u0c95\u0c96\u0c97\u0c98\u0c99\u0c9a\uffff\u0c9b\u0c9c\u0c9d\u0c9e"
- // 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
- + " !\u0c9f\u0ca0\u0ca1\u0ca2\u0ca3\u0ca4)(\u0ca5\u0ca6,\u0ca7.\u0ca80123456789:; "
- // D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....B.....
- + "\u0caa\u0cab?\u0cac\u0cad\u0cae\u0caf\u0cb0\u0cb1\u0cb2\u0cb3 \u0cb5\u0cb6\u0cb7"
- // C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....78.....9.....
- + "\u0cb8\u0cb9\u0cbc\u0cbd\u0cbe\u0cbf\u0cc0\u0cc1\u0cc2\u0cc3\u0cc4 \u0cc6\u0cc7"
- // A.....BC.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
- + "\u0cc8 \u0cca\u0ccb\u0ccc\u0ccd\u0cd5abcdefghijklmnopqrstuvwxyz\u0cd6\u0ce0\u0ce1"
- // E.....F.....
- + "\u0ce2\u0ce3",
-
- /* A.3.8 Malayalam National Language Locking Shift Table
- 01.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....CD.E.....F.....0.....1 */
- " \u0d02\u0d03\u0d05\u0d06\u0d07\u0d08\u0d09\u0d0a\u0d0b\n\u0d0c \r\u0d0e\u0d0f\u0d10 "
- // 2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....
- + "\u0d12\u0d13\u0d14\u0d15\u0d16\u0d17\u0d18\u0d19\u0d1a\uffff\u0d1b\u0d1c\u0d1d\u0d1e"
- // 012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABC
- + " !\u0d1f\u0d20\u0d21\u0d22\u0d23\u0d24)(\u0d25\u0d26,\u0d27.\u0d280123456789:; "
- // D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
- + "\u0d2a\u0d2b?\u0d2c\u0d2d\u0d2e\u0d2f\u0d30\u0d31\u0d32\u0d33\u0d34\u0d35\u0d36"
- // B.....C.....D.....EF.....0.....1.....2.....3.....4.....5.....6.....78.....9.....
- + "\u0d37\u0d38\u0d39 \u0d3d\u0d3e\u0d3f\u0d40\u0d41\u0d42\u0d43\u0d44 \u0d46\u0d47"
- // A.....BC.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....
- + "\u0d48 \u0d4a\u0d4b\u0d4c\u0d4d\u0d57abcdefghijklmnopqrstuvwxyz\u0d60\u0d61\u0d62"
- // E.....F.....
- + "\u0d63\u0d79",
-
- /* A.3.9 Oriya National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....CD.EF.....0.....12 */
- "\u0b01\u0b02\u0b03\u0b05\u0b06\u0b07\u0b08\u0b09\u0b0a\u0b0b\n\u0b0c \r \u0b0f\u0b10 "
- // 3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....01
- + "\u0b13\u0b14\u0b15\u0b16\u0b17\u0b18\u0b19\u0b1a\uffff\u0b1b\u0b1c\u0b1d\u0b1e !"
- // 2.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABCD.....
- + "\u0b1f\u0b20\u0b21\u0b22\u0b23\u0b24)(\u0b25\u0b26,\u0b27.\u0b280123456789:; \u0b2a"
- // E.....F0.....1.....2.....3.....4.....56.....7.....89.....A.....B.....C.....D.....
- + "\u0b2b?\u0b2c\u0b2d\u0b2e\u0b2f\u0b30 \u0b32\u0b33 \u0b35\u0b36\u0b37\u0b38\u0b39"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....789.....A.....BCD.....E.....
- + "\u0b3c\u0b3d\u0b3e\u0b3f\u0b40\u0b41\u0b42\u0b43\u0b44 \u0b47\u0b48 \u0b4b\u0b4c"
- // F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
- + "\u0b4d\u0b56abcdefghijklmnopqrstuvwxyz\u0b57\u0b60\u0b61\u0b62\u0b63",
-
- /* A.3.10 Punjabi National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9A.BCD.EF.....0.....123.....4.....*/
- "\u0a01\u0a02\u0a03\u0a05\u0a06\u0a07\u0a08\u0a09\u0a0a \n \r \u0a0f\u0a10 \u0a13\u0a14"
- // 5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....F.....012.....3.....
- + "\u0a15\u0a16\u0a17\u0a18\u0a19\u0a1a\uffff\u0a1b\u0a1c\u0a1d\u0a1e !\u0a1f\u0a20"
- // 4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789ABCD.....E.....F0.....
- + "\u0a21\u0a22\u0a23\u0a24)(\u0a25\u0a26,\u0a27.\u0a280123456789:; \u0a2a\u0a2b?\u0a2c"
- // 1.....2.....3.....4.....56.....7.....89.....A.....BC.....D.....E.....F0.....1.....
- + "\u0a2d\u0a2e\u0a2f\u0a30 \u0a32\u0a33 \u0a35\u0a36 \u0a38\u0a39\u0a3c \u0a3e\u0a3f"
- // 2.....3.....4.....56789.....A.....BCD.....E.....F.....0.....123456789ABCDEF012345678
- + "\u0a40\u0a41\u0a42 \u0a47\u0a48 \u0a4b\u0a4c\u0a4d\u0a51abcdefghijklmnopqrstuvwx"
- // 9AB.....C.....D.....E.....F.....
- + "yz\u0a70\u0a71\u0a72\u0a73\u0a74",
-
- /* A.3.11 Tamil National Language Locking Shift Table
- 01.....2.....3.....4.....5.....6.....7.....8.....9A.BCD.E.....F.....0.....12.....3..... */
- " \u0b82\u0b83\u0b85\u0b86\u0b87\u0b88\u0b89\u0b8a \n \r\u0b8e\u0b8f\u0b90 \u0b92\u0b93"
- // 4.....5.....6789.....A.....B.....CD.....EF.....012.....3456.....7.....89ABCDEF.....
- + "\u0b94\u0b95 \u0b99\u0b9a\uffff \u0b9c \u0b9e !\u0b9f \u0ba3\u0ba4)( , .\u0ba8"
- // 0123456789ABC.....D.....EF012.....3.....4.....5.....6.....7.....8.....9.....A.....
- + "0123456789:;\u0ba9\u0baa ? \u0bae\u0baf\u0bb0\u0bb1\u0bb2\u0bb3\u0bb4\u0bb5\u0bb6"
- // B.....C.....D.....EF0.....1.....2.....3.....4.....5678.....9.....A.....BC.....D.....
- + "\u0bb7\u0bb8\u0bb9 \u0bbe\u0bbf\u0bc0\u0bc1\u0bc2 \u0bc6\u0bc7\u0bc8 \u0bca\u0bcb"
- // E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....F.....
- + "\u0bcc\u0bcd\u0bd0abcdefghijklmnopqrstuvwxyz\u0bd7\u0bf0\u0bf1\u0bf2\u0bf9",
-
- /* A.3.12 Telugu National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....CD.E.....F.....0.....*/
- "\u0c01\u0c02\u0c03\u0c05\u0c06\u0c07\u0c08\u0c09\u0c0a\u0c0b\n\u0c0c \r\u0c0e\u0c0f\u0c10"
- // 12.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....E.....
- + " \u0c12\u0c13\u0c14\u0c15\u0c16\u0c17\u0c18\u0c19\u0c1a\uffff\u0c1b\u0c1c\u0c1d"
- // F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....0123456789AB
- + "\u0c1e !\u0c1f\u0c20\u0c21\u0c22\u0c23\u0c24)(\u0c25\u0c26,\u0c27.\u0c280123456789:;"
- // CD.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....89.....A.....B.....
- + " \u0c2a\u0c2b?\u0c2c\u0c2d\u0c2e\u0c2f\u0c30\u0c31\u0c32\u0c33 \u0c35\u0c36\u0c37"
- // C.....D.....EF.....0.....1.....2.....3.....4.....5.....6.....78.....9.....A.....B
- + "\u0c38\u0c39 \u0c3d\u0c3e\u0c3f\u0c40\u0c41\u0c42\u0c43\u0c44 \u0c46\u0c47\u0c48 "
- // C.....D.....E.....F.....0.....123456789ABCDEF0123456789AB.....C.....D.....E.....
- + "\u0c4a\u0c4b\u0c4c\u0c4d\u0c55abcdefghijklmnopqrstuvwxyz\u0c56\u0c60\u0c61\u0c62"
- // F.....
- + "\u0c63",
-
- /* A.3.13 Urdu National Language Locking Shift Table
- 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.B.....C.....D.E.....F.....*/
- "\u0627\u0622\u0628\u067b\u0680\u067e\u06a6\u062a\u06c2\u067f\n\u0679\u067d\r\u067a\u067c"
- // 0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....B.....C.....D.....
- + "\u062b\u062c\u0681\u0684\u0683\u0685\u0686\u0687\u062d\u062e\u062f\uffff\u068c\u0688"
- // E.....F.....012.....3.....4.....5.....6.....7.....89A.....B.....CD.....EF.....012345
- + "\u0689\u068a !\u068f\u068d\u0630\u0631\u0691\u0693)(\u0699\u0632,\u0696.\u0698012345"
- // 6789ABC.....D.....E.....F0.....1.....2.....3.....4.....5.....6.....7.....8.....
- + "6789:;\u069a\u0633\u0634?\u0635\u0636\u0637\u0638\u0639\u0641\u0642\u06a9\u06aa"
- // 9.....A.....B.....C.....D.....E.....F.....0.....1.....2.....3.....4.....5.....6.....
- + "\u06ab\u06af\u06b3\u06b1\u0644\u0645\u0646\u06ba\u06bb\u06bc\u0648\u06c4\u06d5\u06c1"
- // 7.....8.....9.....A.....B.....C.....D.....E.....F.....0.....123456789ABCDEF012345678
- + "\u06be\u0621\u06cc\u06d0\u06d2\u064d\u0650\u064f\u0657\u0654abcdefghijklmnopqrstuvwx"
- // 9AB.....C.....D.....E.....F.....
- + "yz\u0655\u0651\u0653\u0656\u0670"
- };
-
- /**
- * GSM default extension table plus national language single shift character tables.
- */
- private static final String[] sLanguageShiftTables = new String[]{
- /* 6.2.1.1 GSM 7 bit Default Alphabet Extension Table
- 0123456789A.....BCDEF0123456789ABCDEF0123456789ABCDEF.0123456789ABCDEF0123456789ABCDEF */
- " \u000c ^ {} \\ [~] | "
- // 0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + " \u20ac ",
-
- /* A.2.1 Turkish National Language Single Shift Table
- 0123456789A.....BCDEF0123456789ABCDEF0123456789ABCDEF.0123456789ABCDEF01234567.....8 */
- " \u000c ^ {} \\ [~] | \u011e "
- // 9.....ABCDEF0123.....456789ABCDEF0123.....45.....67.....89.....ABCDEF0123.....
- + "\u0130 \u015e \u00e7 \u20ac \u011f \u0131 \u015f"
- // 456789ABCDEF
- + " ",
-
- /* A.2.2 Spanish National Language Single Shift Table
- 0123456789.....A.....BCDEF0123456789ABCDEF0123456789ABCDEF.0123456789ABCDEF01.....23 */
- " \u00e7\u000c ^ {} \\ [~] |\u00c1 "
- // 456789.....ABCDEF.....012345.....6789ABCDEF01.....2345.....6789.....ABCDEF.....012
- + " \u00cd \u00d3 \u00da \u00e1 \u20ac \u00ed \u00f3 "
- // 345.....6789ABCDEF
- + " \u00fa ",
-
- /* A.2.3 Portuguese National Language Single Shift Table
- 012345.....6789.....A.....B.....C.....DE.....F.....012.....3.....45.....6.....7.....8....*/
- " \u00ea \u00e7\u000c\u00d4\u00f4 \u00c1\u00e1 \u03a6\u0393^\u03a9\u03a0\u03a8\u03a3"
- // 9.....ABCDEF.....0123456789ABCDEF.0123456789ABCDEF01.....23456789.....ABCDE
- + "\u0398 \u00ca {} \\ [~] |\u00c0 \u00cd "
- // F.....012345.....6789AB.....C.....DEF01.....2345.....6789.....ABCDEF.....01234
- + "\u00d3 \u00da \u00c3\u00d5 \u00c2 \u20ac \u00ed \u00f3 "
- // 5.....6789AB.....C.....DEF.....
- + "\u00fa \u00e3\u00f5 \u00e2",
-
- /* A.2.4 Bengali National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u09e6\u09e7 \u09e8\u09e9"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09df\u09e0\u09e1\u09e2{}\u09e3\u09f2\u09f3"
- // D.....E.....F.0.....1.....2.....3.....4.....56789ABCDEF0123456789ABCDEF
- + "\u09f4\u09f5\\\u09f6\u09f7\u09f8\u09f9\u09fa [~] |ABCDEFGHIJKLMNO"
- // 0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + "PQRSTUVWXYZ \u20ac ",
-
- /* A.2.5 Gujarati National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ae6\u0ae7"
- // E.....F.....0.....1.....2.....3.....4.....5.....6789ABCDEF.0123456789ABCDEF
- + "\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef {} \\ [~] "
- // 0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + "|ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
-
- /* A.2.6 Hindi National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0966\u0967"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u0951\u0952{}\u0953\u0954\u0958"
- // D.....E.....F.0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
- + "\u0959\u095a\\\u095b\u095c\u095d\u095e\u095f\u0960\u0961\u0962\u0963\u0970\u0971"
- // BCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + " [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
-
- /* A.2.7 Kannada National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0ce6\u0ce7"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....BCDEF.01234567
- + "\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u0cde\u0cf1{}\u0cf2 \\ "
- // 89ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + " [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac ",
-
- /* A.2.8 Malayalam National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0d66\u0d67"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u0d68\u0d69\u0d6a\u0d6b\u0d6c\u0d6d\u0d6e\u0d6f\u0d70\u0d71{}\u0d72\u0d73\u0d74"
- // D.....E.....F.0.....1.....2.....3.....4.....56789ABCDEF0123456789ABCDEF0123456789A
- + "\u0d75\u0d7a\\\u0d7b\u0d7c\u0d7d\u0d7e\u0d7f [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- // BCDEF012345.....6789ABCDEF0123456789ABCDEF
- + " \u20ac ",
-
- /* A.2.9 Oriya National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0b66\u0b67"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....DE
- + "\u0b68\u0b69\u0b6a\u0b6b\u0b6c\u0b6d\u0b6e\u0b6f\u0b5c\u0b5d{}\u0b5f\u0b70\u0b71 "
- // F.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789A
- + "\\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
- // BCDEF
- + " ",
-
- /* A.2.10 Punjabi National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0a66\u0a67"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f\u0a59\u0a5a{}\u0a5b\u0a5c\u0a5e"
- // D.....EF.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF01
- + "\u0a75 \\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
- // 23456789ABCDEF
- + " ",
-
- /* A.2.11 Tamil National Language Single Shift Table
- NOTE: TS 23.038 V9.1.1 shows code 0x24 as \u0bef, corrected to \u0bee (typo)
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0964\u0965 \u0be6\u0be7"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0bf3\u0bf4{}\u0bf5\u0bf6\u0bf7"
- // D.....E.....F.0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABC
- + "\u0bf8\u0bfa\\ [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
- // DEF0123456789ABCDEF
- + " ",
-
- /* A.2.12 Telugu National Language Single Shift Table
- NOTE: TS 23.038 V9.1.1 shows code 0x22-0x23 as \u06cc\u06cd, corrected to \u0c6c\u0c6d
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789ABC.....D.....E.....F..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#* \u0c66\u0c67\u0c68\u0c69"
- // 0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....D.....E.....F.
- + "\u0c6a\u0c6b\u0c6c\u0c6d\u0c6e\u0c6f\u0c58\u0c59{}\u0c78\u0c79\u0c7a\u0c7b\u0c7c\\"
- // 0.....1.....2.....3456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345.....6789ABCD
- + "\u0c7d\u0c7e\u0c7f [~] |ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
- // EF0123456789ABCDEF
- + " ",
-
- /* A.2.13 Urdu National Language Single Shift Table
- 01.....23.....4.....5.6.....789A.....BCDEF0123.....45.....6789.....A.....BC.....D..... */
- "@\u00a3$\u00a5\u00bf\"\u00a4%&'\u000c*+ -/<=>\u00a1^\u00a1_#*\u0600\u0601 \u06f0\u06f1"
- // E.....F.....0.....1.....2.....3.....4.....5.....6.....7.....89A.....B.....C.....
- + "\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u060c\u060d{}\u060e\u060f\u0610"
- // D.....E.....F.0.....1.....2.....3.....4.....5.....6.....7.....8.....9.....A.....
- + "\u0611\u0612\\\u0613\u0614\u061b\u061f\u0640\u0652\u0658\u066b\u066c\u0672\u0673"
- // B.....CDEF.....0123456789ABCDEF0123456789ABCDEF012345.....6789ABCDEF0123456789ABCDEF
- + "\u06cd[~]\u06d4|ABCDEFGHIJKLMNOPQRSTUVWXYZ \u20ac "
- };
-
- static {
- enableCountrySpecificEncodings();
- int numTables = sLanguageTables.length;
- int numShiftTables = sLanguageShiftTables.length;
- if (numTables != numShiftTables) {
- Log.e(TAG, "Error: language tables array length " + numTables +
- " != shift tables array length " + numShiftTables);
- }
-
- sCharsToGsmTables = new SparseIntArray[numTables];
- for (int i = 0; i < numTables; i++) {
- String table = sLanguageTables[i];
-
- int tableLen = table.length();
- if (tableLen != 0 && tableLen != 128) {
- Log.e(TAG, "Error: language tables index " + i +
- " length " + tableLen + " (expected 128 or 0)");
- }
-
- SparseIntArray charToGsmTable = new SparseIntArray(tableLen);
- sCharsToGsmTables[i] = charToGsmTable;
- for (int j = 0; j < tableLen; j++) {
- char c = table.charAt(j);
- charToGsmTable.put(c, j);
- }
- }
-
- sCharsToShiftTables = new SparseIntArray[numTables];
- for (int i = 0; i < numShiftTables; i++) {
- String shiftTable = sLanguageShiftTables[i];
-
- int shiftTableLen = shiftTable.length();
- if (shiftTableLen != 0 && shiftTableLen != 128) {
- Log.e(TAG, "Error: language shift tables index " + i +
- " length " + shiftTableLen + " (expected 128 or 0)");
- }
-
- SparseIntArray charToShiftTable = new SparseIntArray(shiftTableLen);
- sCharsToShiftTables[i] = charToShiftTable;
- for (int j = 0; j < shiftTableLen; j++) {
- char c = shiftTable.charAt(j);
- if (c != ' ') {
- charToShiftTable.put(c, j);
- }
- }
- }
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/IccUtils.java b/QKSMS/src/main/java/com/android/internal/telephony/IccUtils.java
deleted file mode 100644
index 872f19518bd61639592794912026e2afb8b84192..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/IccUtils.java
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.util.Log;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * Various methods, useful for dealing with SIM data.
- */
-public class IccUtils {
- static final String LOG_TAG = "IccUtils";
-
- /**
- * Many fields in GSM SIM's are stored as nibble-swizzled BCD
- *
- * Assumes left-justified field that may be padded right with 0xf
- * values.
- *
- * Stops on invalid BCD value, returning string so far
- */
- public static String
- bcdToString(byte[] data, int offset, int length) {
- StringBuilder ret = new StringBuilder(length * 2);
-
- for (int i = offset; i < offset + length; i++) {
- int v;
-
- v = data[i] & 0xf;
- if (v > 9) break;
- ret.append((char) ('0' + v));
-
- v = (data[i] >> 4) & 0xf;
- // Some PLMNs have 'f' as high nibble, ignore it
- if (v == 0xf) continue;
- if (v > 9) break;
- ret.append((char) ('0' + v));
- }
-
- return ret.toString();
- }
-
- /**
- * Decode cdma byte into String.
- */
- public static String
- cdmaBcdToString(byte[] data, int offset, int length) {
- StringBuilder ret = new StringBuilder(length);
-
- int count = 0;
- for (int i = offset; count < length; i++) {
- int v;
- v = data[i] & 0xf;
- if (v > 9) v = 0;
- ret.append((char) ('0' + v));
-
- if (++count == length) break;
-
- v = (data[i] >> 4) & 0xf;
- if (v > 9) v = 0;
- ret.append((char) ('0' + v));
- ++count;
- }
- return ret.toString();
- }
-
- /**
- * Decodes a GSM-style BCD byte, returning an int ranging from 0-99.
- *
- * In GSM land, the least significant BCD digit is stored in the most
- * significant nibble.
- *
- * Out-of-range digits are treated as 0 for the sake of the time stamp,
- * because of this:
- *
- * TS 23.040 section 9.2.3.11
- * "if the MS receives a non-integer value in the SCTS, it shall
- * assume the digit is set to 0 but shall store the entire field
- * exactly as received"
- */
- public static int
- gsmBcdByteToInt(byte b) {
- int ret = 0;
-
- // treat out-of-range BCD values as 0
- if ((b & 0xf0) <= 0x90) {
- ret = (b >> 4) & 0xf;
- }
-
- if ((b & 0x0f) <= 0x09) {
- ret += (b & 0xf) * 10;
- }
-
- return ret;
- }
-
- /**
- * Decodes a CDMA style BCD byte like {@link gsmBcdByteToInt}, but
- * opposite nibble format. The least significant BCD digit
- * is in the least significant nibble and the most significant
- * is in the most significant nibble.
- */
- public static int
- cdmaBcdByteToInt(byte b) {
- int ret = 0;
-
- // treat out-of-range BCD values as 0
- if ((b & 0xf0) <= 0x90) {
- ret = ((b >> 4) & 0xf) * 10;
- }
-
- if ((b & 0x0f) <= 0x09) {
- ret += (b & 0xf);
- }
-
- return ret;
- }
-
- /**
- * Decodes a string field that's formatted like the EF[ADN] alpha
- * identifier
- *
- * From TS 51.011 10.5.1:
- * Coding:
- * this alpha tagging shall use either
- * - the SMS default 7 bit coded alphabet as defined in
- * TS 23.038 [12] with bit 8 set to 0. The alpha identifier
- * shall be left justified. Unused bytes shall be set to 'FF'; or
- * - one of the UCS2 coded options as defined in annex B.
- *
- * Annex B from TS 11.11 V8.13.0:
- * 1) If the first octet in the alpha string is '80', then the
- * remaining octets are 16 bit UCS2 characters ...
- * 2) if the first octet in the alpha string is '81', then the
- * second octet contains a value indicating the number of
- * characters in the string, and the third octet contains an
- * 8 bit number which defines bits 15 to 8 of a 16 bit
- * base pointer, where bit 16 is set to zero and bits 7 to 1
- * are also set to zero. These sixteen bits constitute a
- * base pointer to a "half page" in the UCS2 code space, to be
- * used with some or all of the remaining octets in the string.
- * The fourth and subsequent octets contain codings as follows:
- * If bit 8 of the octet is set to zero, the remaining 7 bits
- * of the octet contain a GSM Default Alphabet character,
- * whereas if bit 8 of the octet is set to one, then the
- * remaining seven bits are an offset value added to the
- * 16 bit base pointer defined earlier...
- * 3) If the first octet of the alpha string is set to '82', then
- * the second octet contains a value indicating the number of
- * characters in the string, and the third and fourth octets
- * contain a 16 bit number which defines the complete 16 bit
- * base pointer to a "half page" in the UCS2 code space...
- */
- public static String
- adnStringFieldToString(byte[] data, int offset, int length) {
- if (length == 0) {
- return "";
- }
- if (length >= 1) {
- if (data[offset] == (byte) 0x80) {
- int ucslen = (length - 1) / 2;
- String ret = null;
-
- try {
- ret = new String(data, offset + 1, ucslen * 2, "utf-16be");
- } catch (UnsupportedEncodingException ex) {
- Log.e(LOG_TAG, "implausible UnsupportedEncodingException",
- ex);
- }
-
- if (ret != null) {
- // trim off trailing FFFF characters
-
- ucslen = ret.length();
- while (ucslen > 0 && ret.charAt(ucslen - 1) == '\uFFFF')
- ucslen--;
-
- return ret.substring(0, ucslen);
- }
- }
- }
-
- boolean isucs2 = false;
- char base = '\0';
- int len = 0;
-
- if (length >= 3 && data[offset] == (byte) 0x81) {
- len = data[offset + 1] & 0xFF;
- if (len > length - 3)
- len = length - 3;
-
- base = (char) ((data[offset + 2] & 0xFF) << 7);
- offset += 3;
- isucs2 = true;
- } else if (length >= 4 && data[offset] == (byte) 0x82) {
- len = data[offset + 1] & 0xFF;
- if (len > length - 4)
- len = length - 4;
-
- base = (char) (((data[offset + 2] & 0xFF) << 8) |
- (data[offset + 3] & 0xFF));
- offset += 4;
- isucs2 = true;
- }
-
- if (isucs2) {
- StringBuilder ret = new StringBuilder();
-
- while (len > 0) {
- // UCS2 subset case
-
- if (data[offset] < 0) {
- ret.append((char) (base + (data[offset] & 0x7F)));
- offset++;
- len--;
- }
-
- // GSM character set case
-
- int count = 0;
- while (count < len && data[offset + count] >= 0)
- count++;
-
- ret.append(GsmAlphabet.gsm8BitUnpackedToString(data,
- offset, count));
-
- offset += count;
- len -= count;
- }
-
- return ret.toString();
- }
-
- Resources resource = Resources.getSystem();
- String defaultCharset = "";
- return GsmAlphabet.gsm8BitUnpackedToString(data, offset, length, defaultCharset.trim());
- }
-
- static int
- hexCharToInt(char c) {
- if (c >= '0' && c <= '9') return (c - '0');
- if (c >= 'A' && c <= 'F') return (c - 'A' + 10);
- if (c >= 'a' && c <= 'f') return (c - 'a' + 10);
-
- throw new RuntimeException("invalid hex char '" + c + "'");
- }
-
- /**
- * Converts a hex String to a byte array.
- *
- * @param s A string of hexadecimal characters, must be an even number of
- * chars long
- * @return byte array representation
- * @throws RuntimeException on invalid format
- */
- public static byte[]
- hexStringToBytes(String s) {
- byte[] ret;
-
- if (s == null) return null;
-
- int sz = s.length();
-
- ret = new byte[sz / 2];
-
- for (int i = 0; i < sz; i += 2) {
- ret[i / 2] = (byte) ((hexCharToInt(s.charAt(i)) << 4)
- | hexCharToInt(s.charAt(i + 1)));
- }
-
- return ret;
- }
-
-
- /**
- * Converts a byte array into a String of hexadecimal characters.
- *
- * @param bytes an array of bytes
- * @return hex string representation of bytes array
- */
- public static String
- bytesToHexString(byte[] bytes) {
- if (bytes == null) return null;
-
- StringBuilder ret = new StringBuilder(2 * bytes.length);
-
- for (int i = 0; i < bytes.length; i++) {
- int b;
-
- b = 0x0f & (bytes[i] >> 4);
-
- ret.append("0123456789abcdef".charAt(b));
-
- b = 0x0f & bytes[i];
-
- ret.append("0123456789abcdef".charAt(b));
- }
-
- return ret.toString();
- }
-
-
- /**
- * Convert a TS 24.008 Section 10.5.3.5a Network Name field to a string
- * "offset" points to "octet 3", the coding scheme byte
- * empty string returned on decode error
- */
- public static String
- networkNameToString(byte[] data, int offset, int length) {
- String ret;
-
- if ((data[offset] & 0x80) != 0x80 || length < 1) {
- return "";
- }
-
- switch ((data[offset] >>> 4) & 0x7) {
- case 0:
- // SMS character set
- int countSeptets;
- int unusedBits = data[offset] & 7;
- countSeptets = (((length - 1) * 8) - unusedBits) / 7;
- ret = GsmAlphabet.gsm7BitPackedToString(data, offset + 1, countSeptets);
- break;
- case 1:
- // UCS2
- try {
- ret = new String(data,
- offset + 1, length - 1, "utf-16");
- } catch (UnsupportedEncodingException ex) {
- ret = "";
- Log.e(LOG_TAG, "implausible UnsupportedEncodingException", ex);
- }
- break;
-
- // unsupported encoding
- default:
- ret = "";
- break;
- }
-
- // "Add CI"
- // "The MS should add the letters for the Country's Initials and
- // a separator (e.g. a space) to the text string"
-
- if ((data[offset] & 0x40) != 0) {
- // FIXME(mkf) add country initials here
-
- }
-
- return ret;
- }
-
- /**
- * Convert a TS 131.102 image instance of code scheme '11' into Bitmap
- *
- * @param data The raw data
- * @param length The length of image body
- * @return The bitmap
- */
- public static Bitmap parseToBnW(byte[] data, int length) {
- int valueIndex = 0;
- int width = data[valueIndex++] & 0xFF;
- int height = data[valueIndex++] & 0xFF;
- int numOfPixels = width * height;
-
- int[] pixels = new int[numOfPixels];
-
- int pixelIndex = 0;
- int bitIndex = 7;
- byte currentByte = 0x00;
- while (pixelIndex < numOfPixels) {
- // reassign data and index for every byte (8 bits).
- if (pixelIndex % 8 == 0) {
- currentByte = data[valueIndex++];
- bitIndex = 7;
- }
- pixels[pixelIndex++] = bitToRGB((currentByte >> bitIndex--) & 0x01);
- }
- ;
-
- if (pixelIndex != numOfPixels) {
- Log.e(LOG_TAG, "parse end and size error");
- }
- return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888);
- }
-
- private static int bitToRGB(int bit) {
- if (bit == 1) {
- return Color.WHITE;
- } else {
- return Color.BLACK;
- }
- }
-
- /**
- * a TS 131.102 image instance of code scheme '11' into color Bitmap
- *
- * @param data The raw data
- * @param length the length of image body
- * @param transparency with or without transparency
- * @return The color bitmap
- */
- public static Bitmap parseToRGB(byte[] data, int length,
- boolean transparency) {
- int valueIndex = 0;
- int width = data[valueIndex++] & 0xFF;
- int height = data[valueIndex++] & 0xFF;
- int bits = data[valueIndex++] & 0xFF;
- int colorNumber = data[valueIndex++] & 0xFF;
- int clutOffset = ((data[valueIndex++] & 0xFF) << 8)
- | (data[valueIndex++] & 0xFF);
-
- int[] colorIndexArray = getCLUT(data, clutOffset, colorNumber);
- if (true == transparency) {
- colorIndexArray[colorNumber - 1] = Color.TRANSPARENT;
- }
-
- int[] resultArray = null;
- if (0 == (8 % bits)) {
- resultArray = mapTo2OrderBitColor(data, valueIndex,
- (width * height), colorIndexArray, bits);
- } else {
- resultArray = mapToNon2OrderBitColor(data, valueIndex,
- (width * height), colorIndexArray, bits);
- }
-
- return Bitmap.createBitmap(resultArray, width, height,
- Bitmap.Config.RGB_565);
- }
-
- private static int[] mapTo2OrderBitColor(byte[] data, int valueIndex,
- int length, int[] colorArray, int bits) {
- if (0 != (8 % bits)) {
- Log.e(LOG_TAG, "not event number of color");
- return mapToNon2OrderBitColor(data, valueIndex, length, colorArray,
- bits);
- }
-
- int mask = 0x01;
- switch (bits) {
- case 1:
- mask = 0x01;
- break;
- case 2:
- mask = 0x03;
- break;
- case 4:
- mask = 0x0F;
- break;
- case 8:
- mask = 0xFF;
- break;
- }
-
- int[] resultArray = new int[length];
- int resultIndex = 0;
- int run = 8 / bits;
- while (resultIndex < length) {
- byte tempByte = data[valueIndex++];
- for (int runIndex = 0; runIndex < run; ++runIndex) {
- int offset = run - runIndex - 1;
- resultArray[resultIndex++] = colorArray[(tempByte >> (offset * bits))
- & mask];
- }
- }
- return resultArray;
- }
-
- private static int[] mapToNon2OrderBitColor(byte[] data, int valueIndex,
- int length, int[] colorArray, int bits) {
- if (0 == (8 % bits)) {
- Log.e(LOG_TAG, "not odd number of color");
- return mapTo2OrderBitColor(data, valueIndex, length, colorArray,
- bits);
- }
-
- int[] resultArray = new int[length];
- // TODO fix me:
- return resultArray;
- }
-
- private static int[] getCLUT(byte[] rawData, int offset, int number) {
- if (null == rawData) {
- return null;
- }
-
- int[] result = new int[number];
- int endIndex = offset + (number * 3); // 1 color use 3 bytes
- int valueIndex = offset;
- int colorIndex = 0;
- int alpha = 0xff << 24;
- do {
- result[colorIndex++] = alpha
- | ((rawData[valueIndex++] & 0xFF) << 16)
- | ((rawData[valueIndex++] & 0xFF) << 8)
- | ((rawData[valueIndex++] & 0xFF));
- } while (valueIndex < endIndex);
- return result;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/PhoneConstants.java b/QKSMS/src/main/java/com/android/internal/telephony/PhoneConstants.java
deleted file mode 100644
index ceae31319f777997b27c1e31f81bd5bd9b7e7054..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/PhoneConstants.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.internal.telephony;
-
-/**
- * @hide
- */
-public class PhoneConstants {
-
- /**
- * The phone state. One of the following:
- *
- *
IDLE = no phone activity
- *
RINGING = a phone call is ringing or call waiting.
- * In the latter case, another call is active as well
- *
OFFHOOK = The phone is off hook. At least one call
- * exists that is dialing, active or holding and no calls are
- * ringing or waiting.
- *
- */
- public enum State {
- IDLE, RINGING, OFFHOOK;
- };
-
- /**
- * The state of a data connection.
- *
- *
CONNECTED = IP traffic should be available
- *
CONNECTING = Currently setting up data connection
- *
DISCONNECTED = IP not available
- *
SUSPENDED = connection is created but IP traffic is
- * temperately not available. i.e. voice call is in place
- * in 2G network
- *
- */
- public enum DataState {
- CONNECTED, CONNECTING, DISCONNECTED, SUSPENDED;
- };
-
- public static final String STATE_KEY = "state";
-
- // Radio Type
- public static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE;
- public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE;
- public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE;
- public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE;
- public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE;
- public static final int PHONE_TYPE_IMS = RILConstants.IMS_PHONE;
-
- // Modes for LTE_ON_CDMA
- public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN;
- public static final int LTE_ON_CDMA_FALSE = RILConstants.LTE_ON_CDMA_FALSE;
- public static final int LTE_ON_CDMA_TRUE = RILConstants.LTE_ON_CDMA_TRUE;
-
- // Number presentation type for caller id display (From internal/Connection.java)
- public static final int PRESENTATION_ALLOWED = 1; // normal
- public static final int PRESENTATION_RESTRICTED = 2; // block by user
- public static final int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
- public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info
-
-
- public static final String PHONE_NAME_KEY = "phoneName";
- public static final String FAILURE_REASON_KEY = "reason";
- public static final String STATE_CHANGE_REASON_KEY = "reason";
- public static final String DATA_NETWORK_TYPE_KEY = "networkType";
- public static final String DATA_FAILURE_CAUSE_KEY = "failCause";
- public static final String DATA_APN_TYPE_KEY = "apnType";
- public static final String DATA_APN_KEY = "apn";
- public static final String DATA_LINK_PROPERTIES_KEY = "linkProperties";
- public static final String DATA_NETWORK_CAPABILITIES_KEY = "networkCapabilities";
-
- public static final String DATA_IFACE_NAME_KEY = "iface";
- public static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
- public static final String DATA_NETWORK_ROAMING_KEY = "networkRoaming";
- public static final String PHONE_IN_ECM_STATE = "phoneinECMState";
-
- public static final String REASON_LINK_PROPERTIES_CHANGED = "linkPropertiesChanged";
-
- /**
- * Return codes for supplyPinReturnResult and
- * supplyPukReturnResult APIs
- */
- public static final int PIN_RESULT_SUCCESS = 0;
- public static final int PIN_PASSWORD_INCORRECT = 1;
- public static final int PIN_GENERAL_FAILURE = 2;
-
- /**
- * Return codes for enableApnType()
- */
- public static final int APN_ALREADY_ACTIVE = 0;
- public static final int APN_REQUEST_STARTED = 1;
- public static final int APN_TYPE_NOT_AVAILABLE = 2;
- public static final int APN_REQUEST_FAILED = 3;
- public static final int APN_ALREADY_INACTIVE = 4;
-
- /**
- * APN types for data connections. These are usage categories for an APN
- * entry. One APN entry may support multiple APN types, eg, a single APN
- * may service regular internet traffic ("default") as well as MMS-specific
- * connections.
- * APN_TYPE_ALL is a special type to indicate that this APN entry can
- * service all data connections.
- */
- public static final String APN_TYPE_ALL = "*";
- /** APN type for default data traffic */
- public static final String APN_TYPE_DEFAULT = "default";
- /** APN type for MMS traffic */
- public static final String APN_TYPE_MMS = "mms";
- /** APN type for SUPL assisted GPS */
- public static final String APN_TYPE_SUPL = "supl";
- /** APN type for DUN traffic */
- public static final String APN_TYPE_DUN = "dun";
- /** APN type for HiPri traffic */
- public static final String APN_TYPE_HIPRI = "hipri";
- /** APN type for FOTA */
- public static final String APN_TYPE_FOTA = "fota";
- /** APN type for IMS */
- public static final String APN_TYPE_IMS = "ims";
- /** APN type for CBS */
- public static final String APN_TYPE_CBS = "cbs";
- /** APN type for IA Initial Attach APN */
- public static final String APN_TYPE_IA = "ia";
- /** APN type for IA Emergency PDN */
- public static final String APN_TYPE_EMERGENCY = "emergency";
-
- public static final int RIL_CARD_MAX_APPS = 8;
-
- public static final int DEFAULT_CARD_INDEX = 0;
-
- public static final int MAX_PHONE_COUNT_SINGLE_SIM = 1;
-
- public static final int MAX_PHONE_COUNT_DUAL_SIM = 2;
-
- public static final int MAX_PHONE_COUNT_TRI_SIM = 3;
-
- public static final String PHONE_KEY = "phone";
-
- public static final String SLOT_KEY = "slot";
-
- // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is
- // FIXME: extensive, and see if this should be an array of all active subId's or ...?
- public static final String SUBSCRIPTION_KEY = "subscription";
-
- public static final String SUB_SETTING = "subSettings";
-
- public static final int SUB1 = 0;
- public static final int SUB2 = 1;
- public static final int SUB3 = 2;
-
- public static final int EVENT_SUBSCRIPTION_ACTIVATED = 500;
- public static final int EVENT_SUBSCRIPTION_DEACTIVATED = 501;
-
- // TODO: Remove these constants and use an int instead.
- public static final int SIM_ID_1 = 0;
- public static final int SIM_ID_2 = 1;
- public static final int SIM_ID_3 = 2;
- public static final int SIM_ID_4 = 3;
-
- // ICC SIM Application Types
- // TODO: Replace the IccCardApplicationStatus.AppType enums with these constants
- public static final int APPTYPE_UNKNOWN = 0;
- public static final int APPTYPE_SIM = 1;
- public static final int APPTYPE_USIM = 2;
- public static final int APPTYPE_RUIM = 3;
- public static final int APPTYPE_CSIM = 4;
- public static final int APPTYPE_ISIM = 5;
-
- public enum CardUnavailableReason {
- REASON_CARD_REMOVED,
- REASON_RADIO_UNAVAILABLE,
- REASON_SIM_REFRESH_RESET
- };
-
- // Initial MTU value.
- public static final int UNSET_MTU = 0;
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/RILConstants.java b/QKSMS/src/main/java/com/android/internal/telephony/RILConstants.java
deleted file mode 100644
index 87657d5a01e66ee81fecc0e914d39c6e72d08ad2..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/RILConstants.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-/**
- * TODO: This should probably not be an interface see
- * http://www.javaworld.com/javaworld/javaqa/2001-06/01-qa-0608-constants.html and google with
- * http://www.google.com/search?q=interface+constants&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a
- *
- * Also they should all probably be static final.
- */
-
-/**
- * {@hide}
- */
-public interface RILConstants {
- // From the top of ril.cpp
- int RIL_ERRNO_INVALID_RESPONSE = -1;
-
- int MAX_INT = 0x7FFFFFFF;
-
- // from RIL_Errno
- int SUCCESS = 0;
- int RADIO_NOT_AVAILABLE = 1; /* If radio did not start or is resetting */
- int GENERIC_FAILURE = 2;
- int PASSWORD_INCORRECT = 3; /* for PIN/PIN2 methods only! */
- int SIM_PIN2 = 4; /* Operation requires SIM PIN2 to be entered */
- int SIM_PUK2 = 5; /* Operation requires SIM PIN2 to be entered */
- int REQUEST_NOT_SUPPORTED = 6;
- int REQUEST_CANCELLED = 7;
- int OP_NOT_ALLOWED_DURING_VOICE_CALL = 8; /* data operation is not allowed during voice call in
- class C */
- int OP_NOT_ALLOWED_BEFORE_REG_NW = 9; /* request is not allowed before device registers to
- network */
- int SMS_SEND_FAIL_RETRY = 10; /* send sms fail and need retry */
- int SIM_ABSENT = 11; /* ICC card is absent */
- int SUBSCRIPTION_NOT_AVAILABLE = 12; /* fail to find CDMA subscription from specified
- location */
- int MODE_NOT_SUPPORTED = 13; /* HW does not support preferred network type */
- int FDN_CHECK_FAILURE = 14; /* send operation barred error when FDN is enabled */
- int ILLEGAL_SIM_OR_ME = 15; /* network selection failure due
- to wrong SIM/ME and no
- retries needed */
- int MISSING_RESOURCE = 16; /* no logical channel available */
- int NO_SUCH_ELEMENT = 17; /* application not found on SIM */
- int SUBSCRIPTION_NOT_SUPPORTED = 26; /* Subscription not supported */
-
- /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */
- int NETWORK_MODE_WCDMA_PREF = 0; /* GSM/WCDMA (WCDMA preferred) */
- int NETWORK_MODE_GSM_ONLY = 1; /* GSM only */
- int NETWORK_MODE_WCDMA_ONLY = 2; /* WCDMA only */
- int NETWORK_MODE_GSM_UMTS = 3; /* GSM/WCDMA (auto mode, according to PRL)
- AVAILABLE Application Settings menu*/
- int NETWORK_MODE_CDMA = 4; /* CDMA and EvDo (auto mode, according to PRL)
- AVAILABLE Application Settings menu*/
- int NETWORK_MODE_CDMA_NO_EVDO = 5; /* CDMA only */
- int NETWORK_MODE_EVDO_NO_CDMA = 6; /* EvDo only */
- int NETWORK_MODE_GLOBAL = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL)
- AVAILABLE Application Settings menu*/
- int NETWORK_MODE_LTE_CDMA_EVDO = 8; /* LTE, CDMA and EvDo */
- int NETWORK_MODE_LTE_GSM_WCDMA = 9; /* LTE, GSM/WCDMA */
- int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */
- int NETWORK_MODE_LTE_ONLY = 11; /* LTE Only mode. */
- int NETWORK_MODE_LTE_WCDMA = 12; /* LTE/WCDMA */
- int PREFERRED_NETWORK_MODE = NETWORK_MODE_WCDMA_PREF;
-
- int CDMA_CELL_BROADCAST_SMS_DISABLED = 1;
- int CDMA_CELL_BROADCAST_SMS_ENABLED = 0;
-
- int NO_PHONE = 0;
- int GSM_PHONE = 1;
- int CDMA_PHONE = 2;
- int SIP_PHONE = 3;
- int THIRD_PARTY_PHONE = 4;
- int IMS_PHONE = 5;
-
- int LTE_ON_CDMA_UNKNOWN = -1;
- int LTE_ON_CDMA_FALSE = 0;
- int LTE_ON_CDMA_TRUE = 1;
-
- int CDM_TTY_MODE_DISABLED = 0;
- int CDM_TTY_MODE_ENABLED = 1;
-
- int CDM_TTY_FULL_MODE = 1;
- int CDM_TTY_HCO_MODE = 2;
- int CDM_TTY_VCO_MODE = 3;
-
- /* Setup a packet data connection. See ril.h RIL_REQUEST_SETUP_DATA_CALL */
- int SETUP_DATA_TECH_CDMA = 0;
- int SETUP_DATA_TECH_GSM = 1;
-
- int SETUP_DATA_AUTH_NONE = 0;
- int SETUP_DATA_AUTH_PAP = 1;
- int SETUP_DATA_AUTH_CHAP = 2;
- int SETUP_DATA_AUTH_PAP_CHAP = 3;
-
- String SETUP_DATA_PROTOCOL_IP = "IP";
- String SETUP_DATA_PROTOCOL_IPV6 = "IPV6";
- String SETUP_DATA_PROTOCOL_IPV4V6 = "IPV4V6";
-
- /* Deactivate data call reasons */
- int DEACTIVATE_REASON_NONE = 0;
- int DEACTIVATE_REASON_RADIO_OFF = 1;
- int DEACTIVATE_REASON_PDP_RESET = 2;
-
- /* NV config radio reset types. */
- int NV_CONFIG_RELOAD_RESET = 1;
- int NV_CONFIG_ERASE_RESET = 2;
- int NV_CONFIG_FACTORY_RESET = 3;
-
-/*
-cat include/telephony/ril.h | \
- egrep '^#define' | \
- sed -re 's/^#define +([^ ]+)* +([^ ]+)/ int \1 = \2;/' \
- >>java/android/com.android.internal.telephony/gsm/RILConstants.java
-*/
-
- /**
- * No restriction at all including voice/SMS/USSD/SS/AV64
- * and packet data.
- */
- int RIL_RESTRICTED_STATE_NONE = 0x00;
- /**
- * Block emergency call due to restriction.
- * But allow all normal voice/SMS/USSD/SS/AV64.
- */
- int RIL_RESTRICTED_STATE_CS_EMERGENCY = 0x01;
- /**
- * Block all normal voice/SMS/USSD/SS/AV64 due to restriction.
- * Only Emergency call allowed.
- */
- int RIL_RESTRICTED_STATE_CS_NORMAL = 0x02;
- /**
- * Block all voice/SMS/USSD/SS/AV64
- * including emergency call due to restriction.
- */
- int RIL_RESTRICTED_STATE_CS_ALL = 0x04;
- /**
- * Block packet data access due to restriction.
- */
- int RIL_RESTRICTED_STATE_PS_ALL = 0x10;
-
- /** Data profile for RIL_REQUEST_SETUP_DATA_CALL */
- public static final int DATA_PROFILE_DEFAULT = 0;
- public static final int DATA_PROFILE_TETHERED = 1;
- public static final int DATA_PROFILE_IMS = 2;
- public static final int DATA_PROFILE_FOTA = 3;
- public static final int DATA_PROFILE_CBS = 4;
- public static final int DATA_PROFILE_OEM_BASE = 1000;
-
- int RIL_REQUEST_GET_SIM_STATUS = 1;
- int RIL_REQUEST_ENTER_SIM_PIN = 2;
- int RIL_REQUEST_ENTER_SIM_PUK = 3;
- int RIL_REQUEST_ENTER_SIM_PIN2 = 4;
- int RIL_REQUEST_ENTER_SIM_PUK2 = 5;
- int RIL_REQUEST_CHANGE_SIM_PIN = 6;
- int RIL_REQUEST_CHANGE_SIM_PIN2 = 7;
- int RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION = 8;
- int RIL_REQUEST_GET_CURRENT_CALLS = 9;
- int RIL_REQUEST_DIAL = 10;
- int RIL_REQUEST_GET_IMSI = 11;
- int RIL_REQUEST_HANGUP = 12;
- int RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND = 13;
- int RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND = 14;
- int RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE = 15;
- int RIL_REQUEST_CONFERENCE = 16;
- int RIL_REQUEST_UDUB = 17;
- int RIL_REQUEST_LAST_CALL_FAIL_CAUSE = 18;
- int RIL_REQUEST_SIGNAL_STRENGTH = 19;
- int RIL_REQUEST_VOICE_REGISTRATION_STATE = 20;
- int RIL_REQUEST_DATA_REGISTRATION_STATE = 21;
- int RIL_REQUEST_OPERATOR = 22;
- int RIL_REQUEST_RADIO_POWER = 23;
- int RIL_REQUEST_DTMF = 24;
- int RIL_REQUEST_SEND_SMS = 25;
- int RIL_REQUEST_SEND_SMS_EXPECT_MORE = 26;
- int RIL_REQUEST_SETUP_DATA_CALL = 27;
- int RIL_REQUEST_SIM_IO = 28;
- int RIL_REQUEST_SEND_USSD = 29;
- int RIL_REQUEST_CANCEL_USSD = 30;
- int RIL_REQUEST_GET_CLIR = 31;
- int RIL_REQUEST_SET_CLIR = 32;
- int RIL_REQUEST_QUERY_CALL_FORWARD_STATUS = 33;
- int RIL_REQUEST_SET_CALL_FORWARD = 34;
- int RIL_REQUEST_QUERY_CALL_WAITING = 35;
- int RIL_REQUEST_SET_CALL_WAITING = 36;
- int RIL_REQUEST_SMS_ACKNOWLEDGE = 37;
- int RIL_REQUEST_GET_IMEI = 38;
- int RIL_REQUEST_GET_IMEISV = 39;
- int RIL_REQUEST_ANSWER = 40;
- int RIL_REQUEST_DEACTIVATE_DATA_CALL = 41;
- int RIL_REQUEST_QUERY_FACILITY_LOCK = 42;
- int RIL_REQUEST_SET_FACILITY_LOCK = 43;
- int RIL_REQUEST_CHANGE_BARRING_PASSWORD = 44;
- int RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE = 45;
- int RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC = 46;
- int RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL = 47;
- int RIL_REQUEST_QUERY_AVAILABLE_NETWORKS = 48;
- int RIL_REQUEST_DTMF_START = 49;
- int RIL_REQUEST_DTMF_STOP = 50;
- int RIL_REQUEST_BASEBAND_VERSION = 51;
- int RIL_REQUEST_SEPARATE_CONNECTION = 52;
- int RIL_REQUEST_SET_MUTE = 53;
- int RIL_REQUEST_GET_MUTE = 54;
- int RIL_REQUEST_QUERY_CLIP = 55;
- int RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE = 56;
- int RIL_REQUEST_DATA_CALL_LIST = 57;
- int RIL_REQUEST_RESET_RADIO = 58;
- int RIL_REQUEST_OEM_HOOK_RAW = 59;
- int RIL_REQUEST_OEM_HOOK_STRINGS = 60;
- int RIL_REQUEST_SCREEN_STATE = 61;
- int RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION = 62;
- int RIL_REQUEST_WRITE_SMS_TO_SIM = 63;
- int RIL_REQUEST_DELETE_SMS_ON_SIM = 64;
- int RIL_REQUEST_SET_BAND_MODE = 65;
- int RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE = 66;
- int RIL_REQUEST_STK_GET_PROFILE = 67;
- int RIL_REQUEST_STK_SET_PROFILE = 68;
- int RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND = 69;
- int RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE = 70;
- int RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM = 71;
- int RIL_REQUEST_EXPLICIT_CALL_TRANSFER = 72;
- int RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE = 73;
- int RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE = 74;
- int RIL_REQUEST_GET_NEIGHBORING_CELL_IDS = 75;
- int RIL_REQUEST_SET_LOCATION_UPDATES = 76;
- int RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE = 77;
- int RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE = 78;
- int RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE = 79;
- int RIL_REQUEST_SET_TTY_MODE = 80;
- int RIL_REQUEST_QUERY_TTY_MODE = 81;
- int RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE = 82;
- int RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE = 83;
- int RIL_REQUEST_CDMA_FLASH = 84;
- int RIL_REQUEST_CDMA_BURST_DTMF = 85;
- int RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY = 86;
- int RIL_REQUEST_CDMA_SEND_SMS = 87;
- int RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE = 88;
- int RIL_REQUEST_GSM_GET_BROADCAST_CONFIG = 89;
- int RIL_REQUEST_GSM_SET_BROADCAST_CONFIG = 90;
- int RIL_REQUEST_GSM_BROADCAST_ACTIVATION = 91;
- int RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG = 92;
- int RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG = 93;
- int RIL_REQUEST_CDMA_BROADCAST_ACTIVATION = 94;
- int RIL_REQUEST_CDMA_SUBSCRIPTION = 95;
- int RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM = 96;
- int RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM = 97;
- int RIL_REQUEST_DEVICE_IDENTITY = 98;
- int RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE = 99;
- int RIL_REQUEST_GET_SMSC_ADDRESS = 100;
- int RIL_REQUEST_SET_SMSC_ADDRESS = 101;
- int RIL_REQUEST_REPORT_SMS_MEMORY_STATUS = 102;
- int RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING = 103;
- int RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE = 104;
- int RIL_REQUEST_ISIM_AUTHENTICATION = 105;
- int RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU = 106;
- int RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS = 107;
- int RIL_REQUEST_VOICE_RADIO_TECH = 108;
- int RIL_REQUEST_GET_CELL_INFO_LIST = 109;
- int RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE = 110;
- int RIL_REQUEST_SET_INITIAL_ATTACH_APN = 111;
- int RIL_REQUEST_IMS_REGISTRATION_STATE = 112;
- int RIL_REQUEST_IMS_SEND_SMS = 113;
- int RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC = 114;
- int RIL_REQUEST_SIM_OPEN_CHANNEL = 115;
- int RIL_REQUEST_SIM_CLOSE_CHANNEL = 116;
- int RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL = 117;
- int RIL_REQUEST_NV_READ_ITEM = 118;
- int RIL_REQUEST_NV_WRITE_ITEM = 119;
- int RIL_REQUEST_NV_WRITE_CDMA_PRL = 120;
- int RIL_REQUEST_NV_RESET_CONFIG = 121;
- int RIL_REQUEST_SET_UICC_SUBSCRIPTION = 122;
- int RIL_REQUEST_ALLOW_DATA = 123;
- int RIL_REQUEST_GET_HARDWARE_CONFIG = 124;
- int RIL_REQUEST_SIM_AUTHENTICATION = 125;
- int RIL_REQUEST_GET_DC_RT_INFO = 126;
- int RIL_REQUEST_SET_DC_RT_INFO_RATE = 127;
- int RIL_REQUEST_SET_DATA_PROFILE = 128;
- int RIL_REQUEST_SHUTDOWN = 129;
-
- int RIL_UNSOL_RESPONSE_BASE = 1000;
- int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
- int RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001;
- int RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED = 1002;
- int RIL_UNSOL_RESPONSE_NEW_SMS = 1003;
- int RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004;
- int RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005;
- int RIL_UNSOL_ON_USSD = 1006;
- int RIL_UNSOL_ON_USSD_REQUEST = 1007;
- int RIL_UNSOL_NITZ_TIME_RECEIVED = 1008;
- int RIL_UNSOL_SIGNAL_STRENGTH = 1009;
- int RIL_UNSOL_DATA_CALL_LIST_CHANGED = 1010;
- int RIL_UNSOL_SUPP_SVC_NOTIFICATION = 1011;
- int RIL_UNSOL_STK_SESSION_END = 1012;
- int RIL_UNSOL_STK_PROACTIVE_COMMAND = 1013;
- int RIL_UNSOL_STK_EVENT_NOTIFY = 1014;
- int RIL_UNSOL_STK_CALL_SETUP = 1015;
- int RIL_UNSOL_SIM_SMS_STORAGE_FULL = 1016;
- int RIL_UNSOL_SIM_REFRESH = 1017;
- int RIL_UNSOL_CALL_RING = 1018;
- int RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED = 1019;
- int RIL_UNSOL_RESPONSE_CDMA_NEW_SMS = 1020;
- int RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS = 1021;
- int RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL = 1022;
- int RIL_UNSOL_RESTRICTED_STATE_CHANGED = 1023;
- int RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE = 1024;
- int RIL_UNSOL_CDMA_CALL_WAITING = 1025;
- int RIL_UNSOL_CDMA_OTA_PROVISION_STATUS = 1026;
- int RIL_UNSOL_CDMA_INFO_REC = 1027;
- int RIL_UNSOL_OEM_HOOK_RAW = 1028;
- int RIL_UNSOL_RINGBACK_TONE = 1029;
- int RIL_UNSOL_RESEND_INCALL_MUTE = 1030;
- int RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 1031;
- int RIL_UNSOl_CDMA_PRL_CHANGED = 1032;
- int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033;
- int RIL_UNSOL_RIL_CONNECTED = 1034;
- int RIL_UNSOL_VOICE_RADIO_TECH_CHANGED = 1035;
- int RIL_UNSOL_CELL_INFO_LIST = 1036;
- int RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED = 1037;
- int RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED = 1038;
- int RIL_UNSOL_SRVCC_STATE_NOTIFY = 1039;
- int RIL_UNSOL_HARDWARE_CONFIG_CHANGED = 1040;
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/SmsConstants.java b/QKSMS/src/main/java/com/android/internal/telephony/SmsConstants.java
deleted file mode 100644
index b36f836818a9bfdc6387b25d306adeb71004038c..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/SmsConstants.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.internal.telephony;
-
-/**
- * SMS Constants and must be the same as the corresponding
- * deprecated version in SmsMessage.
- *
- * @hide
- */
-public class SmsConstants {
- /**
- * User data text encoding code unit size
- */
- public static final int ENCODING_UNKNOWN = 0;
- public static final int ENCODING_7BIT = 1;
- public static final int ENCODING_8BIT = 2;
- public static final int ENCODING_16BIT = 3;
-
- /**
- * The maximum number of payload septets per message
- */
- public static final int MAX_USER_DATA_SEPTETS = 160;
-
- /**
- * The maximum number of payload septets per message if a user data header
- * is present. This assumes the header only contains the
- * CONCATENATED_8_BIT_REFERENCE element.
- */
- public static final int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153;
-
- /**
- * This value is not defined in global standard. Only in Korea, this is used.
- */
- public static final int ENCODING_KSC5601 = 4;
-
- /**
- * The maximum number of payload bytes per message
- */
- public static final int MAX_USER_DATA_BYTES = 140;
-
- /**
- * The maximum number of payload bytes per message if a user data header
- * is present. This assumes the header only contains the
- * CONCATENATED_8_BIT_REFERENCE element.
- */
- public static final int MAX_USER_DATA_BYTES_WITH_HEADER = 134;
-
- /**
- * SMS Class enumeration.
- * See TS 23.038.
- */
- public enum MessageClass {
- UNKNOWN, CLASS_0, CLASS_1, CLASS_2, CLASS_3;
- }
-
- /**
- * Indicates a 3GPP format SMS message.
- *
- * @hide pending API council approval
- */
- public static final String FORMAT_3GPP = "3gpp";
-
- /**
- * Indicates a 3GPP2 format SMS message.
- *
- * @hide pending API council approval
- */
- public static final String FORMAT_3GPP2 = "3gpp2";
-}
diff --git a/QKSMS/src/main/java/com/android/internal/telephony/TelephonyProperties.java b/QKSMS/src/main/java/com/android/internal/telephony/TelephonyProperties.java
deleted file mode 100644
index 61aaaa36654f1cf0c0fee78520a330b4b9a5f45c..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/telephony/TelephonyProperties.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-/**
- * Contains a list of string constants used to get or set telephone properties
- * in the system. You can use {@link android.os.SystemProperties os.SystemProperties}
- * to get and set these values.
- *
- * @hide
- */
-public interface TelephonyProperties {
- //****** Baseband and Radio Interface version
-
- //TODO T: property strings do not have to be gsm specific
- // change gsm.*operator.*" properties to "operator.*" properties
-
- /**
- * Baseband version
- * Availability: property is available any time radio is on
- */
- static final String PROPERTY_BASEBAND_VERSION = "gsm.version.baseband";
-
- /**
- * Radio Interface Layer (RIL) library implementation.
- */
- static final String PROPERTY_RIL_IMPL = "gsm.version.ril-impl";
-
- //****** Current Network
-
- /**
- * Alpha name of current registered operator.
- * Availability: when registered to a network. Result may be unreliable on
- * CDMA networks.
- */
- static final String PROPERTY_OPERATOR_ALPHA = "gsm.operator.alpha";
- //TODO: most of these properties are generic, substitute gsm. with phone. bug 1856959
-
- /**
- * Numeric name (MCC+MNC) of current registered operator.
- * Availability: when registered to a network. Result may be unreliable on
- * CDMA networks.
- */
- static final String PROPERTY_OPERATOR_NUMERIC = "gsm.operator.numeric";
-
- /**
- * 'true' if the device is on a manually selected network
- *
- * Availability: when registered to a network
- */
- static final String PROPERTY_OPERATOR_ISMANUAL = "operator.ismanual";
-
- /**
- * 'true' if the device is considered roaming on this network for GSM
- * purposes.
- * Availability: when registered to a network
- */
- static final String PROPERTY_OPERATOR_ISROAMING = "gsm.operator.isroaming";
-
- /**
- * The ISO country code equivalent of the current registered operator's
- * MCC (Mobile Country Code)
- * Availability: when registered to a network. Result may be unreliable on
- * CDMA networks.
- */
- static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country";
-
- /**
- * The contents of this property is the value of the kernel command line
- * product_type variable that corresponds to a product that supports LTE on CDMA.
- * {@see BaseCommands#getLteOnCdmaMode()}
- */
- static final String PROPERTY_LTE_ON_CDMA_PRODUCT_TYPE = "telephony.lteOnCdmaProductType";
-
- /**
- * The contents of this property is the one of {@link Phone#LTE_ON_CDMA_TRUE} or
- * {@link Phone#LTE_ON_CDMA_FALSE}. If absent the value will assumed to be false
- * and the {@see #PROPERTY_LTE_ON_CDMA_PRODUCT_TYPE} will be used to determine its
- * final value which could also be {@link Phone#LTE_ON_CDMA_FALSE}.
- * {@see BaseCommands#getLteOnCdmaMode()}
- */
- static final String PROPERTY_LTE_ON_CDMA_DEVICE = "telephony.lteOnCdmaDevice";
-
- static final String CURRENT_ACTIVE_PHONE = "gsm.current.phone-type";
-
- //****** SIM Card
- /**
- * One of "UNKNOWN""ABSENT""PIN_REQUIRED"
- * "PUK_REQUIRED""NETWORK_LOCKED" or "READY"
- */
- static String PROPERTY_SIM_STATE = "gsm.sim.state";
-
- /**
- * The MCC+MNC (mobile country code+mobile network code) of the
- * provider of the SIM. 5 or 6 decimal digits.
- * Availability: SIM state must be "READY"
- */
- static String PROPERTY_ICC_OPERATOR_NUMERIC = "gsm.sim.operator.numeric";
-
- /**
- * PROPERTY_ICC_OPERATOR_ALPHA is also known as the SPN, or Service Provider Name.
- * Availability: SIM state must be "READY"
- */
- static String PROPERTY_ICC_OPERATOR_ALPHA = "gsm.sim.operator.alpha";
-
- /**
- * ISO country code equivalent for the SIM provider's country code
- */
- static String PROPERTY_ICC_OPERATOR_ISO_COUNTRY = "gsm.sim.operator.iso-country";
-
- /**
- * Indicates the available radio technology. Values include: "unknown",
- * "GPRS", "EDGE" and "UMTS".
- */
- static String PROPERTY_DATA_NETWORK_TYPE = "gsm.network.type";
-
- /**
- * Indicate if phone is in emergency callback mode
- */
- static final String PROPERTY_INECM_MODE = "ril.cdma.inecmmode";
-
- /**
- * Indicate the timer value for exiting emergency callback mode
- */
- static final String PROPERTY_ECM_EXIT_TIMER = "ro.cdma.ecmexittimer";
-
- /**
- * The international dialing prefix conversion string
- */
- static final String PROPERTY_IDP_STRING = "ro.cdma.idpstring";
-
- /**
- * Defines the schema for the carrier specified OTASP number
- */
- static final String PROPERTY_OTASP_NUM_SCHEMA = "ro.cdma.otaspnumschema";
-
- /**
- * Disable all calls including Emergency call when it set to true.
- */
- static final String PROPERTY_DISABLE_CALL = "ro.telephony.disable-call";
-
- /**
- * Set to true for vendor RIL's that send multiple UNSOL_CALL_RING notifications.
- */
- static final String PROPERTY_RIL_SENDS_MULTIPLE_CALL_RING =
- "ro.telephony.call_ring.multiple";
-
- /**
- * The number of milliseconds between CALL_RING notifications.
- */
- static final String PROPERTY_CALL_RING_DELAY = "ro.telephony.call_ring.delay";
-
- /**
- * Track CDMA SMS message id numbers to ensure they increment
- * monotonically, regardless of reboots.
- */
- static final String PROPERTY_CDMA_MSG_ID = "persist.radio.cdma.msgid";
-
- /**
- * Property to override DEFAULT_WAKE_LOCK_TIMEOUT
- */
- static final String PROPERTY_WAKE_LOCK_TIMEOUT = "ro.ril.wake_lock_timeout";
-
- /**
- * Set to true to indicate that the modem needs to be reset
- * when there is a radio technology change.
- */
- static final String PROPERTY_RESET_ON_RADIO_TECH_CHANGE = "persist.radio.reset_on_switch";
-
- /**
- * Set to false to disable SMS receiving, default is
- * the value of config_sms_capable
- */
- static final String PROPERTY_SMS_RECEIVE = "telephony.sms.receive";
-
- /**
- * Set to false to disable SMS sending, default is
- * the value of config_sms_capable
- */
- static final String PROPERTY_SMS_SEND = "telephony.sms.send";
-
- /**
- * Set to true to indicate a test CSIM card is used in the device.
- * This property is for testing purpose only. This should not be defined
- * in commercial configuration.
- */
- static final String PROPERTY_TEST_CSIM = "persist.radio.test-csim";
-
- /**
- * Ignore RIL_UNSOL_NITZ_TIME_RECEIVED completely, used for debugging/testing.
- */
- static final String PROPERTY_IGNORE_NITZ = "telephony.test.ignore.nitz";
-}
diff --git a/QKSMS/src/main/java/com/android/internal/util/ArrayUtils.java b/QKSMS/src/main/java/com/android/internal/util/ArrayUtils.java
deleted file mode 100644
index 74013582d6c48b82c549f1d200b1ccac9e273c3d..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/util/ArrayUtils.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.util;
-
-import java.lang.reflect.Array;
-
-// XXX these should be changed to reflect the actual memory allocator we use.
-// it looks like right now objects want to be powers of 2 minus 8
-// and the array size eats another 4 bytes
-
-/**
- * ArrayUtils contains some methods that you can call to find out
- * the most efficient increments by which to grow arrays.
- */
-public class ArrayUtils {
- private static Object[] EMPTY = new Object[0];
- private static final int CACHE_SIZE = 73;
- private static Object[] sCache = new Object[CACHE_SIZE];
-
- private ArrayUtils() { /* cannot be instantiated */ }
-
- public static int idealByteArraySize(int need) {
- for (int i = 4; i < 32; i++)
- if (need <= (1 << i) - 12)
- return (1 << i) - 12;
-
- return need;
- }
-
- public static int idealBooleanArraySize(int need) {
- return idealByteArraySize(need);
- }
-
- public static int idealShortArraySize(int need) {
- return idealByteArraySize(need * 2) / 2;
- }
-
- public static int idealCharArraySize(int need) {
- return idealByteArraySize(need * 2) / 2;
- }
-
- public static int idealIntArraySize(int need) {
- return idealByteArraySize(need * 4) / 4;
- }
-
- public static int idealFloatArraySize(int need) {
- return idealByteArraySize(need * 4) / 4;
- }
-
- public static int idealObjectArraySize(int need) {
- return idealByteArraySize(need * 4) / 4;
- }
-
- public static int idealLongArraySize(int need) {
- return idealByteArraySize(need * 8) / 8;
- }
-
- /**
- * Checks if the beginnings of two byte arrays are equal.
- *
- * @param array1 the first byte array
- * @param array2 the second byte array
- * @param length the number of bytes to check
- * @return true if they're equal, false otherwise
- */
- public static boolean equals(byte[] array1, byte[] array2, int length) {
- if (array1 == array2) {
- return true;
- }
- if (array1 == null || array2 == null || array1.length < length || array2.length < length) {
- return false;
- }
- for (int i = 0; i < length; i++) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns an empty array of the specified type. The intent is that
- * it will return the same empty array every time to avoid reallocation,
- * although this is not guaranteed.
- */
- @SuppressWarnings("unchecked")
- public static T[] emptyArray(Class kind) {
- if (kind == Object.class) {
- return (T[]) EMPTY;
- }
-
- int bucket = ((System.identityHashCode(kind) / 8) & 0x7FFFFFFF) % CACHE_SIZE;
- Object cache = sCache[bucket];
-
- if (cache == null || cache.getClass().getComponentType() != kind) {
- cache = Array.newInstance(kind, 0);
- sCache[bucket] = cache;
-
- // Log.e("cache", "new empty " + kind.getName() + " at " + bucket);
- }
-
- return (T[]) cache;
- }
-
- /**
- * Checks that value is present as at least one of the elements of the array.
- *
- * @param array the array to check in
- * @param value the value to check for
- * @return true if the value is present in the array
- */
- public static boolean contains(T[] array, T value) {
- for (T element : array) {
- if (element == null) {
- if (value == null) return true;
- } else {
- if (value != null && element.equals(value)) return true;
- }
- }
- return false;
- }
-
- public static boolean contains(int[] array, int value) {
- for (int element : array) {
- if (element == value) {
- return true;
- }
- }
- return false;
- }
-
- public static long total(long[] array) {
- long total = 0;
- for (long value : array) {
- total += value;
- }
- return total;
- }
-
- /**
- * Appends an element to a copy of the array and returns the copy.
- *
- * @param array The original array, or null to represent an empty array.
- * @param element The element to add.
- * @return A new array that contains all of the elements of the original array
- * with the specified element added at the end.
- */
- @SuppressWarnings("unchecked")
- public static T[] appendElement(Class kind, T[] array, T element) {
- final T[] result;
- final int end;
- if (array != null) {
- end = array.length;
- result = (T[]) Array.newInstance(kind, end + 1);
- System.arraycopy(array, 0, result, 0, end);
- } else {
- end = 0;
- result = (T[]) Array.newInstance(kind, 1);
- }
- result[end] = element;
- return result;
- }
-
- /**
- * Removes an element from a copy of the array and returns the copy.
- * If the element is not present, then the original array is returned unmodified.
- *
- * @param array The original array, or null to represent an empty array.
- * @param element The element to remove.
- * @return A new array that contains all of the elements of the original array
- * except the first copy of the specified element removed. If the specified element
- * was not present, then returns the original array. Returns null if the result
- * would be an empty array.
- */
- @SuppressWarnings("unchecked")
- public static T[] removeElement(Class kind, T[] array, T element) {
- if (array != null) {
- final int length = array.length;
- for (int i = 0; i < length; i++) {
- if (array[i] == element) {
- if (length == 1) {
- return null;
- }
- T[] result = (T[]) Array.newInstance(kind, length - 1);
- System.arraycopy(array, 0, result, 0, i);
- System.arraycopy(array, i + 1, result, i, length - i - 1);
- return result;
- }
- }
- }
- return array;
- }
-
- public static int[] appendInt(int[] cur, int val) {
- if (cur == null) {
- return new int[]{val};
- }
- final int N = cur.length;
- for (int i = 0; i < N; i++) {
- if (cur[i] == val) {
- return cur;
- }
- }
- int[] ret = new int[N + 1];
- System.arraycopy(cur, 0, ret, 0, N);
- ret[N] = val;
- return ret;
- }
-
- public static int[] removeInt(int[] cur, int val) {
- if (cur == null) {
- return null;
- }
- final int N = cur.length;
- for (int i = 0; i < N; i++) {
- if (cur[i] == val) {
- int[] ret = new int[N - 1];
- if (i > 0) {
- System.arraycopy(cur, 0, ret, 0, i);
- }
- if (i < (N - 1)) {
- System.arraycopy(cur, i + 1, ret, i, N - i - 1);
- }
- return ret;
- }
- }
- return cur;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/internal/util/Objects.java b/QKSMS/src/main/java/com/android/internal/util/Objects.java
deleted file mode 100644
index 20bea621829f3c7f911ddf12e15f5485d9db28b4..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/util/Objects.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.util;
-
-import java.util.Arrays;
-
-/**
- * Object utility methods.
- */
-public class Objects {
-
- /**
- * Determines whether two possibly-null objects are equal. Returns:
- *
- *
- *
{@code true} if {@code a} and {@code b} are both null.
- *
{@code true} if {@code a} and {@code b} are both non-null and they are
- * equal according to {@link Object#equals(Object)}.
- *
{@code false} in all other situations.
- *
- *
- *
This assumes that any non-null objects passed to this function conform
- * to the {@code equals()} contract.
- */
- public static boolean equal(Object a, Object b) {
- return a == b || (a != null && a.equals(b));
- }
-
- /**
- * Generates a hash code for multiple values. The hash code is generated by
- * calling {@link java.util.Arrays#hashCode(Object[])}.
- *
- *
This is useful for implementing {@link Object#hashCode()}. For example,
- * in an object that has three properties, {@code x}, {@code y}, and
- * {@code z}, one could write:
- *
- * public int hashCode() {
- * return Objects.hashCode(getX(), getY(), getZ());
- * }
- *
- * Warning: When a single object is supplied, the returned hash code
- * does not equal the hash code of that object.
- */
- public static int hashCode(Object... objects) {
- return Arrays.hashCode(objects);
- }
-
-}
diff --git a/QKSMS/src/main/java/com/android/internal/util/Preconditions.java b/QKSMS/src/main/java/com/android/internal/util/Preconditions.java
deleted file mode 100644
index 99f306731117b6bef5a566c15761b673991c259b..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/internal/util/Preconditions.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.util;
-
-/**
- * Simple static methods to be called at the start of your own methods to verify
- * correct arguments and state.
- */
-public class Preconditions {
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param reference an object reference
- * @return the non-null reference that was validated
- * @throws NullPointerException if {@code reference} is null
- */
- public static T checkNotNull(T reference) {
- if (reference == null) {
- throw new NullPointerException();
- }
- return reference;
- }
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param reference an object reference
- * @param errorMessage the exception message to use if the check fails; will
- * be converted to a string using {@link String#valueOf(Object)}
- * @return the non-null reference that was validated
- * @throws NullPointerException if {@code reference} is null
- */
- public static T checkNotNull(T reference, Object errorMessage) {
- if (reference == null) {
- throw new NullPointerException(String.valueOf(errorMessage));
- }
- return reference;
- }
-
- /**
- * Ensures the truth of an expression involving the state of the calling
- * instance, but not involving any parameters to the calling method.
- *
- * @param expression a boolean expression
- * @throws IllegalStateException if {@code expression} is false
- */
- public static void checkState(boolean expression) {
- if (!expression) {
- throw new IllegalStateException();
- }
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/AttrImpl.java b/QKSMS/src/main/java/com/android/mms/dom/AttrImpl.java
deleted file mode 100644
index ead639c419d6a74211532ec87853573b82b656d1..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/AttrImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.TypeInfo;
-
-public class AttrImpl extends NodeImpl implements Attr {
- private String mName;
- private String mValue;
-
- /*
- * Internal methods
- */
-
- protected AttrImpl(DocumentImpl owner, String name) {
- super(owner);
- mName = name;
- }
-
- /*
- * Attr Interface Methods
- */
-
- public String getName() {
- return mName;
- }
-
- public Element getOwnerElement() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean getSpecified() {
- return mValue != null;
- }
-
- public String getValue() {
- return mValue;
- }
-
- // Instead of setting a Text> with the content of the
- // String value as defined in the specs, we directly set here the
- // internal mValue member.
- public void setValue(String value) throws DOMException {
- mValue = value;
- }
-
- /*
- * Node Interface Methods
- */
-
- @Override
- public String getNodeName() {
- return mName;
- }
-
- @Override
- public short getNodeType() {
- return Node.ATTRIBUTE_NODE;
- }
-
- @Override
- public Node getParentNode() {
- return null;
- }
-
- @Override
- public Node getPreviousSibling() {
- return null;
- }
-
- @Override
- public Node getNextSibling() {
- return null;
- }
-
- @Override
- public void setNodeValue(String nodeValue) throws DOMException {
- setValue(nodeValue);
- }
-
- public TypeInfo getSchemaTypeInfo() {
- return null;
- }
-
- public boolean isId() {
- return false;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/DocumentImpl.java b/QKSMS/src/main/java/com/android/mms/dom/DocumentImpl.java
deleted file mode 100644
index aeeb51e378fd127e60808fd23ed8376017688e39..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/DocumentImpl.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-
-public abstract class DocumentImpl extends NodeImpl implements Document {
-
- /*
- * Internal methods
- */
-
- public DocumentImpl() {
- super(null);
- }
-
- /*
- * Document Interface Methods
- */
-
- public Attr createAttribute(String name) throws DOMException {
- return new AttrImpl(this, name);
- }
-
- public Attr createAttributeNS(String namespaceURI, String qualifiedName)
- throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public CDATASection createCDATASection(String data) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Comment createComment(String data) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DocumentFragment createDocumentFragment() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public abstract Element createElement(String tagName) throws DOMException;
-
- public Element createElementNS(String namespaceURI, String qualifiedName)
- throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public EntityReference createEntityReference(String name) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ProcessingInstruction createProcessingInstruction(String target, String data)
- throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Text createTextNode(String data) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DocumentType getDoctype() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public abstract Element getDocumentElement();
-
- public Element getElementById(String elementId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public NodeList getElementsByTagName(String tagname) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DOMImplementation getImplementation() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Node importNode(Node importedNode, boolean deep) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * Node Interface methods
- */
-
- @Override
- public short getNodeType() {
- return Node.DOCUMENT_NODE;
- }
-
- @Override
- public String getNodeName() {
- // The value of nodeName is "#document" when Node is a Document
- return "#document";
- }
-
- public String getInputEncoding() {
- return null;
- }
-
- public String getXmlEncoding() {
- return null;
- }
-
- public boolean getXmlStandalone() {
- return false;
- }
-
- public void setXmlStandalone(boolean xmlStandalone) throws DOMException {}
-
- public String getXmlVersion() {
- return null;
- }
-
- public void setXmlVersion(String xmlVersion) throws DOMException {}
-
- public boolean getStrictErrorChecking() {
- return true;
- }
-
- public void setStrictErrorChecking(boolean strictErrorChecking) {}
-
- public String getDocumentURI() {
- return null;
- }
-
- public void setDocumentURI(String documentURI) {}
-
- public Node adoptNode(Node source) throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public DOMConfiguration getDomConfig() {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public void normalizeDocument() {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public Node renameNode(Node n, String namespaceURI, String qualifiedName)
- throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/ElementImpl.java b/QKSMS/src/main/java/com/android/mms/dom/ElementImpl.java
deleted file mode 100644
index bad35ef7b4e78f5735266d3291631c4a95944c82..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/ElementImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-
-public class ElementImpl extends NodeImpl implements Element {
- private String mTagName;
- private NamedNodeMap mAttributes = new NamedNodeMapImpl();
-
- /*
- * Internal methods
- */
-
- protected ElementImpl(DocumentImpl owner, String tagName) {
- super(owner);
- mTagName = tagName;
- }
-
- /*
- * Element Interface methods
- */
-
- public String getAttribute(String name) {
- Attr attrNode = getAttributeNode(name);
- String attrValue = "";
- if (attrNode != null) {
- attrValue = attrNode.getValue();
- }
- return attrValue;
- }
-
- public String getAttributeNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Attr getAttributeNode(String name) {
- return (Attr)mAttributes.getNamedItem(name);
- }
-
- public Attr getAttributeNodeNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public NodeList getElementsByTagName(String name) {
- return new NodeListImpl(this, name, true);
- }
-
- public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTagName() {
- return mTagName;
- }
-
- public boolean hasAttribute(String name) {
- return (getAttributeNode(name) != null);
- }
-
- public boolean hasAttributeNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void removeAttribute(String name) throws DOMException {
- // TODO Auto-generated method stub
-
- }
-
- public void removeAttributeNS(String namespaceURI, String localName)
- throws DOMException {
- // TODO Auto-generated method stub
-
- }
-
- public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setAttribute(String name, String value) throws DOMException {
- Attr attribute = getAttributeNode(name);
- if (attribute == null) {
- attribute = mOwnerDocument.createAttribute(name);
- }
- attribute.setNodeValue(value);
- mAttributes.setNamedItem(attribute);
- }
-
- public void setAttributeNS(String namespaceURI, String qualifiedName,
- String value) throws DOMException {
- // TODO Auto-generated method stub
-
- }
-
- public Attr setAttributeNode(Attr newAttr) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * Node Interface methods
- */
-
- @Override
- public short getNodeType() {
- return ELEMENT_NODE;
- }
-
- @Override
- public String getNodeName() {
- // The value of nodeName is tagName when Node is an Element
- return mTagName;
- }
-
- @Override
- public NamedNodeMap getAttributes() {
- return mAttributes;
- }
-
- @Override
- public boolean hasAttributes() {
- return (mAttributes.getLength() > 0);
- }
-
- public TypeInfo getSchemaTypeInfo() {
- return null;
- }
-
- public void setIdAttribute(String name, boolean isId) throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public void setIdAttributeNS(String namespaceURI, String localName,
- boolean isId) throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public void setIdAttributeNode(Attr idAttr, boolean isId)
- throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/NamedNodeMapImpl.java b/QKSMS/src/main/java/com/android/mms/dom/NamedNodeMapImpl.java
deleted file mode 100644
index 93c3f6fb3e1199aaa7a79ae14c3a985c97ee032a..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/NamedNodeMapImpl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-import java.util.Vector;
-
-public class NamedNodeMapImpl implements NamedNodeMap {
-
- private Vector mNodes = new Vector();
-
- public int getLength() {
- return mNodes.size();
- }
-
- public Node getNamedItem(String name) {
- Node node = null;
- for (int i = 0; i < mNodes.size(); i++) {
- if (name.equals(mNodes.elementAt(i).getNodeName())) {
- node = mNodes.elementAt(i);
- break;
- }
- }
- return node;
- }
-
- public Node getNamedItemNS(String namespaceURI, String localName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Node item(int index) {
- if (index < mNodes.size()) {
- return mNodes.elementAt(index);
- }
- return null;
- }
-
- public Node removeNamedItem(String name) throws DOMException {
- Node node = getNamedItem(name);
- if (node == null) {
- throw new DOMException(DOMException.NOT_FOUND_ERR, "Not found");
- } else {
- mNodes.remove(node);
- }
- return node;
- }
-
- public Node removeNamedItemNS(String namespaceURI, String localName)
- throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Node setNamedItem(Node arg) throws DOMException {
- Node existing = getNamedItem(arg.getNodeName());
- if (existing != null) {
- mNodes.remove(existing);
- }
- mNodes.add(arg);
- return existing;
- }
-
- public Node setNamedItemNS(Node arg) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/NodeImpl.java b/QKSMS/src/main/java/com/android/mms/dom/NodeImpl.java
deleted file mode 100644
index bbf6ef50ec89dbb77eadeb7b1f57854225116060..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/NodeImpl.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import com.android.mms.dom.events.EventTargetImpl;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.UserDataHandler;
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventException;
-import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.EventTarget;
-
-import java.util.NoSuchElementException;
-import java.util.Vector;
-
-public abstract class NodeImpl implements Node, EventTarget {
- private Node mParentNode;
- private final Vector mChildNodes = new Vector();
- DocumentImpl mOwnerDocument;
- private final EventTarget mEventTarget = new EventTargetImpl(this);
-
- /*
- * Internal methods
- */
-
- protected NodeImpl(DocumentImpl owner) {
- mOwnerDocument = owner;
- }
-
- /*
- * Node Interface Methods
- */
-
- public Node appendChild(Node newChild) throws DOMException {
- ((NodeImpl)newChild).setParentNode(this);
- mChildNodes.remove(newChild);
- mChildNodes.add(newChild);
- return newChild;
- }
-
- public Node cloneNode(boolean deep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public NamedNodeMap getAttributes() {
- // Default. Override in Element.
- return null;
- }
-
- public NodeList getChildNodes() {
- return new NodeListImpl(this, null, false);
- }
-
- public Node getFirstChild() {
- Node firstChild = null;
- try {
- firstChild = mChildNodes.firstElement();
- }
- catch (NoSuchElementException e) {
- // Ignore and return null
- }
- return firstChild;
- }
-
- public Node getLastChild() {
- Node lastChild = null;
- try {
- lastChild = mChildNodes.lastElement();
- }
- catch (NoSuchElementException e) {
- // Ignore and return null
- }
- return lastChild;
- }
-
- public String getLocalName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getNamespaceURI() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Node getNextSibling() {
- if ((mParentNode != null) && (this != mParentNode.getLastChild())) {
- Vector siblings = ((NodeImpl)mParentNode).mChildNodes;
- int indexOfThis = siblings.indexOf(this);
- return siblings.elementAt(indexOfThis + 1);
- }
- return null;
- }
-
- public abstract String getNodeName();
-
- public abstract short getNodeType();
-
- public String getNodeValue() throws DOMException {
- // Default behaviour. Override if required.
- return null;
- }
-
- public Document getOwnerDocument() {
- return mOwnerDocument;
- }
-
- public Node getParentNode() {
- return mParentNode;
- }
-
- public String getPrefix() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Node getPreviousSibling() {
- if ((mParentNode != null) && (this != mParentNode.getFirstChild())) {
- Vector siblings = ((NodeImpl)mParentNode).mChildNodes;
- int indexOfThis = siblings.indexOf(this);
- return siblings.elementAt(indexOfThis - 1);
- }
- return null;
- }
-
- public boolean hasAttributes() {
- // Default. Override in Element.
- return false;
- }
-
- public boolean hasChildNodes() {
- return !(mChildNodes.isEmpty());
- }
-
- public Node insertBefore(Node newChild, Node refChild) throws DOMException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isSupported(String feature, String version) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void normalize() {
- // TODO Auto-generated method stub
- }
-
- public Node removeChild(Node oldChild) throws DOMException {
- if (mChildNodes.contains(oldChild)) {
- mChildNodes.remove(oldChild);
- ((NodeImpl)oldChild).setParentNode(null);
- } else {
- throw new DOMException(DOMException.NOT_FOUND_ERR, "Child does not exist");
- }
- return null;
- }
-
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
- if (mChildNodes.contains(oldChild)) {
- // Try to remove the new child if available
- try {
- mChildNodes.remove(newChild);
- } catch (DOMException e) {
- // Ignore exception
- }
- mChildNodes.setElementAt(newChild, mChildNodes.indexOf(oldChild));
- ((NodeImpl)newChild).setParentNode(this);
- ((NodeImpl)oldChild).setParentNode(null);
- } else {
- throw new DOMException(DOMException.NOT_FOUND_ERR, "Old child does not exist");
- }
- return oldChild;
- }
-
- public void setNodeValue(String nodeValue) throws DOMException {
- // Default behaviour. Override if required.
- }
-
- public void setPrefix(String prefix) throws DOMException {
- // TODO Auto-generated method stub
- }
-
- private void setParentNode(Node parentNode) {
- mParentNode = parentNode;
- }
-
- /*
- * EventTarget Interface
- */
-
- public void addEventListener(String type, EventListener listener, boolean useCapture) {
- mEventTarget.addEventListener(type, listener, useCapture);
- }
-
- public void removeEventListener(String type, EventListener listener, boolean useCapture) {
- mEventTarget.removeEventListener(type, listener, useCapture);
- }
-
- public boolean dispatchEvent(Event evt) throws EventException {
- return mEventTarget.dispatchEvent(evt);
- }
-
- public String getBaseURI() {
- return null;
- }
-
- public short compareDocumentPosition(Node other) throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public String getTextContent() throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public void setTextContent(String textContent) throws DOMException {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public boolean isSameNode(Node other) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public String lookupPrefix(String namespaceURI) {
- return null;
- }
-
- public boolean isDefaultNamespace(String namespaceURI) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public String lookupNamespaceURI(String prefix) {
- return null;
- }
-
- public boolean isEqualNode(Node arg) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public Object getFeature(String feature, String version) {
- return null;
- }
-
- public Object setUserData(String key, Object data,
- UserDataHandler handler) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, null);
- }
-
- public Object getUserData(String key) {
- return null;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/NodeListImpl.java b/QKSMS/src/main/java/com/android/mms/dom/NodeListImpl.java
deleted file mode 100644
index 3b4a74a714ae2261da115aa76e628ddbf775598c..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/NodeListImpl.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.util.ArrayList;
-
-public class NodeListImpl implements NodeList {
- private ArrayList mSearchNodes;
- private ArrayList mStaticNodes;
- private Node mRootNode;
- private String mTagName;
- private boolean mDeepSearch;
-
- /*
- * Internal Interface
- */
-
- /**
- * Constructs a NodeList by searching for all descendants or the direct
- * children of a root node with a given tag name.
- * @param rootNode The root Node of the search.
- * @param tagName The tag name to be searched for. If null, all descendants
- * will be returned.
- * @param deep Limit the search to the direct children of rootNode if false,
- * to all descendants otherwise.
- */
- public NodeListImpl(Node rootNode, String tagName, boolean deepSearch) {
- mRootNode = rootNode;
- mTagName = tagName;
- mDeepSearch = deepSearch;
- }
-
- /**
- * Constructs a NodeList for a given static node list.
- * @param nodes The static node list.
- */
- public NodeListImpl(ArrayList nodes) {
- mStaticNodes = nodes;
- }
-
- /*
- * NodeListImpl Interface
- */
-
- public int getLength() {
- if (mStaticNodes == null) {
- fillList(mRootNode);
- return mSearchNodes.size();
- } else {
- return mStaticNodes.size();
- }
- }
-
- public Node item(int index) {
- Node node = null;
- if (mStaticNodes == null) {
- fillList(mRootNode);
- try {
- node = mSearchNodes.get(index);
- } catch (IndexOutOfBoundsException e) {
- // Do nothing and return null
- }
- } else {
- try {
- node = mStaticNodes.get(index);
- } catch (IndexOutOfBoundsException e) {
- // Do nothing and return null
- }
- }
- return node;
- }
-
- /**
- * A preorder traversal is done in the following order:
- *
- *
Visit root.
- *
Traverse children from left to right in preorder.
- *
- * This method fills the live node list.
- * @param The root of preorder traversal
- * @return The next match
- */
- private void fillList(Node node) {
- // (Re)-initialize the container if this is the start of the search.
- // Visit the root of this iteration otherwise.
- if (node == mRootNode) {
- mSearchNodes = new ArrayList();
- } else {
- if ((mTagName == null) || node.getNodeName().equals(mTagName)) {
- mSearchNodes.add(node);
- }
- }
-
- // Descend one generation...
- node = node.getFirstChild();
-
- // ...and visit in preorder the children if we are in deep search
- // or directly add the children to the list otherwise.
- while (node != null) {
- if (mDeepSearch) {
- fillList(node);
- } else {
- if ((mTagName == null) || node.getNodeName().equals(mTagName)) {
- mSearchNodes.add(node);
- }
- }
- node = node.getNextSibling();
- }
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/events/EventImpl.java b/QKSMS/src/main/java/com/android/mms/dom/events/EventImpl.java
deleted file mode 100644
index 24fc908fa2539f4b8f518fa6791f94f079ee8476..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/events/EventImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.events;
-
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventTarget;
-
-public class EventImpl implements Event {
-
- // Event type informations
- private String mEventType;
- private boolean mCanBubble;
- private boolean mCancelable;
-
- // Flags whether the event type information was set
- // FIXME: Can we use mEventType for this purpose?
- private boolean mInitialized;
-
- // Target of this event
- private EventTarget mTarget;
-
- // Event status variables
- private short mEventPhase;
- private boolean mStopPropagation;
- private boolean mPreventDefault;
- private EventTarget mCurrentTarget;
- private int mSeekTo;
-
- private final long mTimeStamp = System.currentTimeMillis();
-
- public boolean getBubbles() {
- return mCanBubble;
- }
-
- public boolean getCancelable() {
- return mCancelable;
- }
-
- public EventTarget getCurrentTarget() {
- return mCurrentTarget;
- }
-
- public short getEventPhase() {
- return mEventPhase;
- }
-
- public EventTarget getTarget() {
- return mTarget;
- }
-
- public long getTimeStamp() {
- return mTimeStamp;
- }
-
- public String getType() {
- return mEventType;
- }
-
- public void initEvent(String eventTypeArg, boolean canBubbleArg,
- boolean cancelableArg) {
- mEventType = eventTypeArg;
- mCanBubble = canBubbleArg;
- mCancelable = cancelableArg;
- mInitialized = true;
- }
-
- public void initEvent(String eventTypeArg, boolean canBubbleArg, boolean cancelableArg,
- int seekTo) {
- mSeekTo = seekTo;
- initEvent(eventTypeArg, canBubbleArg, cancelableArg);
- }
-
- public void preventDefault() {
- mPreventDefault = true;
- }
-
- public void stopPropagation() {
- mStopPropagation = true;
- }
-
- /*
- * Internal Interface
- */
-
- boolean isInitialized() {
- return mInitialized;
- }
-
- boolean isPreventDefault() {
- return mPreventDefault;
- }
-
- boolean isPropogationStopped() {
- return mStopPropagation;
- }
-
- void setTarget(EventTarget target) {
- mTarget = target;
- }
-
- void setEventPhase(short eventPhase) {
- mEventPhase = eventPhase;
- }
-
- void setCurrentTarget(EventTarget currentTarget) {
- mCurrentTarget = currentTarget;
- }
-
- public int getSeekTo() {
- return mSeekTo;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/events/EventTargetImpl.java b/QKSMS/src/main/java/com/android/mms/dom/events/EventTargetImpl.java
deleted file mode 100644
index 358543a2629209a422ec814adde0d9eea8cbd7e1..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/events/EventTargetImpl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.events;
-
-import android.util.Log;
-
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventException;
-import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.EventTarget;
-
-import java.util.ArrayList;
-
-public class EventTargetImpl implements EventTarget {
- private static final String TAG = "EventTargetImpl";
- private ArrayList mListenerEntries;
- private EventTarget mNodeTarget;
-
- static class EventListenerEntry
- {
- final String mType;
- final EventListener mListener;
- final boolean mUseCapture;
-
- EventListenerEntry(String type, EventListener listener, boolean useCapture)
- {
- mType = type;
- mListener = listener;
- mUseCapture = useCapture;
- }
- }
-
- public EventTargetImpl(EventTarget target) {
- mNodeTarget = target;
- }
-
- public void addEventListener(String type, EventListener listener, boolean useCapture) {
- if ((type == null) || type.equals("") || (listener == null)) {
- return;
- }
-
- // Make sure we have only one entry
- removeEventListener(type, listener, useCapture);
-
- if (mListenerEntries == null) {
- mListenerEntries = new ArrayList();
- }
- mListenerEntries.add(new EventListenerEntry(type, listener, useCapture));
- }
-
- public boolean dispatchEvent(Event evt) throws EventException {
- // We need to use the internal APIs to modify and access the event status
- EventImpl eventImpl = (EventImpl)evt;
-
- if (!eventImpl.isInitialized()) {
- throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR,
- "Event not initialized");
- } else if ((eventImpl.getType() == null) || eventImpl.getType().equals("")) {
- throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR,
- "Unspecified even type");
- }
-
- // Initialize event status
- eventImpl.setTarget(mNodeTarget);
-
- // TODO: At this point, to support event capturing and bubbling, we should
- // establish the chain of EventTargets from the top of the tree to this
- // event's target.
-
- // TODO: CAPTURING_PHASE skipped
-
- // Handle AT_TARGET
- // Invoke handleEvent of non-capturing listeners on this EventTarget.
- eventImpl.setEventPhase(Event.AT_TARGET);
- eventImpl.setCurrentTarget(mNodeTarget);
- if (!eventImpl.isPropogationStopped() && (mListenerEntries != null)) {
- for (int i = 0; i < mListenerEntries.size(); i++) {
- EventListenerEntry listenerEntry = mListenerEntries.get(i);
- if (!listenerEntry.mUseCapture
- && listenerEntry.mType.equals(eventImpl.getType())) {
- try {
- listenerEntry.mListener.handleEvent(eventImpl);
- }
- catch (Exception e) {
- // Any exceptions thrown inside an EventListener will
- // not stop propagation of the event
- Log.w(TAG, "Catched EventListener exception", e);
- }
- }
- }
- }
-
- if (eventImpl.getBubbles()) {
- // TODO: BUBBLING_PHASE skipped
- }
-
- return eventImpl.isPreventDefault();
- }
-
- public void removeEventListener(String type, EventListener listener,
- boolean useCapture) {
- if (null == mListenerEntries) {
- return;
- }
- for (int i = 0; i < mListenerEntries.size(); i ++) {
- EventListenerEntry listenerEntry = mListenerEntries.get(i);
- if ((listenerEntry.mUseCapture == useCapture)
- && (listenerEntry.mListener == listener)
- && listenerEntry.mType.equals(type)) {
- mListenerEntries.remove(i);
- break;
- }
- }
- }
-
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementParallelTimeContainerImpl.java b/QKSMS/src/main/java/com/android/mms/dom/smil/ElementParallelTimeContainerImpl.java
deleted file mode 100644
index 97b08ec36b65b08acd6e072ed4f40264293021c4..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementParallelTimeContainerImpl.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Esmertec AG.
- * Copyright (C) 2007-2008 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.smil;
-
-import com.android.mms.dom.NodeListImpl;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.smil.ElementParallelTimeContainer;
-import org.w3c.dom.smil.ElementTime;
-import org.w3c.dom.smil.SMILElement;
-import org.w3c.dom.smil.Time;
-import org.w3c.dom.smil.TimeList;
-
-import java.util.ArrayList;
-
-public abstract class ElementParallelTimeContainerImpl extends ElementTimeContainerImpl
- implements ElementParallelTimeContainer {
- private final static String ENDSYNC_ATTRIBUTE_NAME = "endsync";
- private final static String ENDSYNC_FIRST = "first";
- private final static String ENDSYNC_LAST = "last";
- private final static String ENDSYNC_ALL = "all";
- private final static String ENDSYNC_MEDIA = "media";
-
- /*
- * Internal Interface
- */
-
- ElementParallelTimeContainerImpl(SMILElement element) {
- super(element);
- }
-
- public String getEndSync() {
- String endsync = mSmilElement.getAttribute(ENDSYNC_ATTRIBUTE_NAME);
- if ((endsync == null) || (endsync.length() == 0)) {
- setEndSync(ENDSYNC_LAST);
- return ENDSYNC_LAST;
- }
- if (ENDSYNC_FIRST.equals(endsync) || ENDSYNC_LAST.equals(endsync) ||
- ENDSYNC_ALL.equals(endsync) || ENDSYNC_MEDIA.equals(endsync)) {
- return endsync;
- }
-
- // FIXME add the checking for ID-Value and smil1.0-Id-value.
-
- setEndSync(ENDSYNC_LAST);
- return ENDSYNC_LAST;
- }
-
- public void setEndSync(String endSync) throws DOMException {
- if (ENDSYNC_FIRST.equals(endSync) || ENDSYNC_LAST.equals(endSync) ||
- ENDSYNC_ALL.equals(endSync) || ENDSYNC_MEDIA.equals(endSync)) {
- mSmilElement.setAttribute(ENDSYNC_ATTRIBUTE_NAME, endSync);
- } else { // FIXME add the support for ID-Value and smil1.0-Id-value.
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
- "Unsupported endsync value" + endSync);
- }
- }
-
- @Override
- public float getDur() {
- float dur = super.getDur();
- if (dur == 0) {
- dur = getImplicitDuration();
- }
- return dur;
- }
-
- public float getImplicitDuration() {
- float dur = -1.0F;
- if (ENDSYNC_LAST.equals(getEndSync())) {
- NodeList children = getTimeChildren();
- for (int i = 0; i < children.getLength(); ++i) {
- ElementTime child = (ElementTime) children.item(i);
- TimeList endTimeList = child.getEnd();
- for (int j = 0; j < endTimeList.getLength(); ++j) {
- Time endTime = endTimeList.item(j);
- if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
- // Return "indefinite" here.
- return -1.0F;
- }
- if (endTime.getResolved()) {
- float end = (float)endTime.getResolvedOffset();
- dur = (end > dur) ? end : dur;
- }
- }
- }
- } // Other endsync types are not supported now.
-
- return dur;
- }
-
- public NodeList getActiveChildrenAt(float instant) {
- /*
- * Find the closest Time of ElementTime before instant.
- * Add ElementTime to list of active elements if the Time belongs to the begin-list,
- * do not add it otherwise.
- */
- ArrayList activeChildren = new ArrayList();
- NodeList children = getTimeChildren();
- int childrenLen = children.getLength();
- for (int i = 0; i < childrenLen; ++i) {
- double maxOffset = 0.0;
- boolean active = false;
- ElementTime child = (ElementTime) children.item(i);
-
- TimeList beginList = child.getBegin();
- int len = beginList.getLength();
- for (int j = 0; j < len; ++j) {
- Time begin = beginList.item(j);
- if (begin.getResolved()) {
- double resolvedOffset = begin.getResolvedOffset() * 1000.0;
- if ((resolvedOffset <= instant) && (resolvedOffset >= maxOffset)) {
- maxOffset = resolvedOffset;
- active = true;
- }
- }
- }
-
- TimeList endList = child.getEnd();
- len = endList.getLength();
- for (int j = 0; j < len; ++j) {
- Time end = endList.item(j);
- if (end.getResolved()) {
- double resolvedOffset = end.getResolvedOffset() * 1000.0;
- if ((resolvedOffset <= instant) && (resolvedOffset >= maxOffset)) {
- maxOffset = resolvedOffset;
- active = false;
- }
- }
- }
-
- if (active) {
- activeChildren.add((Node) child);
- }
- }
- return new NodeListImpl(activeChildren);
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementSequentialTimeContainerImpl.java b/QKSMS/src/main/java/com/android/mms/dom/smil/ElementSequentialTimeContainerImpl.java
deleted file mode 100644
index 8330b3e65654bd9d49dbac148027cec43262955c..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementSequentialTimeContainerImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.smil;
-
-import com.android.mms.dom.NodeListImpl;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.smil.ElementSequentialTimeContainer;
-import org.w3c.dom.smil.ElementTime;
-import org.w3c.dom.smil.SMILElement;
-
-import java.util.ArrayList;
-
-public abstract class ElementSequentialTimeContainerImpl extends
- ElementTimeContainerImpl implements ElementSequentialTimeContainer {
-
- /*
- * Internal Interface
- */
-
- ElementSequentialTimeContainerImpl(SMILElement element) {
- super(element);
- }
-
- /*
- * ElementSequentialTimeContainer Interface
- */
-
- public NodeList getActiveChildrenAt(float instant) {
- NodeList allChildren = this.getTimeChildren();
- ArrayList nodes = new ArrayList();
- for (int i = 0; i < allChildren.getLength(); i++) {
- instant -= ((ElementTime) allChildren.item(i)).getDur();
- if (instant < 0) {
- nodes.add(allChildren.item(i));
- return new NodeListImpl(nodes);
- }
- }
- return new NodeListImpl(nodes);
- }
-
- public float getDur() {
- float dur = super.getDur();
- if (dur == 0) {
- NodeList children = getTimeChildren();
- for (int i = 0; i < children.getLength(); ++i) {
- ElementTime child = (ElementTime) children.item(i);
- if (child.getDur() < 0) {
- // Return "indefinite" since containing a child whose duration is indefinite.
- return -1.0F;
- }
- dur += child.getDur();
- }
- }
- return dur;
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeContainerImpl.java b/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeContainerImpl.java
deleted file mode 100644
index eca14cf313e136355d6328269ff8a66a21b42f9d..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeContainerImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2007 Esmertec AG.
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.smil;
-
-import org.w3c.dom.smil.ElementTimeContainer;
-import org.w3c.dom.smil.SMILElement;
-
-public abstract class ElementTimeContainerImpl extends ElementTimeImpl implements
- ElementTimeContainer {
-
- /*
- * Internal Interface
- */
-
- ElementTimeContainerImpl(SMILElement element) {
- super(element);
- }
-}
diff --git a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeImpl.java b/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeImpl.java
deleted file mode 100644
index d3e113056016b7c75a587c221f797ef2e19f6eb3..0000000000000000000000000000000000000000
--- a/QKSMS/src/main/java/com/android/mms/dom/smil/ElementTimeImpl.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Esmertec AG.
- * Copyright (C) 2007-2008 The Android Open Source Project
- * Copyright (C) 2015 QK Labs
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.dom.smil;
-
-import android.util.Log;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.smil.ElementTime;
-import org.w3c.dom.smil.SMILElement;
-import org.w3c.dom.smil.Time;
-import org.w3c.dom.smil.TimeList;
-
-import java.util.ArrayList;
-
-public abstract class ElementTimeImpl implements ElementTime {
- private static final String TAG = "ElementTimeImpl";
-
- private static final String FILL_REMOVE_ATTRIBUTE = "remove";
- private static final String FILL_FREEZE_ATTRIBUTE = "freeze";
- private static final String FILL_HOLD_ATTRIBUTE = "hold";
- private static final String FILL_TRANSITION_ATTRIBUTE = "transition";
- private static final String FILL_AUTO_ATTRIBUTE = "auto";
- private static final String FILL_ATTRIBUTE_NAME = "fill";
- private static final String FILLDEFAULT_ATTRIBUTE_NAME = "fillDefault";
-
- final SMILElement mSmilElement;
-
- /*
- * Internal Interface
- */
- ElementTimeImpl(SMILElement element) {
- mSmilElement = element;
- }
-
- // Default implementation. Override if required.
- int getBeginConstraints() {
- return TimeImpl.ALLOW_ALL;
- }
-
- // Default implementation. Override if required
- int getEndConstraints() {
- return TimeImpl.ALLOW_ALL;
- }
-
- /**
- * To get the parent node on the ElementTime tree. It is in opposition to getTimeChildren.
- * @return the parent ElementTime. Returns null if there is no parent.
- */
- abstract ElementTime getParentElementTime();
-
- /*
- * ElementTime Interface
- */
-
- public TimeList getBegin() {
- String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");
-
- // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
- ArrayList