57 Commits

Author SHA1 Message Date
Henrik Engström
6393b07134 Fix possible integer overflow in MtpStorage
When converting the MB value MtpReserveSpace value to bytes there is a
possible integer overflow since 3 integer values are multiplied, even
though the result is stored in a long variable. This would be visible when
the value is more than 2 GB. This is solved by making the constants
longs instead of ints.

Change-Id: I799129f7076a6e331cece17b5c05aed210499648
2013-01-09 09:27:59 +01:00
Kenny Root
58ed5d748c am 768d9e1a: Merge "Correct executable bit for source files"
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
  Correct executable bit for source files
2012-11-07 11:52:12 -08:00
Kenny Root
3a084af2e9 Correct executable bit for source files
Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-11-07 10:27:31 -08:00
Mike Lockwood
465d72073c am ad23333f: am 945080b5: am 1e86994c: Merge "MtpData bmp format file can\'t recognize when copy bmp into DUT"
* commit 'ad23333f728471a7f2c49cd1c9575f1cea2503f6':
  MtpData bmp format file can't recognize when copy bmp into DUT
2012-09-18 11:01:32 -07:00
Mike Lockwood
f6f1661457 MtpDatabase: Use actual file size instead of media database size column
Fixes problems with file transfer from device to host that can occur
if the database size value is wrong.

Bug: 6954446

Change-Id: I03c3dd4b75267d1f4613f0b588c8899ded9a70be
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-09-12 15:50:59 -07:00
Mike Lockwood
58e6831ccb MtpDatabase: Fix typo affecting parent and format queries
Bug: 7114350

Change-Id: I80269cfcebf521ea13cae30c1c9bd477d76adbd1
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-09-11 10:49:34 -07:00
bo huang
240582eabe MtpData bmp format file can't recognize when copy bmp into DUT
add support for bmp format.

Change-Id: I67d4703b43cd32abad638bae57bbceb65b4be6de
Author: bo huang <bo.b.huang@intel.com>
Signed-off-by: bo huang <bo.b.huang@intel.com>
Signed-off-by: Wu, Hao <hao.wu@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 24555
2012-08-17 10:28:51 +08:00
bo huang
3b60dacb4e MtpStorage: correct the size of reserve space for MTP
According to description in frameworks/base/core/res/res/xml/storage_list.xml,
"mtpReserve: (integer) number of megabytes of storage MTP should reserve for free storage".
Mtpstorage class use it directly and doesn't change it to correct size in megabyes.
Mtp initor can not get correct storage information from android.

Change-Id: Icf59eb1eb478e67ea5990be96a9decb41aa55504
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
Signed-off-by: Jack Ren<jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-08-07 13:02:59 +08:00
Mike Lockwood
1e855d98aa MtpDatabase: Fix sqlite3 pattern matching for MTP directory deletes
Bug: 6684451

Change-Id: I90204550ccfcd1b7a5b1973bed2a88e934aae053
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-06-26 16:33:05 -07:00
Fabrice Di Meglio
0100625bb3 Merge "Fix bug #6522190 MountService should respond to configuration changes ("INTERNAL STORAGE" string should be translated dynamically)" into jb-dev 2012-05-24 10:42:23 -07:00
Fabrice Di Meglio
13fe2a5330 Fix bug #6522190 MountService should respond to configuration changes ("INTERNAL STORAGE" string should be translated dynamically)
- use an ID instead of a String for StorageVolume description
- use this ID for getting the correct localized version of the description string

Change-Id: I30f3080fce2c889be38bfdf9f5121dffcf8a99e8
2012-05-23 16:38:09 -07:00
Marco Nelissen
b4b847866f Handle _ and % in paths
When doing a "like" match on a path, add a second non-like constraint
so that sqlite wildcard characters don't match arbitrary other characters.
b/6501408

Change-Id: I21f9b1c2d8e7c7ef27c0ad5fe24c3e01cd67fb61
2012-05-22 16:30:34 -07:00
Marco Nelissen
f3a3b9ec9c Merge "Handle adding/removing/renaming nomedia paths" 2012-01-30 08:27:57 -08:00
Jeff Brown
75ea64fc54 Implement a cancelation mechanism for queries.
Added new API to enable cancelation of SQLite and content provider
queries by means of a CancelationSignal object.  The application
creates a CancelationSignal object and passes it as an argument
to the query.  The cancelation signal can then be used to cancel
the query while it is executing.

If the cancelation signal is raised before the query is executed,
then it is immediately terminated.

Change-Id: If2c76e9a7e56ea5e98768b6d4f225f0a1ca61c61
2012-01-27 17:33:21 -08:00
Marco Nelissen
ca78f3d9af Handle adding/removing/renaming nomedia paths
b/5849015
Change-Id: I3ec7419498d1ecc83db6d4605b3d7610349231f7
2012-01-27 15:10:14 -08:00
Mike Lockwood
73e56d935e MTP: Add support for restricting PTP to only certain subdirectories of the storage
Bug: 5527220

Change-Id: If68e7481617ecb62abd24e2d89e6b7dfdf95ba2b
Signed-off-by: Mike Lockwood <lockwood@google.com>
2011-12-02 11:08:39 -05:00
dujin.cha
fe464a76d8 [Prime K] Fix gabage character issue
Korean characters show up as gabage characters in Music player.
Reason : MTP service does not set the locale for the MediaScanner
Solution : Set locale when MtpDatabase creates MediaScanner.

Bug ID : 5567433
Signed-off-by: dujin.cha <dujin.cha@samsung.com>

Change-Id: I4bfe5f603c113170d45bd57a8709c21c665e260b
2011-11-22 10:28:21 -08:00
Mike Lockwood
dcc31946f2 MTP: Clean up MtpServer initialization and threading:
Move thread from native to Java code
Remove the stop() method (the thread will exit on its own)

Change-Id: Ib897c3630162f82669a4ee8c187e8172da50b29d
2011-07-13 09:44:42 -04:00
Mike Lockwood
7a59dd2ce3 MTP: Return error if user tries to copy a file >= 4GB to a FAT32 file system
Bug: 4561836

Change-Id: I2bffb93b032038f6c220c24c752ccd7ca66c23a0
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-11 13:40:02 -04:00
Mike Lockwood
7d40d42a36 MTP: Add support for PTP variant of GetDeviceInfo result.
Change-Id: I09f86fda768b7697665e401adb9516588859bf59
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-21 08:27:06 -04:00
Mike Lockwood
6acc90fc21 MTP: Fix some problems with GetObjectHandles and GetNumObjects commands
These calls did not correctly handle some variants of the arguments,
which showed up when running in PTP mode.

Change-Id: Iedbaefebfa39111c8bcaee7c6cc3820a65d6c98f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-17 19:49:05 -04:00
Mike Lockwood
aa48835ce9 MTP: Remove obsolete setPtpMode support
PTP mode will be implemented as a separate USB function instead.

Change-Id: I9304c1936c70604ab2ed9704c6b95e11b61f5ba2
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-08 09:19:23 -07:00
Mike Lockwood
fbfe555125 StorageVolume: Add getStorageId() accessor
This ID is used for MTP as well as per volume querying in the media provider.

Change-Id: Ic4fc986d972bd477730643f7e9450c390c0b3a4b
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-17 17:19:37 -04:00
Dianne Hackborn
1e662c3294 Merge "DO NOT MERGE. Integrate from master: Rework display size access." into honeycomb-mr2 2011-05-16 12:54:22 -07:00
Dianne Hackborn
ac8dea12c1 DO NOT MERGE. Integrate from master: Rework display size access.
Applications now get the display size from the window manager.  No
behavior should be changed yet, this is just prep for some real
changes.

Change-Id: I47bf8b55ecd4476c25ed6482494a7bcc5fae45d2
2011-05-16 11:58:27 -07:00
Mike Lockwood
51690544aa MTP: Have GetStorageInfo command return correct storage type for removable storage
Change-Id: I09b548483c12080e7d77970babcae2eef379f2f4
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-16 14:29:45 -04:00
The Android Automerger
158e3582c0 Merge remote branch 'goog/honeycomb-mr1' into honeycomb-mr2 2011-05-08 22:11:52 -07:00
Scott Main
0cdd9f7def docs: add package description for mtp and a little more info to MtpDevice
Change-Id: I44b3926c4a286f624de525a7f0cc896879582bf5
2011-05-05 15:53:44 -07:00
Mike Lockwood
7ae938be1b DO NOT MERGE MTP and media provider support for multiple storage devices:
- MTP support for multiple storage units

- Add storage_id column to media database for MTP storage ID

- Add framework resource for defining mount points and user visible descriptions
for multiple volumes

- Clean up locking in MtpServer JNI code

Change-Id: Ide6d47bd9aa1698ed2a13d695613e03f2a9b29e3
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-03 21:03:56 -04:00
Mike Lockwood
11dd5ae97b Improve Javadoc for USB Manager and MTP/PTP support.
Bug: 4091519

Change-Id: Ida79593d5a984f7ffd0934ae7bded23b8faf9eef
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-04-01 14:11:50 -04:00
Mike Lockwood
a3f8514492 MtpServer: Do not attempt to stop MTP if it has not been started
Fixes an ANR that occurred if we got a USB disconnected event
before the MTP service had started.

Bug: 4118033

Change-Id: I6cad4281a5911a9926cae923f34d3a6bf98346c5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-17 09:43:50 -04:00
Mike Lockwood
62cfeeb821 USB: minor cleanup work
Bug: 4067029

Change-Id: Icd8f912ab8732b5f770a217b9b3731092597ce02
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-11 18:51:29 -05:00
Mike Lockwood
c72eb9113a Remove MtpClient class from framework and public API
After reviewing this class I decided it would be best not to include it in the public API
since it adds no functionality that cannot be done using MtpDevice and other APIs directly.
So I am moving it to the CameraBrowser sample instead.

Also changed CameraBrowser to build against the SDK to ensure all the necessary APIs for
PTP support have been made public.

Bug: 4067029

Change-Id: I585b06104084953176d018ced08bba0cb4607490
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-11 10:55:44 -05:00
Mike Lockwood
acc29cc91b UsbDevice: Move IO related methods to new UsbDeviceConnection class
UsbDevice is now just an immutable parcelable object like UsbInterface and
UsbEndpoint.
All IO related functionality is now contained in UsbDeviceConnection
and UsbRequest.

Bug: 4067029

Change-Id: Ia84da0b512a697acc940eee0c3566711c62e1a68
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-11 10:24:21 -05:00
Mike Lockwood
3a68b8338b USB: Add API and dialog for apps to request permissions for USB devices and accessories
New APIs:

UsbManager.hasPermission returns true if the caller has permission
for the given device or accessory

UsbManager.requestPermission poses a dialog to allow the user to give the caller
permission for the device or accessory.
Result is returned via a PendingIntent.
No dialog is displayed if the caller already has permission.

Also moved UsbResolverActivity to SystemUI package

BUG: 4069037

Change-Id: I93be769501a8776b49ac26e468af19f8fa2114c9
2011-03-08 21:22:19 -05:00
Mike Lockwood
823f5bf3db Merge "MTP: Use SharedPreferences for MTP device properties rather than sqlite3" into honeycomb-mr1 2011-03-07 20:04:23 -08:00
Mike Lockwood
2b8a1ee057 MtpClient: Fix problem with getDeviceList() returning empty result in some cases
BUG: 3503128

Change-Id: I2263437d6018848e316ae4096eb07305fc4dc486
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-07 14:19:06 -05:00
Mike Lockwood
775de951a8 MTP: Use SharedPreferences for MTP device properties rather than sqlite3
sqlite3 is overkill for what we are doing here, and more fragile.

BUG: 3512856

Change-Id: I83d86127949d894a3887db3456d91b013060e852
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-05 17:34:11 -05:00
Mike Lockwood
1bdeef34ef MtpClient: remove finalize override to avoid multiple calls to unregisterReceiver
BUG: 3497801

Change-Id: I4ed0166efcc509a18361287c5816bc4844089025
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-02 16:59:53 -08:00
Mike Lockwood
c4308f01c9 Move USB framework support from android.hardware to android.hardware.usb package
Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-03-01 08:07:20 -08:00
Mike Lockwood
188d00b07e UsbManager: Remove redundant Intent extras from USB device and accessory broadcasts
These extras are also accessable via the UsbDevice and UsbAccessory classes,
which are also included as extras.
Since you can't filter Intents based on extras there is no point in duplicating
this information as separate extras.

Change-Id: I4c8d1e70d66023a1800b3f8f06118898da6b37af
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-23 13:14:33 -08:00
Mike Lockwood
66e57f6aa9 MTP: Disable MTP when the keyguard is locked and secure
BUG:  3402847

Change-Id: I6c77efe18f525cd0af37911c8b6aac4f17352552
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-22 13:57:23 -08:00
Mike Lockwood
540380fb0a Add MTP/PTP host support to the public API
Needed for unbundling the Gallery app

Change-Id: I57e6b76ee5c9e57cb8c055329ac13251879baafd
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-11 09:09:11 -05:00
Mike Lockwood
fd22edc668 MTP: Fix NPE in MtpPropertyGroup
Change-Id: I65fbd3f2f62724434136c6ae310e6647884902d2
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-08 21:45:22 -05:00
Mike Lockwood
4356d81b34 MTP: Add support for querying all objects in GetObjectPropList
Change-Id: I1f31971c4c777462f485e52fac016dc0fff48ad9
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-02-07 13:58:08 -05:00
Glenn Kasten
f9f223edb4 Bug 1804058 FLAC extractor
Note: dependent on external/flac for libFLAC

Implemented and tested:
 * FLAC container
 * mono and stereo
 * standard sample rates
 * standard bit depths
 * sniffer
 * media scanner
 * Vorbis comment metadata including album art
 * random access seeking with "torture test"
 * web browser integration for audio/flac (not audio/x-flac), but
   note that most web servers don't correctly report the MIME type

Not implemented:
 * 24-bit to 16-bit dither or noise shaping in AudioFlinger
 * 96 kHz to 44.1 or 48 kHz downsampling low pass filter in AudioFlinger
 * replay gain is better done in AudioFlinger
 * multi-channel, would need AudioFlinger support
 * Ogg container, does not seem to be very popular yet

Change-Id: I300873e8c0cfc2e95403d9adb5064d16a2923f17
2011-02-03 13:39:10 -08:00
Mike Lockwood
501e52f09d am 7fadb5e7: am 2b3da7ab: Merge "MTP: Fix race conditions in MtpServer JNI code" into honeycomb
* commit '7fadb5e77fd079c3a6c5eeae1ae81a487864b129':
  MTP: Fix race conditions in MtpServer JNI code
2011-01-25 16:20:50 -08:00
Mike Lockwood
071b2b6739 MTP: Fix race conditions in MtpServer JNI code
Make sure previous MtpThread has exited before starting another to avoid
EBUSY opening MTP kernel driver.

BUG: 3317803

Change-Id: I81dcbac42bcf5f680ed1b1469839bc0b0e49d53d
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-25 15:10:31 -08:00
Mike Lockwood
47063a859a Merge "New APIs for MTP and PTP host support" 2011-01-22 15:59:28 -08:00
Mike Lockwood
8182e72479 New APIs for MTP and PTP host support
This replaces the previous ContentProvider based interface

Change-Id: I4cea2544854adb9fdcc04345e4d73d8ef05380f3
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-01-22 15:56:09 -08:00