This CL also removes Android build system required files and keeping
it to the bare minimum to what gomobile requires.
Fixes#10523.
Change-Id: Iabf16e7ea040a74eaf64746e7cc4e23ef3683af2
Reviewed-on: https://go-review.googlesource.com/9204
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I50035006af8358ef2d794ae2c75dddc835f99f3d
Reviewed-on: https://go-review.googlesource.com/9141
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
There is some cleanup to be done in this package now, but I'm
deferring it until later in the cycle.
We should probably also change the semantics slightly: main should
be called for all-Go apps (that is, apps that use NativeActivity),
but it would be more consistent with buildmode=c-shared and c-archive
if we did not call main for Go shared libraries being included in
Java android apps.
Change-Id: I13ca797a478edb22b0c602c1ee6e616fe4fea1e6
Reviewed-on: https://go-review.googlesource.com/9016
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This change deletes unnecessary files - they are auto-generated by
the gomobile bind command.
Change-Id: I490664dfcf52683dd8d2ea821d0b7e458bc06671
Reviewed-on: https://go-review.googlesource.com/8925
Reviewed-by: David Crawshaw <crawshaw@golang.org>
OpenAL Soft is licensed with LGPL which requires users to add a notice
about its license under their open source notices screen.
Change-Id: Ic3c3bcc4a38896508b19d54a8c526bcd1fa9d5b3
Reviewed-on: https://go-review.googlesource.com/8868
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Orientation invokes onNativeWindowRedrawNeeded.
Requery the window width and height when redraw needed.
Change-Id: I45816f13b42db38e71d28cb05bf7cfffda75882c
Reviewed-on: https://go-review.googlesource.com/8700
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This is to enable more flexible encoding/decoding of Go string.
For Java, we use UTF16 to be compatible with java string.
For other languages, we will want other way to represent a string.
Change-Id: Iccd53e2eea18d37636c3c619d06cb473facef0cd
Reviewed-on: https://go-review.googlesource.com/8628
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Drain the event queue between ALooper_pollAll calls. ALooper_pollAll
makes an epoll to see if there is any I/O going on the underlying
resources and is relatively a costly operation. Try to consume the
queue first and block on pollAll again if necessary.
We should stop retrying if timeout occurs and return immediately.
Change-Id: I6e9f85df2dd275fb014f90f13de4f05d776d4b7d
Reviewed-on: https://go-review.googlesource.com/8590
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Don't block on Read forever, force timeout if nothing happens for
a while. 30 secs is high enough not to be the desired delay for
the movement sensors.
Change-Id: I257120809855382d7a945a132f5b7a2cff1ecfca
Reviewed-on: https://go-review.googlesource.com/8580
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
If the looper is waking up, the current timeout limit is exceeded.
There are no external APIs to query if a looper is trying to wake up
or blocking to wait for the event data. Therefore, I'm this
change and will replace the timeout with a significantly high number
that could only be exceeded if sensor fails with a fatal problem.
The goal is not to wait on ALooper_pollAll forever.
This reverts commit 1575a42f33.
Change-Id: I861d81f2550c4435247a0b1d4ce141e94d1e3ec9
Reviewed-on: https://go-review.googlesource.com/8565
Reviewed-by: Burcu Dogan <jbd@google.com>
The necessity to destroy an ALC context is not to leave a leaking
context as Context instances are being collected. If the user doesn't
Destroy, do it when finalizing. If a context is destroyed by the user,
a finalizer is no more needed.
Change-Id: If6330361f7983ec8ede0e93b7f6e3a440de9fd6c
Reviewed-on: https://go-review.googlesource.com/8497
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
It's a common requirement to call MakeContextCurrent with a nil value
before destroying a context. Nil value as a reciever is not as user-
friendly as a standalone MakeContextCurrent.
Change-Id: I537ec0330657ef134f97a3c3b0d32793012eee86
Reviewed-on: https://go-review.googlesource.com/8500
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Avoid blocking forever until there are no new events in the
queue. The queue should have been fed with new events once in each t,
where t is 2 * minimum delay enabled on the queue.
Change-Id: Ie6c754816e89a93adf62d71448c6c85f167350eb
Reviewed-on: https://go-review.googlesource.com/8414
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I0550055b54545b75248bb76086377ebbedda7f58
Reviewed-on: https://go-review.googlesource.com/8458
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I42152d6fd5af220a780a6e3a288a97551ee53f39
Reviewed-on: https://go-review.googlesource.com/8413
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: Iae635926dad40248df2a14a6bb2fbaff1b5bcd03
Reviewed-on: https://go-review.googlesource.com/8412
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This CL contains an Android-specific Manager implementation.
On Android, we create a new ALooper for each Manager instance and
all CGO calls are proxified to an OS-thread-locked goroutine.
Change-Id: I33272cd4369d0b7850f97e840fe4bbe5aee78ec0
Reviewed-on: https://go-review.googlesource.com/8249
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Manager ops are not promised to be thread-safe.
Change-Id: Ib28b80d758234a7a19287c457c57099e36d73f9b
Reviewed-on: https://go-review.googlesource.com/8248
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Instead of the ad-hoc output directory structure to hold java source code
and compiled .so files, this change makes the bind command create an AAR
bundle. AAR is the format for Android library project/module outputs.
AAR is similar to .jar except that includes resource files.
http://tools.android.com/tech-docs/new-build-system/aar-format
This AAR format is in the Android's new build system's roadmap (
http://tools.android.com/tech-docs/jackandjill) and Android IDEs
are likely supporting the format.
For integration with Android Studio project, the user is expected to place
the .aar file to the main app's libs directory and specify the dependency
in the gradle rule. This can be done through a gradle plugin or with Android
Studio integration. For Buck, the .aar file can be the input of the
android_prebuilt_aar rule.
This depends on the availability of javac and android SDK -
which may not be an issue because the bind users will need them anyway
to build their main app.
Change-Id: I635902e994d002bb875c7838e19f172e187b0b87
Reviewed-on: https://go-review.googlesource.com/8084
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reorder DrawElements arguments to match OpenGL spec order:
DrawElements(mode, ty, offset, count) -> (mode, count, ty, offset)
GetActiveAttrib, GetActiveUniform are defined by spec to accept
corresponding integer _index_, not location type. Change their
signature to do that:
GetActiveAttrib(p Program, a Attrib) -> (p Program, index uint32)
GetActiveUniform(p Program, u Uniform) -> (p Program, index uint32)
Clarify and make documentation, parameter names more clear for Uniform
(uniform location), Attrib (attribute location) types,
EnableVertexAttribArray, DisableVertexAttribArray, GetAttribLocation,
GetUniformLocation funcs.
Resolvesgolang/go#10218 again.
Change-Id: I5b822235d9485701186a43dae0b9fd898cc6a3d8
Reviewed-on: https://go-review.googlesource.com/8166
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Sensors package will contain APIs to read data from a wide variety
of movement, position and other physical signals.
This CL contains the initial APIs that are targeting event-based
sensors. Some of the concerns that influenced the APIs are:
- Target game developers. Latency is critical, allow output rates
up to ~10 samples per second.
- It’s rarely possible to predetermine the minimally viable sample
rate requirement of the app. - Allow users to set an upper bound rate
to avoid garbage and preserve battery life.
- Allow multiple instances of accelerometer, gyroscope, magnetometer
and altimeter sensors to be started. Optimize the share of the
underlying resources as long as it is not a bottleneck for the
sample rate.
- Prefer blocking APIs. An automatic
poll-timeout could be useful if we’re far behind the sample rate.
But, sensor initialization and waking-up significantly take longer
and there is no easy way to determine a sensor is in either one of
these states.
- Provide timestamps for each event to determine the actual rate of
the sensor data.
- Allow user to return multiple events from each call. Buffering the
events at the cost of additional latency is sometimes more
neglectable than the overhead of a function call that polls the
events one by one. Allow user to determine how many items they want
to buffer. The typical latency of a read a single event is 56 usec.
Reading 8-16 events at once has a relatively lower bound per event.
For high precision throughput, the opportunity to minimize a
function call overhead could be useful.
- Allow users to check the sensor availability on the device.
Change-Id: I9582c8f025d9f922d9635e247d60817f95bdacb9
Reviewed-on: https://go-review.googlesource.com/8174
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I2a41cf0f16dcefe87c73ab0a8f02a251c1243157
Reviewed-on: https://go-review.googlesource.com/8121
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change func names and parameter order to more closely follow OpenGL
ES/WebGL spec.
BufferData(target, usage, src) -> BufferData(target, src, usage)
GenBuffer -> CreateBuffer
GenFramebuffer -> CreateFramebuffer
GenRenderbuffer -> CreateRenderbuffer
GenTexture -> CreateTexture
Fix issue where glBoolean helper was returning inverted result.
Make Attrib.String() logic consistent with others (print value, not
struct).
Make internal code of GetUniformLocation the same as GetAttribLocation
and BindAttribLocation for consistency.
Resolvesgolang/go#10218.
Change-Id: Ib33dfff7c22c4d178b2e6b8d228f80f3c17308a8
Reviewed-on: https://go-review.googlesource.com/8000
Reviewed-by: David Crawshaw <crawshaw@golang.org>
See golang.org/cl/4131 for context.
Change-Id: I94f2b9dc20fc8ab6156257de157c98cb887a0709
Reviewed-on: https://go-review.googlesource.com/7725
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: Id3c5c58050fa11ec57e8efd2661047dc5e0dfc2d
Reviewed-on: https://go-review.googlesource.com/7665
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
The audio package runs on Android now, we can list it on README.
Change-Id: I2ff03f025328a1d0e6ffc12b860ace9c980dc422
Reviewed-on: https://go-review.googlesource.com/7521
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
filepath.Join returns a Cleaned path that went through FromSlash.
Change-Id: I23afeea32453c3eb271d4e4bf47147940061c20f
Reviewed-on: https://go-review.googlesource.com/7161
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: I47b42db1443040bcd9c77cd1d19a0e0f8c5119ec
Reviewed-on: https://go-review.googlesource.com/7090
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Comment from golang.org/cl/6642. As bionic (surprisingly) has strlcat,
using it instead of strncat. If you're not familiar with the l-variants,
see http://www.sudo.ws/todd/papers/strlcpy.html
Change-Id: I69958ee99917903f9d10dda0ec99111c4793db71
Reviewed-on: https://go-review.googlesource.com/7011
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Go.init must be called once and from the main thread.
setUp is called from a non-main thread and once per each test.
Change-Id: I848a1461793463785b38141e077da5bf5e53cb4c
Reviewed-on: https://go-review.googlesource.com/6832
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: I415a6c4693be340ff8236d5f56c3c00fa95ce2e0
Reviewed-on: https://go-review.googlesource.com/6822
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I1a7282fcb31d778ff12d7a655eadbac1a01e584b
Reviewed-on: https://go-review.googlesource.com/6720
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Due to licensing limitations, OpenAL should be dynamically
loaded. Android apps that needs to import the audio package
needs to be packed with libopenal.so as an extenal lib
dependency.
Instructions to build OpenAL for Android is available at
http://repo.or.cz/w/openal-soft.git/blob/HEAD:/XCompile-Android.txt
The packed libopenal.so is exported to
/data/data/<package_name>/lib/libopenal.so at installation.
The audio package dlopens libopenal.so from this location and
dlsym to dispatch the OpenAL functions.
Change-Id: I7aa36bb8dd0ae8e101ae4aa5366c3d426b2569a9
Reviewed-on: https://go-review.googlesource.com/6642
Reviewed-by: David Crawshaw <crawshaw@golang.org>