Commit Graph

2007 Commits

Author SHA1 Message Date
Eino-Ville Talvala
52d600769c Merge "Camera: Updates in preparation for HIDL" 2016-12-14 23:08:14 +00:00
TreeHugger Robot
db10a2094c Merge "Remove accidentally exposed Geofencing classes." 2016-12-14 20:15:27 +00:00
Eino-Ville Talvala
283ae234f9 Camera: Updates in preparation for HIDL
- For all camera2 paths, and anything shared between the legacy API and
  camera2, switch to using String for camera IDs.
- Remove assumption that camera device IDs must be a dense set of small
  integers, and rewrite the camera ID query methods
- Change operation of ICameraService.addListener: it now returns the list of
  available devices directly, instead of invoking callbacks. This is
  needed to ensure an up-to-date list of cameras is immediately available
  on connection to the camera service.
- Add new CameraStatus object to use as the addListener return value
- Update tests to work with new interface

Test: cts-tradefed run cts -m Camera --skip-connectivity-check -d -o --abi armeabi-v7a --disable-reboot
Bug: 32991422
Change-Id: I6ff4a5dd014c6aefe0750850eeece6f3267a3e5b
2016-12-13 12:12:21 -08:00
Jerry Zhang
d9291d55f6 Merge "Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers." am: 1975240f17 am: 830874dbe7 am: 88672d7d29
am: 11dc0eccfb

Change-Id: Ibafebe4877052595cb34626bde9ac6fba1983fb0
2016-12-13 01:02:55 +00:00
Jerry Zhang
bb598ee16f Modify UsbDeviceManager stack to allow MtpServer to use FunctionFS drivers.
Functionfs requires MtpServer to write descriptors before the device can be
configured. This adds a new configure call that will occur only when
functions are changed (new argument added to updateUsbStateBroadcast for this)
and be called after sys.usb.config is changed but before the waitForState
call to ensure compatibility with configfs devices.

Bug: 30976142
Change-Id: I7e94a5847d3b19c0fd75139e1b15a3f2a1cea01d
Test: Manual
2016-12-12 11:05:32 -08:00
TreeHugger Robot
5683204632 Merge "Camera2: Consolidate the overriding of PRIVATE format" 2016-12-08 02:34:08 +00:00
Shuzhen Wang
71e6d62d23 Camera2: Consolidate the overriding of PRIVATE format
We had overriding of PRIVATE format scattered at multiple places.
Consolidate them into one place.

Test: Camera preview/capture, and camcorder recording
Change-Id: I098ce93bba2000760a20c0297fcf0cb9d8c6caab
2016-12-07 16:22:37 -08:00
Michael Wright
05c68d3940 Remove accidentally exposed Geofencing classes.
Bug: 33238174
Test: m -j12

Change-Id: I95c3c314f8659f1eeff1dfa218c4c0ab7f0b47b3
2016-12-02 14:45:18 +00:00
Eino-Ville Talvala
d5b9c6ba55 CameraDevice: Add missing @Nullable for a handler argument.
Like the other capture session creation methods,
createCaptureSessionByOutputConfigurations() will happily take a null
handler.

Test: Compiles
Change-Id: I702a0761e40207ca5143ad69f5d8694c45f27561
2016-12-01 11:31:02 -08:00
Jorim Jaggi
57e2f4db35 Make LockoutResetCallback oneway
Test: Get locked out, make sure wake-and-unlock is working
again after 30 seconds.

Change-Id: I2fb03775898c0567f058d6d9d0b963ed071cc786
Fixes: 32946531
2016-11-24 14:50:54 +01:00
Jerry Zhang
4c4666c5ef Merge commit '54f33d9af22e62629798555a3cde4e784bd8ba54' into manual_merge_54f33d9
Change-Id: Icfd9bc3eff034d33e733dbb8386949c9ec345e58
2016-11-17 10:48:26 -08:00
Jerry Zhang
5cbd151d40 Refactored setCurrentFunction and setUsbDataUnlocked into single method.
am: 935372bfd6

Change-Id: I5436278e092f691c9179f7cc3709c4578b544e74
2016-11-17 00:12:50 +00:00
Jerry Zhang
935372bfd6 Refactored setCurrentFunction and setUsbDataUnlocked into single method.
This gets rid of an extraneous configuration change when going from
adb to adb + file transfer as previously the config would have been
reset once for functions and once for data unlocked.

It also simplifies some of the code.

Test: manually changing usb configurations
Change-Id: Ica10a195338b2189db13113f44657393db110bee
(cherry picked from commit 7a396be6d5)
2016-11-15 15:29:45 -08:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
Jeff Sharkey
cb62162219 Make another interface oneway, whitelist provider.
More progress towards removing blocking calls to improve system
stability.

Test: builds, boots
Bug: 32715088
Change-Id: I5ab2d2687f4f47e0ee68105c6998e74798af061c
2016-11-11 14:06:11 -07:00
Jeff Sharkey
0a17db1cc5 Detect non-oneway calls leaving system_server.
To protect system stability, any Binder calls leaving the
system_server must carefully be performed using FLAG_ONEWAY (or
the 'oneway' verb in AIDL) which prevents the call from blocking
indefinitely on the remote process.

In this CL, the system_server uses the new Binder.setWarnOnBlocking()
method to enable detection by default for all remote Binder
interfaces.  It can also use Binder.allowBlocking() to allow
blocking calls on certain remote interfaces that have been
determined to be safe.

This CL adds the 'oneway' verb to several interfaces and methods
where it should have been added, and marks a handful of system
ContentProviders as being safe to call into.  Also, we assume that
any services obtained from ServiceManager are part of the core
OS, and are okay to make blocking calls to.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: Ide476e120cb40436a94b7faf7615c943d691f4c0
2016-11-07 17:03:37 -07:00
TreeHugger Robot
2c442e962e Merge "Stop using return within finally" 2016-11-04 02:42:11 +00:00
Ray Essick
7601049275 Stop using return within finally
Refactor code to avoid a return statement inside a finally block. Such
constructs interfere with exception propagation in non-obvious ways
and are therefore considered bad practice.

Bug: 32586420
Test: manual code walk
2016-11-03 14:45:56 -07:00
Philip P. Moltmann
08b678c029 Correctly use ByteBuffer in UsbRequest
Meaning: Read/Write to correct area in buffer, set position correectly.

- Create a new method UsbRequest#enqueue that has correct behavior, deprecate
  UsbRequest#queue.
- Move all description of the weird (legacy) UsbRequest#queue behavior to
  this method.

Change-Id: Ibeed400b4ad2aa9d005ace345c7895a3dc4ba1ad
Fixes: 31050148
Test: Submitted alongside
2016-10-27 10:25:40 -07:00
Philip P. Moltmann
927fefe813 Add UsbDeviceConnection.requestWait with a timeout
Test: Test is submitted alongside this change
Change-Id: I1c46143030a2822ee76676ddc80d3b5c8c62ee80
Fixes: 31288102
2016-10-26 10:21:21 -07:00
Yin-Chia Yeh
3e254b6953 Merge "Camera2 Legacy: catch more surface abandoned error" am: 03f14bef41 am: 50f9b6e71f
am: 0eb99d23b4

Change-Id: Ie8dbed22423aa52b418cebfd19e29c6ae2c6e2b5
2016-10-21 21:28:21 +00:00
Yin-Chia Yeh
50f9b6e71f Merge "Camera2 Legacy: catch more surface abandoned error"
am: 03f14bef41

Change-Id: If2e05eeb8c7fe24f97fc0c5e20bfe03a6c8c9e23
2016-10-21 21:07:44 +00:00
Yin-Chia Yeh
091661334b Camera2 Legacy: catch more surface abandoned error
Bug: 30140107
Change-Id: Ia293bdbb85c8078e17def55db9c599cfe70458db
2016-10-21 11:40:46 -07:00
Shuzhen Wang
88f1af2410 Camera2: Add onCaptureQueueEmpty callback
onCaptureQueueEmpty indicates that the non-repeating
capture request queue of camera device is empty, and
is ready to process a new request.

Test: testMultipleCapture in PerformanceTest.java

Bug: 29006447
Change-Id: If245ff6abf352548ca13a10fcfbd1550b92c1224
2016-10-18 17:50:17 -07:00
Philip P. Moltmann
f2d83edc26 Clarify which props of USB devices are optional
Test: Compiles, manually inspected object creation code, ran USB CTS
verifier tests
Fixes: 32209658
Change-Id: I738c0cea5a0f37484e986f0a01c8ed9c46b639ed
2016-10-17 12:14:45 -07:00
Jerry Zhang
7a396be6d5 Refactored setCurrentFunction and setUsbDataUnlocked into single method.
This gets rid of an extraneous configuration change when going from
adb to adb + file transfer as previously the config would have been
reset once for functions and once for data unlocked.

It also simplifies some of the code.

Test: manually changing usb configurations
Change-Id: Ica10a195338b2189db13113f44657393db110bee
2016-10-13 17:32:21 -07:00
Philip P. Moltmann
5201f1e61c Do not access MTP devices when disabled.
The USB data transfer is disabled we should not allow access MTP devices
(e.g.
usb sticks). We have two ways of accessing them: Either by mounting them
or by creating a MTPDevice in an app.

Of course an app could implement implement their own MTPDevice
implementation. In this case we cannot enforce the policy without
completely suppressing all MTP USB devices which would be too
restrictive.

Note: When the policy is set we do _not_ disconnect already connected
MTP devices

Fixes: 31472955
Change-Id: I6080c48c49657102774b2b3b4d89ff030245a266
2016-09-30 22:24:23 +00:00
Eino-Ville Talvala
dce815430d DngCreator: Do not cache timezone in static initializer am: ec727411d2 am: fa141e303e
am: f6ea31d8f1

Change-Id: Ib702bb0fed2a4980ce543a1ab37d7c43179a67e8
2016-09-29 02:05:30 +00:00
Eino-Ville Talvala
fa141e303e DngCreator: Do not cache timezone in static initializer
am: ec727411d2

Change-Id: I86d207b7bfd156f5296aa3f5ba5acecd2d762d4e
2016-09-28 21:27:21 +00:00
Eino-Ville Talvala
4e3bb26f64 Merge "DngCreator: Do not cache timezone in static initializer" into nyc-mr1-dev 2016-09-28 21:20:21 +00:00
Philip P. Moltmann
5dd4e6cf74 Clarify the behavior of UsbRequest
This is obviously just about describing a bad behavior. In the next step
these methods should be deprecated and replaced with versions that deal
with ByteBuffers appropriately.

Bug: 31050148
Test: Test that enshrines the documented behavior is submitted alongside
      this change
Change-Id: If250a8bbd636784355e839a1638d52f3bbe9b83d
2016-09-28 11:29:02 -07:00
Eino-Ville Talvala
ec727411d2 DngCreator: Do not cache timezone in static initializer
The static initializer for a pre-loaded framework class is run
no later than at zygote startup, which happens at device boot.

Which means that if the timezone later changes, DngCreator will use
an incorrect cached timezone until the next reboot.  This is especially
evident in freshly wiped devices, where initial setup will typically
change the timezone.

Instead, read the timezone each time DngCreator is created, which is
also when we query the current time for constructing the timestamps.

Test: android.hardware.camera2.cts.DngCreatorTest#testSingleImageThumbnail
Bug: 31743060
Change-Id: I83a4eac762650e5f904f3b8fa779c094cef30562
2016-09-28 11:10:00 -07:00
Greg Kaiser
5abcc9a888 ContextHubService: Hack around 32-bit app ID am: 1983f9b05b am: 40c0435026
am: eaed84e40a

Change-Id: I2eb38c4cf7e27bfb75db2f41b529840ac9fd1f44
2016-09-28 00:11:46 +00:00
Greg Kaiser
1983f9b05b ContextHubService: Hack around 32-bit app ID
The NanoApp.java class has a bug (b/30808791) where the API treats
app IDs as 32-bits, instead of 64-bits.  We are too late in the
Android N release cycle to change this API.

We previously put in a hack to fix this only for Google nanoapps.
However, our GTS nanoapps need this to work, and there are other
partners who need this to work in the N timeframe.  So we make
a more robust hack which parses the full 64-bit app ID out of
the header binary.

Test: Compiles and runs GTS
Bug: 31767599
Change-Id: Ic43f1f62c685fb99aac08d08767d1a67c329503f
2016-09-27 15:01:48 -07:00
Chien-Yu Chen
62d6962835 Camera2: Support early finished tasks am: dd6629ef86 am: 8425ebc28f
am: e98ffa404e

Change-Id: If7c38066a4244a0ba02158442d0a067b6fc802cd
2016-09-27 00:55:42 +00:00
Chien-Yu Chen
dd6629ef86 Camera2: Support early finished tasks
Add support to track finished tasks before it starts.

Bug: 30117138
Change-Id: I42eb0377f719d57d820d9c1b2484600116c8807a
2016-09-23 17:23:45 -07:00
Philip P. Moltmann
1599ab8d12 Merge "Clarify UsbConnection#bulkTransfer api behavior" 2016-09-23 16:49:34 +00:00
Philip P. Moltmann
71985f5e23 Merge "Do not access MTP devices when disabled." 2016-09-21 18:14:25 +00:00
Philip P. Moltmann
5e040ae477 Clarify UsbConnection#bulkTransfer api behavior
- Do not allow negative length as inside of JNI this is interpreted as
  unsigned value which lead to memory corruptions.
- Document behavior for uncommon but usable values of parameters

Test: Ran CTS verifier UBS device test
Change-Id: I0899a2831c6dd2617528a5e79ea21932f6a66c13
2016-09-20 15:31:32 -07:00
Eino-Ville Talvala
2ce4b7a8a0 DngCreator: Fix calculation of date/time stamps am: 3fc21ef78b am: 215c76b1f4
am: ba57a47375

Change-Id: I818087e4a3495162eedceaebcd4da93c9eecfe87
2016-09-20 03:04:26 +00:00
Eino-Ville Talvala
3fc21ef78b DngCreator: Fix calculation of date/time stamps
Converting the sensor timestamp to date/time requires checking
what the timebase of those timestamps is; getting it wrong will
create drift that increases with device uptime.

Test: android.hardware.camera2.cts.
      DngCreatorTest#testSingleImageThumbnail
Bug: 30125412
Change-Id: Ia5db86012bc9e1c06463b8dc4434d3e063f62cf5
2016-09-18 17:11:41 -07:00
Philip P. Moltmann
2c6fe63b4c Merge "Set buffer before UsbRequest is queued" 2016-09-15 16:17:50 +00:00
Philip P. Moltmann
4346f3c5ec Set buffer before UsbRequest is queued
Otherwise a second thread might dequeue() it in between
native_queue_direct and mBuffer = buffer. If that happens the dequeue
operation does mBuffer.isDirect which triggers a NPE.

Fixes: 30914003
Change-Id: I3ca3b72db8f53a14be1c5f0e37f8924eba44b9bc
2016-09-14 22:44:50 +00:00
Philip P. Moltmann
3390281f71 Leak UsbDeviceConnection fd if not closed
This is the previous behavior and there are users that just copy the fd
and then forget about the connection. In this case it is unsafe to close
the fd when finalizing.

Change-Id: I5cd76564e1e8ddbd61c829b34b0f43b9c699f094
2016-09-14 14:13:46 -07:00
Philip P. Moltmann
ec3cbb2a66 Do not access MTP devices when disabled.
The USB data transfer is disabled we should not allow access MTP devices (e.g.
usb sticks). We have two ways of accessing them: Either by mounting them
or by creating a MTPDevice in an app.

Of course an app could implement implement their own MTPDevice
implementation. In this case we cannot enforce the policy without
completely suppressing all MTP USB devices which would be too
restrictive.

Note: When the policy is set we do _not_ disconnect already connected
MTP devices

Fixes: 31472955
Change-Id: I6080c48c49657102774b2b3b4d89ff030245a266
2016-09-14 13:29:45 -07:00
Eino-Ville Talvala
1a64580308 Camera2: Unhide deferred surface configuration APIs
To speed up camera startup, allow setting up a camera capture session
before all the output Surfaces are available (but their eventual sizes
and types are known). Also allow images to be captured to the
non-deferred outputs even before the deferred outputs are available.

This allows parallelizing of camera startup and UI layout.

Test: android.hardware.camera2.cts.SurfaceViewPreviewTest#testDeferrredSurfaces 
passes
Bug: 31319716
Change-Id: I657efc39bb8cc2d4bf201e5d70807a227ef82dde
2016-09-08 21:59:16 +00:00
Eino-Ville Talvala
3c8c16f9f1 Camera2: Clean up some obsolete trampolines left from original API launch
Test: Checkbuild passes on angler-userdebug
Change-Id: Iddcb72616be2eb07a4499647b3383ff9d37f73d2
2016-09-07 22:46:33 +00:00
TreeHugger Robot
1ae9143d7a Merge "Do not leak usb device connection FD" 2016-08-31 18:03:12 +00:00
Greg Kaiser
f4d609b9c0 ContextHubService: Hack in Google vendor value am: 5817ce0c13 am: 3d2f2a4305
am: ee483f7d78

Change-Id: I8ca30026b44d6ccea7cefa4b6671b4f286c352b5
2016-08-31 03:04:41 +00:00
Philip P. Moltmann
674e8c3825 Do not leak usb device connection FD
The native code uses mNativeContext=0 to indicate that is was already
closed and checks this properly. Hence let's leave the checking in the
native code.

We need to keep a reference in UsbRequest as otherwise the
UsbDeviceConnection might get finalized while a UsbRequest is in
progress. The UsbRequest itself makes sure that it is not garbage
collected while the I/O is in progress.

Also I added CloseGuards to make sure the classes are used properly and
fixed an error string in the native code.

Fixes: 31124312
Bug: 31021315
Change-Id: I96deb73957eba0e14e6b656988a2ae9b409bf55f
2016-08-30 10:52:39 -07:00