Commit Graph

62 Commits (5e2c4c0297ddc733265fd324eb44ac5eca4d7228)

Author SHA1 Message Date
Jean Chalard 267e528253 Arrange to send the rawChecksum to LatinIME.
Bug: 13125743
Change-Id: I5d111336e6a0f5ab4e93ff333654a7a1f8f46480
2014-05-22 11:01:04 +09:00
Jean Chalard b8ff8ca9d9 Straighten out database cursors behavior.
Some were never closed, other closed twice. This change
makes all Cursor instances behave, having the #close()
call in a finally{} clause, and puts the burden of closing
the cursor squarely on the creator rather than in the
called methods.
There is however one exception that is beyond the scope
of this change: UserDictionarySettings have a Cursor
member, it's never closed, and fixing the problem is not
obvious. This change adds a TODO for now.

It's not very clear if this change actually helps with
bug#12670151, but it may be related and it's a good
think to do anyway.

Bug: 12670151
Change-Id: I87cc44387e7dee3da1488671b93a28d9d73f7dc0
2014-02-18 19:58:23 +09:00
Ken Wakasa 2fa3693c26 Reset to 9bd6dac470
The bulk merge from -bayo to klp-dev should not have been merged to master.

Change-Id: I527a03a76f5247e4939a672f27c314dc11cbb854
2013-12-13 17:13:32 +09:00
Ken Wakasa a7d2fc6bef Move settings related classes to "settings"
Change-Id: Id170dbfe2dcfc93130b7be4a84615940403ec37f
2013-07-22 16:35:44 +09:00
Jean Chalard cb13d11c0a Add a trace.
Emit a trace when a new dictionary is copied to LatinIME
successfully, not just when it fails. That will help diagnosing
some problems by being able to ensure this step succeeded
looking at the log.
This does not happen often (like, maybe 3 times at device
activation, and once every few weeks afterwards), so I think
the extra line in the log is more than acceptable.

Change-Id: I1674bc22d950a7be801076c5aa7e8bbebccab14b
2013-07-05 12:44:47 +09:00
Jean Chalard 555c4236db Fix a bug where AOSP Latin IME would not fill dictionaries
There is no reason not to contact the dictionary provider
when we don't have internet permission or when the URL
is empty. It knows how to handle both these cases.

Bug: 9388602
Change-Id: I30c4540551ad2f5e527d3acd1842bbd749feca89
2013-06-28 12:48:41 +09:00
Ken Wakasa e28eba5074 Move util classes to the latin/utils directory
Change-Id: I1c5b27c8edf231680edb8d96f63b9d04cfc6a6fa
2013-06-24 17:04:40 +09:00
Kurt Partridge e6125db98d Merge "Catch a permission exception" 2013-05-31 00:30:14 +00:00
Kurt Partridge d63f756013 Catch a permission exception
This change catches a SecurityException if the DictionaryProvider is
unavailable.

Change-Id: I4f2d87327c40765383d8847fd4e934b3cf799488
2013-05-30 13:40:40 -07:00
Jean Chalard e90d039e0c Fix two strict mode warnings.
Bug: 9052555
Change-Id: I86e90488679a78a9f6e901b640025619293765a0
2013-05-30 20:12:05 +09:00
Ken Wakasa 0d6c87d113 Cleanup an unused return value
Change-Id: I974964aa3cc24b5480e57bd38c197fe7a49acaa4
2013-04-30 16:53:18 +09:00
Jean Chalard c3f4783649 Add an additional ID to the client info.
Bug: 8651863
Change-Id: I748f35726d72ede926d5b06ed87ff029317f1ac3
2013-04-23 14:37:15 +09:00
Jean Chalard 8987cccf89 Add a class to encapsulate getting the metadata URI
Bug: 8376173
Change-Id: Icaac8ad412e0180c44e6a955943e3b208981b2ea
2013-04-11 17:52:16 +09:00
Jean Chalard 76d5f512f9 Ask the client to make itself known when it's not
Upon invoking the settings of the dictionary pack with an unknown
client, we now launch an intent to ask the client to make itself known.
This change also includes the code that receives this intent and
acts upon it.

Bug: 8492879
Change-Id: I2c6496dea845646961ecafcf64e282cb93ee91dc
2013-04-01 17:37:22 +09:00
Jean Chalard 1061bfdb34 Break dependencies to allow offdevice tests to build
Change-Id: Ia9a2e8f0672b3f72943f26fb15de1d3c7c5ce7f1
2013-03-19 16:45:25 +09:00
Jean Chalard d4cbc4fd07 Implement getting data files with protocol v2
This also does it for deleting them
Bug: 8167342
Bug: 6789534
Change-Id: I1823f98508881f109a667146d3608003f87aa4cb
2013-02-15 11:09:16 -08:00
Jean Chalard b1f27a2e26 Determine the protocol version of the dictionary pack
...for query.

Bug: 8167342
Change-Id: Ieb8e5b31c4b62bf507593c4631e31799aad5f267
2013-02-13 20:45:36 -08:00
Jean Chalard a9df972780 Clean up dictionary pack presence test.
This method is much cleaner and much more readable.

Change-Id: I8055c169ef7c4453ab45c463704bd56a6080da4f
2013-02-12 17:59:36 -08:00
Jean Chalard 8018051022 Some cleanups
Improve a slew of logging statements, and put commands that we don't
expect to need protecting against exceptions out of a try {} block.

This is a followup to Id3dc510a

Change-Id: Idc6f419ac095b5b0f2d6862d58926ef888cb34e6
2013-02-11 19:47:15 -08:00
Jean Chalard 82441e60e2 Remove unnecessary whitespace
This is a cleanup followup to Id3dc510a

Change-Id: Ie64395eb4b6218fd8c73cacddeed2fba1df65d26
2013-02-11 13:31:47 -08:00
Jean Chalard b2eac474ff Don't try to issue delete() commands on missing provider
Bug: 8173622
Change-Id: Id3dc510ae3535169b5290e87075cb2f433a1f603
2013-02-11 12:38:24 -08:00
Jean Chalard 3623ad238c [B14] Implement sending the dictionary list.
Bug: 7005813
Change-Id: Ic3ef69510d2b385d0d403191b2f701b6527d0166
2013-02-06 19:19:30 -08:00
Jean Chalard 6ecb4c4dcc [B11] Implement reset and passing of the URL to the dict pack
Bug: 7601410
Bug: 7595195
Change-Id: I78cf04dce7c1e64de6725d32317de288a83bd39d
2013-02-06 15:21:33 -08:00
Jean Chalard 8192b4a6ef [B9] Pass the client id parameter for dict info requests
Bug: 6789534
Change-Id: Ie3ea75b19ae4da2dea531e0077c58742a9502bc6
2013-02-02 18:23:40 +09:00
Jean Chalard f1acb0e52d Make some strings private
Change-Id: I0ffdbcf6bede86a3cdcb3a0e4ec263398502617c
2013-02-02 15:00:09 +09:00
Jean Chalard d515f134f7 Refactoring
This creates a new DictionaryInfoUtils class and moves a bunch
of static methods there for later usage.

Change-Id: Iecb0643e6029a7be36bd6cb36aa918c40e6d8c6a
2013-01-29 19:16:21 +09:00
Tadashi G. Takaoka 8aa9963a89 Fix Apache license comment
Change-Id: Ic56167f952a7f4449da366e1e81610e72c966086
2013-01-21 22:23:37 +09:00
Jean Chalard b56260b891 [AD4] Actually copy the file in place.
This finally makes it work.

Bug: 7702011

Change-Id: I3508c88567f79598e4d1dff561b6ba7dc5c3808f
2013-01-21 17:58:38 +09:00
Jean Chalard 372f9da4f9 am 18ff5612: am f592270a: am 7648b37d: Merge "Make sure all FDs are correctly closed." into jb-mr1.1-dev
* commit '18ff56125345746e288118d177fcabf3c079ead3':
  Make sure all FDs are correctly closed.
2012-11-13 18:47:02 -08:00
Jean Chalard 5c32b6da44 Make sure all FDs are correctly closed.
In this kind of series of calls, it's possible that an outer call to a
constructor fails, but the inner succeeded.
Example:
try {
    is = new A(new B());
} finally {
    if (null != is) is.close();
}
In this case, if new B() succeeds but new A() throws an
exception, is stays null and the intermediate object is never
closed. This is what was happening in this instance.

Bug: 7377336
Change-Id: I3fae9fec1135244982fcf5098c76d93f3e0f2add
2012-11-13 16:53:07 +09:00
Jean Chalard 1e0cc86b6f Fix the build.
It seems this change snuck out from a previous version.

Change-Id: I9c33d51273732b1d55bfd60f0957184c86fa88ab
2012-10-23 15:34:42 +09:00
Jean Chalard 9bb4eebf48 Add reader and writer for the combined dict format.
This introduces a new textual format for the dictionary that combines
words, bigrams and shortcuts to avoid complexity. It is also extensible
to n-grams to fool-prof for the future, and easier to read than XML.

Bug: 7388540
Change-Id: I942bbad51bd0c905a5a54c278667563fd6dd66ec
2012-10-23 15:06:25 +09:00
Jean Chalard 01e0913ad2 Make a better choice for the temporary file
Change-Id: I745bb285b6b52875c8d2b3a94deb962352f9754e
2012-10-12 19:58:07 +09:00
Jean Chalard 66c90cd2ae Put temporary files under a separate directory.
Bug: 7328003
Change-Id: Ibe5278ea209d149f87fd08785c77b17e3859948e
2012-10-11 17:53:06 +09:00
Jean Chalard c15726482e Unlink an old file before moving the new file over it
This is unlikely to be relevant to this bug, but just in case.

Bug: 7274972
Change-Id: I56b31b377af16cc2c15ceb90a19792bed3aab367
2012-10-04 15:49:08 +09:00
Tadashi G. Takaoka a28a05e971 Cleanup: Make some classes as final
Change-Id: I6009b3c1950ba32b7f1e205a3db2307fe0cd688e
2012-09-27 19:03:30 +09:00
Tadashi G. Takaoka 5f282ea9e4 Add CollectionUtils class to create generic collection easily
Change-Id: I6b4de9187e122298e5e9cd8ddc9070d062df6a89
2012-08-22 10:21:38 +09:00
Jean Chalard 4bcf70c931 Fix a bad interaction with mmap
Bug: 6761221
Change-Id: I7e6d98dc9d7cb34a6163c3957e401ff97abb975c
2012-07-04 17:57:06 +09:00
Jean Chalard 3abac7e28e Notify the dictionary pack about copy failures
Bug: 6532896
Change-Id: I57f7b1a400222c89776f9bff652a7da4470232c5
2012-05-23 18:46:51 +09:00
Jean Chalard b9e2bce95e Remove an updated dictionary that changed locales
When a dictionary changes locale, we need to remove the file
that corresponds to the old version. It has a different path
than the new one, so we have to search for it explicitly.

Bug: 6540631
Change-Id: Ie9d63ba636651fe90f8fbb9627b7265ac7b34ccd
2012-05-23 15:59:49 +09:00
Jean Chalard 04b03f4dd6 Allow using a format version 2 word list in LatinIME
Change-Id: I73a4df3a83e49be6e8d3a7d14eb027cfe10f1a23
2012-04-20 18:56:03 +09:00
Jean Chalard cec8552b18 Pass a parameter to the dict pack if we don't have a default dict
Also, optimize quite a bit the code that decides whether we have
a default dict or not.

Bug: 5705834
Change-Id: Ied20fbcbbc42cbe8c01759d11b1804d1156c6960
2012-04-12 13:05:31 +09:00
Tadashi G. Takaoka c61cd79229 Fix some obvious compiler warnings
Change-Id: I10a634f7492b45d5a72345f14d36cf341946387d
2012-03-29 15:07:53 +09:00
Jean Chalard bc89f5d3a5 Correctly close the gzip stream
I had gotten the chain call in reverse.
Bug: 6177523

Change-Id: Ic5b76425de2d5d05d5132f8d2c7ade0d79c14ccc
2012-03-21 17:28:37 +09:00
Tadashi G. Takaoka ab72a97d7c Cleanup unused import
This change also gets rid of several compiler warnings.

Change-Id: I23962edaadad18a6e0395d528af17b909dcf5dad
2011-10-04 12:46:20 +09:00
Jean Chalard 7a408431fe Check the magic number of a decoded file
Checking the magic number of a file upon decoding is necessary,
because if the file is corrupt and we don't check it, we will
fall back to a simple copy of the corrupted file. Latin IME
would realize this and would not crash, but would not use the
corrupted dictionary. If this happened to be a main dictionary,
then the user would lose the ability to use the correct
built-in dictionary.

Not the same, but kinda similar to
Bug: 5223031

Change-Id: Ic2783dc9dd5f3dcf2865623d9452765fe3778db7
2011-08-31 14:37:11 +09:00
Jean Chalard de4e8dedcc Allow sharing dictionaries between similar locales.
Bug: 5058488
Change-Id: Ib12013f58afad957a8205b439f87480cc12ea06f
2011-08-25 19:42:06 +09:00
Jean Chalard a16621ada4 Add a debug variable
...that was missing

Change-Id: Ia3b17909f295e0a93dee633c8d67c0e03840023e
2011-08-24 21:36:18 +09:00
Jean Chalard 20973de72b Avoid unnecessary output to the system log.
The message this removes gets printed under normal conditions.
Normally dictionary files are compressed then crypted, but not
compressed a second time; however LatinIME tries to open a
compressed-crypted-compressed file first, because it could not
do it afterwards and we want to support this case. So under
normal operations, the first method LatinIME tries is actually
expected to fail.
Also, if we decide to stop compressing or/and encrypting dicts
LatinIME supports it as a valid use case. It should not print
errors to the log.

If the file cannot be open at all, then it is an unexpected
case, and Latin IME still reports to the log.

Change-Id: Ic5228c51365a101af1d03e2c893484d3050b5a1c
2011-08-24 20:27:04 +09:00
Jean Chalard 38d512c0b2 Call the decrypt/unzip routines upon copying a dictionary.
Bug: 5095140
Change-Id: I7000f752bc9b7fd6a7af4839b2f225c085300128
2011-08-24 17:12:12 +09:00